Commit ec03f720 authored by Rouslan Solomakhin's avatar Rouslan Solomakhin Committed by Commit Bot

[Payment Request] Show status bar.

Before this patch, Android Oreo and newer blacked-out the status bar, so
the time and battery icon, for example, were not visible during
payment.

This patch sets the payment dialogs status bar icon color to be either
white or black, depending on the status bar background color. These
changes apply to Android Oreo and newer only.

After this patch, the status bar icons are always visible during
payment.

Bug: 890183
Change-Id: Ia478ec9461b05bd4cb2993fd11b301a9ec0f4704
Reviewed-on: https://chromium-review.googlesource.com/c/1286744
Commit-Queue: Rouslan Solomakhin <rouslan@chromium.org>
Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600950}
parent 41486047
...@@ -14,6 +14,7 @@ import android.content.Context; ...@@ -14,6 +14,7 @@ import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.support.v4.view.animation.FastOutLinearInInterpolator; import android.support.v4.view.animation.FastOutLinearInInterpolator;
import android.support.v4.view.animation.LinearOutSlowInInterpolator; import android.support.v4.view.animation.LinearOutSlowInInterpolator;
import android.view.Gravity; import android.view.Gravity;
...@@ -27,6 +28,7 @@ import android.widget.FrameLayout; ...@@ -27,6 +28,7 @@ import android.widget.FrameLayout;
import org.chromium.base.ApiCompatibilityUtils; import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.VisibleForTesting; import org.chromium.base.VisibleForTesting;
import org.chromium.chrome.R; import org.chromium.chrome.R;
import org.chromium.chrome.browser.util.ColorUtils;
import org.chromium.chrome.browser.widget.AlwaysDismissedDialog; import org.chromium.chrome.browser.widget.AlwaysDismissedDialog;
import org.chromium.chrome.browser.widget.animation.AnimatorProperties; import org.chromium.chrome.browser.widget.animation.AnimatorProperties;
...@@ -71,16 +73,26 @@ import org.chromium.chrome.browser.widget.animation.AnimatorProperties; ...@@ -71,16 +73,26 @@ import org.chromium.chrome.browser.widget.animation.AnimatorProperties;
mDialog.setOnDismissListener(dismissListener); mDialog.setOnDismissListener(dismissListener);
mDialog.addContentView(mFullContainer, mDialog.addContentView(mFullContainer,
new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
Window dialogWindow = mDialog.getWindow(); Window dialogWindow = mDialog.getWindow();
dialogWindow.setGravity(Gravity.CENTER); dialogWindow.setGravity(Gravity.CENTER);
dialogWindow.setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); dialogWindow.setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
dialogWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); dialogWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
setVisibleStatusBarIconColor(dialogWindow);
mAnimatorTranslation = mAnimatorTranslation =
activity.getResources().getDimensionPixelSize(R.dimen.payments_ui_translation); activity.getResources().getDimensionPixelSize(R.dimen.payments_ui_translation);
} }
/**
* Makes sure that the color of the icons in the status bar makes the icons visible.
* @param window The window whose status bar icon color is being set.
*/
/* package */ static void setVisibleStatusBarIconColor(Window window) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return;
ApiCompatibilityUtils.setStatusBarIconColor(window.getDecorView().getRootView(),
!ColorUtils.shouldUseLightForegroundOnBackground(window.getStatusBarColor()));
}
/** @param bottomSheetView The view to show in the bottom sheet. */ /** @param bottomSheetView The view to show in the bottom sheet. */
/* package */ void addBottomSheetView(View bottomSheetView) { /* package */ void addBottomSheetView(View bottomSheetView) {
FrameLayout.LayoutParams bottomSheetParams = FrameLayout.LayoutParams bottomSheetParams =
......
...@@ -401,8 +401,11 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View ...@@ -401,8 +401,11 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View
mEditorDialog = new EditorDialog(activity, sEditorObserverForTest, mEditorDialog = new EditorDialog(activity, sEditorObserverForTest,
/*deleteRunnable =*/null); /*deleteRunnable =*/null);
DimmingDialog.setVisibleStatusBarIconColor(mEditorDialog.getWindow());
mCardEditorDialog = new EditorDialog(activity, sEditorObserverForTest, mCardEditorDialog = new EditorDialog(activity, sEditorObserverForTest,
/*deleteRunnable =*/null); /*deleteRunnable =*/null);
DimmingDialog.setVisibleStatusBarIconColor(mCardEditorDialog.getWindow());
// Allow screenshots of the credit card number in Canary, Dev, and developer builds. // Allow screenshots of the credit card number in Canary, Dev, and developer builds.
if (ChromeVersionInfo.isBetaBuild() || ChromeVersionInfo.isStableBuild()) { if (ChromeVersionInfo.isBetaBuild() || ChromeVersionInfo.isStableBuild()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment