diff --git a/packages/SystemUI/res/drawable/circle_wallet_primary_50dp.xml b/packages/SystemUI/res/drawable/circle_wallet_primary_56dp.xml
similarity index 93%
rename from packages/SystemUI/res/drawable/circle_wallet_primary_50dp.xml
rename to packages/SystemUI/res/drawable/circle_wallet_primary_56dp.xml
index 41d88b4c4ca84..3d4c23315e4b1 100644
--- a/packages/SystemUI/res/drawable/circle_wallet_primary_50dp.xml
+++ b/packages/SystemUI/res/drawable/circle_wallet_primary_56dp.xml
@@ -16,8 +16,8 @@
+ android:height="56dp"
+ android:width="56dp" />
diff --git a/packages/SystemUI/res/drawable/circle_wallet_secondary_56dp.xml b/packages/SystemUI/res/drawable/circle_wallet_secondary_56dp.xml
new file mode 100644
index 0000000000000..1634e2db33225
--- /dev/null
+++ b/packages/SystemUI/res/drawable/circle_wallet_secondary_56dp.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
diff --git a/packages/SystemUI/res/drawable/wallet_button.xml b/packages/SystemUI/res/drawable/wallet_action_button_bg.xml
similarity index 100%
rename from packages/SystemUI/res/drawable/wallet_button.xml
rename to packages/SystemUI/res/drawable/wallet_action_button_bg.xml
diff --git a/packages/SystemUI/res/drawable/wallet_app_button_bg.xml b/packages/SystemUI/res/drawable/wallet_app_button_bg.xml
new file mode 100644
index 0000000000000..1136b9d208af1
--- /dev/null
+++ b/packages/SystemUI/res/drawable/wallet_app_button_bg.xml
@@ -0,0 +1,25 @@
+
+
+
+ -
+
+
+
+
+
+
+
diff --git a/packages/SystemUI/res/layout/wallet_fullscreen.xml b/packages/SystemUI/res/layout/wallet_fullscreen.xml
index dc678481ea6e6..b47c2f2e1821a 100644
--- a/packages/SystemUI/res/layout/wallet_fullscreen.xml
+++ b/packages/SystemUI/res/layout/wallet_fullscreen.xml
@@ -23,7 +23,7 @@
android:id="@+id/card_carousel_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_marginTop="36dp"
+ android:layout_marginTop="48dp"
android:orientation="vertical">
+
+
+ android:layout_gravity="center_horizontal"
+ android:paddingVertical="@dimen/wallet_button_vertical_padding"
+ android:paddingHorizontal="@dimen/wallet_button_horizontal_padding"
+ android:background="@drawable/wallet_app_button_bg"
+ android:text="@string/wallet_app_button_label"
+ android:textColor="@color/GM2_blue_600"
+ android:textAlignment="center"
+ android:layout_marginVertical="24dp"/>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 433e1bea28b57..e889822052883 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -1452,6 +1452,8 @@
24dp
32dp
50dp
+ 24dp
+ 8dp
12dp
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index d5b4f9b03fca2..4ae1c936d1a9f 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -1650,10 +1650,10 @@
Wallet
-
- Show all
-
- Unlock to pay
+
+ Show all
+
+ Unlock to pay
Ready
diff --git a/packages/SystemUI/src/com/android/systemui/wallet/ui/WalletActivity.java b/packages/SystemUI/src/com/android/systemui/wallet/ui/WalletActivity.java
index c1835db9ab0c2..f884687daad4b 100644
--- a/packages/SystemUI/src/com/android/systemui/wallet/ui/WalletActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/wallet/ui/WalletActivity.java
@@ -94,17 +94,15 @@ public class WalletActivity extends LifecycleActivity {
mHandler,
mUserTracker,
mKeyguardStateController);
- // Clicking the wallet button will open the wallet app if the device is unlocked; bring up
- // the security bouncer otherwise.
- walletView.getWalletButton().setOnClickListener(
- v -> {
- if (mKeyguardStateController.isUnlocked()) {
- mActivityStarter.startActivity(
- mQuickAccessWalletClient.createWalletIntent(), true);
- } else {
- mKeyguardDismissUtil.executeWhenUnlocked(() -> false, false);
- }
- });
+
+ walletView.getAppButton().setOnClickListener(
+ v -> mActivityStarter.startActivity(
+ mQuickAccessWalletClient.createWalletIntent(), true));
+ // Click the action button to re-render the screen when the device is unlocked.
+ if (!mKeyguardStateController.isUnlocked()) {
+ walletView.getActionButton().setOnClickListener(
+ v -> mKeyguardDismissUtil.executeWhenUnlocked(() -> false, false));
+ }
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/wallet/ui/WalletView.java b/packages/SystemUI/src/com/android/systemui/wallet/ui/WalletView.java
index a3793945aedf1..a3c26998e2c08 100644
--- a/packages/SystemUI/src/com/android/systemui/wallet/ui/WalletView.java
+++ b/packages/SystemUI/src/com/android/systemui/wallet/ui/WalletView.java
@@ -54,7 +54,10 @@ public class WalletView extends FrameLayout implements WalletCardCarousel.OnCard
private final WalletCardCarousel mCardCarousel;
private final ImageView mIcon;
private final TextView mCardLabel;
- private final Button mWalletButton;
+ // Displays at the bottom of the screen, allow user to enter the default wallet app.
+ private final Button mAppButton;
+ // Displays underneath the carousel, allow user to unlock device, verify card, etc.
+ private final Button mActionButton;
private final Interpolator mInInterpolator;
private final Interpolator mOutInterpolator;
private final float mAnimationTranslationX;
@@ -75,7 +78,8 @@ public class WalletView extends FrameLayout implements WalletCardCarousel.OnCard
mCardCarousel.setCardScrollListener(this);
mIcon = requireViewById(R.id.icon);
mCardLabel = requireViewById(R.id.label);
- mWalletButton = requireViewById(R.id.wallet_button);
+ mAppButton = requireViewById(R.id.wallet_app_button);
+ mActionButton = requireViewById(R.id.wallet_action_button);
mErrorView = requireViewById(R.id.error_view);
mEmptyStateView = requireViewById(R.id.wallet_empty_state);
mInInterpolator =
@@ -101,15 +105,6 @@ public class WalletView extends FrameLayout implements WalletCardCarousel.OnCard
public void onCardScroll(WalletCardViewInfo centerCard, WalletCardViewInfo nextCard,
float percentDistanceFromCenter) {
CharSequence centerCardText = centerCard.getLabel();
- Drawable icon = centerCard.getIcon();
- if (icon != null) {
- Drawable drawable = resizeDrawable(getResources(), icon);
- drawable.setTint(mContext.getColor(R.color.GM2_blue_600));
- mIcon.setImageDrawable(drawable);
- mIcon.setVisibility(VISIBLE);
- } else {
- mIcon.setVisibility(INVISIBLE);
- }
if (!TextUtils.equals(mCenterCardText, centerCardText)) {
mCenterCardText = centerCardText;
mCardLabel.setText(centerCardText);
@@ -122,16 +117,21 @@ public class WalletView extends FrameLayout implements WalletCardCarousel.OnCard
}
}
+ /**
+ * Render and show card carousel view.
+ *
+ *
This is called only when {@param data} is not empty.
+ *
+ * @param data a list of wallet cards information.
+ * @param selectedIndex index of the current selected card
+ * @param isDeviceLocked indicates whether the device is locked.
+ */
void showCardCarousel(
List data, int selectedIndex, boolean isDeviceLocked) {
boolean shouldAnimate = mCardCarousel.setData(data, selectedIndex);
mCardCarouselContainer.setVisibility(VISIBLE);
mErrorView.setVisibility(GONE);
- if (isDeviceLocked) {
- mWalletButton.setText(R.string.wallet_button_label_device_locked);
- } else {
- mWalletButton.setText(R.string.wallet_button_label_device_unlocked);
- }
+ renderHeaderIconAndActionButton(data.get(0), isDeviceLocked);
if (shouldAnimate) {
// If the empty state is visible, animate it away and delay the card carousel animation
int emptyStateAnimDelay = 0;
@@ -216,8 +216,12 @@ public class WalletView extends FrameLayout implements WalletCardCarousel.OnCard
return mCardCarousel;
}
- Button getWalletButton() {
- return mWalletButton;
+ Button getAppButton() {
+ return mAppButton;
+ }
+
+ Button getActionButton() {
+ return mActionButton;
}
@VisibleForTesting
@@ -235,7 +239,37 @@ public class WalletView extends FrameLayout implements WalletCardCarousel.OnCard
return mCardCarouselContainer;
}
- private static Drawable resizeDrawable(Resources resources, Drawable drawable) {
+ private void renderHeaderIconAndActionButton(WalletCardViewInfo walletCard, boolean isLocked) {
+ Drawable icon = resizeDrawable(getResources(), walletCard.getIcon());
+ renderHeaderIcon(icon, isLocked);
+ if (isLocked) {
+ mActionButton.setVisibility(VISIBLE);
+ mActionButton.setText(R.string.wallet_action_button_label_unlock);
+ } else {
+ mActionButton.setVisibility(GONE);
+ }
+ }
+
+ private void renderHeaderIcon(@Nullable Drawable icon, boolean isLocked) {
+ if (icon == null) {
+ mIcon.setVisibility(INVISIBLE);
+ return;
+ }
+ icon.setTint(mContext.getColor(isLocked ? R.color.GM2_grey_800 : R.color.GM2_blue_600));
+ mIcon.setImageDrawable(icon);
+ mIcon.setVisibility(VISIBLE);
+ mIcon.setBackground(
+ mContext.getDrawable(
+ isLocked
+ ? R.drawable.circle_wallet_secondary_56dp
+ : R.drawable.circle_wallet_primary_56dp));
+ }
+
+ @Nullable
+ private static Drawable resizeDrawable(Resources resources, @Nullable Drawable drawable) {
+ if (drawable == null) {
+ return null;
+ }
Bitmap bitmap = ((BitmapDrawable) drawable).getBitmap();
return new BitmapDrawable(resources, Bitmap.createScaledBitmap(
bitmap, CONTACTLESS_ICON_SIZE, CONTACTLESS_ICON_SIZE, true));