Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
yotta
/
pictogram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
60
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
01ad6ba3
authored
May 20, 2016
by
Pablo Molina
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Solved
#403
, en android la tira no desaparece hasta leerse
parent
f6c257ff
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
23 deletions
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/PictogramActivity.java
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/TapeAdapter.java
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/PictogramActivity.java
View file @
01ad6ba3
...
...
@@ -15,6 +15,7 @@ import android.os.Bundle;
import
android.provider.MediaStore
;
import
android.speech.tts.TextToSpeech
;
import
android.speech.tts.UtteranceProgressListener
;
import
android.text.InputType
;
import
android.util.DisplayMetrics
;
import
android.util.Log
;
...
...
@@ -135,6 +136,7 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
// tts = new TextToSpeech(this, this, "IVONA Text-to-Speech HQ");
tts
=
new
TextToSpeech
(
this
,
this
);
tts
.
setOnUtteranceProgressListener
(
new
OnTTSEndListener
());
this
.
tapeGridView
.
setOnDragListener
(
new
OnPictoDragListener
());
this
.
pictoCategoriesGridView
.
setOnDragListener
(
new
OnPictoDragListener
());
...
...
@@ -631,25 +633,43 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
private
class
OnTTSButtonClickListener
implements
View
.
OnClickListener
{
@Override
public
void
onClick
(
View
arg0
)
{
// Send websocket action
LinkedList
<
Picto
>
lp
=
tapeAdapter
.
getAll
();
// Call to static log method
PCBcontext
.
getActionLog
().
log
(
new
PictosAction
(
lp
));
tapeAdapter
.
ttsAllNew
(
tts
);
}
}
//send_phrase_action(tapeAdapter.getAll());
/**
* Class for listening the TTS start/end/error events.
* It clears the tape and shows the category grid when the speech has finished or errored.
*/
private
class
OnTTSEndListener
extends
UtteranceProgressListener
{
@Override
public
void
onStart
(
String
utteranceId
)
{
Log
.
d
(
LOG_TAG
,
"TTS tape read start"
);
}
// Uncomment next line for locution when the version of Android be greater than 5.0
// (Unsupported on previous versions)
tapeAdapter
.
ttsAllNew
(
tts
);
t
apeAdapter
.
deleteAll
();
tapeAdapter
.
notifyDataSetChanged
();
@Override
public
void
onDone
(
String
utteranceId
)
{
Log
.
d
(
LOG_TAG
,
"TTS tape read end"
);
t
his
.
finishSpeech
();
}
RelativeLayout
rl
=
(
RelativeLayout
)
findViewById
(
R
.
id
.
pictogramLayout
);
rl
.
setBackgroundColor
(
Color
.
parseColor
(
"#BDBDBD"
));
@Override
public
void
onError
(
String
utteranceId
)
{
Log
.
d
(
LOG_TAG
,
"TTS tape read error"
);
this
.
finishSpeech
();
}
// Load the categories
showPictoCategoriesGridView
();
private
void
finishSpeech
()
{
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
tapeAdapter
.
deleteAll
();
tapeAdapter
.
notifyDataSetChanged
();
showPictoCategoriesGridView
();
}
});
}
}
...
...
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/TapeAdapter.java
View file @
01ad6ba3
...
...
@@ -4,6 +4,7 @@ import android.annotation.TargetApi;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.speech.tts.TextToSpeech
;
import
android.speech.tts.UtteranceProgressListener
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.ViewGroup
;
...
...
@@ -104,18 +105,11 @@ public class TapeAdapter extends BaseAdapter {
}
@TargetApi
(
Build
.
VERSION_CODES
.
LOLLIPOP
)
public
void
ttsAllNew
(
TextToSpeech
tts
){
// DE PRUEBA
//String input = pictoLinkedList.getFirst().get_translation();
public
void
ttsAllNew
(
TextToSpeech
tts
)
{
String
input
=
getAllAsString
();
//String input = "Geni, vaya fin de semana en el bater vas a pasar !!!";
Bundle
params
=
new
Bundle
();
params
.
putString
(
TextToSpeech
.
Engine
.
KEY_PARAM_VOLUME
,
"1"
);
//tts.setPitch((float) 0.6);
//tts.setSpeechRate((float) 1);
tts
.
speak
(
input
,
TextToSpeech
.
QUEUE_FLUSH
,
params
,
null
);
params
.
putString
(
TextToSpeech
.
Engine
.
KEY_PARAM_UTTERANCE_ID
,
"TAPE_READ"
);
tts
.
speak
(
input
,
TextToSpeech
.
QUEUE_FLUSH
,
params
,
"TAPE_READ"
);
}
}
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