Merge "Update wallet tile secondary label." into tm-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
8ec931fd44
@@ -1211,7 +1211,7 @@
|
|||||||
<string name="wallet_app_button_label">Show all</string>
|
<string name="wallet_app_button_label">Show all</string>
|
||||||
<!-- Label of the button underneath the card carousel prompting user unlock device. [CHAR LIMIT=NONE] -->
|
<!-- 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] -->
|
<!-- 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] -->
|
<!-- Secondary label of the quick access wallet tile if wallet is still updating. [CHAR LIMIT=NONE] -->
|
||||||
<string name="wallet_secondary_label_updating">Updating</string>
|
<string name="wallet_secondary_label_updating">Updating</string>
|
||||||
<!-- Secondary label of the quick access wallet tile if device locked. [CHAR LIMIT=NONE] -->
|
<!-- Secondary label of the quick access wallet tile if device locked. [CHAR LIMIT=NONE] -->
|
||||||
|
|||||||
@@ -147,16 +147,9 @@ public class QuickAccessWalletTile extends QSTileImpl<QSTile.State> {
|
|||||||
if (mController.getWalletClient().isWalletServiceAvailable()
|
if (mController.getWalletClient().isWalletServiceAvailable()
|
||||||
&& mController.getWalletClient().isWalletFeatureAvailable()) {
|
&& mController.getWalletClient().isWalletFeatureAvailable()) {
|
||||||
if (mSelectedCard != null) {
|
if (mSelectedCard != null) {
|
||||||
if (isDeviceLocked) {
|
state.state = isDeviceLocked ? Tile.STATE_INACTIVE : Tile.STATE_ACTIVE;
|
||||||
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.secondaryLabel = mSelectedCard.getContentDescription();
|
||||||
state.sideViewCustomDrawable = mCardViewDrawable;
|
state.sideViewCustomDrawable = mCardViewDrawable;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
state.state = Tile.STATE_INACTIVE;
|
state.state = Tile.STATE_INACTIVE;
|
||||||
state.secondaryLabel =
|
state.secondaryLabel =
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ public class QuickAccessWalletTileTest extends SysuiTestCase {
|
|||||||
|
|
||||||
private static final String CARD_ID = "card_id";
|
private static final String CARD_ID = "card_id";
|
||||||
private static final String LABEL = "QAW";
|
private static final String LABEL = "QAW";
|
||||||
|
private static final String CARD_DESCRIPTION = "•••• 1234";
|
||||||
private static final Icon CARD_IMAGE =
|
private static final Icon CARD_IMAGE =
|
||||||
Icon.createWithBitmap(Bitmap.createBitmap(70, 50, Bitmap.Config.ARGB_8888));
|
Icon.createWithBitmap(Bitmap.createBitmap(70, 50, Bitmap.Config.ARGB_8888));
|
||||||
|
|
||||||
@@ -282,9 +283,7 @@ public class QuickAccessWalletTileTest extends SysuiTestCase {
|
|||||||
mTile.handleUpdateState(state, null);
|
mTile.handleUpdateState(state, null);
|
||||||
|
|
||||||
assertEquals(Tile.STATE_ACTIVE, state.state);
|
assertEquals(Tile.STATE_ACTIVE, state.state);
|
||||||
assertEquals(
|
assertEquals(CARD_DESCRIPTION, state.secondaryLabel);
|
||||||
"•••• 1234",
|
|
||||||
state.secondaryLabel);
|
|
||||||
assertNotNull(state.stateDescription);
|
assertNotNull(state.stateDescription);
|
||||||
assertNotNull(state.sideViewCustomDrawable);
|
assertNotNull(state.sideViewCustomDrawable);
|
||||||
}
|
}
|
||||||
@@ -298,11 +297,9 @@ public class QuickAccessWalletTileTest extends SysuiTestCase {
|
|||||||
mTile.handleUpdateState(state, null);
|
mTile.handleUpdateState(state, null);
|
||||||
|
|
||||||
assertEquals(Tile.STATE_INACTIVE, state.state);
|
assertEquals(Tile.STATE_INACTIVE, state.state);
|
||||||
assertEquals(
|
assertEquals(CARD_DESCRIPTION, state.secondaryLabel);
|
||||||
mContext.getString(R.string.wallet_secondary_label_device_locked),
|
|
||||||
state.secondaryLabel);
|
|
||||||
assertNotNull(state.stateDescription);
|
assertNotNull(state.stateDescription);
|
||||||
assertNull(state.sideViewCustomDrawable);
|
assertNotNull(state.sideViewCustomDrawable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -314,9 +311,7 @@ public class QuickAccessWalletTileTest extends SysuiTestCase {
|
|||||||
mTile.handleUpdateState(state, null);
|
mTile.handleUpdateState(state, null);
|
||||||
|
|
||||||
assertEquals(Tile.STATE_ACTIVE, state.state);
|
assertEquals(Tile.STATE_ACTIVE, state.state);
|
||||||
assertEquals(
|
assertEquals(CARD_DESCRIPTION, state.secondaryLabel);
|
||||||
"•••• 1234",
|
|
||||||
state.secondaryLabel);
|
|
||||||
assertNotNull(state.stateDescription);
|
assertNotNull(state.stateDescription);
|
||||||
assertNotNull(state.sideViewCustomDrawable);
|
assertNotNull(state.sideViewCustomDrawable);
|
||||||
}
|
}
|
||||||
@@ -426,6 +421,6 @@ public class QuickAccessWalletTileTest extends SysuiTestCase {
|
|||||||
private WalletCard createWalletCard(Context context) {
|
private WalletCard createWalletCard(Context context) {
|
||||||
PendingIntent pendingIntent =
|
PendingIntent pendingIntent =
|
||||||
PendingIntent.getActivity(context, 0, mWalletIntent, PendingIntent.FLAG_IMMUTABLE);
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user