diff --git a/res/values/colors.xml b/res/values/colors.xml index f1483bc90a..b71862b422 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -32,6 +32,7 @@ #ff33b5e5 #ff111111 + #ff1f1f1f #400099cc #33ffffff #66ffffff diff --git a/src/org/thoughtcrime/securesms/ConversationFragment.java b/src/org/thoughtcrime/securesms/ConversationFragment.java index f8e20ab65e..bc987eb068 100644 --- a/src/org/thoughtcrime/securesms/ConversationFragment.java +++ b/src/org/thoughtcrime/securesms/ConversationFragment.java @@ -6,6 +6,7 @@ import android.content.DialogInterface; import android.content.Intent; import android.database.Cursor; import android.os.AsyncTask; +import android.os.Build; import android.os.Bundle; import android.support.v4.app.ListFragment; import android.support.v4.app.LoaderManager; @@ -21,6 +22,7 @@ import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; +import android.view.Window; import android.widget.AdapterView; import android.widget.ListView; import android.widget.Toast; @@ -345,11 +347,19 @@ public class ConversationFragment extends ListFragment private class ActionModeCallback implements ActionMode.Callback { + private int statusBarColor; + @Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { MenuInflater inflater = mode.getMenuInflater(); inflater.inflate(R.menu.conversation_context, menu); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + Window window = getActivity().getWindow(); + statusBarColor = window.getStatusBarColor(); + window.setStatusBarColor(getResources().getColor(R.color.action_mode_status_bar)); + } + setCorrectMenuVisibility(menu); return true; } @@ -364,6 +374,10 @@ public class ConversationFragment extends ListFragment ((ConversationAdapter)getListAdapter()).getBatchSelected().clear(); ((ConversationAdapter)getListAdapter()).notifyDataSetChanged(); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + getActivity().getWindow().setStatusBarColor(statusBarColor); + } + actionMode = null; } diff --git a/src/org/thoughtcrime/securesms/ConversationListFragment.java b/src/org/thoughtcrime/securesms/ConversationListFragment.java index de821e5a25..05db73ac5b 100644 --- a/src/org/thoughtcrime/securesms/ConversationListFragment.java +++ b/src/org/thoughtcrime/securesms/ConversationListFragment.java @@ -19,8 +19,11 @@ package org.thoughtcrime.securesms; import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.Intent; +import android.content.res.TypedArray; import android.database.Cursor; +import android.graphics.Color; import android.os.AsyncTask; +import android.os.Build; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.LoaderManager; @@ -267,6 +270,11 @@ public class ConversationListFragment extends Fragment mode.setTitle(R.string.conversation_fragment_cab__batch_selection_mode); mode.setSubtitle(null); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + getActivity().getWindow() + .setStatusBarColor(getResources().getColor(R.color.action_mode_status_bar)); + } + return true; } @@ -288,6 +296,14 @@ public class ConversationListFragment extends Fragment @Override public void onDestroyActionMode(ActionMode mode) { getListAdapter().initializeBatchMode(false); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + TypedArray color = getActivity().getTheme() + .obtainStyledAttributes(new int[] { android.R.attr.statusBarColor }); + getActivity().getWindow().setStatusBarColor(color.getColor(0, Color.BLACK)); + color.recycle(); + } + actionMode = null; }