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
f53239e2
authored
Apr 20, 2018
by
Kunj Gupta
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Added - Listening dialog will dismiss after 10 secs if user will not respond.
parent
26d2ec39
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
5 deletions
app/src/main/java/com/vsoft/servicenow/ui/ChatActivity.java
app/src/main/java/com/vsoft/servicenow/ui/ChatActivity.java
View file @
f53239e2
...
@@ -100,6 +100,16 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
...
@@ -100,6 +100,16 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
private
static
final
int
SCREEN_OFF
=
0
;
private
static
final
int
SCREEN_OFF
=
0
;
private
static
final
int
SCREEN_ON
=
1
;
private
static
final
int
SCREEN_ON
=
1
;
private
static
final
long
LISTENING_DIALOG_DISMISS_DELAY_TIME
=
10000
;
/**
* These var will to set delay for listing dialog. Previously it will open for infinite time.
* Now open the listening, if user will not response it'll close after 10 Secs.
* */
private
static
final
int
LISTENING_DELAY_STARTED_STATE
=
1
;
private
static
final
int
LISTENING_DELAY_DONE_STATE
=
2
;
private
static
int
LISTENING_DELAY_STATE
=
LISTENING_DELAY_DONE_STATE
;
@Override
@Override
public
boolean
onOptionsItemSelected
(
MenuItem
menuItem
)
{
public
boolean
onOptionsItemSelected
(
MenuItem
menuItem
)
{
if
(
menuItem
.
getItemId
()
==
android
.
R
.
id
.
home
)
{
if
(
menuItem
.
getItemId
()
==
android
.
R
.
id
.
home
)
{
...
@@ -567,6 +577,9 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
...
@@ -567,6 +577,9 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
@Override
@Override
public
void
onDroidSpeechFinalResult
(
String
finalSpeechResult
)
{
public
void
onDroidSpeechFinalResult
(
String
finalSpeechResult
)
{
LISTENING_DELAY_STATE
=
LISTENING_DELAY_DONE_STATE
;
handler
.
removeCallbacks
(
runnable
);
if
(
droidSpeech
!=
null
)
{
if
(
droidSpeech
!=
null
)
{
droidSpeech
.
closeDroidSpeechOperations
();
droidSpeech
.
closeDroidSpeechOperations
();
}
}
...
@@ -575,6 +588,16 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
...
@@ -575,6 +588,16 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
}
}
@Override
@Override
public
void
onDroidSpeechStarted
()
{
callScreenOnAndOff
(
SCREEN_ON
);
if
(
LISTENING_DELAY_STATE
==
LISTENING_DELAY_DONE_STATE
)
{
LISTENING_DELAY_STATE
=
LISTENING_DELAY_STARTED_STATE
;
handler
.
postDelayed
(
runnable
,
LISTENING_DIALOG_DISMISS_DELAY_TIME
);
}
}
@Override
public
void
onDroidSpeechClosedByUser
()
{
public
void
onDroidSpeechClosedByUser
()
{
callScreenOnAndOff
(
SCREEN_OFF
);
callScreenOnAndOff
(
SCREEN_OFF
);
}
}
...
@@ -602,11 +625,6 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
...
@@ -602,11 +625,6 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
}
}
@Override
@Override
public
void
onDroidSpeechStarted
()
{
callScreenOnAndOff
(
SCREEN_ON
);
}
@Override
public
void
onDestroy
()
{
public
void
onDestroy
()
{
super
.
onDestroy
();
super
.
onDestroy
();
...
@@ -663,5 +681,13 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
...
@@ -663,5 +681,13 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
message
.
what
=
screenState
;
message
.
what
=
screenState
;
handler
.
sendMessage
(
message
);
handler
.
sendMessage
(
message
);
}
}
Runnable
runnable
=
new
Runnable
()
{
@Override
public
void
run
()
{
LISTENING_DELAY_STATE
=
LISTENING_DELAY_DONE_STATE
;
droidSpeech
.
closeDroidSpeechOperations
();
}
};
}
}
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