Make the code executable on 1.5 platform. Ask some dialogs only when

making changes from SettingsActivity. Small update of the texts.
This commit is contained in:
Pavol Zibrita 2011-06-21 22:27:56 +02:00
parent 3d0690e9a7
commit c991459679
5 changed files with 23 additions and 34 deletions

View file

@ -3,7 +3,7 @@
package="net.osmand.plus" android:installLocation="auto" android:versionName="0.6.5" android:versionCode="34"> package="net.osmand.plus" android:installLocation="auto" android:versionName="0.6.5" android:versionCode="34">
<application android:icon="@drawable/icon" android:label="@string/app_name" <application android:icon="@drawable/icon" android:label="@string/app_name"
android:debuggable="true" android:name=".activities.OsmandApplication" android:description="@string/app_description"> android:debuggable="true" android:name=".activities.OsmandApplication" android:description="@string/app_description">
<activity android:name=".activities.MainMenuActivity" android:screenOrientation="nosensor" <activity android:name=".activities.MainMenuActivity"
android:label="@string/app_name"> android:label="@string/app_name">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
@ -49,7 +49,6 @@
<intent-filter><action android:name="net.osmand.plus.NavigationService"></action></intent-filter> <intent-filter><action android:name="net.osmand.plus.NavigationService"></action></intent-filter>
</service> </service>
<receiver android:name=".OnNavigationServiceAlarmReceiver"/> <receiver android:name=".OnNavigationServiceAlarmReceiver"/>
<activity android:name=".activities.InitTTSActivity"></activity>
</application> </application>

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?> <?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources> <resources>
<string name="tts_language_not_supported_title">Language unsupported</string> <string name="tts_language_not_supported_title">Language unsupported</string>
<string name="tts_language_not_supported">The selected language is not supported by the installed TTS engine. Do you want to go to market and search for other TTS engine?</string> <string name="tts_language_not_supported">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.</string>
<string name="tts_missing_language_data_title">Missing data</string> <string name="tts_missing_language_data_title">Missing data</string>
<string name="tts_missing_language_data">Data for selected language are not installed. Do you want to go market to install them?</string> <string name="tts_missing_language_data">Data for selected language are not installed. Do you want to go market to install them?</string>

View file

@ -6,6 +6,7 @@ import java.util.List;
import net.osmand.Algoritms; import net.osmand.Algoritms;
import net.osmand.CallbackWithObject; import net.osmand.CallbackWithObject;
import net.osmand.GPXUtilities.GPXFileResult;
import net.osmand.LogUtil; import net.osmand.LogUtil;
import net.osmand.Version; import net.osmand.Version;
import net.osmand.data.MapTileDownloader; import net.osmand.data.MapTileDownloader;
@ -35,8 +36,8 @@ import android.app.ProgressDialog;
import android.content.ActivityNotFoundException; import android.content.ActivityNotFoundException;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent;
import android.content.DialogInterface.OnMultiChoiceClickListener; import android.content.DialogInterface.OnMultiChoiceClickListener;
import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo; import android.content.pm.ResolveInfo;
import android.graphics.Color; import android.graphics.Color;
@ -58,7 +59,6 @@ import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.os.PowerManager; import android.os.PowerManager;
import android.os.PowerManager.WakeLock; import android.os.PowerManager.WakeLock;
import android.provider.Settings.Secure;
import android.util.Log; import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.Menu; import android.view.Menu;
@ -128,8 +128,6 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
// Store previous map rotation settings for rotate button // Store previous map rotation settings for rotate button
private Integer previousMapRotate = null; private Integer previousMapRotate = null;
private RouteAnimation routeAnimation = new RouteAnimation();
private boolean isMapLinkedToLocation = false; private boolean isMapLinkedToLocation = false;
private boolean isMapLinkedToLocation(){ private boolean isMapLinkedToLocation(){
@ -421,7 +419,6 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
protected void onDestroy() { protected void onDestroy() {
super.onDestroy(); super.onDestroy();
savingTrackHelper.close(); savingTrackHelper.close();
routeAnimation.close();
if(mNotificationManager != null){ if(mNotificationManager != null){
mNotificationManager.cancel(APP_NOTIFICATION_ID); mNotificationManager.cancel(APP_NOTIFICATION_ID);
} }
@ -951,16 +948,6 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
muteMenu.setVisible(false); 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; return val;
} }
@ -1040,10 +1027,6 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
case R.id.map_show_point_options: case R.id.map_show_point_options:
contextMenuPoint(mapView.getLatitude(), mapView.getLongitude()); contextMenuPoint(mapView.getLatitude(), mapView.getLongitude());
return true; return true;
case R.id.map_animate_route:
//animate moving on route
routeAnimation.startStopRouteAnimation(routingHelper, this);
return true;
default: default:
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }

View file

@ -7,6 +7,7 @@ import net.osmand.plus.R;
import net.osmand.plus.ResourceManager; import net.osmand.plus.ResourceManager;
import net.osmand.plus.activities.OsmandApplication; import net.osmand.plus.activities.OsmandApplication;
import android.app.Activity; import android.app.Activity;
import android.os.Build;
public class CommandPlayerFactory public class CommandPlayerFactory
{ {
@ -21,9 +22,11 @@ public class CommandPlayerFactory
} }
if (MediaCommandPlayerImpl.isMyData(voiceDir)) { if (MediaCommandPlayerImpl.isMyData(voiceDir)) {
return new MediaCommandPlayerImpl(osmandApplication, voiceProvider); return new MediaCommandPlayerImpl(osmandApplication, voiceProvider);
} else if (TTSCommandPlayerImpl.isMyData(voiceDir)) { } else if (Integer.parseInt(Build.VERSION.SDK) >= 4) {
if (TTSCommandPlayerImpl.isMyData(voiceDir)) {
return new TTSCommandPlayerImpl(ctx, voiceProvider); return new TTSCommandPlayerImpl(ctx, voiceProvider);
} }
}
throw new CommandPlayerException(ctx.getString(R.string.voice_data_not_supported)); throw new CommandPlayerException(ctx.getString(R.string.voice_data_not_supported));
} }
return null; return null;

View file

@ -6,6 +6,7 @@ import java.util.Locale;
import net.osmand.Algoritms; import net.osmand.Algoritms;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.SettingsActivity;
import alice.tuprolog.Struct; import alice.tuprolog.Struct;
import alice.tuprolog.Term; import alice.tuprolog.Term;
import android.app.Activity; import android.app.Activity;
@ -112,7 +113,9 @@ public class TTSCommandPlayerImpl extends AbstractPrologCommandPlayer {
mTts.setLanguage(new Locale(language)); mTts.setLanguage(new Locale(language));
break; break;
case TextToSpeech.LANG_NOT_SUPPORTED: case TextToSpeech.LANG_NOT_SUPPORTED:
internalClear(); //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( 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,
@ -122,6 +125,7 @@ public class TTSCommandPlayerImpl extends AbstractPrologCommandPlayer {
)), )),
ctx); ctx);
builder.show(); builder.show();
}
break; break;
} }
} }