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
fe4b5615
Commit
fe4b5615
authored
Jul 31, 2018
by
Varun Patil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show edit body fab only when user has role
parent
18d998ba
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
20 deletions
+36
-20
app/src/main/java/app/insti/MainActivity.java
app/src/main/java/app/insti/MainActivity.java
+14
-0
app/src/main/java/app/insti/fragment/BodyFragment.java
app/src/main/java/app/insti/fragment/BodyFragment.java
+22
-20
No files found.
app/src/main/java/app/insti/MainActivity.java
View file @
fe4b5615
...
@@ -472,6 +472,20 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
...
@@ -472,6 +472,20 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
return
false
;
return
false
;
}
}
public
boolean
editBodyAccess
(
Body
toEditBody
)
{
if
(
currentUser
==
null
||
currentUser
.
getUserRoles
()
==
null
||
currentUser
.
getUserRoles
().
size
()
==
0
)
return
false
;
for
(
Role
role
:
currentUser
.
getUserRoles
())
{
for
(
Body
body
:
role
.
getRoleBodies
())
{
if
(
body
.
getBodyID
().
equals
(
toEditBody
.
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/BodyFragment.java
View file @
fe4b5615
...
@@ -349,6 +349,7 @@ public class BodyFragment extends BackHandledFragment {
...
@@ -349,6 +349,7 @@ public class BodyFragment extends BackHandledFragment {
getActivity
().
findViewById
(
R
.
id
.
loadingPanel
).
setVisibility
(
View
.
GONE
);
getActivity
().
findViewById
(
R
.
id
.
loadingPanel
).
setVisibility
(
View
.
GONE
);
/* Show update button if role */
/* Show update button if role */
if
(((
MainActivity
)
getActivity
()).
editBodyAccess
(
body
))
{
final
FloatingActionButton
fab
=
(
FloatingActionButton
)
getView
().
findViewById
(
R
.
id
.
edit_fab
);
final
FloatingActionButton
fab
=
(
FloatingActionButton
)
getView
().
findViewById
(
R
.
id
.
edit_fab
);
fab
.
setVisibility
(
View
.
VISIBLE
);
fab
.
setVisibility
(
View
.
VISIBLE
);
NestedScrollView
nsv
=
(
NestedScrollView
)
getView
().
findViewById
(
R
.
id
.
body_scrollview
);
NestedScrollView
nsv
=
(
NestedScrollView
)
getView
().
findViewById
(
R
.
id
.
body_scrollview
);
...
@@ -371,6 +372,7 @@ public class BodyFragment extends BackHandledFragment {
...
@@ -371,6 +372,7 @@ public class BodyFragment extends BackHandledFragment {
}
}
});
});
}
}
}
/**
/**
* Open body fragment for a body
* Open body fragment for a body
...
...
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