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
964f4635
authored
Oct 03, 2019
by
Sreenivasulu Mannem
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Bug Fixes for crash, login page issue
parent
493df8e0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
11 deletions
app/src/main/java/com/vsoft/vera/ui/ChatActivity.java
app/src/main/java/com/vsoft/vera/ui/ChatActivity.java
View file @
964f4635
...
@@ -23,6 +23,7 @@ import android.os.PowerManager;
...
@@ -23,6 +23,7 @@ import android.os.PowerManager;
import
android.provider.MediaStore
;
import
android.provider.MediaStore
;
import
android.speech.tts.TextToSpeech
;
import
android.speech.tts.TextToSpeech
;
import
android.speech.tts.UtteranceProgressListener
;
import
android.speech.tts.UtteranceProgressListener
;
import
android.support.design.widget.Snackbar
;
import
android.support.v4.content.LocalBroadcastManager
;
import
android.support.v4.content.LocalBroadcastManager
;
import
android.support.v7.app.ActionBar
;
import
android.support.v7.app.ActionBar
;
import
android.support.v7.app.AppCompatActivity
;
import
android.support.v7.app.AppCompatActivity
;
...
@@ -148,6 +149,7 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
...
@@ -148,6 +149,7 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
String
takePictureFilePath
=
""
;
String
takePictureFilePath
=
""
;
private
Speaker
speaker
;
private
Speaker
speaker
;
private
Boolean
isConnected
=
false
;
private
Boolean
isConnected
=
false
;
private
Boolean
isConnectError
=
false
;
private
static
final
int
NONE
=
-
1
;
private
static
final
int
NONE
=
-
1
;
private
static
final
int
VOICE_STATE
=
1
;
private
static
final
int
VOICE_STATE
=
1
;
private
static
final
int
TYPING_STATE
=
2
;
private
static
final
int
TYPING_STATE
=
2
;
...
@@ -249,7 +251,7 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
...
@@ -249,7 +251,7 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
mSocket
.
connect
();
mSocket
.
connect
();
checkTTS
();
checkTTS
();
speaker
=
new
Speaker
(
this
);
//
speaker = new Speaker(this);
textDotLoader
=
findViewById
(
R
.
id
.
avi
);
textDotLoader
=
findViewById
(
R
.
id
.
avi
);
mMessagesView
=
(
RecyclerView
)
findViewById
(
R
.
id
.
messages
);
mMessagesView
=
(
RecyclerView
)
findViewById
(
R
.
id
.
messages
);
sendImageToserv
=
(
ImageButton
)
findViewById
(
R
.
id
.
image_button
);
sendImageToserv
=
(
ImageButton
)
findViewById
(
R
.
id
.
image_button
);
...
@@ -261,7 +263,6 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
...
@@ -261,7 +263,6 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
@Override
@Override
public
void
imageViewOnClick
(
String
imagePath
)
{
public
void
imageViewOnClick
(
String
imagePath
)
{
shoawUserImagePopupImageAlert
(
imagePath
);
shoawUserImagePopupImageAlert
(
imagePath
);
}
}
@Override
@Override
...
@@ -667,8 +668,12 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
...
@@ -667,8 +668,12 @@ 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
())
if
(
mSocket
==
null
)
return
;
return
;
if
(!
mSocket
.
connected
())
{
mSocket
.
connect
();
//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
())
{
...
@@ -777,8 +782,21 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
...
@@ -777,8 +782,21 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
@Override
@Override
public
void
run
()
{
public
void
run
()
{
isConnected
=
false
;
isConnected
=
false
;
Toast
.
makeText
(
getApplicationContext
(),
isConnectError
=
false
;
R
.
string
.
disconnect
,
Toast
.
LENGTH_LONG
).
show
();
Snackbar
snackbar
=
Snackbar
.
make
(
mMessagesView
,
R
.
string
.
disconnect
,
Snackbar
.
LENGTH_LONG
);
snackbar
.
show
();
// Changing action button text color
View
sbView
=
snackbar
.
getView
();
TextView
textView
=
(
TextView
)
sbView
.
findViewById
(
android
.
support
.
design
.
R
.
id
.
snackbar_text
);
textView
.
setTextColor
(
Color
.
YELLOW
);
snackbar
.
show
();
/*Toast.makeText(getApplicationContext(),
R.string.disconnect, Toast.LENGTH_LONG).show();*/
}
}
});
});
}
}
...
@@ -802,8 +820,8 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
...
@@ -802,8 +820,8 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
private
Emitter
.
Listener
onReconnect
=
new
Emitter
.
Listener
()
{
private
Emitter
.
Listener
onReconnect
=
new
Emitter
.
Listener
()
{
@Override
@Override
public
void
call
(
Object
...
args
)
{
public
void
call
(
Object
...
args
)
{
Toast
.
makeText
(
getApplicationContext
(),
/*
Toast.makeText(getApplicationContext(),
"Reconnection Called"
,
Toast
.
LENGTH_LONG
).
show
();
"Reconnection Called", Toast.LENGTH_LONG).show();
*/
//reconnect();
//reconnect();
}
}
...
@@ -818,18 +836,42 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
...
@@ -818,18 +836,42 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
runOnUiThread
(
new
Runnable
()
{
runOnUiThread
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
if
(!
isConnectError
)
{
Snackbar
snackbar
=
Snackbar
.
make
(
mMessagesView
,
R
.
string
.
error_connect
,
Snackbar
.
LENGTH_LONG
)
.
setAction
(
"Dismiss"
,
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
}
});
snackbar
.
show
();
// Changing message text color
snackbar
.
setActionTextColor
(
Color
.
RED
);
Toast
toast
=
Toast
.
makeText
(
getApplicationContext
(),
R
.
string
.
error_connect
,
Toast
.
LENGTH_LONG
);
// Changing action button text color
View
sbView
=
snackbar
.
getView
();
TextView
textView
=
(
TextView
)
sbView
.
findViewById
(
android
.
support
.
design
.
R
.
id
.
snackbar_text
);
textView
.
setTextColor
(
Color
.
YELLOW
);
snackbar
.
show
();
isConnectError
=
true
;
}
/*Toast toast = Toast.makeText(getApplicationContext(), R.string.error_connect, 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.
/* And now you can get the TextView of the default View of the Toast. */
*//* And now you can get the TextView of the default View of the Toast. *//*
TextView toastMessage = (TextView) toastView.findViewById(android.R.id.message);
TextView toastMessage = (TextView) toastView.findViewById(android.R.id.message);
toastMessage.setTextSize(15);
toastMessage.setTextSize(15);
toastMessage.setTextColor(Color.WHITE);
toastMessage.setTextColor(Color.WHITE);
toastMessage.setGravity(Gravity.CENTER);
toastMessage.setGravity(Gravity.CENTER);
toastMessage.setPadding(30,0,30,0);
toastMessage.setPadding(30,0,30,0);
toastView.setBackgroundColor(Color.BLACK);
toastView.setBackgroundColor(Color.BLACK);
toast
.
show
();
toast.show();
*/
}
}
});
});
}
}
...
...
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