diff options
author | Sean Pont <seanpont@google.com> | 2020-05-31 02:41:04 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-05-31 02:41:04 +0000 |
commit | 2a3e1e0c1d673c8bdf9a9d64772e31d759a9c001 (patch) | |
tree | a0470a7c4c57a0e99e9bfb43147925acca38ee92 | |
parent | dd205b112698d830dc4f72e12946156d0c1c5b73 (diff) | |
parent | d9300f77619b3482f421976daf3580ad3d989b0f (diff) | |
download | QuickAccessWallet-2a3e1e0c1d673c8bdf9a9d64772e31d759a9c001.tar.gz |
Add light border to quick access wallet cards am: d9300f7761
Change-Id: I7d2fefccc6e5fddb32a1440c2440a55f749b2237
-rw-r--r-- | res/layout/wallet_card_view.xml | 4 | ||||
-rw-r--r-- | res/values/colors.xml | 2 | ||||
-rw-r--r-- | res/values/dimens.xml | 1 | ||||
-rw-r--r-- | src/com/android/systemui/plugin/globalactions/wallet/WalletCardView.java | 56 |
4 files changed, 60 insertions, 3 deletions
diff --git a/res/layout/wallet_card_view.xml b/res/layout/wallet_card_view.xml index 3e2ad4c..8c320a7 100644 --- a/res/layout/wallet_card_view.xml +++ b/res/layout/wallet_card_view.xml @@ -20,7 +20,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content"> - <androidx.cardview.widget.CardView + <com.android.systemui.plugin.globalactions.wallet.WalletCardView android:id="@+id/card" android:layout_width="match_parent" android:layout_height="match_parent" @@ -35,5 +35,5 @@ android:adjustViewBounds="true" android:contentDescription="@null" android:scaleType="fitXY" /> - </androidx.cardview.widget.CardView> + </com.android.systemui.plugin.globalactions.wallet.WalletCardView> </FrameLayout>
\ No newline at end of file diff --git a/res/values/colors.xml b/res/values/colors.xml index e393de6..e4e1271 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -22,5 +22,5 @@ <color name="wallet_primary_text">@color/wallet_grey_100</color> <color name="wallet_more_vert">@*android:color/foreground_material_dark</color> <color name="wallet_secondary_text">@color/wallet_grey_500</color> - + <color name="wallet_card_border">#33FFFFFF</color> </resources> diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 4df223b..eeeeeb0 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -10,4 +10,5 @@ <dimen name="wallet_menu_vertical_offset">-36dp</dimen> <dimen name="wallet_menu_horizontal_offset">12dp</dimen> <dimen name="wallet_menu_padding_vertical">48dp</dimen> + <dimen name="wallet_card_border_width">1dp</dimen> </resources> diff --git a/src/com/android/systemui/plugin/globalactions/wallet/WalletCardView.java b/src/com/android/systemui/plugin/globalactions/wallet/WalletCardView.java new file mode 100644 index 0000000..e57a3b0 --- /dev/null +++ b/src/com/android/systemui/plugin/globalactions/wallet/WalletCardView.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.plugin.globalactions.wallet; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.util.AttributeSet; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.cardview.widget.CardView; + +/** + * A CardView that draws a light border around its contents. This is done to make black cards easier + * to see against the black background of the global actions menu. On more brightly colored cards, + * the border is barely visible. + */ +public class WalletCardView extends CardView { + private final Paint mBorderPaint; + + public WalletCardView(@NonNull Context context) { + this(context, null); + } + + public WalletCardView(@NonNull Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + mBorderPaint = new Paint(); + mBorderPaint.setColor(context.getColor(R.color.wallet_card_border)); + mBorderPaint.setStrokeWidth( + context.getResources().getDimension(R.dimen.wallet_card_border_width)); + mBorderPaint.setStyle(Paint.Style.STROKE); + mBorderPaint.setAntiAlias(true); + } + + @Override + public void draw(Canvas canvas) { + super.draw(canvas); + float radius = getRadius(); + canvas.drawRoundRect(0, 0, getWidth(), getHeight(), radius, radius, mBorderPaint); + } +} |