Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Krishna Vemulavada
/
vera_2.1_app
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
29cd325e
authored
Sep 27, 2019
by
Krishna Vemulawada
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
adal change
parent
c5ee77ec
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
28 deletions
app/src/main/java/com/vsoft/vera/ui/ADALActivity.java
app/src/main/java/com/vsoft/vera/ui/LoginChooseActivity.java
app/src/main/java/com/vsoft/vera/ui/SplashScreen.java
app/src/main/res/layout/adal_main.xml
app/src/main/java/com/vsoft/vera/ui/ADALActivity.java
View file @
29cd325e
...
@@ -34,6 +34,7 @@ import com.microsoft.aad.adal.PromptBehavior;
...
@@ -34,6 +34,7 @@ import com.microsoft.aad.adal.PromptBehavior;
import
com.microsoft.aad.adal.Telemetry
;
import
com.microsoft.aad.adal.Telemetry
;
import
com.vsoft.vera.R
;
import
com.vsoft.vera.R
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
org.json.JSONObject
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -188,14 +189,16 @@ public class ADALActivity extends AppCompatActivity {
...
@@ -188,14 +189,16 @@ public class ADALActivity extends AppCompatActivity {
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
Log
.
d
(
TAG
,
"Failed to put parameters: "
+
e
.
toString
());
Log
.
d
(
TAG
,
"Failed to put parameters: "
+
e
.
toString
());
}
}
JsonObjectRequest
request
=
new
JsonObjectRequest
(
Request
.
Method
.
GET
,
MSGRAPH_URL
,
final
JsonObjectRequest
request
=
new
JsonObjectRequest
(
Request
.
Method
.
GET
,
MSGRAPH_URL
,
parameters
,
new
Response
.
Listener
<
JSONObject
>()
{
parameters
,
new
Response
.
Listener
<
JSONObject
>()
{
@Override
@Override
public
void
onResponse
(
JSONObject
response
)
{
public
void
onResponse
(
JSONObject
response
)
{
/* Successfully called graph, process data and send to UI */
/* Successfully called graph, process data and send to UI */
Log
.
d
(
TAG
,
"Response: "
+
response
.
toString
());
Log
.
d
(
TAG
,
"Response: "
+
response
.
toString
());
updateGraphUI
(
response
);
}
}
},
new
Response
.
ErrorListener
()
{
},
new
Response
.
ErrorListener
()
{
@Override
@Override
...
@@ -246,19 +249,19 @@ public class ADALActivity extends AppCompatActivity {
...
@@ -246,19 +249,19 @@ public class ADALActivity extends AppCompatActivity {
private
void
updateSuccessUI
()
{
private
void
updateSuccessUI
()
{
// Called on success from /me endpoint
// Called on success from /me endpoint
// Removed call Graph API button and paint Sign out
// Removed call Graph API button and paint Sign out
callGraphButton
.
setVisibility
(
View
.
IN
VISIBLE
);
callGraphButton
.
setVisibility
(
View
.
VISIBLE
);
signOutButton
.
setVisibility
(
View
.
VISIBL
E
);
signOutButton
.
setVisibility
(
View
.
GON
E
);
findViewById
(
R
.
id
.
welcome
).
setVisibility
(
View
.
VISIBL
E
);
findViewById
(
R
.
id
.
welcome
).
setVisibility
(
View
.
GON
E
);
((
TextView
)
findViewById
(
R
.
id
.
welcome
)).
setText
(
"Welcome, "
+
((
TextView
)
findViewById
(
R
.
id
.
welcome
)).
setText
(
"Welcome, "
+
mAuthResult
.
getUserInfo
().
getGivenName
());
mAuthResult
.
getUserInfo
().
getGivenName
());
findViewById
(
R
.
id
.
graphData
).
setVisibility
(
View
.
VISIBL
E
);
findViewById
(
R
.
id
.
graphData
).
setVisibility
(
View
.
GON
E
);
}
}
@SuppressLint
(
"SetTextI18n"
)
@SuppressLint
(
"SetTextI18n"
)
private
void
updateSignedOutUI
()
{
private
void
updateSignedOutUI
()
{
callGraphButton
.
setVisibility
(
View
.
VISIBLE
);
callGraphButton
.
setVisibility
(
View
.
VISIBLE
);
signOutButton
.
setVisibility
(
View
.
INVISIBL
E
);
signOutButton
.
setVisibility
(
View
.
GON
E
);
findViewById
(
R
.
id
.
welcome
).
setVisibility
(
View
.
INVISIBLE
);
findViewById
(
R
.
id
.
welcome
).
setVisibility
(
View
.
INVISIBLE
);
findViewById
(
R
.
id
.
graphData
).
setVisibility
(
View
.
INVISIBLE
);
findViewById
(
R
.
id
.
graphData
).
setVisibility
(
View
.
INVISIBLE
);
((
TextView
)
findViewById
(
R
.
id
.
graphData
)).
setText
(
"No Data"
);
((
TextView
)
findViewById
(
R
.
id
.
graphData
)).
setText
(
"No Data"
);
...
...
app/src/main/java/com/vsoft/vera/ui/LoginChooseActivity.java
View file @
29cd325e
...
@@ -37,6 +37,7 @@ import com.vsoft.vera.CatalogueApplication;
...
@@ -37,6 +37,7 @@ import com.vsoft.vera.CatalogueApplication;
import
com.vsoft.vera.R
;
import
com.vsoft.vera.R
;
import
com.vsoft.vera.db.models.UserApiValues
;
import
com.vsoft.vera.db.models.UserApiValues
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
org.json.JSONObject
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -113,10 +114,10 @@ public class LoginChooseActivity extends Activity {
...
@@ -113,10 +114,10 @@ public class LoginChooseActivity extends Activity {
loginSSO
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
loginSSO
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
@Override
public
void
onClick
(
View
view
)
{
public
void
onClick
(
View
view
)
{
Intent
intent
=
new
Intent
(
LoginChooseActivity
.
this
,
ADALActivity
.
class
);
//
Intent intent = new Intent(LoginChooseActivity.this,ADALActivity.class);
startActivity
(
intent
);
//
startActivity(intent);
//
onCallGraphClicked();
onCallGraphClicked
();
}
}
});
});
loginOTP
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
loginOTP
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
...
@@ -196,6 +197,16 @@ public class LoginChooseActivity extends Activity {
...
@@ -196,6 +197,16 @@ public class LoginChooseActivity extends Activity {
Log
.
d
(
TAG
,
"Response: "
+
response
.
toString
());
Log
.
d
(
TAG
,
"Response: "
+
response
.
toString
());
updateGraphUI
(
response
);
updateGraphUI
(
response
);
JSONObject
root
=
null
;
try
{
root
=
new
JSONObject
(
response
.
toString
());
String
userLoginName
=
root
.
getString
(
"givenName"
);
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
// updateGraphUI(response);
}
}
},
new
Response
.
ErrorListener
()
{
},
new
Response
.
ErrorListener
()
{
@Override
@Override
...
@@ -238,26 +249,19 @@ public class LoginChooseActivity extends Activity {
...
@@ -238,26 +249,19 @@ public class LoginChooseActivity extends Activity {
private
void
updateGraphUI
(
JSONObject
response
)
{
private
void
updateGraphUI
(
JSONObject
response
)
{
// Called on success from /me endpoint
// Called on success from /me endpoint
// Writes graph data to the UI
// Writes graph data to the UI
TextView
graphText
=
(
TextView
)
findViewById
(
R
.
id
.
graphData
);
//
TextView graphText = (TextView) findViewById(R.id.graphData);
graphText
.
setText
(
response
.
toString
());
//
graphText.setText(response.toString());
}
}
@SuppressLint
(
"SetTextI18n"
)
@SuppressLint
(
"SetTextI18n"
)
private
void
updateSuccessUI
()
{
private
void
updateSuccessUI
()
{
// Called on success from /me endpoint
// Removed call Graph API button and paint Sign out
findViewById
(
R
.
id
.
welcome
).
setVisibility
(
View
.
VISIBLE
);
((
TextView
)
findViewById
(
R
.
id
.
welcome
)).
setText
(
"Welcome, "
+
mAuthResult
.
getUserInfo
().
getGivenName
());
findViewById
(
R
.
id
.
graphData
).
setVisibility
(
View
.
VISIBLE
);
}
}
@SuppressLint
(
"SetTextI18n"
)
@SuppressLint
(
"SetTextI18n"
)
private
void
updateSignedOutUI
()
{
private
void
updateSignedOutUI
()
{
findViewById
(
R
.
id
.
welcome
).
setVisibility
(
View
.
INVISIBLE
);
findViewById
(
R
.
id
.
graphData
).
setVisibility
(
View
.
INVISIBLE
);
((
TextView
)
findViewById
(
R
.
id
.
graphData
)).
setText
(
"No Data"
);
}
}
//
//
...
...
app/src/main/java/com/vsoft/vera/ui/SplashScreen.java
View file @
29cd325e
...
@@ -49,7 +49,7 @@ public class SplashScreen extends Activity {
...
@@ -49,7 +49,7 @@ public class SplashScreen extends Activity {
public
void
run
()
{
public
void
run
()
{
// This method will be executed once the timer is over
// This method will be executed once the timer is over
// Start your app main activity
// Start your app main activity
Intent
i
=
new
Intent
(
SplashScreen
.
this
,
LoginChoose
Activity
.
class
);
Intent
i
=
new
Intent
(
SplashScreen
.
this
,
ADAL
Activity
.
class
);
startActivity
(
i
);
startActivity
(
i
);
// close this activity
// close this activity
...
...
app/src/main/res/layout/adal_main.xml
View file @
29cd325e
...
@@ -17,17 +17,45 @@
...
@@ -17,17 +17,45 @@
android:layout_marginLeft=
"10dp"
android:layout_marginLeft=
"10dp"
android:layout_marginTop=
"15dp"
android:layout_marginTop=
"15dp"
android:id=
"@+id/welcome"
android:id=
"@+id/welcome"
android:visibility=
"invisible"
/>
android:visibility=
"gone"
/>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:visibility=
"visible"
android:layout_marginTop=
"50dp"
android:layout_gravity=
"center_horizontal"
android:background=
"@drawable/ic_login_banner"
/>
<Button
<Button
android:id=
"@+id/callGraph"
android:id=
"@+id/callGraph"
android:text=
"Call Graph"
android:textColor=
"#FFFFFF"
android:background=
"#00a1f1"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"200dp"
android:layout_marginBottom=
"@dimen/normal_margin"
android:textAllCaps=
"false"
/>
android:layout_marginLeft=
"@dimen/extra_large_margin"
android:layout_marginRight=
"@dimen/extra_large_margin"
android:layout_marginTop=
"30dp"
android:background=
"@drawable/login_bg"
android:gravity=
"center"
android:paddingBottom=
"@dimen/normal_margin"
android:paddingTop=
"@dimen/normal_margin"
android:text=
"Login with ADAL"
android:textColor=
"@android:color/white"
android:textSize=
"@dimen/large_text_size"
/>
<Button
android:id=
"@+id/login_with_otp"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"@dimen/normal_margin"
android:layout_marginLeft=
"@dimen/extra_large_margin"
android:layout_marginRight=
"@dimen/extra_large_margin"
android:layout_marginTop=
"30dp"
android:background=
"@drawable/login_bg"
android:gravity=
"center"
android:paddingBottom=
"@dimen/normal_margin"
android:paddingTop=
"@dimen/normal_margin"
android:text=
"Login with otp"
android:textColor=
"@android:color/white"
android:textSize=
"@dimen/large_text_size"
/>
<TextView
<TextView
android:text=
"Loading"
android:text=
"Loading"
...
...
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