Merge "Add logout button style" into sc-qpr1-dev

This commit is contained in:
TreeHugger Robot
2021-09-13 16:55:49 +00:00
committed by Android (Google) Code Review
6 changed files with 27 additions and 9 deletions

View File

@@ -142,4 +142,8 @@
<item name="android:shadowColor">@color/keyguard_shadow_color</item> <item name="android:shadowColor">@color/keyguard_shadow_color</item>
<item name="android:shadowRadius">?attr/shadowRadius</item> <item name="android:shadowRadius">?attr/shadowRadius</item>
</style> </style>
<style name="TextAppearance.Keyguard.BottomArea.Button">
<item name="android:shadowRadius">0</item>
</style>
</resources> </resources>

View File

@@ -17,7 +17,8 @@
--> -->
<shape xmlns:android="http://schemas.android.com/apk/res/android" <shape xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
android:shape="rectangle"> android:shape="rectangle">
<solid android:color="@color/logout_button_bg_color"/> <solid android:color="?androidprv:attr/colorAccentPrimary"/>
<corners android:radius="@dimen/logout_button_corner_radius"/> <corners android:radius="@dimen/logout_button_corner_radius"/>
</shape> </shape>

View File

@@ -190,9 +190,6 @@
<color name="udfps_enroll_progress">#ff669DF6</color> <!-- blue 400 --> <color name="udfps_enroll_progress">#ff669DF6</color> <!-- blue 400 -->
<color name="udfps_enroll_progress_help">#ffEE675C</color> <!-- red 400 --> <color name="udfps_enroll_progress_help">#ffEE675C</color> <!-- red 400 -->
<!-- Logout button -->
<color name="logout_button_bg_color">#ccffffff</color>
<!-- Color for the Assistant invocation lights --> <!-- Color for the Assistant invocation lights -->
<color name="default_invocation_lights_color">#ffffffff</color> <!-- white --> <color name="default_invocation_lights_color">#ffffffff</color> <!-- white -->

View File

@@ -1242,10 +1242,7 @@
<integer name="wired_charging_keyguard_text_animation_distance">-30</integer> <integer name="wired_charging_keyguard_text_animation_distance">-30</integer>
<!-- Logout button --> <!-- Logout button -->
<dimen name="logout_button_layout_height">32dp</dimen> <dimen name="logout_button_corner_radius">50dp</dimen>
<dimen name="logout_button_padding_horizontal">16dp</dimen>
<dimen name="logout_button_margin_bottom">12dp</dimen>
<dimen name="logout_button_corner_radius">4dp</dimen>
<!-- Blur radius on status bar window and power menu --> <!-- Blur radius on status bar window and power menu -->
<dimen name="min_window_blur_radius">1px</dimen> <dimen name="min_window_blur_radius">1px</dimen>

View File

@@ -66,6 +66,7 @@ import com.android.internal.widget.LockPatternUtils;
import com.android.internal.widget.ViewClippingUtil; import com.android.internal.widget.ViewClippingUtil;
import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.settingslib.Utils;
import com.android.settingslib.fuelgauge.BatteryStatus; import com.android.settingslib.fuelgauge.BatteryStatus;
import com.android.systemui.R; import com.android.systemui.R;
import com.android.systemui.animation.Interpolators; import com.android.systemui.animation.Interpolators;
@@ -455,7 +456,8 @@ public class KeyguardIndicationController {
new KeyguardIndication.Builder() new KeyguardIndication.Builder()
.setMessage(mContext.getResources().getString( .setMessage(mContext.getResources().getString(
com.android.internal.R.string.global_action_logout)) com.android.internal.R.string.global_action_logout))
.setTextColor(mInitialTextColorState) .setTextColor(Utils.getColorAttr(
mContext, com.android.internal.R.attr.textColorOnAccent))
.setBackground(mContext.getDrawable( .setBackground(mContext.getDrawable(
com.android.systemui.R.drawable.logout_button_background)) com.android.systemui.R.drawable.logout_button_background))
.setClickListener((view) -> { .setClickListener((view) -> {

View File

@@ -28,7 +28,10 @@ import android.util.AttributeSet;
import android.view.View; import android.view.View;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.StyleRes;
import com.android.internal.annotations.VisibleForTesting; import com.android.internal.annotations.VisibleForTesting;
import com.android.systemui.R;
import com.android.systemui.animation.Interpolators; import com.android.systemui.animation.Interpolators;
import com.android.systemui.keyguard.KeyguardIndication; import com.android.systemui.keyguard.KeyguardIndication;
@@ -39,6 +42,12 @@ import java.util.LinkedList;
*/ */
public class KeyguardIndicationTextView extends TextView { public class KeyguardIndicationTextView extends TextView {
private static final long MSG_MIN_DURATION_MILLIS_DEFAULT = 1500; private static final long MSG_MIN_DURATION_MILLIS_DEFAULT = 1500;
@StyleRes
private static int sStyleId = R.style.TextAppearance_Keyguard_BottomArea;
@StyleRes
private static int sButtonStyleId = R.style.TextAppearance_Keyguard_BottomArea_Button;
private long mNextAnimationTime = 0; private long mNextAnimationTime = 0;
private boolean mAnimationsEnabled = true; private boolean mAnimationsEnabled = true;
private LinkedList<CharSequence> mMessages = new LinkedList<>(); private LinkedList<CharSequence> mMessages = new LinkedList<>();
@@ -136,6 +145,14 @@ public class KeyguardIndicationTextView extends TextView {
public void onAnimationEnd(Animator animator) { public void onAnimationEnd(Animator animator) {
KeyguardIndication info = mKeyguardIndicationInfo.poll(); KeyguardIndication info = mKeyguardIndicationInfo.poll();
if (info != null) { if (info != null) {
// First, update the style.
// If a background is set on the text, we don't want shadow on the text
if (info.getBackground() != null) {
setTextAppearance(sButtonStyleId);
} else {
setTextAppearance(sStyleId);
}
setBackground(info.getBackground());
setTextColor(info.getTextColor()); setTextColor(info.getTextColor());
setOnClickListener(info.getClickListener()); setOnClickListener(info.getClickListener());
setClickable(info.getClickListener() != null); setClickable(info.getClickListener() != null);