Inform user about tts problems only in settings activity.

Fix small things in tts config files.
This commit is contained in:
Pavol Zibrita 2011-06-25 12:27:57 +02:00
parent 08747b3219
commit 1f5628599c
4 changed files with 52 additions and 49 deletions

View file

@ -21,7 +21,7 @@ turn(Turn, Dist) == ['After ', D, M] :-
turn(Turn) == M :- turn(Turn, M).
prepare_make_ut(Dist) == ['Prepare to turn after ', D, ' turn back'] :-
prepare_make_ut(Dist) == ['Prepare after ', D, ' to turn back'] :-
distance(Dist) == D.
prepare_roundabout(Dist) == ['Prepare to enter roundabout after ', D] :-
@ -29,7 +29,7 @@ prepare_roundabout(Dist) == ['Prepare to enter roundabout after ', D] :-
make_ut(Dist) == ['After ', D, ' turn back '] :-
distance(Dist) == D.
make_ut == ['Turn back '].
make_ut == ['Make U turn '].
roundabout(Dist, _Angle, Exit) == ['After ', D, ' enter the roundabout, and take the ', E, 'exit'] :- distance(Dist) == D, nth(Exit, E).
roundabout(_Angle, Exit) == ['taking the ', E, 'exit'] :- nth(Exit, E).
@ -46,23 +46,23 @@ go_ahead(Dist) == ['Drive for ', D]:- distance(Dist) == D.
go_ahead == ['Continue straight ahead '].
%%
nth(1, '1st ').
nth(2, '2nd ').
nth(3, '3rd ').
nth(4, '4th ').
nth(5, '5th ').
nth(6, '6th ').
nth(7, '7th ').
nth(8, '8th ').
nth(9, '9th ').
nth(10, '10th ').
nth(11, '11th ').
nth(12, '12th ').
nth(13, '13th ').
nth(14, '14th ').
nth(15, '15th ').
nth(16, '16th ').
nth(17, '17th ').
nth(1, 'first ').
nth(2, 'second ').
nth(3, 'third ').
nth(4, 'fourth ').
nth(5, 'fifth ').
nth(6, 'sixth ').
nth(7, 'seventh ').
nth(8, 'eight ').
nth(9, 'nineth ').
nth(10, 'tenth ').
nth(11, 'eleventh ').
nth(12, 'twelfth ').
nth(13, 'thirteenth ').
nth(14, 'fourteenth ').
nth(15, 'fifteenth ').
nth(16, 'sixteenth ').
nth(17, 'seventeenth ').
%%% distance measure

View file

@ -99,15 +99,16 @@ public class TTSCommandPlayerImpl extends AbstractPrologCommandPlayer {
switch (mTts.isLanguageAvailable(new Locale(language)))
{
case TextToSpeech.LANG_MISSING_DATA:
internalClear();
Builder builder = createAlertDialog(
R.string.tts_missing_language_data_title,
R.string.tts_missing_language_data,
new IntentStarter(
ctx,
TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA),
ctx);
builder.show();
if (isSettingsActivity(ctx)) {
Builder builder = createAlertDialog(
R.string.tts_missing_language_data_title,
R.string.tts_missing_language_data,
new IntentStarter(
ctx,
TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA),
ctx);
builder.show();
}
break;
case TextToSpeech.LANG_AVAILABLE:
mTts.setLanguage(new Locale(language));
@ -115,8 +116,8 @@ public class TTSCommandPlayerImpl extends AbstractPrologCommandPlayer {
case TextToSpeech.LANG_NOT_SUPPORTED:
//maybe weird, but I didn't want to introduce parameter in around 5 methods just to do
//this if condition
if (ctx instanceof SettingsActivity) {
builder = createAlertDialog(
if (isSettingsActivity(ctx)) {
Builder builder = createAlertDialog(
R.string.tts_language_not_supported_title,
R.string.tts_language_not_supported,
new IntentStarter(
@ -131,7 +132,9 @@ public class TTSCommandPlayerImpl extends AbstractPrologCommandPlayer {
}
}
private boolean isSettingsActivity(final Activity ctx) {
return ctx instanceof SettingsActivity;
}
});
}
}

View file

@ -1,6 +1,6 @@
:- op('==', xfy, 500).
version(100).
language(cz).
language(cs).
% before each announcement (beep)

View file

@ -46,23 +46,23 @@ go_ahead(Dist) == ['Drive for ', D]:- distance(Dist) == D.
go_ahead == ['Continue straight ahead '].
%%
nth(1, '1st ').
nth(2, '2nd ').
nth(3, '3rd ').
nth(4, '4th ').
nth(5, '5th ').
nth(6, '6th ').
nth(7, '7th ').
nth(8, '8th ').
nth(9, '9th ').
nth(10, '10th ').
nth(11, '11th ').
nth(12, '12th ').
nth(13, '13th ').
nth(14, '14th ').
nth(15, '15th ').
nth(16, '16th ').
nth(17, '17th ').
nth(1, 'first ').
nth(2, 'second ').
nth(3, 'third ').
nth(4, 'fourth ').
nth(5, 'fifth ').
nth(6, 'sixth ').
nth(7, 'seventh ').
nth(8, 'eight ').
nth(9, 'nineth ').
nth(10, 'tenth ').
nth(11, 'eleventh ').
nth(12, 'twelfth ').
nth(13, 'thirteenth ').
nth(14, 'fourteenth ').
nth(15, 'fifteenth ').
nth(16, 'sixteenth ').
nth(17, 'seventeenth ').
%%% distance measure