Update wallet screen to use MaterialNext colors.
before: https://screenshot.googleplex.com/3Ge4KeLTvoogMgg, https://screenshot.googleplex.com/55QxcAdLxkFMNtU. after: https://drive.google.com/file/d/1THwgmDV9KoXkRJ0tkXb-8k7yH2OqXDRF/view?usp=sharing&resourcekey=0-PuUzeCxpb7PMRijUvKL5FQ Test: manual Fix: 187727600 Change-Id: I1d14b5faa56ba7965c7d791a3d4ddaecd6b59dc6
This commit is contained in:
@@ -14,13 +14,14 @@
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License
|
||||
-->
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/GM2_blue_600"/>
|
||||
<solid android:color="@color/GM2_blue_600"/>
|
||||
android:color="?androidprv:attr/colorAccentPrimary"/>
|
||||
<solid android:color="?androidprv:attr/colorAccentPrimary"/>
|
||||
<corners android:radius="24dp"/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
~ limitations under the License.
|
||||
-->
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="?android:attr/colorControlHighlight">
|
||||
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
|
||||
<item android:id="@android:id/mask">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#DADCE0" />
|
||||
@@ -26,7 +26,7 @@
|
||||
<shape>
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/GM2_grey_900" />
|
||||
android:color="?androidprv:attr/colorAccentPrimary" />
|
||||
<corners android:radius="@dimen/wallet_empty_state_corner_radius" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
** limitations under the License.
|
||||
*/
|
||||
-->
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
|
||||
<LinearLayout
|
||||
android:id="@+id/wallet_empty_state"
|
||||
android:layout_width="match_parent"
|
||||
@@ -35,6 +36,7 @@
|
||||
android:layout_height="28dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:tint="?androidprv:attr/colorAccentPrimary"
|
||||
android:contentDescription="@null"
|
||||
android:scaleType="fitCenter"/>
|
||||
<TextView
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
-->
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipChildren="false">
|
||||
@@ -65,7 +67,7 @@
|
||||
android:paddingVertical="@dimen/wallet_button_vertical_padding"
|
||||
android:paddingHorizontal="@dimen/wallet_button_horizontal_padding"
|
||||
android:background="@drawable/wallet_action_button_bg"
|
||||
android:textColor="@color/wallet_white"
|
||||
android:textColor="?androidprv:attr/textColorPrimaryInverse"
|
||||
android:textAlignment="center"
|
||||
android:visibility="gone"/>
|
||||
|
||||
@@ -83,7 +85,7 @@
|
||||
android:paddingHorizontal="@dimen/wallet_button_horizontal_padding"
|
||||
android:background="@drawable/wallet_app_button_bg"
|
||||
android:text="@string/wallet_app_button_label"
|
||||
android:textColor="@color/GM2_blue_600"
|
||||
android:textColor="?androidprv:attr/colorAccentPrimary"
|
||||
android:textAlignment="center"
|
||||
android:layout_marginVertical="24dp"/>
|
||||
|
||||
|
||||
@@ -286,7 +286,5 @@
|
||||
<color name="accessibility_floating_menu_stroke_dark">#26FFFFFF</color> <!-- 15% -->
|
||||
|
||||
<!-- Wallet screen -->
|
||||
<color name="wallet_white">#FFFFFF</color>
|
||||
<color name="wallet_card_border">#33FFFFFF</color>
|
||||
<color name="wallet_primary_text">@color/GM2_grey_900</color>
|
||||
</resources>
|
||||
|
||||
@@ -878,12 +878,12 @@
|
||||
|
||||
<style name="Wallet.TextAppearance">
|
||||
<item name="android:fontFamily">@*android:string/config_headlineFontFamily</item>
|
||||
<item name="android:textColor">@color/wallet_primary_text</item>
|
||||
<item name="android:textColor">?android:attr/textColorPrimary</item>
|
||||
<item name="android:singleLine">true</item>
|
||||
<item name="android:textSize">14sp</item>
|
||||
</style>
|
||||
|
||||
<style name="Wallet.Theme">
|
||||
<item name="android:colorControlHighlight">@*android:color/primary_text_material_dark</item>
|
||||
<style name="Wallet.Theme" parent="@android:style/Theme.DeviceDefault">
|
||||
<item name="android:colorBackground">@android:color/system_neutral1_900</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
||||
@@ -20,13 +20,10 @@ import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Rect;
|
||||
import android.text.TextPaint;
|
||||
import android.util.MathUtils;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
@@ -39,12 +36,10 @@ final class DotIndicatorDecoration extends RecyclerView.ItemDecoration {
|
||||
@ColorInt private final int mUnselectedColor;
|
||||
@ColorInt private final int mSelectedColor;
|
||||
private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
private final TextPaint mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
|
||||
private WalletCardCarousel mCardCarousel;
|
||||
|
||||
DotIndicatorDecoration(Context context) {
|
||||
super();
|
||||
|
||||
mUnselectedRadius =
|
||||
context.getResources().getDimensionPixelSize(
|
||||
R.dimen.card_carousel_dot_unselected_radius);
|
||||
@@ -53,13 +48,8 @@ final class DotIndicatorDecoration extends RecyclerView.ItemDecoration {
|
||||
R.dimen.card_carousel_dot_selected_radius);
|
||||
mDotMargin = context.getResources().getDimensionPixelSize(R.dimen.card_carousel_dot_margin);
|
||||
|
||||
TextView textView = new TextView(context);
|
||||
mTextPaint.set(textView.getPaint());
|
||||
// Text color is not copied from text appearance.
|
||||
mTextPaint.setColor(ContextCompat.getColor(context, R.color.GM2_blue_600));
|
||||
|
||||
mUnselectedColor = ContextCompat.getColor(context, R.color.GM2_grey_300);
|
||||
mSelectedColor = ContextCompat.getColor(context, R.color.GM2_blue_600);
|
||||
mUnselectedColor = context.getColor(com.android.internal.R.color.system_neutral1_300);
|
||||
mSelectedColor = context.getColor(com.android.internal.R.color.system_neutral1_0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -107,9 +97,9 @@ final class DotIndicatorDecoration extends RecyclerView.ItemDecoration {
|
||||
int i = isLayoutLtr() ? itemsDrawn : itemCount - itemsDrawn - 1;
|
||||
|
||||
if (isSelectedItem(i)) {
|
||||
drawSelectedDot(canvas, interpolatedProgress, i);
|
||||
drawSelectedDot(canvas, interpolatedProgress);
|
||||
} else if (isNextItemInScrollingDirection(i)) {
|
||||
drawFadingUnselectedDot(canvas, interpolatedProgress, i);
|
||||
drawFadingUnselectedDot(canvas, interpolatedProgress);
|
||||
} else {
|
||||
drawUnselectedDot(canvas);
|
||||
}
|
||||
@@ -121,7 +111,7 @@ final class DotIndicatorDecoration extends RecyclerView.ItemDecoration {
|
||||
this.mCardCarousel = null; // No need to hold a reference.
|
||||
}
|
||||
|
||||
private void drawSelectedDot(Canvas canvas, float progress, int position) {
|
||||
private void drawSelectedDot(Canvas canvas, float progress) {
|
||||
// Divide progress by 2 because the other half of the animation is done by
|
||||
// drawFadingUnselectedDot.
|
||||
mPaint.setColor(
|
||||
@@ -132,13 +122,13 @@ final class DotIndicatorDecoration extends RecyclerView.ItemDecoration {
|
||||
canvas.translate(radius * 2, 0);
|
||||
}
|
||||
|
||||
private void drawFadingUnselectedDot(Canvas canvas, float progress, int position) {
|
||||
private void drawFadingUnselectedDot(Canvas canvas, float progress) {
|
||||
// Divide progress by 2 because the first half of the animation is done by drawSelectedDot.
|
||||
int blendedColor =
|
||||
ColorUtils.blendARGB(
|
||||
mUnselectedColor, mSelectedColor, progress / 2);
|
||||
mPaint.setColor(getTransitionAdjustedColor(blendedColor));
|
||||
float radius = MathUtils.lerp(mSelectedRadius, mUnselectedRadius, progress / 2);
|
||||
float radius = MathUtils.lerp(mUnselectedRadius, mSelectedColor, progress / 2);
|
||||
canvas.drawCircle(radius, 0, radius, mPaint);
|
||||
canvas.translate(radius * 2, 0);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.android.systemui.wallet.ui;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.service.quickaccesswallet.QuickAccessWalletClient;
|
||||
@@ -95,7 +96,7 @@ public class WalletActivity extends LifecycleActivity {
|
||||
}
|
||||
setTitle("");
|
||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
getActionBar().setHomeAsUpIndicator(R.drawable.ic_close);
|
||||
getActionBar().setHomeAsUpIndicator(getHomeIndicatorDrawable());
|
||||
getActionBar().setHomeActionContentDescription(R.string.accessibility_desc_close);
|
||||
WalletView walletView = requireViewById(R.id.wallet_view);
|
||||
mWalletScreenController = new WalletScreenController(
|
||||
@@ -175,4 +176,10 @@ public class WalletActivity extends LifecycleActivity {
|
||||
mWalletScreenController.onDismissed();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
private Drawable getHomeIndicatorDrawable() {
|
||||
Drawable drawable = getDrawable(R.drawable.ic_close);
|
||||
drawable.setTint(getColor(com.android.internal.R.color.system_neutral1_300));
|
||||
return drawable;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.settingslib.Utils;
|
||||
import com.android.systemui.R;
|
||||
|
||||
import java.util.List;
|
||||
@@ -100,7 +101,7 @@ public class WalletView extends FrameLayout implements WalletCardCarousel.OnCard
|
||||
public void onCardScroll(WalletCardViewInfo centerCard, WalletCardViewInfo nextCard,
|
||||
float percentDistanceFromCenter) {
|
||||
CharSequence centerCardText = getLabelText(centerCard);
|
||||
Drawable centerCardIcon = centerCard.getIcon();
|
||||
Drawable centerCardIcon = getHeaderIcon(mContext, centerCard);
|
||||
if (!TextUtils.equals(mCenterCardText, centerCardText)) {
|
||||
mCenterCardText = centerCardText;
|
||||
mCardLabel.setText(centerCardText);
|
||||
@@ -221,11 +222,27 @@ public class WalletView extends FrameLayout implements WalletCardCarousel.OnCard
|
||||
}
|
||||
|
||||
private void renderHeaderIconAndActionButton(WalletCardViewInfo walletCard, boolean isLocked) {
|
||||
mIcon.setImageDrawable(walletCard.getIcon());
|
||||
mIcon.setVisibility(VISIBLE);
|
||||
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();
|
||||
if (icon != null) {
|
||||
icon.setTint(
|
||||
Utils.getColorAttrDefaultColor(
|
||||
context, com.android.internal.R.attr.colorAccentPrimary));
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
|
||||
private void renderActionButton(WalletCardViewInfo walletCard, boolean isDeviceLocked) {
|
||||
CharSequence actionButtonText = getActionButtonText(walletCard);
|
||||
if (isDeviceLocked) {
|
||||
|
||||
Reference in New Issue
Block a user