Merge "Wallet screen UI Polish:" into sc-dev
This commit is contained in:
@@ -883,5 +883,6 @@
|
|||||||
|
|
||||||
<style name="Wallet.Theme" parent="@android:style/Theme.DeviceDefault">
|
<style name="Wallet.Theme" parent="@android:style/Theme.DeviceDefault">
|
||||||
<item name="android:colorBackground">@android:color/system_neutral1_900</item>
|
<item name="android:colorBackground">@android:color/system_neutral1_900</item>
|
||||||
|
<item name="android:itemBackground">@android:color/system_neutral1_800</item>
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -104,15 +104,14 @@ public class WalletView extends FrameLayout implements WalletCardCarousel.OnCard
|
|||||||
float percentDistanceFromCenter) {
|
float percentDistanceFromCenter) {
|
||||||
CharSequence centerCardText = getLabelText(centerCard);
|
CharSequence centerCardText = getLabelText(centerCard);
|
||||||
Drawable centerCardIcon = getHeaderIcon(mContext, centerCard);
|
Drawable centerCardIcon = getHeaderIcon(mContext, centerCard);
|
||||||
if (!TextUtils.equals(mCenterCardText, centerCardText)) {
|
renderActionButton(centerCard, mIsDeviceLocked, mIsUdfpsEnabled);
|
||||||
mCenterCardText = centerCardText;
|
if (centerCard.isUiEquivalent(nextCard)) {
|
||||||
|
mCardLabel.setAlpha(1f);
|
||||||
|
mIcon.setAlpha(1f);
|
||||||
|
mActionButton.setAlpha(1f);
|
||||||
|
} else {
|
||||||
mCardLabel.setText(centerCardText);
|
mCardLabel.setText(centerCardText);
|
||||||
mIcon.setImageDrawable(centerCardIcon);
|
mIcon.setImageDrawable(centerCardIcon);
|
||||||
}
|
|
||||||
renderActionButton(centerCard, mIsDeviceLocked, mIsUdfpsEnabled);
|
|
||||||
if (TextUtils.equals(centerCardText, getLabelText(nextCard))) {
|
|
||||||
mCardLabel.setAlpha(1f);
|
|
||||||
} else {
|
|
||||||
mCardLabel.setAlpha(percentDistanceFromCenter);
|
mCardLabel.setAlpha(percentDistanceFromCenter);
|
||||||
mIcon.setAlpha(percentDistanceFromCenter);
|
mIcon.setAlpha(percentDistanceFromCenter);
|
||||||
mActionButton.setAlpha(percentDistanceFromCenter);
|
mActionButton.setAlpha(percentDistanceFromCenter);
|
||||||
@@ -141,6 +140,7 @@ public class WalletView extends FrameLayout implements WalletCardCarousel.OnCard
|
|||||||
mErrorView.setVisibility(GONE);
|
mErrorView.setVisibility(GONE);
|
||||||
mEmptyStateView.setVisibility(GONE);
|
mEmptyStateView.setVisibility(GONE);
|
||||||
mIcon.setImageDrawable(getHeaderIcon(mContext, data.get(selectedIndex)));
|
mIcon.setImageDrawable(getHeaderIcon(mContext, data.get(selectedIndex)));
|
||||||
|
mCardLabel.setText(getLabelText(data.get(selectedIndex)));
|
||||||
renderActionButton(data.get(selectedIndex), isDeviceLocked, mIsUdfpsEnabled);
|
renderActionButton(data.get(selectedIndex), isDeviceLocked, mIsUdfpsEnabled);
|
||||||
if (shouldAnimate) {
|
if (shouldAnimate) {
|
||||||
animateViewsShown(mIcon, mCardLabel, mActionButton);
|
animateViewsShown(mIcon, mCardLabel, mActionButton);
|
||||||
@@ -248,20 +248,20 @@ public class WalletView extends FrameLayout implements WalletCardCarousel.OnCard
|
|||||||
private void renderActionButton(
|
private void renderActionButton(
|
||||||
WalletCardViewInfo walletCard, boolean isDeviceLocked, boolean isUdfpsEnabled) {
|
WalletCardViewInfo walletCard, boolean isDeviceLocked, boolean isUdfpsEnabled) {
|
||||||
CharSequence actionButtonText = getActionButtonText(walletCard);
|
CharSequence actionButtonText = getActionButtonText(walletCard);
|
||||||
if (!isUdfpsEnabled && isDeviceLocked) {
|
if (!isUdfpsEnabled && actionButtonText != null) {
|
||||||
mActionButton.setVisibility(VISIBLE);
|
mActionButton.setVisibility(VISIBLE);
|
||||||
mActionButton.setText(R.string.wallet_action_button_label_unlock);
|
|
||||||
mActionButton.setOnClickListener(mDeviceLockedActionOnClickListener);
|
|
||||||
} else if (!isDeviceLocked && actionButtonText != null) {
|
|
||||||
mActionButton.setText(actionButtonText);
|
mActionButton.setText(actionButtonText);
|
||||||
mActionButton.setVisibility(VISIBLE);
|
mActionButton.setOnClickListener(
|
||||||
mActionButton.setOnClickListener(v -> {
|
isDeviceLocked
|
||||||
|
? mDeviceLockedActionOnClickListener
|
||||||
|
: v -> {
|
||||||
try {
|
try {
|
||||||
walletCard.getPendingIntent().send();
|
walletCard.getPendingIntent().send();
|
||||||
} catch (PendingIntent.CanceledException e) {
|
} catch (PendingIntent.CanceledException e) {
|
||||||
Log.w(TAG, "Error sending pending intent for wallet card");
|
Log.w(TAG, "Error sending pending intent for wallet card.");
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
mActionButton.setVisibility(GONE);
|
mActionButton.setVisibility(GONE);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ import java.util.Collections;
|
|||||||
@SmallTest
|
@SmallTest
|
||||||
public class WalletScreenControllerTest extends SysuiTestCase {
|
public class WalletScreenControllerTest extends SysuiTestCase {
|
||||||
|
|
||||||
private static final int MAX_CARDS = 10;
|
|
||||||
private static final int CARD_CAROUSEL_WIDTH = 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_1 = "card_id_1";
|
||||||
private static final String CARD_ID_2 = "card_id_2";
|
private static final String CARD_ID_2 = "card_id_2";
|
||||||
@@ -158,7 +157,7 @@ public class WalletScreenControllerTest extends SysuiTestCase {
|
|||||||
when(mKeyguardStateController.isUnlocked()).thenReturn(false);
|
when(mKeyguardStateController.isUnlocked()).thenReturn(false);
|
||||||
GetWalletCardsResponse response =
|
GetWalletCardsResponse response =
|
||||||
new GetWalletCardsResponse(
|
new GetWalletCardsResponse(
|
||||||
Collections.singletonList(createWalletCard(mContext)), 0);
|
Collections.singletonList(createLockedWalletCard(mContext)), 0);
|
||||||
|
|
||||||
mController.queryWalletCards();
|
mController.queryWalletCards();
|
||||||
mTestableLooper.processAllMessages();
|
mTestableLooper.processAllMessages();
|
||||||
@@ -406,6 +405,15 @@ public class WalletScreenControllerTest extends SysuiTestCase {
|
|||||||
.build();
|
.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) {
|
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);
|
||||||
|
|||||||
Reference in New Issue
Block a user