Merge "Bug fix for wallet screen and lockscreen icon." into sc-dev

This commit is contained in:
TreeHugger Robot
2021-05-12 14:55:41 +00:00
committed by Android (Google) Code Review
5 changed files with 15 additions and 18 deletions

View File

@@ -36,8 +36,8 @@
android:orientation="vertical"> android:orientation="vertical">
<ImageView <ImageView
android:id="@+id/icon" android:id="@+id/icon"
android:layout_width="wrap_content" android:layout_width="@dimen/wallet_screen_header_view_size"
android:layout_height="wrap_content" android:layout_height="@dimen/wallet_screen_header_view_size"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginVertical="10dp" android:layout_marginVertical="10dp"
android:scaleType="center" android:scaleType="center"

View File

@@ -1492,7 +1492,8 @@
<!-- Wallet activity screen specs --> <!-- Wallet activity screen specs -->
<dimen name="wallet_icon_size">36sp</dimen> <dimen name="wallet_icon_size">36sp</dimen>
<dimen name="wallet_view_header_icon_size">56dp</dimen> <dimen name="wallet_screen_header_icon_size">56dp</dimen>
<dimen name="wallet_screen_header_view_size">80dp</dimen>
<dimen name="card_margin">16dp</dimen> <dimen name="card_margin">16dp</dimen>
<dimen name="card_carousel_dot_offset">24dp</dimen> <dimen name="card_carousel_dot_offset">24dp</dimen>
<dimen name="card_carousel_dot_unselected_radius">2dp</dimen> <dimen name="card_carousel_dot_unselected_radius">2dp</dimen>

View File

@@ -929,7 +929,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
} }
GetWalletCardsRequest request = GetWalletCardsRequest request =
new GetWalletCardsRequest(1 /* cardWidth */, 1 /* cardHeight */, new GetWalletCardsRequest(1 /* cardWidth */, 1 /* cardHeight */,
1 /* iconSizePx */, 2 /* maxCards */); 1 /* iconSizePx */, 1 /* maxCards */);
mQuickAccessWalletClient.getWalletCards(mUiExecutor, request, mCardRetriever); mQuickAccessWalletClient.getWalletCards(mUiExecutor, request, mCardRetriever);
} }

View File

@@ -234,7 +234,9 @@ public class WalletScreenController implements
mWalletView.show(); mWalletView.show();
mWalletView.hideErrorMessage(); mWalletView.hideErrorMessage();
int iconSizePx = int iconSizePx =
mContext.getResources().getDimensionPixelSize(R.dimen.wallet_view_header_icon_size); mContext
.getResources()
.getDimensionPixelSize(R.dimen.wallet_screen_header_icon_size);
GetWalletCardsRequest request = GetWalletCardsRequest request =
new GetWalletCardsRequest(cardWidthPx, cardHeightPx, iconSizePx, MAX_CARDS); new GetWalletCardsRequest(cardWidthPx, cardHeightPx, iconSizePx, MAX_CARDS);
mWalletClient.getWalletCards(mExecutor, request, this); mWalletClient.getWalletCards(mExecutor, request, this);
@@ -340,7 +342,11 @@ public class WalletScreenController implements
@Override @Override
public CharSequence getLabel() { public CharSequence getLabel() {
return mWalletCard.getCardLabel(); CharSequence label = mWalletCard.getCardLabel();
if (label == null) {
return "";
}
return label;
} }
@Override @Override

View File

@@ -134,7 +134,8 @@ public class WalletView extends FrameLayout implements WalletCardCarousel.OnCard
mCardCarouselContainer.setVisibility(VISIBLE); mCardCarouselContainer.setVisibility(VISIBLE);
mErrorView.setVisibility(GONE); mErrorView.setVisibility(GONE);
mEmptyStateView.setVisibility(GONE); mEmptyStateView.setVisibility(GONE);
renderHeaderIconAndActionButton(data.get(selectedIndex), isDeviceLocked); mIcon.setImageDrawable(getHeaderIcon(mContext, data.get(selectedIndex)));
renderActionButton(data.get(selectedIndex), isDeviceLocked);
if (shouldAnimate) { if (shouldAnimate) {
animateViewsShown(mIcon, mCardLabel, mActionButton); animateViewsShown(mIcon, mCardLabel, mActionButton);
} }
@@ -221,17 +222,6 @@ public class WalletView extends FrameLayout implements WalletCardCarousel.OnCard
return mCardLabel; return mCardLabel;
} }
private void renderHeaderIconAndActionButton(WalletCardViewInfo walletCard, boolean isLocked) {
Drawable icon = getHeaderIcon(mContext, walletCard);
if (icon != null) {
mIcon.setImageDrawable(walletCard.getIcon());
mIcon.setVisibility(VISIBLE);
} else {
mIcon.setVisibility(INVISIBLE);
}
renderActionButton(walletCard, isLocked);
}
@Nullable @Nullable
private static Drawable getHeaderIcon(Context context, WalletCardViewInfo walletCard) { private static Drawable getHeaderIcon(Context context, WalletCardViewInfo walletCard) {
Drawable icon = walletCard.getIcon(); Drawable icon = walletCard.getIcon();