This commit is contained in:
Dima-1 2020-01-30 17:15:00 +02:00
parent c2465e05c2
commit 22992aa8d7
9 changed files with 15 additions and 9 deletions

View file

@ -422,6 +422,9 @@
<color name="app_bar_main_light">#ff8800</color>
<color name="status_bar_main_dark">#101112</color>
<color name="status_bar_main_light">#E68200</color>
<color name="navigation_bar_bg_light">#CCCCCC</color>
<color name="navigation_bar_bg_dark">#2B2E31</color>
<color name="activity_background_dark">#17181a</color>
<color name="activity_background_light">#f0f0f0</color>
<color name="card_and_list_background_dark">#222526</color>

View file

@ -1520,6 +1520,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
mapLayers.updateLayers(mapView);
mapActions.updateDrawerMenu();
updateNavigationBarColor();
mapView.setComplexZoom(mapView.getZoom(), mapView.getSettingsMapDensity());
app.getDaynightHelper().startSensorIfNeeded(new StateChangedListener<Boolean>() {
@ -1532,6 +1533,16 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
applyScreenOrientation();
}
public void updateNavigationBarColor() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (getMyApplication().getDaynightHelper().isNightModeForMapControls() || getMyApplication().getDaynightHelper().isNightMode()) {
getWindow().setNavigationBarColor(ContextCompat.getColor(app, R.color.navigation_bar_bg_dark));
} else {
getWindow().setNavigationBarColor(ContextCompat.getColor(app, R.color.navigation_bar_bg_light));
}
}
}
public void updateMapSettings() {
if (app.isApplicationInitializing()) {
return;

View file

@ -42,7 +42,6 @@ public class BaseOsmAndFragment extends Fragment implements TransitionAnimator {
} else {
statusBarColor = activity.getWindow().getStatusBarColor();
activity.getWindow().setStatusBarColor(ContextCompat.getColor(activity, colorId));
activity.getWindow().setNavigationBarColor(ContextCompat.getColor(activity, colorId));
}
}
if (!isFullScreenAllowed() && activity instanceof MapActivity) {
@ -60,7 +59,6 @@ public class BaseOsmAndFragment extends Fragment implements TransitionAnimator {
if (activity != null) {
if (!(activity instanceof MapActivity) && statusBarColor != -1) {
activity.getWindow().setStatusBarColor(statusBarColor);
activity.getWindow().setNavigationBarColor(statusBarColor);
}
if (!isFullScreenAllowed() && activity instanceof MapActivity) {
((MapActivity) activity).enterToFullScreen();

View file

@ -171,7 +171,6 @@ public abstract class ChoosePlanDialogFragment extends BaseOsmAndDialogFragment
}
if (Build.VERSION.SDK_INT >= 21) {
window.setStatusBarColor(ContextCompat.getColor(ctx, getStatusBarColor()));
window.setNavigationBarColor(ContextCompat.getColor(ctx, getStatusBarColor()));
}
}
return dialog;

View file

@ -79,7 +79,6 @@ public class OsmLiveCancelledDialog extends BaseOsmAndDialogFragment implements
}
if (Build.VERSION.SDK_INT >= 21) {
window.setStatusBarColor(ContextCompat.getColor(ctx, getStatusBarColor()));
window.setNavigationBarColor(ContextCompat.getColor(ctx, getStatusBarColor()));
}
}
return dialog;

View file

@ -241,7 +241,6 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
if (!lightTheme && Build.VERSION.SDK_INT >= 21) {
window.setStatusBarColor(getResolvedColor(R.color.status_bar_coordinate_input_dark));
window.setNavigationBarColor(getResolvedColor(R.color.status_bar_coordinate_input_dark));
}
}
return dialog;

View file

@ -237,7 +237,6 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
} else {
statusBarColor = activity.getWindow().getStatusBarColor();
activity.getWindow().setStatusBarColor(ContextCompat.getColor(activity, colorId));
activity.getWindow().setNavigationBarColor(ContextCompat.getColor(activity, colorId));
}
}
if (activity instanceof MapActivity) {
@ -260,7 +259,6 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
if (Build.VERSION.SDK_INT >= 21) {
if (!(activity instanceof MapActivity) && statusBarColor != -1) {
activity.getWindow().setStatusBarColor(statusBarColor);
activity.getWindow().setNavigationBarColor(statusBarColor);
}
if (activity instanceof MapActivity) {
((MapActivity) activity).enterToFullScreen();
@ -276,6 +274,7 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
Activity activity = getActivity();
if (activity instanceof MapActivity) {
((MapActivity) activity).updateStatusBarColor();
((MapActivity) activity).updateNavigationBarColor();
}
}
}

View file

@ -45,7 +45,6 @@ public class WikiBaseDialogFragment extends BaseOsmAndDialogFragment {
}
if (Build.VERSION.SDK_INT >= 21) {
window.setStatusBarColor(getResolvedColor(getStatusBarColor()));
window.setNavigationBarColor(getResolvedColor(getStatusBarColor()));
}
}
return dialog;

View file

@ -79,7 +79,6 @@ public class WikivoyageExploreActivity extends TabActivity implements DownloadEv
}
if (Build.VERSION.SDK_INT >= 21) {
window.setStatusBarColor(getResolvedColor(getStatusBarColor()));
window.setNavigationBarColor(getResolvedColor(getStatusBarColor()));
}
}