Fix #4006. Suggest to restart
This commit is contained in:
parent
263c2d62c8
commit
90608ee7df
4 changed files with 26 additions and 21 deletions
|
@ -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"/>
|
||||
</LinearLayout>
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue