diff --git a/OsmAnd/res/layout/fragment_import_complete.xml b/OsmAnd/res/layout/fragment_import_complete.xml
index 6e9a5fa22b..e9d6180784 100644
--- a/OsmAnd/res/layout/fragment_import_complete.xml
+++ b/OsmAnd/res/layout/fragment_import_complete.xml
@@ -66,28 +66,64 @@
-
+ android:orientation="horizontal" >
-
+ android:background="?attr/dlg_btn_secondary"
+ android:layout_weight="1">
-
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index 6b0805f1ba..a706cf4b6b 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -12,6 +12,7 @@
-->
+ Restart
Routing could avoid strong uphills
Don\'t rotate map view if speed is less than a threshold
Current location icon will be snapped to the current navigation route
diff --git a/OsmAnd/src/net/osmand/plus/AppInitializer.java b/OsmAnd/src/net/osmand/plus/AppInitializer.java
index 065c7aba2e..819590a516 100644
--- a/OsmAnd/src/net/osmand/plus/AppInitializer.java
+++ b/OsmAnd/src/net/osmand/plus/AppInitializer.java
@@ -514,7 +514,7 @@ public class AppInitializer implements IProgress {
return null;
}
});
- app.regions.setLocale(app.getLanguage(), app.getCountry());
+ app.regions.setLocale(app.getLanguage(), app.getLocaleHelper().getCountry());
}
diff --git a/OsmAnd/src/net/osmand/plus/CustomOsmandPlugin.java b/OsmAnd/src/net/osmand/plus/CustomOsmandPlugin.java
index 9f3003e925..8c8a1dafa0 100644
--- a/OsmAnd/src/net/osmand/plus/CustomOsmandPlugin.java
+++ b/OsmAnd/src/net/osmand/plus/CustomOsmandPlugin.java
@@ -237,7 +237,7 @@ public class CustomOsmandPlugin extends OsmandPlugin {
final SettingsHelper.SettingsImportListener importListener = new SettingsHelper.SettingsImportListener() {
@Override
- public void onSettingsImportFinished(boolean succeed, @NonNull List items) {
+ public void onSettingsImportFinished(boolean succeed, boolean needRestart, @NonNull List items) {
if (AndroidUtils.isActivityNotDestroyed(activity)) {
progress.dismiss();
}
diff --git a/OsmAnd/src/net/osmand/plus/OsmandApplication.java b/OsmAnd/src/net/osmand/plus/OsmandApplication.java
index 9d2524d30c..165a9a9c07 100644
--- a/OsmAnd/src/net/osmand/plus/OsmandApplication.java
+++ b/OsmAnd/src/net/osmand/plus/OsmandApplication.java
@@ -59,6 +59,7 @@ import net.osmand.plus.download.DownloadService;
import net.osmand.plus.download.IndexItem;
import net.osmand.plus.helpers.AvoidSpecificRoads;
import net.osmand.plus.helpers.DayNightHelper;
+import net.osmand.plus.helpers.LocaleHelper;
import net.osmand.plus.helpers.LocationServiceHelper;
import net.osmand.plus.helpers.LockHelper;
import net.osmand.plus.helpers.WaypointHelper;
@@ -126,6 +127,7 @@ public class OsmandApplication extends MultiDexApplication {
private final SQLiteAPI sqliteAPI = new SQLiteAPIImpl(this);
private final OsmAndTaskManager taskManager = new OsmAndTaskManager(this);
private final UiUtilities iconsCache = new UiUtilities(this);
+ private final LocaleHelper localeHelper = new LocaleHelper(this);
// start variables
ResourceManager resourceManager;
@@ -166,10 +168,7 @@ public class OsmandApplication extends MultiDexApplication {
MeasurementEditingContext measurementEditingContext;
OnlineRoutingHelper onlineRoutingHelper;
- private Resources localizedResources;
private Map customRoutingConfigs = new ConcurrentHashMap<>();
- private Locale preferredLocale;
- private Locale defaultLocale;
private File externalStorageDirectory;
private boolean externalStorageDirectoryReadOnly;
@@ -218,7 +217,7 @@ public class OsmandApplication extends MultiDexApplication {
removeSqliteDbTravelFiles();
}
- checkPreferredLocale();
+ localeHelper.checkPreferredLocale();
appInitializer.onCreateApplication();
// if(!osmandSettings.FOLLOW_THE_ROUTE.get()) {
// targetPointsHelper.clearPointToNavigate(false);
@@ -402,6 +401,10 @@ public class OsmandApplication extends MultiDexApplication {
return oprAuthHelper;
}
+ public LocaleHelper getLocaleHelper() {
+ return localeHelper;
+ }
+
public synchronized DownloadIndexesThread getDownloadThread() {
if (downloadIndexesThread == null) {
downloadIndexesThread = new DownloadIndexesThread(this);
@@ -416,7 +419,8 @@ public class OsmandApplication extends MultiDexApplication {
}
@Override
- public void onConfigurationChanged(Configuration newConfig) {
+ public void onConfigurationChanged(@NonNull Configuration newConfig) {
+ Locale preferredLocale = localeHelper.getPreferredLocale();
if (preferredLocale != null && !newConfig.locale.getLanguage().equals(preferredLocale.getLanguage())) {
super.onConfigurationChanged(newConfig);
// ugly fix ! On devices after 4.0 screen is blinking when you rotate device!
@@ -430,53 +434,10 @@ public class OsmandApplication extends MultiDexApplication {
}
}
-
- public void checkPreferredLocale() {
- Configuration config = getBaseContext().getResources().getConfiguration();
-
- String pl = osmandSettings.PREFERRED_LOCALE.get();
- String[] split = pl.split("_");
- String lang = split[0];
- String country = (split.length > 1) ? split[1] : "";
-
- if (defaultLocale == null) {
- defaultLocale = Locale.getDefault();
- }
- if (!Algorithms.isEmpty(lang)) {
- if (!Algorithms.isEmpty(country)) {
- preferredLocale = new Locale(lang, country);
- } else {
- preferredLocale = new Locale(lang);
- }
- }
- Locale selectedLocale = null;
-
- if (!Algorithms.isEmpty(lang) && !config.locale.equals(preferredLocale)) {
- selectedLocale = preferredLocale;
- } else if (Algorithms.isEmpty(lang) && defaultLocale != null && Locale.getDefault() != defaultLocale) {
- selectedLocale = defaultLocale;
- preferredLocale = null;
- }
- if (selectedLocale != null) {
- Locale.setDefault(selectedLocale);
- config.locale = selectedLocale;
- config.setLayoutDirection(selectedLocale);
-
- getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());
- if (android.os.Build.VERSION.SDK_INT >= 17) {
- Configuration conf = new Configuration(config);
- conf.locale = selectedLocale;
- localizedResources = createConfigurationContext(conf).getResources();
- }
- }
- }
-
- public static final int PROGRESS_DIALOG = 5;
-
public void checkApplicationIsBeingInitialized(Activity activity, AppInitializeListener listener) {
// start application if it was previously closed
startApplication();
- if(listener != null) {
+ if (listener != null) {
appInitializer.addListener(listener);
}
}
@@ -717,7 +678,6 @@ public class OsmandApplication extends MultiDexApplication {
}
}
-
public TargetPointsHelper getTargetPointsHelper() {
return targetPointsHelper;
}
@@ -823,7 +783,7 @@ public class OsmandApplication extends MultiDexApplication {
themeResId = R.style.OsmandLightTheme;
}
}
- setLanguage(c);
+ localeHelper.setLanguage(c);
c.setTheme(themeResId);
}
@@ -850,53 +810,18 @@ public class OsmandApplication extends MultiDexApplication {
return s;
}
- public void setLanguage(Context context) {
- if (preferredLocale != null) {
- Configuration config = context.getResources().getConfiguration();
- String lang = preferredLocale.getLanguage();
- if (!Algorithms.isEmpty(lang) && !config.locale.getLanguage().equals(lang)) {
- preferredLocale = new Locale(lang);
- Locale.setDefault(preferredLocale);
- config.locale = preferredLocale;
- context.getResources().updateConfiguration(config, context.getResources().getDisplayMetrics());
- } else if (Algorithms.isEmpty(lang) && defaultLocale != null && Locale.getDefault() != defaultLocale) {
- Locale.setDefault(defaultLocale);
- config.locale = defaultLocale;
- getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());
- }
- }
- }
-
- public String getCountry() {
- String country;
- if (preferredLocale != null) {
- country = preferredLocale.getCountry();
- } else {
- country = Locale.getDefault().getCountry();
- }
- return country;
- }
-
public String getLanguage() {
- String lang;
- if (preferredLocale != null) {
- lang = preferredLocale.getLanguage();
- } else {
- lang = Locale.getDefault().getLanguage();
- }
- if (lang != null && lang.length() > 3) {
- lang = lang.substring(0, 2).toLowerCase();
- }
- return lang;
+ return localeHelper.getLanguage();
}
@Override
public AssetManager getAssets() {
- return localizedResources != null ? localizedResources.getAssets() : super.getAssets();
+ return getResources() != null ? getResources().getAssets() : super.getAssets();
}
@Override
public Resources getResources() {
+ Resources localizedResources = localeHelper.getLocalizedResources();
return localizedResources != null ? localizedResources : super.getResources();
}
diff --git a/OsmAnd/src/net/osmand/plus/helpers/LocaleHelper.java b/OsmAnd/src/net/osmand/plus/helpers/LocaleHelper.java
new file mode 100644
index 0000000000..bdacd02c62
--- /dev/null
+++ b/OsmAnd/src/net/osmand/plus/helpers/LocaleHelper.java
@@ -0,0 +1,118 @@
+package net.osmand.plus.helpers;
+
+import android.content.Context;
+import android.content.res.Configuration;
+import android.content.res.Resources;
+
+import net.osmand.StateChangedListener;
+import net.osmand.plus.OsmandApplication;
+import net.osmand.util.Algorithms;
+
+import java.util.Locale;
+
+public class LocaleHelper {
+
+ private final OsmandApplication app;
+
+ private Locale defaultLocale;
+ private Locale preferredLocale;
+ private Resources localizedResources;
+
+ public LocaleHelper(OsmandApplication app) {
+ this.app = app;
+ }
+
+ public void checkPreferredLocale() {
+ Configuration config = app.getBaseContext().getResources().getConfiguration();
+
+ String pl = app.getSettings().PREFERRED_LOCALE.get();
+ String[] split = pl.split("_");
+ String lang = split[0];
+ String country = (split.length > 1) ? split[1] : "";
+
+ if (defaultLocale == null) {
+ defaultLocale = Locale.getDefault();
+ }
+ if (!Algorithms.isEmpty(lang)) {
+ if (!Algorithms.isEmpty(country)) {
+ preferredLocale = new Locale(lang, country);
+ } else {
+ preferredLocale = new Locale(lang);
+ }
+ }
+ Locale selectedLocale = null;
+
+ if (!Algorithms.isEmpty(lang) && !config.locale.equals(preferredLocale)) {
+ selectedLocale = preferredLocale;
+ } else if (Algorithms.isEmpty(lang) && defaultLocale != null && Locale.getDefault() != defaultLocale) {
+ selectedLocale = defaultLocale;
+ preferredLocale = null;
+ }
+ if (selectedLocale != null) {
+ Locale.setDefault(selectedLocale);
+ config.locale = selectedLocale;
+ config.setLayoutDirection(selectedLocale);
+
+ Resources resources = app.getBaseContext().getResources();
+ resources.updateConfiguration(config, resources.getDisplayMetrics());
+ if (android.os.Build.VERSION.SDK_INT >= 17) {
+ Configuration conf = new Configuration(config);
+ conf.locale = selectedLocale;
+ localizedResources = app.createConfigurationContext(conf).getResources();
+ }
+ }
+ }
+
+ public void setLanguage(Context context) {
+ if (preferredLocale != null) {
+ Configuration config = context.getResources().getConfiguration();
+ String lang = preferredLocale.getLanguage();
+ if (!Algorithms.isEmpty(lang) && !config.locale.getLanguage().equals(lang)) {
+ preferredLocale = new Locale(lang);
+ Locale.setDefault(preferredLocale);
+ config.locale = preferredLocale;
+ context.getResources().updateConfiguration(config, context.getResources().getDisplayMetrics());
+ } else if (Algorithms.isEmpty(lang) && defaultLocale != null && Locale.getDefault() != defaultLocale) {
+ Locale.setDefault(defaultLocale);
+ config.locale = defaultLocale;
+ Resources resources = app.getBaseContext().getResources();
+ resources.updateConfiguration(config, resources.getDisplayMetrics());
+ }
+ }
+ }
+
+ public Resources getLocalizedResources() {
+ return localizedResources;
+ }
+
+ public Locale getPreferredLocale() {
+ return preferredLocale;
+ }
+
+ public Locale getDefaultLocale() {
+ return defaultLocale;
+ }
+
+ public String getCountry() {
+ String country;
+ if (preferredLocale != null) {
+ country = preferredLocale.getCountry();
+ } else {
+ country = Locale.getDefault().getCountry();
+ }
+ return country;
+ }
+
+ public String getLanguage() {
+ String lang;
+ if (preferredLocale != null) {
+ lang = preferredLocale.getLanguage();
+ } else {
+ lang = Locale.getDefault().getLanguage();
+ }
+ if (lang != null && lang.length() > 3) {
+ lang = lang.substring(0, 2).toLowerCase();
+ }
+ return lang;
+ }
+}
\ No newline at end of file
diff --git a/OsmAnd/src/net/osmand/plus/importfiles/SettingsImportTask.java b/OsmAnd/src/net/osmand/plus/importfiles/SettingsImportTask.java
index 1f886a23bb..a80ed45126 100644
--- a/OsmAnd/src/net/osmand/plus/importfiles/SettingsImportTask.java
+++ b/OsmAnd/src/net/osmand/plus/importfiles/SettingsImportTask.java
@@ -134,7 +134,7 @@ class SettingsImportTask extends BaseLoadAsyncTask {
private SettingsImportListener getImportListener(final File file) {
return new SettingsImportListener() {
@Override
- public void onSettingsImportFinished(boolean succeed, @NonNull List items) {
+ public void onSettingsImportFinished(boolean succeed, boolean needRestart, @NonNull List items) {
if (succeed) {
app.getRendererRegistry().updateExternalRenderers();
app.getPoiFilters().loadSelectedPoiFilters();
@@ -150,7 +150,7 @@ class SettingsImportTask extends BaseLoadAsyncTask {
}
if (!silentImport && file != null && activity != null) {
FragmentManager fm = activity.getSupportFragmentManager();
- ImportCompleteFragment.showInstance(fm, items, file.getName());
+ ImportCompleteFragment.showInstance(fm, items, file.getName(), needRestart);
}
}
}
@@ -174,7 +174,7 @@ class SettingsImportTask extends BaseLoadAsyncTask {
final SettingsImportListener importListener = new SettingsImportListener() {
@Override
- public void onSettingsImportFinished(boolean succeed, @NonNull List items) {
+ public void onSettingsImportFinished(boolean succeed, boolean needRestart, @NonNull List items) {
FragmentActivity activity = activityRef.get();
if (progress != null && AndroidUtils.isActivityNotDestroyed(activity)) {
progress.dismiss();
diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java
index 11fe377040..4204fded0b 100644
--- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java
+++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java
@@ -11,6 +11,7 @@ import net.osmand.Collator;
import net.osmand.IndexConstants;
import net.osmand.OsmAndCollator;
import net.osmand.PlatformUtil;
+import net.osmand.StateChangedListener;
import net.osmand.data.LatLon;
import net.osmand.map.ITileSource;
import net.osmand.map.TileSourceManager;
@@ -29,6 +30,7 @@ import net.osmand.plus.helpers.AvoidSpecificRoads.AvoidRoadInfo;
import net.osmand.plus.helpers.FileNameTranslationHelper;
import net.osmand.plus.helpers.GpxUiHelper;
import net.osmand.plus.helpers.GpxUiHelper.GPXInfo;
+import net.osmand.plus.helpers.LocaleHelper;
import net.osmand.plus.helpers.SearchHistoryHelper;
import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry;
import net.osmand.plus.mapmarkers.MapMarker;
@@ -110,7 +112,7 @@ public class SettingsHelper {
private Map exportAsyncTasks = new HashMap<>();
public interface SettingsImportListener {
- void onSettingsImportFinished(boolean succeed, @NonNull List items);
+ void onSettingsImportFinished(boolean succeed, boolean needRestart, @NonNull List items);
}
public interface SettingsCollectListener {
@@ -172,7 +174,7 @@ public class SettingsHelper {
}
}
- private void finishImport(@Nullable SettingsImportListener listener, boolean success, @NonNull List items) {
+ private void finishImport(@Nullable SettingsImportListener listener, boolean success, @NonNull List items, boolean needRestart) {
importTask = null;
List warnings = new ArrayList<>();
for (SettingsItem item : items) {
@@ -182,17 +184,19 @@ public class SettingsHelper {
app.showToastMessage(AndroidUtils.formatWarnings(warnings).toString());
}
if (listener != null) {
- listener.onSettingsImportFinished(success, items);
+ listener.onSettingsImportFinished(success, needRestart, items);
}
}
@SuppressLint("StaticFieldLeak")
private class ImportItemsAsyncTask extends AsyncTask {
- private SettingsImporter importer;
- private File file;
- private SettingsImportListener listener;
- private List items;
+ private final SettingsImporter importer;
+ private final File file;
+ private final SettingsImportListener listener;
+ private final List items;
+ private final StateChangedListener localeListener;
+ private boolean needRestart = false;
ImportItemsAsyncTask(@NonNull File file,
@Nullable SettingsImportListener listener,
@@ -201,6 +205,17 @@ public class SettingsHelper {
this.file = file;
this.listener = listener;
this.items = items;
+ localeListener = new StateChangedListener() {
+ @Override
+ public void stateChanged(String change) {
+ needRestart = true;
+ }
+ };
+ }
+
+ @Override
+ protected void onPreExecute() {
+ app.getSettings().PREFERRED_LOCALE.addListener(localeListener);
}
@Override
@@ -218,7 +233,8 @@ public class SettingsHelper {
@Override
protected void onPostExecute(Boolean success) {
- finishImport(listener, success, items);
+ app.getSettings().PREFERRED_LOCALE.removeListener(localeListener);
+ finishImport(listener, success, items, needRestart);
}
}
@@ -339,7 +355,7 @@ public class SettingsHelper {
protected void onPreExecute() {
ImportAsyncTask importTask = SettingsHelper.this.importTask;
if (importTask != null && !importTask.importDone) {
- finishImport(importListener, false, items);
+ finishImport(importListener, false, items, false);
}
SettingsHelper.this.importTask = this;
}
diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ConfigureProfileFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ConfigureProfileFragment.java
index cea9b0e17c..e421a981b9 100644
--- a/OsmAnd/src/net/osmand/plus/settings/fragments/ConfigureProfileFragment.java
+++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ConfigureProfileFragment.java
@@ -202,7 +202,7 @@ public class ConfigureProfileFragment extends BaseSettingsFragment implements Co
private void importBackupSettingsItems(File file, List items) {
app.getSettingsHelper().importSettings(file, items, "", 1, new SettingsHelper.SettingsImportListener() {
@Override
- public void onSettingsImportFinished(boolean succeed, @NonNull List items) {
+ public void onSettingsImportFinished(boolean succeed, boolean needRestart, @NonNull List items) {
app.showToastMessage(R.string.profile_prefs_reset_successful);
updateCopiedOrResetPrefs();
}
diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/GlobalSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/GlobalSettingsFragment.java
index 071d7be709..8114874547 100644
--- a/OsmAnd/src/net/osmand/plus/settings/fragments/GlobalSettingsFragment.java
+++ b/OsmAnd/src/net/osmand/plus/settings/fragments/GlobalSettingsFragment.java
@@ -108,7 +108,7 @@ public class GlobalSettingsFragment extends BaseSettingsFragment
Activity activity = getActivity();
OsmandApplication app = getMyApplication();
if (app != null && activity != null) {
- app.checkPreferredLocale();
+ app.getLocaleHelper().checkPreferredLocale();
app.restartApp(activity);
}
} else if (prefId.equals(settings.SPEED_CAMERAS_UNINSTALLED.getId())) {
diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportCompleteFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportCompleteFragment.java
index 0d40a3c2f1..abcd5afc0a 100644
--- a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportCompleteFragment.java
+++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportCompleteFragment.java
@@ -15,6 +15,7 @@ import android.widget.TextView;
import androidx.activity.OnBackPressedCallback;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@@ -28,6 +29,7 @@ import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
import net.osmand.plus.base.BaseOsmAndFragment;
import net.osmand.plus.dashboard.DashboardOnMap;
import net.osmand.plus.dialogs.SelectMapStyleBottomSheetDialogFragment;
+import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.myplaces.FavoritesActivity;
import net.osmand.plus.osmedit.OsmEditingPlugin;
import net.osmand.plus.quickaction.QuickActionListFragment;
@@ -50,14 +52,16 @@ public class ImportCompleteFragment extends BaseOsmAndFragment {
private RecyclerView recyclerView;
private List settingsItems;
private String fileName;
+ private boolean needRestart;
private boolean nightMode;
public static void showInstance(FragmentManager fm, @NonNull List settingsItems,
- @NonNull String fileName) {
+ @NonNull String fileName, boolean needRestart) {
ImportCompleteFragment fragment = new ImportCompleteFragment();
fragment.setSettingsItems(settingsItems);
fragment.setFileName(fileName);
fragment.setRetainInstance(true);
+ fragment.setNeedRestart(needRestart);
fm.beginTransaction()
.replace(R.id.fragmentContainer, fragment, TAG)
.addToBackStack(SETTINGS_LIST_TAG)
@@ -97,6 +101,9 @@ public class ImportCompleteFragment extends BaseOsmAndFragment {
dismissFragment();
}
});
+ if (needRestart) {
+ setupRestartButton(root);
+ }
if (Build.VERSION.SDK_INT >= 21) {
AndroidUtils.addStatusBarPadding21v(app, root);
}
@@ -239,6 +246,25 @@ public class ImportCompleteFragment extends BaseOsmAndFragment {
}
}
+ private void setupRestartButton(View root) {
+ View buttonsDivider = root.findViewById(R.id.buttons_divider);
+ View buttonContainer = root.findViewById(R.id.button_restart_container);
+ AndroidUiHelper.setVisibility(View.VISIBLE, buttonsDivider, buttonContainer);
+
+ TextView btnRestart = root.findViewById(R.id.button_restart);
+ btnRestart.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ FragmentActivity activity = getActivity();
+ if (activity instanceof MapActivity) {
+ MapActivity.doRestart(activity);
+ } else {
+ android.os.Process.killProcess(android.os.Process.myPid());
+ }
+ }
+ });
+ }
+
@Override
public int getStatusBarColorId() {
return nightMode ? R.color.status_bar_color_dark : R.color.status_bar_color_light;
@@ -251,4 +277,8 @@ public class ImportCompleteFragment extends BaseOsmAndFragment {
public void setFileName(String fileName) {
this.fileName = fileName;
}
+
+ public void setNeedRestart(boolean needRestart) {
+ this.needRestart = needRestart;
+ }
}
diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportSettingsFragment.java
index b614bc57dd..3cae444157 100644
--- a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportSettingsFragment.java
+++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportSettingsFragment.java
@@ -155,7 +155,7 @@ public class ImportSettingsFragment extends BaseSettingsListFragment {
public SettingsHelper.SettingsImportListener getImportListener() {
return new SettingsHelper.SettingsImportListener() {
@Override
- public void onSettingsImportFinished(boolean succeed, @NonNull List items) {
+ public void onSettingsImportFinished(boolean succeed, boolean needRestart, @NonNull List items) {
if (succeed) {
app.getRendererRegistry().updateExternalRenderers();
AppInitializer.loadRoutingFiles(app, null);
@@ -166,7 +166,7 @@ public class ImportSettingsFragment extends BaseSettingsListFragment {
}
FragmentManager fm = getFragmentManager();
if (fm != null && file != null) {
- ImportCompleteFragment.showInstance(fm, items, file.getName());
+ ImportCompleteFragment.showInstance(fm, items, file.getName(), needRestart);
}
}
}
diff --git a/OsmAnd/src/net/osmand/plus/widgets/WebViewEx.java b/OsmAnd/src/net/osmand/plus/widgets/WebViewEx.java
index c83e1110cb..747e1bff57 100644
--- a/OsmAnd/src/net/osmand/plus/widgets/WebViewEx.java
+++ b/OsmAnd/src/net/osmand/plus/widgets/WebViewEx.java
@@ -40,7 +40,7 @@ public class WebViewEx extends WebView {
// also see: https://gist.github.com/amake/0ac7724681ac1c178c6f95a5b09f03ce
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
OsmandApplication app = (OsmandApplication) ctx.getApplicationContext();
- app.checkPreferredLocale();
+ app.getLocaleHelper().checkPreferredLocale();
ctx.getResources().updateConfiguration(
new Configuration(app.getResources().getConfiguration()),
ctx.getResources().getDisplayMetrics());
diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/WikivoyageExploreActivity.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/WikivoyageExploreActivity.java
index bc4de7d575..29add9c1a7 100644
--- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/WikivoyageExploreActivity.java
+++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/WikivoyageExploreActivity.java
@@ -71,7 +71,7 @@ public class WikivoyageExploreActivity extends TabActivity implements DownloadEv
nightMode = !settings.isLightContent();
int themeId = nightMode ? R.style.OsmandDarkTheme_NoActionbar : R.style.OsmandLightTheme_NoActionbar_LightStatusBar;
- app.setLanguage(this);
+ app.getLocaleHelper().setLanguage(this);
setTheme(themeId);
super.onCreate(savedInstanceState);