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
86254a47
Commit
86254a47
authored
Jul 11, 2018
by
Sajal Narang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix LoginActivity and MainActivity navigation
parent
7bd6ac24
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
app/src/main/java/app/insti/LoginActivity.java
app/src/main/java/app/insti/LoginActivity.java
+13
-10
No files found.
app/src/main/java/app/insti/LoginActivity.java
View file @
86254a47
...
...
@@ -43,10 +43,21 @@ public class LoginActivity extends AppCompatActivity {
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
session
=
new
SessionManager
(
mContext
);
if
(
session
.
isLoggedIn
())
{
openMainActivity
();
}
setContentView
(
R
.
layout
.
activity_login
);
progressDialog
=
new
ProgressDialog
(
LoginActivity
.
this
);
}
private
void
openMainActivity
()
{
Intent
i
=
new
Intent
(
mContext
,
MainActivity
.
class
);
i
.
addFlags
(
Intent
.
FLAG_ACTIVITY_CLEAR_TOP
);
i
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
startActivity
(
i
);
finish
();
}
@Override
protected
void
onStart
()
{
super
.
onStart
();
...
...
@@ -130,11 +141,7 @@ public class LoginActivity extends AppCompatActivity {
guestView
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
Intent
intent
=
new
Intent
(
LoginActivity
.
this
,
MainActivity
.
class
);
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_CLEAR_TOP
);
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
startActivity
(
intent
);
finish
();
openMainActivity
();
}
});
}
...
...
@@ -164,11 +171,8 @@ public class LoginActivity extends AppCompatActivity {
if
(
response
.
isSuccessful
())
{
Log
.
d
(
TAG
,
"Login request successful"
);
session
.
createLoginSession
(
username
,
response
.
body
().
getUser
(),
response
.
body
().
getSessionID
());
Intent
i
=
new
Intent
(
mContext
,
MainActivity
.
class
);
i
.
addFlags
(
Intent
.
FLAG_ACTIVITY_CLEAR_TOP
);
i
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
startActivity
(
i
);
progressDialog
.
dismiss
();
openMainActivity
();
finish
();
//Save credentials in AccountManager to keep user logged in
//Go to MainActivity
...
...
@@ -201,6 +205,5 @@ public class LoginActivity extends AppCompatActivity {
}
return
true
;
}
}
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