Fix preferences status bar color and edit poi dialogs theme
This commit is contained in:
parent
a74cd4fca6
commit
7b05d8ab1d
19 changed files with 407 additions and 57 deletions
|
@ -5,7 +5,7 @@
|
|||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/toolbar_height"
|
||||
android:background="@color/icon_color_osmand_light"
|
||||
android:background="?attr/actionModeBackground"
|
||||
app:contentInsetLeft="0dp"
|
||||
app:contentInsetStart="0dp">
|
||||
|
||||
|
|
|
@ -936,10 +936,13 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
int colorId = -1;
|
||||
BaseOsmAndFragment fragmentAboveDashboard = getVisibleBaseOsmAndFragment(R.id.fragmentContainer);
|
||||
BaseSettingsFragment settingsFragmentAboveDashboard = getVisibleBaseSettingsFragment(R.id.fragmentContainer);
|
||||
BaseOsmAndFragment fragmentBelowDashboard = getVisibleBaseOsmAndFragment(R.id.routeMenuContainer,
|
||||
R.id.topFragmentContainer, R.id.bottomFragmentContainer);
|
||||
if (fragmentAboveDashboard != null) {
|
||||
colorId = fragmentAboveDashboard.getStatusBarColorId();
|
||||
} else if (settingsFragmentAboveDashboard != null) {
|
||||
colorId = settingsFragmentAboveDashboard.getStatusBarColorId();
|
||||
} else if (dashboardOnMap.isVisible()) {
|
||||
colorId = dashboardOnMap.getStatusBarColor();
|
||||
} else if (fragmentBelowDashboard != null) {
|
||||
|
@ -989,6 +992,17 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
return null;
|
||||
}
|
||||
|
||||
private BaseSettingsFragment getVisibleBaseSettingsFragment(int... ids) {
|
||||
for (int id : ids) {
|
||||
Fragment fragment = getSupportFragmentManager().findFragmentById(id);
|
||||
if (fragment != null && !fragment.isRemoving() && fragment instanceof BaseSettingsFragment
|
||||
&& ((BaseSettingsFragment) fragment).getStatusBarColorId() != -1) {
|
||||
return (BaseSettingsFragment) fragment;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isInAppPurchaseAllowed() {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package net.osmand.plus.osmedit;
|
||||
|
||||
import static net.osmand.plus.osmedit.EditPoiDialogFragment.AMENITY_TEXT_LENGTH;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
|
@ -9,6 +8,7 @@ import android.support.annotation.Nullable;
|
|||
import android.text.Editable;
|
||||
import android.text.InputFilter;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnFocusChangeListener;
|
||||
|
@ -19,6 +19,7 @@ import android.widget.Button;
|
|||
import android.widget.ImageButton;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.osm.AbstractPoiType;
|
||||
import net.osmand.osm.MapPoiTypes;
|
||||
|
@ -28,7 +29,6 @@ import net.osmand.osm.PoiType;
|
|||
import net.osmand.osm.edit.OSMSettings;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
|
@ -39,6 +39,8 @@ import java.util.Map;
|
|||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import static net.osmand.plus.osmedit.EditPoiDialogFragment.AMENITY_TEXT_LENGTH;
|
||||
|
||||
public class AdvancedEditPoiFragment extends BaseOsmAndFragment
|
||||
implements EditPoiDialogFragment.OnFragmentActivatedListener {
|
||||
private static final String TAG = "AdvancedEditPoiFragment";
|
||||
|
@ -60,7 +62,9 @@ public class AdvancedEditPoiFragment extends BaseOsmAndFragment
|
|||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
final View view = inflater.inflate(R.layout.fragment_edit_poi_advanced, container, false);
|
||||
int themeRes = requireMyApplication().getSettings().isLightActionBar() ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme;
|
||||
Context themedContext = new ContextThemeWrapper(getContext(), themeRes);
|
||||
final View view = inflater.cloneInContext(themedContext).inflate(R.layout.fragment_edit_poi_advanced, container, false);
|
||||
|
||||
OsmandApplication app = requireMyApplication();
|
||||
deleteDrawable = app.getUIUtilities().getIcon(R.drawable.ic_action_remove_dark, app.getSettings().isLightContent());
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.osmand.plus.osmedit;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
|
@ -11,6 +12,7 @@ import android.text.InputFilter;
|
|||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.TypedValue;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -55,10 +57,12 @@ public class BasicEditPoiFragment extends BaseOsmAndFragment
|
|||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_edit_poi_normal, container, false);
|
||||
int themeRes = requireMyApplication().getSettings().isLightActionBar() ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme;
|
||||
Context themedContext = new ContextThemeWrapper(getContext(), themeRes);
|
||||
View view = inflater.cloneInContext(themedContext).inflate(R.layout.fragment_edit_poi_normal, container, false);
|
||||
|
||||
TypedValue typedValue = new TypedValue();
|
||||
Resources.Theme theme = getActivity().getTheme();
|
||||
Resources.Theme theme = themedContext.getTheme();
|
||||
theme.resolveAttribute(android.R.attr.textColorSecondary, typedValue, true);
|
||||
int iconColor = typedValue.data;
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package net.osmand.plus.settings;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
@ -10,6 +11,7 @@ import android.os.Bundle;
|
|||
import android.support.annotation.ColorInt;
|
||||
import android.support.annotation.ColorRes;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.support.annotation.IdRes;
|
||||
import android.support.annotation.LayoutRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
|
@ -35,11 +37,11 @@ import android.support.v7.widget.RecyclerView;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
|
@ -58,17 +60,14 @@ import net.osmand.plus.settings.preferences.ListPreferenceEx;
|
|||
import net.osmand.plus.settings.preferences.MultiSelectBooleanPreference;
|
||||
import net.osmand.plus.settings.preferences.SwitchPreferenceEx;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
public abstract class BaseSettingsFragment extends PreferenceFragmentCompat implements OnPreferenceChangeListener,
|
||||
OnPreferenceClickListener, AppModeChangedListener {
|
||||
|
||||
protected final Log log = PlatformUtil.getLog(this.getClass());
|
||||
|
||||
protected OsmandApplication app;
|
||||
protected OsmandSettings settings;
|
||||
protected UiUtilities iconsCache;
|
||||
|
||||
private int statusBarColor = -1;
|
||||
private int themeRes;
|
||||
private boolean nightMode;
|
||||
private boolean wasDrawerDisabled;
|
||||
|
@ -133,7 +132,6 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
|
|||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
wasDrawerDisabled = mapActivity.isDrawerDisabled();
|
||||
|
@ -141,6 +139,42 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
|
|||
mapActivity.disableDrawer();
|
||||
}
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null) {
|
||||
int colorId = getStatusBarColorId();
|
||||
if (colorId != -1) {
|
||||
if (activity instanceof MapActivity) {
|
||||
((MapActivity) activity).updateStatusBarColor();
|
||||
} else {
|
||||
statusBarColor = activity.getWindow().getStatusBarColor();
|
||||
activity.getWindow().setStatusBarColor(ContextCompat.getColor(activity, colorId));
|
||||
}
|
||||
}
|
||||
if (!isFullScreenAllowed() && activity instanceof MapActivity) {
|
||||
View view = getView();
|
||||
if (view != null) {
|
||||
ViewTreeObserver vto = view.getViewTreeObserver();
|
||||
vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
|
||||
View view = getView();
|
||||
if (view != null) {
|
||||
ViewTreeObserver obs = view.getViewTreeObserver();
|
||||
obs.removeOnGlobalLayoutListener(this);
|
||||
view.requestLayout();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
((MapActivity) activity).exitFromFullScreen();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -151,6 +185,38 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
|
|||
if (!wasDrawerDisabled && mapActivity != null) {
|
||||
mapActivity.enableDrawer();
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null) {
|
||||
if (!(activity instanceof MapActivity) && statusBarColor != -1) {
|
||||
activity.getWindow().setStatusBarColor(statusBarColor);
|
||||
}
|
||||
if (!isFullScreenAllowed() && activity instanceof MapActivity) {
|
||||
((MapActivity) activity).enterToFullScreen();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetach() {
|
||||
super.onDetach();
|
||||
if (Build.VERSION.SDK_INT >= 21 && getStatusBarColorId() != -1) {
|
||||
Activity activity = getActivity();
|
||||
if (activity instanceof MapActivity) {
|
||||
((MapActivity) activity).updateStatusBarColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ColorRes
|
||||
public int getStatusBarColorId() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected boolean isFullScreenAllowed() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -190,6 +256,8 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
|
|||
|
||||
protected abstract void setupPreferences();
|
||||
|
||||
protected abstract String getFragmentTag();
|
||||
|
||||
protected void onBindPreferenceViewHolder(Preference preference, PreferenceViewHolder holder) {
|
||||
if (preference.isSelectable()) {
|
||||
View selectableView = holder.itemView.findViewById(R.id.selectable_list_item);
|
||||
|
@ -349,18 +417,6 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
|
|||
return R.string.shared_string_settings;
|
||||
}
|
||||
|
||||
@ColorRes
|
||||
protected int getStatusBarColorId() {
|
||||
View view = getView();
|
||||
if (view != null) {
|
||||
if (Build.VERSION.SDK_INT >= 23 && !isNightMode()) {
|
||||
view.setSystemUiVisibility(view.getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
}
|
||||
return isNightMode() ? R.color.list_background_color_dark : R.color.list_background_color_light;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ColorInt
|
||||
protected int getActiveProfileColor() {
|
||||
return ContextCompat.getColor(app, getActiveProfileColorRes());
|
||||
|
@ -451,6 +507,35 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
|
|||
return iconsCache;
|
||||
}
|
||||
|
||||
protected Drawable getPaintedContentIcon(@DrawableRes int id, @ColorInt int color) {
|
||||
UiUtilities cache = getIconsCache();
|
||||
return cache != null ? cache.getPaintedIcon(id, color) : null;
|
||||
}
|
||||
|
||||
protected void setThemedDrawable(View parent, @IdRes int viewId, @DrawableRes int iconId) {
|
||||
((ImageView) parent.findViewById(viewId)).setImageDrawable(getContentIcon(iconId));
|
||||
}
|
||||
|
||||
protected void setThemedDrawable(View view, @DrawableRes int iconId) {
|
||||
((ImageView) view).setImageDrawable(getContentIcon(iconId));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected OsmandSettings getSettings() {
|
||||
OsmandApplication app = getMyApplication();
|
||||
if (app != null) {
|
||||
return app.getSettings();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
protected OsmandSettings requireSettings() {
|
||||
OsmandApplication app = requireMyApplication();
|
||||
return app.getSettings();
|
||||
}
|
||||
|
||||
protected Drawable getIcon(@DrawableRes int id) {
|
||||
UiUtilities cache = getIconsCache();
|
||||
return cache != null ? cache.getIcon(id) : null;
|
||||
|
@ -476,22 +561,6 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
|
|||
return cache != null ? cache.getPaintedIcon(id, color) : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected OsmandSettings getSettings() {
|
||||
OsmandApplication app = getMyApplication();
|
||||
if (app != null) {
|
||||
return app.getSettings();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
protected OsmandSettings requireSettings() {
|
||||
OsmandApplication app = requireMyApplication();
|
||||
return app.getSettings();
|
||||
}
|
||||
|
||||
public SwitchPreferenceCompat createSwitchPreference(OsmandSettings.OsmandPreference<Boolean> b, int title, int summary, int layoutId) {
|
||||
return createSwitchPreference(b, getString(title), getString(summary), layoutId);
|
||||
}
|
||||
|
|
|
@ -7,8 +7,10 @@ import android.graphics.Canvas;
|
|||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.ColorRes;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.preference.Preference;
|
||||
|
@ -22,6 +24,7 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.aidl.OsmandAidlApi;
|
||||
import net.osmand.aidl.OsmandAidlApi.ConnectedApp;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
|
@ -32,6 +35,8 @@ import net.osmand.plus.activities.MapActivity;
|
|||
import net.osmand.plus.activities.PluginActivity;
|
||||
import net.osmand.plus.settings.preferences.SwitchPreferenceEx;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static net.osmand.plus.profiles.EditProfileFragment.MAP_CONFIG;
|
||||
|
@ -40,9 +45,17 @@ import static net.osmand.plus.profiles.EditProfileFragment.SELECTED_ITEM;
|
|||
|
||||
public class ConfigureProfileFragment extends BaseSettingsFragment {
|
||||
|
||||
public static final String TAG = "ConfigureProfileFragment";
|
||||
public static final String TAG = ConfigureProfileFragment.class.getSimpleName();
|
||||
|
||||
private static final Log log = PlatformUtil.getLog(ConfigureProfileFragment.class);
|
||||
|
||||
private static final String PLUGIN_SETTINGS = "plugin_settings";
|
||||
private static final String CONFIGURE_MAP = "configure_map";
|
||||
|
||||
@Override
|
||||
protected String getFragmentTag() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPreferencesResId() {
|
||||
|
@ -59,6 +72,20 @@ public class ConfigureProfileFragment extends BaseSettingsFragment {
|
|||
return R.string.configure_profile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusBarColorId() {
|
||||
View view = getView();
|
||||
if (view != null) {
|
||||
boolean nightMode = isNightMode();
|
||||
if (Build.VERSION.SDK_INT >= 23 && !nightMode) {
|
||||
view.setSystemUiVisibility(view.getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
}
|
||||
return nightMode ? R.color.list_background_color_dark : R.color.list_background_color_light;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ColorRes
|
||||
protected int getBackgroundColorRes() {
|
||||
return isNightMode() ? R.color.activity_background_color_dark : R.color.activity_background_color_light;
|
||||
|
@ -148,14 +175,13 @@ public class ConfigureProfileFragment extends BaseSettingsFragment {
|
|||
if (ctx == null) {
|
||||
return;
|
||||
}
|
||||
Preference configureMap = findPreference("configure_map");
|
||||
Preference configureMap = findPreference(CONFIGURE_MAP);
|
||||
configureMap.setIcon(getContentIcon(R.drawable.ic_action_layers_dark));
|
||||
|
||||
Intent intent = new Intent(ctx, MapActivity.class);
|
||||
intent.putExtra(OPEN_CONFIG_ON_MAP, MAP_CONFIG);
|
||||
intent.putExtra(SELECTED_ITEM, getSelectedAppMode().getStringKey());
|
||||
configureMap.setIntent(intent);
|
||||
configureMap.setVisible(false);
|
||||
}
|
||||
|
||||
private void setupConnectedAppsPref(PreferenceCategory preferenceCategory) {
|
||||
|
@ -214,6 +240,28 @@ public class ConfigureProfileFragment extends BaseSettingsFragment {
|
|||
return intent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
if (CONFIGURE_MAP.equals(preference.getKey())) {
|
||||
FragmentActivity activity = getActivity();
|
||||
if (activity != null) {
|
||||
try {
|
||||
FragmentManager fragmentManager = activity.getSupportFragmentManager();
|
||||
if (fragmentManager != null) {
|
||||
fragmentManager.beginTransaction()
|
||||
.remove(this)
|
||||
.addToBackStack(TAG)
|
||||
.commitAllowingStateLoss();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return super.onPreferenceClick(preference);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
String key = preference.getKey();
|
||||
|
@ -224,6 +272,7 @@ public class ConfigureProfileFragment extends BaseSettingsFragment {
|
|||
if ((plugin.isActive() || !plugin.needsInstallation())) {
|
||||
if (OsmandPlugin.enablePlugin(getActivity(), app, plugin, (Boolean) newValue)) {
|
||||
preference.setIcon(getPluginIcon(plugin));
|
||||
updatePreference(preference);
|
||||
return true;
|
||||
}
|
||||
} else if (plugin.needsInstallation() && preference.getIntent() != null) {
|
||||
|
|
|
@ -2,6 +2,7 @@ package net.osmand.plus.settings;
|
|||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v7.preference.CheckBoxPreference;
|
||||
|
@ -30,7 +31,7 @@ import net.osmand.plus.wikipedia.WikipediaDialogFragment;
|
|||
|
||||
public class CoordinatesFormatFragment extends BaseSettingsFragment {
|
||||
|
||||
public static final String TAG = "CoordinatesFormatFragment";
|
||||
public static final String TAG = CoordinatesFormatFragment.class.getSimpleName();
|
||||
|
||||
private static final String UTM_FORMAT_WIKI_LINK = "https://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system";
|
||||
|
||||
|
@ -40,6 +41,11 @@ public class CoordinatesFormatFragment extends BaseSettingsFragment {
|
|||
private static final String UTM_FORMAT = "utm_format";
|
||||
private static final String OLC_FORMAT = "olc_format";
|
||||
|
||||
@Override
|
||||
protected String getFragmentTag() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPreferencesResId() {
|
||||
return R.xml.coordinates_format;
|
||||
|
@ -55,6 +61,20 @@ public class CoordinatesFormatFragment extends BaseSettingsFragment {
|
|||
return R.string.coordinates_format;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusBarColorId() {
|
||||
View view = getView();
|
||||
if (view != null) {
|
||||
boolean nightMode = isNightMode();
|
||||
if (Build.VERSION.SDK_INT >= 23 && !nightMode) {
|
||||
view.setSystemUiVisibility(view.getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
}
|
||||
return nightMode ? R.color.list_background_color_dark : R.color.list_background_color_light;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupPreferences() {
|
||||
Preference generalSettings = findPreference("coordinates_format_info");
|
||||
|
|
|
@ -3,6 +3,7 @@ package net.osmand.plus.settings;
|
|||
import android.content.DialogInterface;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
|
@ -28,7 +29,12 @@ import java.util.List;
|
|||
|
||||
public class GeneralProfileSettingsFragment extends BaseSettingsFragment {
|
||||
|
||||
public static final String TAG = "GeneralProfileSettingsFragment";
|
||||
public static final String TAG = GeneralProfileSettingsFragment.class.getSimpleName();
|
||||
|
||||
@Override
|
||||
protected String getFragmentTag() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPreferencesResId() {
|
||||
|
@ -45,6 +51,20 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment {
|
|||
return R.string.general_settings_2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusBarColorId() {
|
||||
View view = getView();
|
||||
if (view != null) {
|
||||
boolean nightMode = isNightMode();
|
||||
if (Build.VERSION.SDK_INT >= 23 && !nightMode) {
|
||||
view.setSystemUiVisibility(view.getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
}
|
||||
return nightMode ? R.color.list_background_color_dark : R.color.list_background_color_light;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupPreferences() {
|
||||
setupAppThemePref();
|
||||
|
|
|
@ -19,10 +19,15 @@ import net.osmand.plus.settings.preferences.SwitchPreferenceEx;
|
|||
|
||||
public class GlobalSettingsFragment extends BaseSettingsFragment implements SendAnalyticsBottomSheetDialogFragment.OnSendAnalyticsPrefsUpdate, OnPreferenceChanged {
|
||||
|
||||
public static final String TAG = "GlobalSettingsFragment";
|
||||
public static final String TAG = GlobalSettingsFragment.class.getSimpleName();
|
||||
|
||||
private static final String SEND_ANONYMOUS_DATA_PREF_ID = "send_anonymous_data";
|
||||
|
||||
@Override
|
||||
protected String getFragmentTag() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPreferencesResId() {
|
||||
return R.xml.global_settings;
|
||||
|
@ -38,6 +43,11 @@ public class GlobalSettingsFragment extends BaseSettingsFragment implements Send
|
|||
return R.string.osmand_settings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusBarColorId() {
|
||||
return isNightMode() ? R.color.status_bar_color_dark : R.color.status_bar_color_light;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupPreferences() {
|
||||
setupDefaultAppModePref();
|
||||
|
|
|
@ -12,7 +12,12 @@ import net.osmand.util.Algorithms;
|
|||
|
||||
public class MainSettingsFragment extends BaseSettingsFragment {
|
||||
|
||||
public static final String TAG = "MainSettingsFragment";
|
||||
public static final String TAG = MainSettingsFragment.class.getSimpleName();
|
||||
|
||||
@Override
|
||||
protected String getFragmentTag() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPreferencesResId() {
|
||||
|
@ -31,7 +36,7 @@ public class MainSettingsFragment extends BaseSettingsFragment {
|
|||
|
||||
@Override
|
||||
public int getStatusBarColorId() {
|
||||
return isNightMode() ? R.color.status_bar_color_light : R.color.status_bar_color_dark;
|
||||
return isNightMode() ? R.color.status_bar_color_dark : R.color.status_bar_color_light;
|
||||
}
|
||||
|
||||
@ColorRes
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package net.osmand.plus.settings;
|
||||
|
||||
import android.os.Build;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.view.View;
|
||||
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.OsmandSettings.AutoZoomMap;
|
||||
|
@ -10,7 +12,12 @@ import net.osmand.plus.settings.preferences.SwitchPreferenceEx;
|
|||
|
||||
public class MapDuringNavigationFragment extends BaseSettingsFragment {
|
||||
|
||||
public static final String TAG = "MapDuringNavigationFragment";
|
||||
public static final String TAG = MapDuringNavigationFragment.class.getSimpleName();
|
||||
|
||||
@Override
|
||||
protected String getFragmentTag() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPreferencesResId() {
|
||||
|
@ -27,6 +34,20 @@ public class MapDuringNavigationFragment extends BaseSettingsFragment {
|
|||
return R.string.map_during_navigation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusBarColorId() {
|
||||
View view = getView();
|
||||
if (view != null) {
|
||||
boolean nightMode = isNightMode();
|
||||
if (Build.VERSION.SDK_INT >= 23 && !nightMode) {
|
||||
view.setSystemUiVisibility(view.getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
}
|
||||
return nightMode ? R.color.list_background_color_dark : R.color.list_background_color_light;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupPreferences() {
|
||||
Preference mapDuringNavigationInfo = findPreference("map_during_navigation_info");
|
||||
|
|
|
@ -1,13 +1,20 @@
|
|||
package net.osmand.plus.settings;
|
||||
|
||||
import android.os.Build;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.SwitchPreferenceCompat;
|
||||
import android.view.View;
|
||||
|
||||
import net.osmand.plus.R;
|
||||
|
||||
public class NavigationFragment extends BaseSettingsFragment {
|
||||
|
||||
public static final String TAG = "NavigationFragment";
|
||||
public static final String TAG = NavigationFragment.class.getSimpleName();
|
||||
|
||||
@Override
|
||||
protected String getFragmentTag() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPreferencesResId() {
|
||||
|
@ -24,6 +31,20 @@ public class NavigationFragment extends BaseSettingsFragment {
|
|||
return R.string.routing_settings_2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusBarColorId() {
|
||||
View view = getView();
|
||||
if (view != null) {
|
||||
boolean nightMode = isNightMode();
|
||||
if (Build.VERSION.SDK_INT >= 23 && !nightMode) {
|
||||
view.setSystemUiVisibility(view.getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
}
|
||||
return nightMode ? R.color.list_background_color_dark : R.color.list_background_color_light;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupPreferences() {
|
||||
Preference routeParameters = findPreference("route_parameters");
|
||||
|
|
|
@ -13,6 +13,11 @@ public class ProxySettingsFragment extends BaseSettingsFragment {
|
|||
|
||||
public static final String TAG = ProxySettingsFragment.class.getSimpleName();
|
||||
|
||||
@Override
|
||||
protected String getFragmentTag() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPreferencesResId() {
|
||||
return R.xml.proxy_preferences;
|
||||
|
@ -28,6 +33,11 @@ public class ProxySettingsFragment extends BaseSettingsFragment {
|
|||
return R.string.proxy_pref_title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusBarColorId() {
|
||||
return isNightMode() ? R.color.status_bar_color_dark : R.color.status_bar_color_light;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupPreferences() {
|
||||
Preference mapDuringNavigationInfo = findPreference("proxy_preferences_info");
|
||||
|
|
|
@ -6,6 +6,7 @@ import android.support.v4.content.ContextCompat;
|
|||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceScreen;
|
||||
import android.support.v7.preference.PreferenceViewHolder;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
|
@ -33,7 +34,7 @@ import static net.osmand.plus.activities.SettingsNavigationActivity.getRouter;
|
|||
|
||||
public class RouteParametersFragment extends BaseSettingsFragment {
|
||||
|
||||
public static final String TAG = "RouteParametersFragment";
|
||||
public static final String TAG = RouteParametersFragment.class.getSimpleName();
|
||||
|
||||
private static final String AVOID_ROUTING_PARAMETER_PREFIX = "avoid_";
|
||||
private static final String PREFER_ROUTING_PARAMETER_PREFIX = "prefer_";
|
||||
|
@ -46,6 +47,11 @@ public class RouteParametersFragment extends BaseSettingsFragment {
|
|||
private List<GeneralRouter.RoutingParameter> reliefFactorParameters = new ArrayList<GeneralRouter.RoutingParameter>();
|
||||
private List<GeneralRouter.RoutingParameter> otherRoutingParameters = new ArrayList<GeneralRouter.RoutingParameter>();
|
||||
|
||||
@Override
|
||||
protected String getFragmentTag() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPreferencesResId() {
|
||||
return R.xml.route_parameters;
|
||||
|
@ -61,6 +67,20 @@ public class RouteParametersFragment extends BaseSettingsFragment {
|
|||
return R.string.route_parameters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusBarColorId() {
|
||||
View view = getView();
|
||||
if (view != null) {
|
||||
boolean nightMode = isNightMode();
|
||||
if (Build.VERSION.SDK_INT >= 23 && !nightMode) {
|
||||
view.setSystemUiVisibility(view.getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
}
|
||||
return nightMode ? R.color.list_background_color_dark : R.color.list_background_color_light;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupPreferences() {
|
||||
setupRouteParametersImage();
|
||||
|
|
|
@ -7,17 +7,23 @@ import android.support.v4.content.ContextCompat;
|
|||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceViewHolder;
|
||||
import android.support.v7.preference.SwitchPreferenceCompat;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import net.osmand.plus.R;
|
||||
|
||||
public class ScreenAlertsFragment extends BaseSettingsFragment {
|
||||
|
||||
public static final String TAG = "ScreenAlertsFragment";
|
||||
public static final String TAG = ScreenAlertsFragment.class.getSimpleName();
|
||||
|
||||
private static final String SHOW_ROUTING_ALARMS_INFO = "show_routing_alarms_info";
|
||||
private static final String SCREEN_ALERTS_IMAGE = "screen_alerts_image";
|
||||
|
||||
@Override
|
||||
protected String getFragmentTag() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPreferencesResId() {
|
||||
return R.xml.screen_alerts;
|
||||
|
@ -33,6 +39,20 @@ public class ScreenAlertsFragment extends BaseSettingsFragment {
|
|||
return R.string.screen_alerts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusBarColorId() {
|
||||
View view = getView();
|
||||
if (view != null) {
|
||||
boolean nightMode = isNightMode();
|
||||
if (Build.VERSION.SDK_INT >= 23 && !nightMode) {
|
||||
view.setSystemUiVisibility(view.getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
}
|
||||
return nightMode ? R.color.list_background_color_dark : R.color.list_background_color_light;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupPreferences() {
|
||||
Preference showRoutingAlarmsInfo = findPreference(SHOW_ROUTING_ALARMS_INFO);
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package net.osmand.plus.settings;
|
||||
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Build;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceViewHolder;
|
||||
import android.support.v7.preference.SwitchPreferenceCompat;
|
||||
import android.view.View;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.R;
|
||||
|
@ -13,7 +15,12 @@ import net.osmand.plus.settings.preferences.SwitchPreferenceEx;
|
|||
|
||||
public class TurnScreenOnFragment extends BaseSettingsFragment {
|
||||
|
||||
public static final String TAG = "TurnScreenOnFragment";
|
||||
public static final String TAG = TurnScreenOnFragment.class.getSimpleName();
|
||||
|
||||
@Override
|
||||
protected String getFragmentTag() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPreferencesResId() {
|
||||
|
@ -30,6 +37,20 @@ public class TurnScreenOnFragment extends BaseSettingsFragment {
|
|||
return R.string.turn_screen_on;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusBarColorId() {
|
||||
View view = getView();
|
||||
if (view != null) {
|
||||
boolean nightMode = isNightMode();
|
||||
if (Build.VERSION.SDK_INT >= 23 && !nightMode) {
|
||||
view.setSystemUiVisibility(view.getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
}
|
||||
return nightMode ? R.color.list_background_color_dark : R.color.list_background_color_light;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupPreferences() {
|
||||
Preference turnScreenOnInfo = findPreference("turn_screen_on_info");
|
||||
|
|
|
@ -2,7 +2,9 @@ package net.osmand.plus.settings;
|
|||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.view.View;
|
||||
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
|
@ -19,7 +21,12 @@ import static net.osmand.plus.activities.SettingsNavigationActivity.showSeekbarS
|
|||
|
||||
public class VehicleParametersFragment extends BaseSettingsFragment {
|
||||
|
||||
public static final String TAG = "VehicleParametersFragment";
|
||||
public static final String TAG = VehicleParametersFragment.class.getSimpleName();
|
||||
|
||||
@Override
|
||||
protected String getFragmentTag() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPreferencesResId() {
|
||||
|
@ -36,6 +43,20 @@ public class VehicleParametersFragment extends BaseSettingsFragment {
|
|||
return R.string.vehicle_parameters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusBarColorId() {
|
||||
View view = getView();
|
||||
if (view != null) {
|
||||
boolean nightMode = isNightMode();
|
||||
if (Build.VERSION.SDK_INT >= 23 && !nightMode) {
|
||||
view.setSystemUiVisibility(view.getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
}
|
||||
return nightMode ? R.color.list_background_color_dark : R.color.list_background_color_light;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupPreferences() {
|
||||
OsmandApplication app = getMyApplication();
|
||||
|
|
|
@ -6,11 +6,13 @@ import android.content.DialogInterface;
|
|||
import android.content.Intent;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.media.AudioManager;
|
||||
import android.os.Build;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceViewHolder;
|
||||
import android.support.v7.preference.SwitchPreferenceCompat;
|
||||
import android.view.View;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
|
@ -28,7 +30,12 @@ import static net.osmand.plus.activities.SettingsNavigationActivity.MORE_VALUE;
|
|||
|
||||
public class VoiceAnnouncesFragment extends BaseSettingsFragment {
|
||||
|
||||
public static final String TAG = "VoiceAnnouncesFragment";
|
||||
public static final String TAG = VoiceAnnouncesFragment.class.getSimpleName();
|
||||
|
||||
@Override
|
||||
protected String getFragmentTag() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPreferencesResId() {
|
||||
|
@ -45,6 +52,20 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment {
|
|||
return R.string.voice_announces;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusBarColorId() {
|
||||
View view = getView();
|
||||
if (view != null) {
|
||||
boolean nightMode = isNightMode();
|
||||
if (Build.VERSION.SDK_INT >= 23 && !nightMode) {
|
||||
view.setSystemUiVisibility(view.getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
}
|
||||
return nightMode ? R.color.list_background_color_dark : R.color.list_background_color_light;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupPreferences() {
|
||||
Preference voiceAnnouncesInfo = findPreference("voice_announces_info");
|
||||
|
|
|
@ -28,7 +28,7 @@ import java.util.List;
|
|||
|
||||
public class ChangeGeneralProfilesPrefBottomSheet extends BasePreferenceBottomSheet {
|
||||
|
||||
public static final String TAG = "ChangeGeneralProfilesPrefBottomSheet";
|
||||
public static final String TAG = ChangeGeneralProfilesPrefBottomSheet.class.getSimpleName();
|
||||
|
||||
private static final Log LOG = PlatformUtil.getLog(ChangeGeneralProfilesPrefBottomSheet.class);
|
||||
|
||||
|
|
Loading…
Reference in a new issue