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
458beb8c
authored
Apr 06, 2018
by
Kunj Gupta
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Added user sysid null handle code in chat screen.
parent
b6f32a03
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
1 deletions
app/src/main/java/com/vsoft/servicenow/ui/ChatActivity.java
app/src/main/java/com/vsoft/servicenow/ui/LoginScreen.java
app/src/main/java/com/vsoft/servicenow/utils/Constants.java
app/src/main/java/com/vsoft/servicenow/ui/ChatActivity.java
View file @
458beb8c
...
@@ -100,6 +100,15 @@ public class ChatActivity extends HandleNotificationActivity implements OnDSList
...
@@ -100,6 +100,15 @@ public class ChatActivity extends HandleNotificationActivity implements OnDSList
mLoggedInUserSysId
=
PrefManager
.
getSharedPref
(
this
,
PrefManager
.
PREFERENCE_USER_SYS_ID
);
mLoggedInUserSysId
=
PrefManager
.
getSharedPref
(
this
,
PrefManager
.
PREFERENCE_USER_SYS_ID
);
mLoggedInUsername
=
PrefManager
.
getSharedPref
(
this
,
PrefManager
.
PREFERENCE_USER_FIRST_NAME
);
mLoggedInUsername
=
PrefManager
.
getSharedPref
(
this
,
PrefManager
.
PREFERENCE_USER_FIRST_NAME
);
if
(
TextUtils
.
isEmpty
(
mLoggedInUserSysId
)
||
TextUtils
.
isEmpty
(
mLoggedInUsername
))
{
CatalogueLog
.
e
(
"User Sys id or Name is Null"
);
Intent
intent
=
new
Intent
(
this
,
LoginScreen
.
class
);
intent
.
putExtra
(
Constants
.
DATA_KEY_LOGIN_REQUEST_CODE
,
Constants
.
LOGIN_SCREEN_REQUEST_CODE
);
startActivity
(
intent
);
finish
();
}
Toolbar
mToolbar
=
findViewById
(
R
.
id
.
tool_bar_view
);
Toolbar
mToolbar
=
findViewById
(
R
.
id
.
tool_bar_view
);
setSupportActionBar
(
mToolbar
);
setSupportActionBar
(
mToolbar
);
ActionBar
actionBar
=
getSupportActionBar
();
ActionBar
actionBar
=
getSupportActionBar
();
...
@@ -463,6 +472,8 @@ public class ChatActivity extends HandleNotificationActivity implements OnDSList
...
@@ -463,6 +472,8 @@ public class ChatActivity extends HandleNotificationActivity implements OnDSList
install
.
setAction
(
TextToSpeech
.
Engine
.
ACTION_INSTALL_TTS_DATA
);
install
.
setAction
(
TextToSpeech
.
Engine
.
ACTION_INSTALL_TTS_DATA
);
startActivity
(
install
);
startActivity
(
install
);
}
}
}
else
if
(
requestCode
==
Constants
.
LOGIN_SCREEN_REQUEST_CODE
)
{
}
}
}
}
...
@@ -553,6 +564,7 @@ public class ChatActivity extends HandleNotificationActivity implements OnDSList
...
@@ -553,6 +564,7 @@ public class ChatActivity extends HandleNotificationActivity implements OnDSList
public
void
onDestroy
()
{
public
void
onDestroy
()
{
super
.
onDestroy
();
super
.
onDestroy
();
if
(
mSocket
!=
null
)
{
mSocket
.
disconnect
();
mSocket
.
disconnect
();
mSocket
.
off
(
Socket
.
EVENT_CONNECT
,
onConnect
);
mSocket
.
off
(
Socket
.
EVENT_CONNECT
,
onConnect
);
...
@@ -562,9 +574,12 @@ public class ChatActivity extends HandleNotificationActivity implements OnDSList
...
@@ -562,9 +574,12 @@ public class ChatActivity extends HandleNotificationActivity implements OnDSList
mSocket
.
off
(
NEW_MESSAGE
,
onNewMessage
);
mSocket
.
off
(
NEW_MESSAGE
,
onNewMessage
);
mSocket
.
off
(
AUTHENTICATED
,
authenticated
);
mSocket
.
off
(
AUTHENTICATED
,
authenticated
);
mSocket
.
off
(
UNAUTHORIZED
,
unAuthorized
);
mSocket
.
off
(
UNAUTHORIZED
,
unAuthorized
);
}
if
(
speaker
!=
null
)
{
speaker
.
destroy
();
speaker
.
destroy
();
}
}
}
private
String
firstLetterCaps
(
String
data
)
{
private
String
firstLetterCaps
(
String
data
)
{
String
firstLetter
=
data
.
substring
(
0
,
1
).
toUpperCase
();
String
firstLetter
=
data
.
substring
(
0
,
1
).
toUpperCase
();
...
...
app/src/main/java/com/vsoft/servicenow/ui/LoginScreen.java
View file @
458beb8c
...
@@ -93,7 +93,17 @@ public class LoginScreen extends Activity {
...
@@ -93,7 +93,17 @@ public class LoginScreen extends Activity {
intent
.
putExtra
(
Constants
.
APPLICATION_BROADCAST_DATA_ACTION
,
Constants
.
ACTION_SYNC
);
intent
.
putExtra
(
Constants
.
APPLICATION_BROADCAST_DATA_ACTION
,
Constants
.
ACTION_SYNC
);
LocalBroadcastManager
.
getInstance
(
LoginScreen
.
this
).
sendBroadcast
(
intent
);
LocalBroadcastManager
.
getInstance
(
LoginScreen
.
this
).
sendBroadcast
(
intent
);
Bundle
bundle
=
getIntent
().
getExtras
();
if
(
bundle
!=
null
)
{
int
requestCode
=
bundle
.
getInt
(
Constants
.
DATA_KEY_LOGIN_REQUEST_CODE
);
if
(
requestCode
==
Constants
.
LOGIN_SCREEN_REQUEST_CODE
)
{
setResult
(
Constants
.
LOGIN_SCREEN_REQUEST_CODE
,
new
Intent
());
}
else
{
startActivity
(
new
Intent
(
LoginScreen
.
this
,
HomeScreen
.
class
));
startActivity
(
new
Intent
(
LoginScreen
.
this
,
HomeScreen
.
class
));
}
}
else
{
startActivity
(
new
Intent
(
LoginScreen
.
this
,
HomeScreen
.
class
));
}
finish
();
finish
();
}
}
}
}
...
@@ -244,7 +254,17 @@ public class LoginScreen extends Activity {
...
@@ -244,7 +254,17 @@ public class LoginScreen extends Activity {
intent
.
putExtra
(
Constants
.
APPLICATION_BROADCAST_DATA_ACTION
,
Constants
.
ACTION_SYNC
);
intent
.
putExtra
(
Constants
.
APPLICATION_BROADCAST_DATA_ACTION
,
Constants
.
ACTION_SYNC
);
LocalBroadcastManager
.
getInstance
(
LoginScreen
.
this
).
sendBroadcast
(
intent
);
LocalBroadcastManager
.
getInstance
(
LoginScreen
.
this
).
sendBroadcast
(
intent
);
Bundle
bundle
=
getIntent
().
getExtras
();
if
(
bundle
!=
null
)
{
int
requestCode
=
bundle
.
getInt
(
Constants
.
DATA_KEY_LOGIN_REQUEST_CODE
);
if
(
requestCode
==
Constants
.
LOGIN_SCREEN_REQUEST_CODE
)
{
startActivity
(
new
Intent
(
LoginScreen
.
this
,
ChatActivity
.
class
));
}
else
{
startActivity
(
new
Intent
(
LoginScreen
.
this
,
HomeScreen
.
class
));
startActivity
(
new
Intent
(
LoginScreen
.
this
,
HomeScreen
.
class
));
}
}
else
{
startActivity
(
new
Intent
(
LoginScreen
.
this
,
HomeScreen
.
class
));
}
finish
();
finish
();
}
else
{
}
else
{
Toast
.
makeText
(
LoginScreen
.
this
,
R
.
string
.
user_detail_not_available
,
Toast
.
LENGTH_LONG
).
show
();
Toast
.
makeText
(
LoginScreen
.
this
,
R
.
string
.
user_detail_not_available
,
Toast
.
LENGTH_LONG
).
show
();
...
...
app/src/main/java/com/vsoft/servicenow/utils/Constants.java
View file @
458beb8c
...
@@ -29,9 +29,9 @@ public class Constants {
...
@@ -29,9 +29,9 @@ public class Constants {
public
static
final
String
DATA_KEY_CATALOGUE_TITLE
=
"catalogue_title"
;
public
static
final
String
DATA_KEY_CATALOGUE_TITLE
=
"catalogue_title"
;
public
static
final
String
DATA_KEY_CATALOGUE_ITEM_DESCRIPTION
=
"catalogue_item_des"
;
public
static
final
String
DATA_KEY_CATALOGUE_ITEM_DESCRIPTION
=
"catalogue_item_des"
;
public
static
final
String
DATA_KEY_CATALOGUE_ITEM_SHORT_DESCRIPTION
=
"catalogue_item_short_des"
;
public
static
final
String
DATA_KEY_CATALOGUE_ITEM_SHORT_DESCRIPTION
=
"catalogue_item_short_des"
;
public
static
final
String
DATA_KEY_CHAT_USER_NAME
=
"username"
;
public
static
final
String
DATA_KEY_NOTIFICATION_TITLE
=
"notification_title"
;
public
static
final
String
DATA_KEY_NOTIFICATION_TITLE
=
"notification_title"
;
public
static
final
String
DATA_KEY_NOTIFICATION_MESSAGE
=
"notification_message"
;
public
static
final
String
DATA_KEY_NOTIFICATION_MESSAGE
=
"notification_message"
;
public
static
final
String
DATA_KEY_LOGIN_REQUEST_CODE
=
"login_request_code"
;
/**
/**
* Broadcast custom intent
* Broadcast custom intent
...
@@ -45,6 +45,7 @@ public class Constants {
...
@@ -45,6 +45,7 @@ public class Constants {
public
static
final
String
APPLICATION_BROADCAST_INTENT
=
"application_broadcast"
;
public
static
final
String
APPLICATION_BROADCAST_INTENT
=
"application_broadcast"
;
public
static
final
String
APPLICATION_BROADCAST_DATA_ACTION
=
"action"
;
public
static
final
String
APPLICATION_BROADCAST_DATA_ACTION
=
"action"
;
public
static
final
String
ACTION_PROMPT_LOGIN
=
"action_prompt_login"
;
public
static
final
String
ACTION_PROMPT_LOGIN
=
"action_prompt_login"
;
/**
/**
* Catalogue services post parameters
* Catalogue services post parameters
*/
*/
...
@@ -59,6 +60,11 @@ public class Constants {
...
@@ -59,6 +60,11 @@ public class Constants {
public
static
final
String
URL_PARAM_SYS_ID
=
"sys_id"
;
public
static
final
String
URL_PARAM_SYS_ID
=
"sys_id"
;
/**
/**
* Request Code
* */
public
static
final
int
LOGIN_SCREEN_REQUEST_CODE
=
105
;
/**
* Preference Notification token.
* Preference Notification token.
*/
*/
public
static
final
String
PREFS_NOTIFICATION_TOKEN
=
"notification_token"
;
public
static
final
String
PREFS_NOTIFICATION_TOKEN
=
"notification_token"
;
...
...
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