diff options
| author | 2021-06-18 11:46:05 -0700 | |
|---|---|---|
| committer | 2021-06-18 12:35:17 -0700 | |
| commit | 5097a4fbd670bdb43dde138dbe5f73fe6087d832 (patch) | |
| tree | ec8d4f07ee37ef46ace8af7825768c8dc7e0c217 | |
| parent | 4ed9ab51ff449deb6788ae7b472a6e39ebb15fc5 (diff) | |
Wallet screen UI Polish:
1. update the fading effect for action button.
2. the action button will depend on whether the card above it has the
second line label.
3. update the options menu item background to 1 shade lighter grey.
Test: manual, see demo:
https: //drive.google.com/file/d/1TLc6t1Ola6G_QiU0yadWdh1nLbQnEJ7g/view?usp=sharing&resourcekey=0-f1qKR8nLjvo0VrtLqKBE9w
Bug: 190760488
Bug: 190531125
Change-Id: I012694e9ff0a252f6ce918043f6bf7dcd01ba97e
3 files changed, 29 insertions, 20 deletions
diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml index 97273a88e9c0..7a5a3480d0c5 100644 --- a/packages/SystemUI/res/values/styles.xml +++ b/packages/SystemUI/res/values/styles.xml @@ -883,5 +883,6 @@ <style name="Wallet.Theme" parent="@android:style/Theme.DeviceDefault"> <item name="android:colorBackground">@android:color/system_neutral1_900</item> + <item name="android:itemBackground">@android:color/system_neutral1_800</item> </style> </resources> 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 8412a8ae966e..0c5347724035 100644 --- a/packages/SystemUI/src/com/android/systemui/wallet/ui/WalletView.java +++ b/packages/SystemUI/src/com/android/systemui/wallet/ui/WalletView.java @@ -104,15 +104,14 @@ public class WalletView extends FrameLayout implements WalletCardCarousel.OnCard float percentDistanceFromCenter) { CharSequence centerCardText = getLabelText(centerCard); Drawable centerCardIcon = getHeaderIcon(mContext, centerCard); - if (!TextUtils.equals(mCenterCardText, centerCardText)) { - mCenterCardText = centerCardText; - mCardLabel.setText(centerCardText); - mIcon.setImageDrawable(centerCardIcon); - } renderActionButton(centerCard, mIsDeviceLocked, mIsUdfpsEnabled); - if (TextUtils.equals(centerCardText, getLabelText(nextCard))) { + if (centerCard.isUiEquivalent(nextCard)) { mCardLabel.setAlpha(1f); + mIcon.setAlpha(1f); + mActionButton.setAlpha(1f); } else { + mCardLabel.setText(centerCardText); + mIcon.setImageDrawable(centerCardIcon); mCardLabel.setAlpha(percentDistanceFromCenter); mIcon.setAlpha(percentDistanceFromCenter); mActionButton.setAlpha(percentDistanceFromCenter); @@ -141,6 +140,7 @@ public class WalletView extends FrameLayout implements WalletCardCarousel.OnCard mErrorView.setVisibility(GONE); mEmptyStateView.setVisibility(GONE); mIcon.setImageDrawable(getHeaderIcon(mContext, data.get(selectedIndex))); + mCardLabel.setText(getLabelText(data.get(selectedIndex))); renderActionButton(data.get(selectedIndex), isDeviceLocked, mIsUdfpsEnabled); if (shouldAnimate) { animateViewsShown(mIcon, mCardLabel, mActionButton); @@ -248,20 +248,20 @@ public class WalletView extends FrameLayout implements WalletCardCarousel.OnCard private void renderActionButton( WalletCardViewInfo walletCard, boolean isDeviceLocked, boolean isUdfpsEnabled) { CharSequence actionButtonText = getActionButtonText(walletCard); - if (!isUdfpsEnabled && isDeviceLocked) { + if (!isUdfpsEnabled && actionButtonText != null) { mActionButton.setVisibility(VISIBLE); - mActionButton.setText(R.string.wallet_action_button_label_unlock); - mActionButton.setOnClickListener(mDeviceLockedActionOnClickListener); - } else if (!isDeviceLocked && actionButtonText != null) { mActionButton.setText(actionButtonText); - mActionButton.setVisibility(VISIBLE); - mActionButton.setOnClickListener(v -> { - try { - walletCard.getPendingIntent().send(); - } catch (PendingIntent.CanceledException e) { - Log.w(TAG, "Error sending pending intent for wallet card"); - } - }); + mActionButton.setOnClickListener( + isDeviceLocked + ? mDeviceLockedActionOnClickListener + : v -> { + try { + walletCard.getPendingIntent().send(); + } catch (PendingIntent.CanceledException e) { + Log.w(TAG, "Error sending pending intent for wallet card."); + } + } + ); } else { mActionButton.setVisibility(GONE); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/wallet/ui/WalletScreenControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/wallet/ui/WalletScreenControllerTest.java index e6c740b3a263..30180897f5d7 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/wallet/ui/WalletScreenControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/wallet/ui/WalletScreenControllerTest.java @@ -67,7 +67,6 @@ import java.util.Collections; @SmallTest public class WalletScreenControllerTest extends SysuiTestCase { - private static final int MAX_CARDS = 10; private static final int CARD_CAROUSEL_WIDTH = 10; private static final String CARD_ID_1 = "card_id_1"; private static final String CARD_ID_2 = "card_id_2"; @@ -158,7 +157,7 @@ public class WalletScreenControllerTest extends SysuiTestCase { when(mKeyguardStateController.isUnlocked()).thenReturn(false); GetWalletCardsResponse response = new GetWalletCardsResponse( - Collections.singletonList(createWalletCard(mContext)), 0); + Collections.singletonList(createLockedWalletCard(mContext)), 0); mController.queryWalletCards(); mTestableLooper.processAllMessages(); @@ -406,6 +405,15 @@ public class WalletScreenControllerTest extends SysuiTestCase { .build(); } + private WalletCard createLockedWalletCard(Context context) { + PendingIntent pendingIntent = + PendingIntent.getActivity(context, 0, mWalletIntent, PendingIntent.FLAG_IMMUTABLE); + return new WalletCard.Builder(CARD_ID_2, createIcon(), "•••• 5679", pendingIntent) + .setCardIcon(createIcon()) + .setCardLabel("Locked\nUnlock to pay") + .build(); + } + private WalletCard createWalletCard(Context context) { PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, mWalletIntent, PendingIntent.FLAG_IMMUTABLE); |