Update wallet tile secondary label.

- if there's no cards, change the label from "Add a card" to "Tap to open".
- if device locked, show the card's description and the card image instead of "unlock to use".

Test: manual, atest QuickAccessWalletTile
Fixes: 228969609
Change-Id: Ib591c90a77e4e2356e3309a2d0c4ce038f05f888
This commit is contained in:
Silin Huang
2022-05-02 15:41:21 -07:00
parent a436e42912
commit 287064c658
3 changed files with 10 additions and 22 deletions

View File

@@ -1211,7 +1211,7 @@
<string name="wallet_app_button_label">Show all</string>
<!-- Label of the button underneath the card carousel prompting user unlock device. [CHAR LIMIT=NONE] -->
<!-- Secondary label of the quick access wallet tile if no card. [CHAR LIMIT=NONE] -->
<string name="wallet_secondary_label_no_card">Add a card</string>
<string name="wallet_secondary_label_no_card">Tap to open</string>
<!-- Secondary label of the quick access wallet tile if wallet is still updating. [CHAR LIMIT=NONE] -->
<string name="wallet_secondary_label_updating">Updating</string>
<!-- Secondary label of the quick access wallet tile if device locked. [CHAR LIMIT=NONE] -->

View File

@@ -147,16 +147,9 @@ public class QuickAccessWalletTile extends QSTileImpl<QSTile.State> {
if (mController.getWalletClient().isWalletServiceAvailable()
&& mController.getWalletClient().isWalletFeatureAvailable()) {
if (mSelectedCard != null) {
if (isDeviceLocked) {
state.state = Tile.STATE_INACTIVE;
state.secondaryLabel =
mContext.getString(R.string.wallet_secondary_label_device_locked);
state.sideViewCustomDrawable = null;
} else {
state.state = Tile.STATE_ACTIVE;
state.secondaryLabel = mSelectedCard.getContentDescription();
state.sideViewCustomDrawable = mCardViewDrawable;
}
state.state = isDeviceLocked ? Tile.STATE_INACTIVE : Tile.STATE_ACTIVE;
state.secondaryLabel = mSelectedCard.getContentDescription();
state.sideViewCustomDrawable = mCardViewDrawable;
} else {
state.state = Tile.STATE_INACTIVE;
state.secondaryLabel =

View File

@@ -90,6 +90,7 @@ public class QuickAccessWalletTileTest extends SysuiTestCase {
private static final String CARD_ID = "card_id";
private static final String LABEL = "QAW";
private static final String CARD_DESCRIPTION = "•••• 1234";
private static final Icon CARD_IMAGE =
Icon.createWithBitmap(Bitmap.createBitmap(70, 50, Bitmap.Config.ARGB_8888));
@@ -282,9 +283,7 @@ public class QuickAccessWalletTileTest extends SysuiTestCase {
mTile.handleUpdateState(state, null);
assertEquals(Tile.STATE_ACTIVE, state.state);
assertEquals(
"•••• 1234",
state.secondaryLabel);
assertEquals(CARD_DESCRIPTION, state.secondaryLabel);
assertNotNull(state.stateDescription);
assertNotNull(state.sideViewCustomDrawable);
}
@@ -298,11 +297,9 @@ public class QuickAccessWalletTileTest extends SysuiTestCase {
mTile.handleUpdateState(state, null);
assertEquals(Tile.STATE_INACTIVE, state.state);
assertEquals(
mContext.getString(R.string.wallet_secondary_label_device_locked),
state.secondaryLabel);
assertEquals(CARD_DESCRIPTION, state.secondaryLabel);
assertNotNull(state.stateDescription);
assertNull(state.sideViewCustomDrawable);
assertNotNull(state.sideViewCustomDrawable);
}
@Test
@@ -314,9 +311,7 @@ public class QuickAccessWalletTileTest extends SysuiTestCase {
mTile.handleUpdateState(state, null);
assertEquals(Tile.STATE_ACTIVE, state.state);
assertEquals(
"•••• 1234",
state.secondaryLabel);
assertEquals(CARD_DESCRIPTION, state.secondaryLabel);
assertNotNull(state.stateDescription);
assertNotNull(state.sideViewCustomDrawable);
}
@@ -426,6 +421,6 @@ public class QuickAccessWalletTileTest extends SysuiTestCase {
private WalletCard createWalletCard(Context context) {
PendingIntent pendingIntent =
PendingIntent.getActivity(context, 0, mWalletIntent, PendingIntent.FLAG_IMMUTABLE);
return new WalletCard.Builder(CARD_ID, CARD_IMAGE, "•••• 1234", pendingIntent).build();
return new WalletCard.Builder(CARD_ID, CARD_IMAGE, CARD_DESCRIPTION, pendingIntent).build();
}
}