Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e8ed11dd authored by Silin Huang's avatar Silin Huang
Browse files

Bug fix for wallet screen and lockscreen icon.

1. Make the header icon imageview a fixed size.
2. Fix an NPE for when the card doesn't have a label text.
3. The lockscreen should request 1 maxCards instead of 2 (align with the Wallet Tile)

Test: manual
Bug: 187860480
Change-Id: Ic9b015c40260a44382a97ae02aa30cb0ee15a29d
parent 0a35d1d6
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -36,8 +36,8 @@
        android:orientation="vertical">
        <ImageView
            android:id="@+id/icon"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_width="@dimen/wallet_screen_header_view_size"
            android:layout_height="@dimen/wallet_screen_header_view_size"
            android:layout_gravity="center_horizontal"
            android:layout_marginVertical="10dp"
            android:scaleType="center"
+2 −1
Original line number Diff line number Diff line
@@ -1492,7 +1492,8 @@

    <!-- Wallet activity screen specs -->
    <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_carousel_dot_offset">24dp</dimen>
    <dimen name="card_carousel_dot_unselected_radius">2dp</dimen>
+1 −1
Original line number Diff line number Diff line
@@ -929,7 +929,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
        }
        GetWalletCardsRequest request =
                new GetWalletCardsRequest(1 /* cardWidth */, 1 /* cardHeight */,
                        1 /* iconSizePx */, 2 /* maxCards */);
                        1 /* iconSizePx */, 1 /* maxCards */);
        mQuickAccessWalletClient.getWalletCards(mUiExecutor, request, mCardRetriever);
    }

+8 −2
Original line number Diff line number Diff line
@@ -234,7 +234,9 @@ public class WalletScreenController implements
        mWalletView.show();
        mWalletView.hideErrorMessage();
        int iconSizePx =
                mContext.getResources().getDimensionPixelSize(R.dimen.wallet_view_header_icon_size);
                mContext
                        .getResources()
                        .getDimensionPixelSize(R.dimen.wallet_screen_header_icon_size);
        GetWalletCardsRequest request =
                new GetWalletCardsRequest(cardWidthPx, cardHeightPx, iconSizePx, MAX_CARDS);
        mWalletClient.getWalletCards(mExecutor, request, this);
@@ -340,7 +342,11 @@ public class WalletScreenController implements

        @Override
        public CharSequence getLabel() {
            return mWalletCard.getCardLabel();
            CharSequence label = mWalletCard.getCardLabel();
            if (label == null) {
                return "";
            }
            return label;
        }

        @Override
+2 −12
Original line number Diff line number Diff line
@@ -134,7 +134,8 @@ public class WalletView extends FrameLayout implements WalletCardCarousel.OnCard
        mCardCarouselContainer.setVisibility(VISIBLE);
        mErrorView.setVisibility(GONE);
        mEmptyStateView.setVisibility(GONE);
        renderHeaderIconAndActionButton(data.get(selectedIndex), isDeviceLocked);
        mIcon.setImageDrawable(getHeaderIcon(mContext, data.get(selectedIndex)));
        renderActionButton(data.get(selectedIndex), isDeviceLocked);
        if (shouldAnimate) {
            animateViewsShown(mIcon, mCardLabel, mActionButton);
        }
@@ -221,17 +222,6 @@ public class WalletView extends FrameLayout implements WalletCardCarousel.OnCard
        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
    private static Drawable getHeaderIcon(Context context, WalletCardViewInfo walletCard) {
        Drawable icon = walletCard.getIcon();