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). 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. distance(Dist) == D.
prepare_roundabout(Dist) == ['Prepare to enter roundabout after ', 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 '] :- make_ut(Dist) == ['After ', D, ' turn back '] :-
distance(Dist) == D. 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(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). 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 ']. go_ahead == ['Continue straight ahead '].
%% %%
nth(1, '1st '). nth(1, 'first ').
nth(2, '2nd '). nth(2, 'second ').
nth(3, '3rd '). nth(3, 'third ').
nth(4, '4th '). nth(4, 'fourth ').
nth(5, '5th '). nth(5, 'fifth ').
nth(6, '6th '). nth(6, 'sixth ').
nth(7, '7th '). nth(7, 'seventh ').
nth(8, '8th '). nth(8, 'eight ').
nth(9, '9th '). nth(9, 'nineth ').
nth(10, '10th '). nth(10, 'tenth ').
nth(11, '11th '). nth(11, 'eleventh ').
nth(12, '12th '). nth(12, 'twelfth ').
nth(13, '13th '). nth(13, 'thirteenth ').
nth(14, '14th '). nth(14, 'fourteenth ').
nth(15, '15th '). nth(15, 'fifteenth ').
nth(16, '16th '). nth(16, 'sixteenth ').
nth(17, '17th '). nth(17, 'seventeenth ').
%%% distance measure %%% distance measure

View file

@ -99,15 +99,16 @@ public class TTSCommandPlayerImpl extends AbstractPrologCommandPlayer {
switch (mTts.isLanguageAvailable(new Locale(language))) switch (mTts.isLanguageAvailable(new Locale(language)))
{ {
case TextToSpeech.LANG_MISSING_DATA: case TextToSpeech.LANG_MISSING_DATA:
internalClear(); if (isSettingsActivity(ctx)) {
Builder builder = createAlertDialog( Builder builder = createAlertDialog(
R.string.tts_missing_language_data_title, R.string.tts_missing_language_data_title,
R.string.tts_missing_language_data, R.string.tts_missing_language_data,
new IntentStarter( new IntentStarter(
ctx, ctx,
TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA), TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA),
ctx); ctx);
builder.show(); builder.show();
}
break; break;
case TextToSpeech.LANG_AVAILABLE: case TextToSpeech.LANG_AVAILABLE:
mTts.setLanguage(new Locale(language)); mTts.setLanguage(new Locale(language));
@ -115,8 +116,8 @@ public class TTSCommandPlayerImpl extends AbstractPrologCommandPlayer {
case TextToSpeech.LANG_NOT_SUPPORTED: case TextToSpeech.LANG_NOT_SUPPORTED:
//maybe weird, but I didn't want to introduce parameter in around 5 methods just to do //maybe weird, but I didn't want to introduce parameter in around 5 methods just to do
//this if condition //this if condition
if (ctx instanceof SettingsActivity) { if (isSettingsActivity(ctx)) {
builder = createAlertDialog( Builder builder = createAlertDialog(
R.string.tts_language_not_supported_title, R.string.tts_language_not_supported_title,
R.string.tts_language_not_supported, R.string.tts_language_not_supported,
new IntentStarter( 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). :- op('==', xfy, 500).
version(100). version(100).
language(cz). language(cs).
% before each announcement (beep) % before each announcement (beep)

View file

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