From c9914596791d99d3d67b5d6e6a0e19f904729191 Mon Sep 17 00:00:00 2001 From: Pavol Zibrita Date: Tue, 21 Jun 2011 22:27:56 +0200 Subject: [PATCH] Make the code executable on 1.5 platform. Ask some dialogs only when making changes from SettingsActivity. Small update of the texts. --- OsmAnd/AndroidManifest.xml | 3 +-- OsmAnd/res/values/strings.xml | 2 +- .../osmand/plus/activities/MapActivity.java | 21 ++-------------- .../plus/voice/CommandPlayerFactory.java | 7 ++++-- .../plus/voice/TTSCommandPlayerImpl.java | 24 +++++++++++-------- 5 files changed, 23 insertions(+), 34 deletions(-) diff --git a/OsmAnd/AndroidManifest.xml b/OsmAnd/AndroidManifest.xml index 12253b6699..427bcaa19e 100644 --- a/OsmAnd/AndroidManifest.xml +++ b/OsmAnd/AndroidManifest.xml @@ -3,7 +3,7 @@ package="net.osmand.plus" android:installLocation="auto" android:versionName="0.6.5" android:versionCode="34"> - @@ -49,7 +49,6 @@ - diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 12503fe2c7..94f46bc242 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -1,7 +1,7 @@ Language unsupported - The selected language is not supported by the installed TTS engine. Do you want to go to market and search for other TTS engine? + The selected language is not supported by the installed TTS engine. Do you want to go to market and search for other TTS engine? Else preset TTS language will be used. Missing data Data for selected language are not installed. Do you want to go market to install them? diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index 83f07703c5..8f00407980 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -6,6 +6,7 @@ import java.util.List; import net.osmand.Algoritms; import net.osmand.CallbackWithObject; +import net.osmand.GPXUtilities.GPXFileResult; import net.osmand.LogUtil; import net.osmand.Version; import net.osmand.data.MapTileDownloader; @@ -35,8 +36,8 @@ import android.app.ProgressDialog; import android.content.ActivityNotFoundException; import android.content.ComponentName; import android.content.DialogInterface; -import android.content.Intent; import android.content.DialogInterface.OnMultiChoiceClickListener; +import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.graphics.Color; @@ -58,7 +59,6 @@ import android.os.Handler; import android.os.Message; import android.os.PowerManager; import android.os.PowerManager.WakeLock; -import android.provider.Settings.Secure; import android.util.Log; import android.view.KeyEvent; import android.view.Menu; @@ -128,8 +128,6 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso // Store previous map rotation settings for rotate button private Integer previousMapRotate = null; - private RouteAnimation routeAnimation = new RouteAnimation(); - private boolean isMapLinkedToLocation = false; private boolean isMapLinkedToLocation(){ @@ -421,7 +419,6 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso protected void onDestroy() { super.onDestroy(); savingTrackHelper.close(); - routeAnimation.close(); if(mNotificationManager != null){ mNotificationManager.cancel(APP_NOTIFICATION_ID); } @@ -951,16 +948,6 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso muteMenu.setVisible(false); } } - MenuItem animateMenu = menu.findItem(R.id.map_animate_route); - if (animateMenu != null) { - animateMenu.setTitle(routeAnimation.isRouteAnimating() ? R.string.animate_route_off - : R.string.animate_route); - animateMenu.setVisible("1".equals(Secure.getString( - getContentResolver(), Secure.ALLOW_MOCK_LOCATION)) - && settings.getPointToNavigate() != null - && routingHelper.isRouteCalculated()); - } - return val; } @@ -1040,10 +1027,6 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso case R.id.map_show_point_options: contextMenuPoint(mapView.getLatitude(), mapView.getLongitude()); return true; - case R.id.map_animate_route: - //animate moving on route - routeAnimation.startStopRouteAnimation(routingHelper, this); - return true; default: return super.onOptionsItemSelected(item); } diff --git a/OsmAnd/src/net/osmand/plus/voice/CommandPlayerFactory.java b/OsmAnd/src/net/osmand/plus/voice/CommandPlayerFactory.java index bf062e5f45..2b3bd1078b 100644 --- a/OsmAnd/src/net/osmand/plus/voice/CommandPlayerFactory.java +++ b/OsmAnd/src/net/osmand/plus/voice/CommandPlayerFactory.java @@ -7,6 +7,7 @@ import net.osmand.plus.R; import net.osmand.plus.ResourceManager; import net.osmand.plus.activities.OsmandApplication; import android.app.Activity; +import android.os.Build; public class CommandPlayerFactory { @@ -21,8 +22,10 @@ public class CommandPlayerFactory } if (MediaCommandPlayerImpl.isMyData(voiceDir)) { return new MediaCommandPlayerImpl(osmandApplication, voiceProvider); - } else if (TTSCommandPlayerImpl.isMyData(voiceDir)) { - return new TTSCommandPlayerImpl(ctx, voiceProvider); + } else if (Integer.parseInt(Build.VERSION.SDK) >= 4) { + if (TTSCommandPlayerImpl.isMyData(voiceDir)) { + return new TTSCommandPlayerImpl(ctx, voiceProvider); + } } throw new CommandPlayerException(ctx.getString(R.string.voice_data_not_supported)); } diff --git a/OsmAnd/src/net/osmand/plus/voice/TTSCommandPlayerImpl.java b/OsmAnd/src/net/osmand/plus/voice/TTSCommandPlayerImpl.java index 577bd2ad84..cdffab5305 100644 --- a/OsmAnd/src/net/osmand/plus/voice/TTSCommandPlayerImpl.java +++ b/OsmAnd/src/net/osmand/plus/voice/TTSCommandPlayerImpl.java @@ -6,6 +6,7 @@ import java.util.Locale; import net.osmand.Algoritms; import net.osmand.plus.R; +import net.osmand.plus.activities.SettingsActivity; import alice.tuprolog.Struct; import alice.tuprolog.Term; import android.app.Activity; @@ -112,16 +113,19 @@ public class TTSCommandPlayerImpl extends AbstractPrologCommandPlayer { mTts.setLanguage(new Locale(language)); break; case TextToSpeech.LANG_NOT_SUPPORTED: - internalClear(); - builder = createAlertDialog( - R.string.tts_language_not_supported_title, - R.string.tts_language_not_supported, - new IntentStarter( - ctx, - Intent.ACTION_VIEW, Uri.parse("market://search?q=text to speech engine" - )), - ctx); - builder.show(); + //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( + R.string.tts_language_not_supported_title, + R.string.tts_language_not_supported, + new IntentStarter( + ctx, + Intent.ACTION_VIEW, Uri.parse("market://search?q=text to speech engine" + )), + ctx); + builder.show(); + } break; } }