Refactor with WindowUtil and correct some colors.

This commit is contained in:
Alex Hart
2020-11-13 14:43:58 -04:00
committed by GitHub
parent 96e241ef9c
commit 2a193ef455
16 changed files with 38 additions and 38 deletions

View File

@@ -258,6 +258,7 @@ import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.thoughtcrime.securesms.util.TextSecurePreferences.MediaKeyboardMode;
import org.thoughtcrime.securesms.util.Util;
import org.thoughtcrime.securesms.util.ViewUtil;
import org.thoughtcrime.securesms.util.WindowUtil;
import org.thoughtcrime.securesms.util.concurrent.AssertedSuccessListener;
import org.thoughtcrime.securesms.util.concurrent.ListenableFuture;
import org.thoughtcrime.securesms.util.concurrent.SettableFuture;
@@ -2368,7 +2369,7 @@ public class ConversationActivity extends PassphraseRequiredActivity
ActionBar supportActionBar = getSupportActionBar();
if (supportActionBar == null) throw new AssertionError();
supportActionBar.setBackgroundDrawable(new ColorDrawable(color.toActionBarColor(this)));
setStatusBarColor(color.toStatusBarColor(this));
WindowUtil.setStatusBarColor(getWindow(), color.toStatusBarColor(this));
}
private void setBlockedUserState(Recipient recipient, boolean isSecureText, boolean isDefaultSms) {

View File

@@ -1523,7 +1523,7 @@ public class ConversationFragment extends LoggingFragment {
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));
WindowUtil.setStatusBarColor(window, getResources().getColor(R.color.action_mode_status_bar));
}
if (!ThemeUtil.isDarkTheme(getContext())) {
@@ -1547,7 +1547,7 @@ public class ConversationFragment extends LoggingFragment {
list.getAdapter().notifyDataSetChanged();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getActivity().getWindow().setStatusBarColor(statusBarColor);
WindowUtil.setStatusBarColor(requireActivity().getWindow(), statusBarColor);
}
WindowUtil.clearLightStatusBar(getActivity().getWindow());

View File

@@ -201,7 +201,7 @@ public final class ConversationReactionOverlay extends RelativeLayout {
if (Build.VERSION.SDK_INT >= 21) {
this.activity = activity;
originalStatusBarColor = activity.getWindow().getStatusBarColor();
activity.getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), R.color.signal_background_secondary));
WindowUtil.setStatusBarColor(activity.getWindow(), ContextCompat.getColor(getContext(), R.color.action_mode_status_bar));
if (!ThemeUtil.isDarkTheme(getContext())) {
WindowUtil.setLightStatusBar(activity.getWindow());
@@ -243,7 +243,7 @@ public final class ConversationReactionOverlay extends RelativeLayout {
hideAnimatorSet.start();
if (Build.VERSION.SDK_INT >= 21 && activity != null) {
activity.getWindow().setStatusBarColor(originalStatusBarColor);
WindowUtil.setStatusBarColor(activity.getWindow(), originalStatusBarColor);
WindowUtil.clearLightStatusBar(activity.getWindow());
activity = null;
}