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
84d408af
authored
Oct 01, 2019
by
Chayaa852
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Socket related changes
parent
cb7cc48d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
14 deletions
app/build.gradle
app/src/main/java/com/vsoft/vera/CatalogueApplication.java
app/src/main/java/com/vsoft/vera/ui/ChatActivity.java
build.gradle
app/build.gradle
View file @
84d408af
...
@@ -56,7 +56,7 @@ android {
...
@@ -56,7 +56,7 @@ android {
}
}
staging
{
//staging is the UAT environment
staging
{
//staging is the UAT environment
//applicationIdSuffix ".staging"
//applicationIdSuffix ".staging"
debuggable
fals
e
debuggable
tru
e
buildConfigField
"int"
,
"BUILD_TYPE_INT"
,
"3"
buildConfigField
"int"
,
"BUILD_TYPE_INT"
,
"3"
signingConfig
signingConfigs
.
debug
signingConfig
signingConfigs
.
debug
}
}
...
@@ -72,7 +72,7 @@ android {
...
@@ -72,7 +72,7 @@ android {
vportal
{
vportal
{
applicationId
"com.vsoft.vera.vportal"
applicationId
"com.vsoft.vera.vportal"
versionCode
1
versionCode
1
versionName
"0.1.
5
"
versionName
"0.1.
6
"
}
}
}
}
}
}
...
@@ -108,7 +108,7 @@ dependencies {
...
@@ -108,7 +108,7 @@ dependencies {
transitive
=
true
;
transitive
=
true
;
}
}
implementation
'com.squareup.picasso:picasso:2.5.2'
implementation
'com.squareup.picasso:picasso:2.5.2'
implementation
'com.github.nkzawa:socket.io-client:0.
3
.0'
implementation
'com.github.nkzawa:socket.io-client:0.
6
.0'
implementation
'com.android.support:appcompat-v7:28.0.0'
implementation
'com.android.support:appcompat-v7:28.0.0'
implementation
'com.android.support:cardview-v7:28.0.0'
implementation
'com.android.support:cardview-v7:28.0.0'
implementation
'com.android.support:recyclerview-v7:28.0.0'
implementation
'com.android.support:recyclerview-v7:28.0.0'
...
...
app/src/main/java/com/vsoft/vera/CatalogueApplication.java
View file @
84d408af
...
@@ -150,10 +150,16 @@ public class CatalogueApplication extends MultiDexApplication {
...
@@ -150,10 +150,16 @@ public class CatalogueApplication extends MultiDexApplication {
IO
.
Options
options
=
new
IO
.
Options
();
IO
.
Options
options
=
new
IO
.
Options
();
options
.
forceNew
=
true
;
options
.
forceNew
=
true
;
options
.
reconnection
=
true
;
options
.
reconnection
=
true
;
options
.
reconnectionDelay
=
0
;
options
.
reconnectionAttempts
=
2000
;
options
.
transports
=
new
String
[]{
Polling
.
NAME
,
WebSocket
.
NAME
};
options
.
transports
=
new
String
[]{
Polling
.
NAME
,
WebSocket
.
NAME
};
options
.
upgrade
=
true
;
options
.
upgrade
=
true
;
mSocket
=
IO
.
socket
(
Constants
.
CHAT_SERVER_URL
,
options
);
mSocket
=
IO
.
socket
(
Constants
.
CHAT_SERVER_URL
,
options
);
mSocket
.
io
().
timeout
(-
1
);
mSocket
.
io
().
reconnection
(
true
);
mSocket
.
io
().
reconnectionDelay
(
0
);
mSocket
.
io
().
reconnectionAttempts
(
2000
);
}
catch
(
URISyntaxException
e
)
{
}
catch
(
URISyntaxException
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
...
...
app/src/main/java/com/vsoft/vera/ui/ChatActivity.java
View file @
84d408af
...
@@ -231,7 +231,8 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
...
@@ -231,7 +231,8 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
mSocket
.
on
(
Socket
.
EVENT_CONNECT
,
onConnect
);
mSocket
.
on
(
Socket
.
EVENT_CONNECT
,
onConnect
);
mSocket
.
on
(
Socket
.
EVENT_DISCONNECT
,
onDisconnect
);
mSocket
.
on
(
Socket
.
EVENT_DISCONNECT
,
onDisconnect
);
mSocket
.
on
(
Socket
.
EVENT_CONNECT_ERROR
,
onConnectError
);
mSocket
.
on
(
Socket
.
EVENT_CONNECT_ERROR
,
onConnectError
);
mSocket
.
on
(
Socket
.
EVENT_CONNECT_TIMEOUT
,
onConnectError
);
mSocket
.
on
(
Socket
.
EVENT_CONNECT_TIMEOUT
,
onConnectTimeOut
);
mSocket
.
on
(
Socket
.
EVENT_RECONNECT
,
onReconnect
);
mSocket
.
on
(
NEW_MESSAGE
,
onNewMessage
);
mSocket
.
on
(
NEW_MESSAGE
,
onNewMessage
);
mSocket
.
on
(
AUTHENTICATED
,
authenticated
);
mSocket
.
on
(
AUTHENTICATED
,
authenticated
);
mSocket
.
on
(
UNAUTHORIZED
,
unAuthorized
);
mSocket
.
on
(
UNAUTHORIZED
,
unAuthorized
);
...
@@ -411,8 +412,6 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
...
@@ -411,8 +412,6 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
private
String
getResults
()
private
String
getResults
()
{
{
try
{
try
{
if
(
checkDataBase
())
{
if
(
checkDataBase
())
{
...
@@ -462,15 +461,15 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
...
@@ -462,15 +461,15 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
}
}
cursor
.
close
();
cursor
.
close
();
Log
.
d
(
"TAG_NAME"
,
chatHistroy
);
Log
.
d
(
"TAG_NAME"
,
chatHistroy
);
}
else
{
}
else
{
Toast
.
makeText
(
ChatActivity
.
this
,
"Fail to get DB"
,
Toast
.
LENGTH_SHORT
).
show
();
Toast
.
makeText
(
ChatActivity
.
this
,
"Fail to get DB"
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
}
}
return
chatHistroy
;
return
chatHistroy
;
}
}
public
void
clearChatAlertDialouge
()
{
public
void
clearChatAlertDialouge
()
{
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
this
);
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
this
);
builder
.
setMessage
(
R
.
string
.
home_screen_clear_chat_confirmation_msg_string
)
builder
.
setMessage
(
R
.
string
.
home_screen_clear_chat_confirmation_msg_string
)
...
@@ -659,7 +658,8 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
...
@@ -659,7 +658,8 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
String
message
=
mInputMessageView
.
getText
().
toString
().
trim
();
String
message
=
mInputMessageView
.
getText
().
toString
().
trim
();
if
(!
TextUtils
.
isEmpty
(
message
)){
if
(!
TextUtils
.
isEmpty
(
message
)){
if
(
null
==
mLoggedInUsername
)
return
;
if
(
null
==
mLoggedInUsername
)
return
;
if
(!
mSocket
.
connected
())
return
;
if
(!
mSocket
.
connected
())
return
;
//Whenever we'll click on send button, running TTS speak should stop
//Whenever we'll click on send button, running TTS speak should stop
if
(
speaker
!=
null
&&
speaker
.
isSpeaking
())
{
if
(
speaker
!=
null
&&
speaker
.
isSpeaking
())
{
...
@@ -689,7 +689,7 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
...
@@ -689,7 +689,7 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
}
}
mSocket
.
emit
(
NEW_MESSAGE
,
jsonObject
);
mSocket
.
emit
(
NEW_MESSAGE
,
jsonObject
);
}
else
{
}
else
{
Toast
toast
=
Toast
.
makeText
(
getApplicationContext
(),
"Please enter the message"
,
Toast
.
LENGTH_LONG
);
Toast
toast
=
Toast
.
makeText
(
getApplicationContext
(),
"Please enter the message"
,
Toast
.
LENGTH_LONG
);
View
toastView
=
toast
.
getView
();
// This'll return the default View of the Toast.
View
toastView
=
toast
.
getView
();
// This'll return the default View of the Toast.
...
@@ -732,7 +732,7 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
...
@@ -732,7 +732,7 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
public
void
initChatMessage
(
String
message
)
{
public
void
initChatMessage
(
String
message
)
{
//
textDotLoader.show();
//
textDotLoader.show();
if
(
message
.
contains
(
"stop"
)){
if
(
message
.
contains
(
"stop"
)){
addMessage
(
mLoggedInUsername
,
message
,
""
);
addMessage
(
mLoggedInUsername
,
message
,
""
);
...
@@ -776,6 +776,31 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
...
@@ -776,6 +776,31 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
};
};
/**
/**
* Chat server calls this if we will get connection time out in connection.
*/
private
Emitter
.
Listener
onConnectTimeOut
=
new
Emitter
.
Listener
()
{
@Override
public
void
call
(
Object
...
args
)
{
Toast
.
makeText
(
getApplicationContext
(),
"onConnectTimeOut Called"
,
Toast
.
LENGTH_LONG
).
show
();
//reconnect();
}
};
/**
* Chat server calls this if we will get reconnected.
*/
private
Emitter
.
Listener
onReconnect
=
new
Emitter
.
Listener
()
{
@Override
public
void
call
(
Object
...
args
)
{
Toast
.
makeText
(
getApplicationContext
(),
"Reconnection Called"
,
Toast
.
LENGTH_LONG
).
show
();
//reconnect();
}
};
/**
* Chat server calls this if we will get any error in connection.
* Chat server calls this if we will get any error in connection.
*/
*/
private
Emitter
.
Listener
onConnectError
=
new
Emitter
.
Listener
()
{
private
Emitter
.
Listener
onConnectError
=
new
Emitter
.
Listener
()
{
...
@@ -1187,6 +1212,7 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
...
@@ -1187,6 +1212,7 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
public
void
onResume
()
public
void
onResume
()
{
{
super
.
onResume
();
super
.
onResume
();
if
(
mSocket
!=
null
&&
!
mSocket
.
connected
())
mSocket
.
connect
();
mSocket
.
connect
();
if
(!
OpenCVLoader
.
initDebug
())
{
if
(!
OpenCVLoader
.
initDebug
())
{
Log
.
d
(
"OpenCV"
,
"Internal OpenCV library not found. Using OpenCV Manager for initialization"
);
Log
.
d
(
"OpenCV"
,
"Internal OpenCV library not found. Using OpenCV Manager for initialization"
);
...
@@ -1196,6 +1222,7 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
...
@@ -1196,6 +1222,7 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
mLoaderCallback
.
onManagerConnected
(
LoaderCallbackInterface
.
SUCCESS
);
mLoaderCallback
.
onManagerConnected
(
LoaderCallbackInterface
.
SUCCESS
);
}
}
}
}
RecyclerView
.
OnItemTouchListener
mOnItemTouchListener
=
new
RecyclerView
.
OnItemTouchListener
()
{
RecyclerView
.
OnItemTouchListener
mOnItemTouchListener
=
new
RecyclerView
.
OnItemTouchListener
()
{
@Override
@Override
public
boolean
onInterceptTouchEvent
(
RecyclerView
rv
,
MotionEvent
e
)
{
public
boolean
onInterceptTouchEvent
(
RecyclerView
rv
,
MotionEvent
e
)
{
...
@@ -1301,7 +1328,8 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
...
@@ -1301,7 +1328,8 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
mSocket
.
off
(
Socket
.
EVENT_CONNECT
,
onConnect
);
mSocket
.
off
(
Socket
.
EVENT_CONNECT
,
onConnect
);
mSocket
.
off
(
Socket
.
EVENT_DISCONNECT
,
onDisconnect
);
mSocket
.
off
(
Socket
.
EVENT_DISCONNECT
,
onDisconnect
);
mSocket
.
off
(
Socket
.
EVENT_CONNECT_ERROR
,
onConnectError
);
mSocket
.
off
(
Socket
.
EVENT_CONNECT_ERROR
,
onConnectError
);
mSocket
.
off
(
Socket
.
EVENT_CONNECT_TIMEOUT
,
onConnectError
);
mSocket
.
on
(
Socket
.
EVENT_CONNECT_TIMEOUT
,
onConnectTimeOut
);
mSocket
.
on
(
Socket
.
EVENT_RECONNECT
,
onReconnect
);
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
);
...
...
build.gradle
View file @
84d408af
...
@@ -8,7 +8,7 @@ buildscript {
...
@@ -8,7 +8,7 @@ buildscript {
maven
{
url
"https://jitpack.io"
}
maven
{
url
"https://jitpack.io"
}
}
}
dependencies
{
dependencies
{
classpath
'com.android.tools.build:gradle:3.
5.0
'
classpath
'com.android.tools.build:gradle:3.
4.2
'
classpath
'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath
'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath
'com.google.gms:google-services:4.2.0'
classpath
'com.google.gms:google-services:4.2.0'
...
...
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