diff --git a/OsmAnd/res/layout/dash_storage_type_fragment.xml b/OsmAnd/res/layout/dash_storage_type_fragment.xml index 1beeca58f0..d435152e80 100644 --- a/OsmAnd/res/layout/dash_storage_type_fragment.xml +++ b/OsmAnd/res/layout/dash_storage_type_fragment.xml @@ -112,7 +112,7 @@ android:gravity="center" android:paddingLeft="5dp" android:paddingRight="5dp" - android:text="@string/shared_string_ok" + android:text="@string/shared_string_continue" osmand:textAllCapsCompat="true" osmand:typeface="@string/font_roboto_medium"/> diff --git a/OsmAnd/src/net/osmand/plus/OsmandApplication.java b/OsmAnd/src/net/osmand/plus/OsmandApplication.java index 1493509df8..1203adafe8 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandApplication.java +++ b/OsmAnd/src/net/osmand/plus/OsmandApplication.java @@ -7,6 +7,7 @@ import android.app.PendingIntent; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; +import android.content.DialogInterface.OnClickListener; import android.content.pm.PackageInfo; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Configuration; @@ -989,4 +990,17 @@ public class OsmandApplication extends MultiDexApplication { } return defaultValue; } + + public void restartApp(Context ctx) { + AlertDialog.Builder bld = new AlertDialog.Builder(ctx); + bld.setMessage(R.string.restart_is_required); + bld.setPositiveButton(R.string.shared_string_ok, new OnClickListener() { + + @Override + public void onClick(DialogInterface dialog, int which) { + android.os.Process.killProcess(android.os.Process.myPid()); + } + }); + bld.show(); + } } diff --git a/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java b/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java index 1f3d959b1d..9fc8c3867e 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java @@ -535,13 +535,13 @@ public class SettingsGeneralActivity extends SettingsBaseActivity implements OnR } else if (id.equals(settings.PREFERRED_LOCALE.getId())) { // restart application to update locale getMyApplication().checkPreferredLocale(); - restartApp(); + getMyApplication().restartApp(this); } else if (id.equals(settings.OSMAND_THEME.getId())) { - restartApp(); + getMyApplication().restartApp(this); } else if (id.equals(settings.METRIC_SYSTEM.getId())) { settings.METRIC_SYSTEM_CHANGED_MANUALLY.set(true); } else if (id.equals(settings.DO_NOT_USE_ANIMATIONS.getId())) { - restartApp(); + getMyApplication().restartApp(this); } else { updateAllSettings(); } @@ -549,21 +549,7 @@ public class SettingsGeneralActivity extends SettingsBaseActivity implements OnR } - private void restartApp() { - AlertDialog.Builder bld = new AlertDialog.Builder(this); - bld.setMessage(R.string.restart_is_required); - bld.setPositiveButton(R.string.shared_string_ok, new OnClickListener() { - - @Override - public void onClick(DialogInterface dialog, int which) { - android.os.Process.killProcess(android.os.Process.myPid()); -// Intent intent = getIntent(); -// finish(); -// startActivity(intent); - } - }); - bld.show(); - } + private void warnAboutChangingStorage(final String newValue) { diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashChooseAppDirFragment.java b/OsmAnd/src/net/osmand/plus/dashboard/DashChooseAppDirFragment.java index faed84088e..c34a4988e6 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/DashChooseAppDirFragment.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashChooseAppDirFragment.java @@ -319,7 +319,7 @@ public class DashChooseAppDirFragment { }); copyMapsBtn.setOnClickListener(new View.OnClickListener() { @Override - public void onClick(View v) { + public void onClick(final View v) { MoveFilesToDifferentDirectory task = new MoveFilesToDifferentDirectory(activity, currentAppFile, selectedFile) { @@ -329,11 +329,14 @@ public class DashChooseAppDirFragment { if (result) { mapsCopied = true; getMyApplication().getResourceManager().resetStoreDirectory(); + // immediately proceed with change (to not loose where maps are currently located) + getConfirmListener().onClick(v); } else { Toast.makeText(activity, R.string.copying_osmand_file_failed, Toast.LENGTH_SHORT).show(); + updateView(); } - updateView(); + } }; task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); @@ -360,10 +363,12 @@ public class DashChooseAppDirFragment { ((FragmentActivity) activity).getSupportFragmentManager().beginTransaction() .remove(fragment).commit(); } + getMyApplication().restartApp(activity); } else { Toast.makeText(activity, R.string.specified_directiory_not_writeable, Toast.LENGTH_LONG).show(); } + if(dlg != null) { dlg.dismiss(); }