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
b5528c19
authored
Apr 04, 2018
by
Kunj Gupta
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fixed - Reading minus minus minus... for underline text.
parent
53caff81
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
app/src/main/java/com/vsoft/servicenow/chat/Speaker.java
app/src/main/java/com/vsoft/servicenow/ui/ChatActivity.java
app/src/main/java/com/vsoft/servicenow/chat/Speaker.java
View file @
b5528c19
...
@@ -3,6 +3,7 @@ package com.vsoft.servicenow.chat;
...
@@ -3,6 +3,7 @@ package com.vsoft.servicenow.chat;
import
android.content.Context
;
import
android.content.Context
;
import
android.media.AudioManager
;
import
android.media.AudioManager
;
import
android.speech.tts.TextToSpeech
;
import
android.speech.tts.TextToSpeech
;
import
com.vsoft.servicenow.utils.Util
;
import
com.vsoft.servicenow.utils.Util
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -45,6 +46,8 @@ public class Speaker implements TextToSpeech.OnInitListener {
...
@@ -45,6 +46,8 @@ public class Speaker implements TextToSpeech.OnInitListener {
}
}
public
void
speak
(
String
text
)
{
public
void
speak
(
String
text
)
{
//remove all special characters.
String
speakText
=
text
.
replaceAll
(
"---*"
,
""
);
// Speak only if the TTS is ready
// Speak only if the TTS is ready
// and the user has allowed speech
// and the user has allowed speech
if
(
ready
&&
allowed
)
{
if
(
ready
&&
allowed
)
{
...
@@ -52,7 +55,7 @@ public class Speaker implements TextToSpeech.OnInitListener {
...
@@ -52,7 +55,7 @@ public class Speaker implements TextToSpeech.OnInitListener {
hash
.
put
(
TextToSpeech
.
Engine
.
KEY_PARAM_STREAM
,
hash
.
put
(
TextToSpeech
.
Engine
.
KEY_PARAM_STREAM
,
String
.
valueOf
(
AudioManager
.
STREAM_MUSIC
));
String
.
valueOf
(
AudioManager
.
STREAM_MUSIC
));
hash
.
put
(
TextToSpeech
.
Engine
.
KEY_PARAM_UTTERANCE_ID
,
""
+
System
.
currentTimeMillis
());
hash
.
put
(
TextToSpeech
.
Engine
.
KEY_PARAM_UTTERANCE_ID
,
""
+
System
.
currentTimeMillis
());
tts
.
speak
(
Util
.
fromHtml
(
t
ext
).
toString
(),
TextToSpeech
.
QUEUE_ADD
,
hash
);
tts
.
speak
(
Util
.
fromHtml
(
speakT
ext
).
toString
(),
TextToSpeech
.
QUEUE_ADD
,
hash
);
}
}
}
}
...
...
app/src/main/java/com/vsoft/servicenow/ui/ChatActivity.java
View file @
b5528c19
...
@@ -476,7 +476,7 @@ public class ChatActivity extends HandleNotificationActivity implements OnDSList
...
@@ -476,7 +476,7 @@ public class ChatActivity extends HandleNotificationActivity implements OnDSList
@Override
@Override
public
void
onDroidSpeechFinalResult
(
String
finalSpeechResult
)
{
public
void
onDroidSpeechFinalResult
(
String
finalSpeechResult
)
{
mInputMessageView
.
setText
(
fi
nalSpeechResult
);
mInputMessageView
.
setText
(
fi
rstLetterCaps
(
finalSpeechResult
)
);
attemptSend
();
attemptSend
();
}
}
...
@@ -522,5 +522,11 @@ public class ChatActivity extends HandleNotificationActivity implements OnDSList
...
@@ -522,5 +522,11 @@ public class ChatActivity extends HandleNotificationActivity implements OnDSList
speaker
.
destroy
();
speaker
.
destroy
();
}
}
private
String
firstLetterCaps
(
String
data
)
{
String
firstLetter
=
data
.
substring
(
0
,
1
).
toUpperCase
();
String
restLetters
=
data
.
substring
(
1
).
toLowerCase
();
return
firstLetter
+
restLetters
;
}
}
}
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