Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
InstiApp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
RAHUL SHARMA
InstiApp
Commits
833f19e2
Commit
833f19e2
authored
Jul 28, 2018
by
Varun Patil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show edit event only when has permission
parent
8f766bc1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletion
+23
-1
app/src/main/java/app/insti/MainActivity.java
app/src/main/java/app/insti/MainActivity.java
+18
-0
app/src/main/java/app/insti/fragment/EventFragment.java
app/src/main/java/app/insti/fragment/EventFragment.java
+5
-1
No files found.
app/src/main/java/app/insti/MainActivity.java
View file @
833f19e2
...
@@ -29,6 +29,7 @@ import com.squareup.picasso.Picasso;
...
@@ -29,6 +29,7 @@ import com.squareup.picasso.Picasso;
import
app.insti.api.UnsafeOkHttpClient
;
import
app.insti.api.UnsafeOkHttpClient
;
import
app.insti.data.Body
;
import
app.insti.data.Body
;
import
app.insti.data.Event
;
import
app.insti.data.Event
;
import
app.insti.data.Role
;
import
app.insti.data.User
;
import
app.insti.data.User
;
import
app.insti.fragment.BackHandledFragment
;
import
app.insti.fragment.BackHandledFragment
;
import
app.insti.fragment.BodyFragment
;
import
app.insti.fragment.BodyFragment
;
...
@@ -374,6 +375,23 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
...
@@ -374,6 +375,23 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
return
true
;
return
true
;
}
}
public
boolean
editEventAccess
(
Event
event
)
{
if
(
currentUser
==
null
||
currentUser
.
getUserRoles
()
==
null
||
currentUser
.
getUserRoles
().
size
()
==
0
)
return
false
;
for
(
Role
role
:
currentUser
.
getUserRoles
())
{
for
(
Body
body
:
role
.
getRoleBodies
())
{
for
(
Body
eventBody
:
event
.
getEventBodies
())
{
if
(
body
.
getBodyID
().
equals
(
eventBody
.
getBodyID
()))
{
return
true
;
}
}
}
}
return
false
;
}
public
static
void
hideKeyboard
(
Activity
activity
)
{
public
static
void
hideKeyboard
(
Activity
activity
)
{
InputMethodManager
imm
=
(
InputMethodManager
)
activity
.
getSystemService
(
Activity
.
INPUT_METHOD_SERVICE
);
InputMethodManager
imm
=
(
InputMethodManager
)
activity
.
getSystemService
(
Activity
.
INPUT_METHOD_SERVICE
);
//Find the currently focused view, so we can grab the correct window token from it.
//Find the currently focused view, so we can grab the correct window token from it.
...
...
app/src/main/java/app/insti/fragment/EventFragment.java
View file @
833f19e2
...
@@ -231,7 +231,11 @@ public class EventFragment extends BackHandledFragment {
...
@@ -231,7 +231,11 @@ public class EventFragment extends BackHandledFragment {
mShortAnimationDuration
=
getResources
().
getInteger
(
android
.
R
.
integer
.
config_shortAnimTime
);
mShortAnimationDuration
=
getResources
().
getInteger
(
android
.
R
.
integer
.
config_shortAnimTime
);
FloatingActionButton
fab
=
(
FloatingActionButton
)
getView
().
findViewById
(
R
.
id
.
edit_fab
);
FloatingActionButton
fab
=
(
FloatingActionButton
)
getView
().
findViewById
(
R
.
id
.
edit_fab
);
if
(((
MainActivity
)
getActivity
()).
editEventAccess
(
event
))
{
fab
.
setVisibility
(
View
.
VISIBLE
);
fab
.
setVisibility
(
View
.
VISIBLE
);
}
fab
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
fab
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
@Override
public
void
onClick
(
View
v
)
{
public
void
onClick
(
View
v
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment