From 4cc7757bbaa28419b13efa2dca8af1d402c3646c Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Mon, 30 Oct 2017 10:41:28 +0200 Subject: [PATCH] Change status bar color --- OsmAnd/res/values/colors.xml | 2 ++ .../mapmarkers/CoordinateInputDialogFragment.java | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values/colors.xml b/OsmAnd/res/values/colors.xml index 715564f2a0..6e702310a5 100644 --- a/OsmAnd/res/values/colors.xml +++ b/OsmAnd/res/values/colors.xml @@ -269,4 +269,6 @@ #ffffff + #4257c9 + \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java index fb5e43b15d..6ee1e1954a 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java @@ -4,11 +4,13 @@ import android.app.Dialog; import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; +import android.os.Build; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.DialogFragment; import android.support.v4.app.Fragment; +import android.support.v4.content.ContextCompat; import android.support.v4.widget.TextViewCompat; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.PopupMenu; @@ -24,6 +26,8 @@ import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; +import android.view.Window; +import android.view.WindowManager; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.EditText; @@ -117,13 +121,22 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { - return new Dialog(getContext(), getTheme()) { + Dialog dialog = new Dialog(getContext(), getTheme()) { @Override public void onBackPressed() { saveMarkers(); super.onBackPressed(); } }; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + Window window = dialog.getWindow(); + if (window != null) { + window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + window.setStatusBarColor(ContextCompat.getColor(getContext(), R.color.coordinate_input_status_bar_color)); + } + } + return dialog; } @Nullable