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
b75379ba
Commit
b75379ba
authored
Jul 13, 2018
by
Varun Patil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show and init logout button and user in settings only if logged in
parent
12485107
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
27 deletions
+33
-27
app/src/main/java/app/insti/fragment/SettingsFragment.java
app/src/main/java/app/insti/fragment/SettingsFragment.java
+33
-27
No files found.
app/src/main/java/app/insti/fragment/SettingsFragment.java
View file @
b75379ba
...
@@ -90,10 +90,10 @@ public class SettingsFragment extends Fragment {
...
@@ -90,10 +90,10 @@ public class SettingsFragment extends Fragment {
// Check if we exist
// Check if we exist
if
(
getActivity
()
==
null
||
getView
()
==
null
)
return
;
if
(
getActivity
()
==
null
||
getView
()
==
null
)
return
;
Button
updateProfileButton
=
get
Activity
().
findViewById
(
R
.
id
.
settings_update_profile
);
Button
updateProfileButton
=
get
View
().
findViewById
(
R
.
id
.
settings_update_profile
);
Button
feedbackButton
=
get
Activity
().
findViewById
(
R
.
id
.
settings_feedback
);
Button
feedbackButton
=
get
View
().
findViewById
(
R
.
id
.
settings_feedback
);
Button
aboutButton
=
get
Activity
().
findViewById
(
R
.
id
.
settings_about
);
Button
aboutButton
=
get
View
().
findViewById
(
R
.
id
.
settings_about
);
Button
logoutButton
=
get
Activity
().
findViewById
(
R
.
id
.
settings_logout
);
Button
logoutButton
=
get
View
().
findViewById
(
R
.
id
.
settings_logout
);
updateProfileButton
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
updateProfileButton
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
@Override
...
@@ -121,6 +121,9 @@ public class SettingsFragment extends Fragment {
...
@@ -121,6 +121,9 @@ public class SettingsFragment extends Fragment {
}
}
});
});
// Logged in user vs Guest
final
SessionManager
sessionManager
=
new
SessionManager
(
getContext
());
if
(
sessionManager
.
isLoggedIn
())
{
logoutButton
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
logoutButton
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
@Override
public
void
onClick
(
View
v
)
{
public
void
onClick
(
View
v
)
{
...
@@ -129,7 +132,6 @@ public class SettingsFragment extends Fragment {
...
@@ -129,7 +132,6 @@ public class SettingsFragment extends Fragment {
@Override
@Override
public
void
onResponse
(
Call
<
Void
>
call
,
Response
<
Void
>
response
)
{
public
void
onResponse
(
Call
<
Void
>
call
,
Response
<
Void
>
response
)
{
if
(
response
.
isSuccessful
())
{
if
(
response
.
isSuccessful
())
{
SessionManager
sessionManager
=
new
SessionManager
(
getContext
());
sessionManager
.
logout
();
sessionManager
.
logout
();
Intent
intent
=
new
Intent
(
getContext
(),
LoginActivity
.
class
);
Intent
intent
=
new
Intent
(
getContext
(),
LoginActivity
.
class
);
startActivity
(
intent
);
startActivity
(
intent
);
...
@@ -145,6 +147,10 @@ public class SettingsFragment extends Fragment {
...
@@ -145,6 +147,10 @@ public class SettingsFragment extends Fragment {
});
});
}
}
});
});
}
else
{
logoutButton
.
setVisibility
(
View
.
GONE
);
getView
().
findViewById
(
R
.
id
.
role_card_layout
).
setVisibility
(
View
.
GONE
);
}
}
}
private
void
openWebURL
(
String
URL
)
{
private
void
openWebURL
(
String
URL
)
{
...
...
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