[DO NOT MERGE] Bouncer - Update selected item text color am: 195baa1c93
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18030422 Change-Id: Ib8607443f68c08adf8b83c0e76f4ca4a5f581150 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
26
packages/SystemUI/res-keyguard/values-night/styles.xml
Normal file
26
packages/SystemUI/res-keyguard/values-night/styles.xml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
**
|
||||||
|
** Copyright 2022, 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.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<resources xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
|
||||||
|
<style name="Bouncer.UserSwitcher.Spinner.Item">
|
||||||
|
<item name="android:textSize">@dimen/bouncer_user_switcher_item_text_size</item>
|
||||||
|
<item name="android:textColor">@color/bouncer_user_switcher_item_text</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2022 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.
|
||||||
|
-->
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:state_selected="false"
|
||||||
|
android:color="?android:attr/textColorPrimary"/>
|
||||||
|
|
||||||
|
<item android:color="?android:attr/textColorPrimaryInverse"/>
|
||||||
|
</selector>
|
||||||
@@ -707,6 +707,10 @@ public class KeyguardSecurityContainer extends FrameLayout {
|
|||||||
mDisappearAnimRunning = false;
|
mDisappearAnimRunning = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reloadColors() {
|
||||||
|
mViewMode.reloadColors();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enscapsulates the differences between bouncer modes for the container.
|
* Enscapsulates the differences between bouncer modes for the container.
|
||||||
*/
|
*/
|
||||||
@@ -728,6 +732,9 @@ public class KeyguardSecurityContainer extends FrameLayout {
|
|||||||
/** Called when the view needs to reset or hides */
|
/** Called when the view needs to reset or hides */
|
||||||
default void reset() {};
|
default void reset() {};
|
||||||
|
|
||||||
|
/** Refresh colors */
|
||||||
|
default void reloadColors() {};
|
||||||
|
|
||||||
/** On a successful auth, optionally handle how the view disappears */
|
/** On a successful auth, optionally handle how the view disappears */
|
||||||
default void startDisappearAnimation(SecurityMode securityMode) {};
|
default void startDisappearAnimation(SecurityMode securityMode) {};
|
||||||
|
|
||||||
@@ -821,6 +828,17 @@ public class KeyguardSecurityContainer extends FrameLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reloadColors() {
|
||||||
|
TextView header = (TextView) mView.findViewById(R.id.user_switcher_header);
|
||||||
|
if (header != null) {
|
||||||
|
header.setTextColor(Utils.getColorAttrDefaultColor(mView.getContext(),
|
||||||
|
android.R.attr.textColorPrimary));
|
||||||
|
header.setBackground(mView.getContext().getDrawable(
|
||||||
|
R.drawable.bouncer_user_switcher_header_bg));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
mUserSwitcherController.removeUserSwitchCallback(mUserSwitchCallback);
|
mUserSwitcherController.removeUserSwitchCallback(mUserSwitchCallback);
|
||||||
@@ -911,6 +929,7 @@ public class KeyguardSecurityContainer extends FrameLayout {
|
|||||||
} else {
|
} else {
|
||||||
textView.setBackground(null);
|
textView.setBackground(null);
|
||||||
}
|
}
|
||||||
|
textView.setSelected(item == currentUser);
|
||||||
view.setEnabled(item.isSwitchToEnabled);
|
view.setEnabled(item.isSwitchToEnabled);
|
||||||
view.setAlpha(view.isEnabled() ? USER_SWITCH_ENABLED_ALPHA :
|
view.setAlpha(view.isEnabled() ? USER_SWITCH_ENABLED_ALPHA :
|
||||||
USER_SWITCH_DISABLED_ALPHA);
|
USER_SWITCH_DISABLED_ALPHA);
|
||||||
|
|||||||
@@ -232,12 +232,12 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
|
|||||||
new ConfigurationController.ConfigurationListener() {
|
new ConfigurationController.ConfigurationListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onThemeChanged() {
|
public void onThemeChanged() {
|
||||||
mSecurityViewFlipperController.reloadColors();
|
reloadColors();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUiModeChanged() {
|
public void onUiModeChanged() {
|
||||||
mSecurityViewFlipperController.reloadColors();
|
reloadColors();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private final KeyguardUpdateMonitorCallback mKeyguardUpdateMonitorCallback =
|
private final KeyguardUpdateMonitorCallback mKeyguardUpdateMonitorCallback =
|
||||||
@@ -635,6 +635,11 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
|
|||||||
mView.updatePositionByTouchX(x);
|
mView.updatePositionByTouchX(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void reloadColors() {
|
||||||
|
mSecurityViewFlipperController.reloadColors();
|
||||||
|
mView.reloadColors();
|
||||||
|
}
|
||||||
|
|
||||||
static class Factory {
|
static class Factory {
|
||||||
|
|
||||||
private final KeyguardSecurityContainer mView;
|
private final KeyguardSecurityContainer mView;
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import androidx.annotation.StyleRes;
|
import androidx.annotation.StyleRes;
|
||||||
|
|
||||||
|
import com.android.settingslib.Utils;
|
||||||
import com.android.systemui.animation.Interpolators;
|
import com.android.systemui.animation.Interpolators;
|
||||||
import com.android.systemui.util.Utils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides background color and radius animations for key pad buttons.
|
* Provides background color and radius animations for key pad buttons.
|
||||||
@@ -45,6 +45,7 @@ class NumPadAnimator {
|
|||||||
private int mNormalColor;
|
private int mNormalColor;
|
||||||
private int mHighlightColor;
|
private int mHighlightColor;
|
||||||
private int mStyle;
|
private int mStyle;
|
||||||
|
private TextView mDigitTextView;
|
||||||
private static final int EXPAND_ANIMATION_MS = 100;
|
private static final int EXPAND_ANIMATION_MS = 100;
|
||||||
private static final int EXPAND_COLOR_ANIMATION_MS = 50;
|
private static final int EXPAND_COLOR_ANIMATION_MS = 50;
|
||||||
private static final int CONTRACT_ANIMATION_DELAY_MS = 33;
|
private static final int CONTRACT_ANIMATION_DELAY_MS = 33;
|
||||||
@@ -58,71 +59,9 @@ class NumPadAnimator {
|
|||||||
@Nullable TextView digitTextView) {
|
@Nullable TextView digitTextView) {
|
||||||
mStyle = style;
|
mStyle = style;
|
||||||
mBackground = (GradientDrawable) drawable;
|
mBackground = (GradientDrawable) drawable;
|
||||||
|
mDigitTextView = digitTextView;
|
||||||
|
|
||||||
reloadColors(context);
|
reloadColors(context);
|
||||||
int textColorPrimary = com.android.settingslib.Utils
|
|
||||||
.getColorAttrDefaultColor(context, android.R.attr.textColorPrimary);
|
|
||||||
int textColorPrimaryInverse = com.android.settingslib.Utils
|
|
||||||
.getColorAttrDefaultColor(context, android.R.attr.textColorPrimaryInverse);
|
|
||||||
|
|
||||||
// Actual values will be updated later, usually during an onLayout() call
|
|
||||||
mExpandAnimator = ValueAnimator.ofFloat(0f, 1f);
|
|
||||||
mExpandAnimator.setDuration(EXPAND_ANIMATION_MS);
|
|
||||||
mExpandAnimator.setInterpolator(Interpolators.LINEAR);
|
|
||||||
mExpandAnimator.addUpdateListener(
|
|
||||||
anim -> mBackground.setCornerRadius((float) anim.getAnimatedValue()));
|
|
||||||
|
|
||||||
ValueAnimator expandBackgroundColorAnimator = ValueAnimator.ofObject(new ArgbEvaluator(),
|
|
||||||
mNormalColor, mHighlightColor);
|
|
||||||
expandBackgroundColorAnimator.setDuration(EXPAND_COLOR_ANIMATION_MS);
|
|
||||||
expandBackgroundColorAnimator.setInterpolator(Interpolators.LINEAR);
|
|
||||||
expandBackgroundColorAnimator.addUpdateListener(
|
|
||||||
animator -> mBackground.setColor((int) animator.getAnimatedValue()));
|
|
||||||
|
|
||||||
ValueAnimator expandTextColorAnimator =
|
|
||||||
ValueAnimator.ofObject(new ArgbEvaluator(),
|
|
||||||
textColorPrimary, textColorPrimaryInverse);
|
|
||||||
expandTextColorAnimator.setInterpolator(Interpolators.LINEAR);
|
|
||||||
expandTextColorAnimator.setDuration(EXPAND_COLOR_ANIMATION_MS);
|
|
||||||
expandTextColorAnimator.addUpdateListener(valueAnimator -> {
|
|
||||||
if (digitTextView != null) {
|
|
||||||
digitTextView.setTextColor((int) valueAnimator.getAnimatedValue());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mExpandAnimatorSet = new AnimatorSet();
|
|
||||||
mExpandAnimatorSet.playTogether(mExpandAnimator,
|
|
||||||
expandBackgroundColorAnimator, expandTextColorAnimator);
|
|
||||||
|
|
||||||
mContractAnimator = ValueAnimator.ofFloat(1f, 0f);
|
|
||||||
mContractAnimator.setStartDelay(CONTRACT_ANIMATION_DELAY_MS);
|
|
||||||
mContractAnimator.setDuration(CONTRACT_ANIMATION_MS);
|
|
||||||
mContractAnimator.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
|
|
||||||
mContractAnimator.addUpdateListener(
|
|
||||||
anim -> mBackground.setCornerRadius((float) anim.getAnimatedValue()));
|
|
||||||
ValueAnimator contractBackgroundColorAnimator = ValueAnimator.ofObject(new ArgbEvaluator(),
|
|
||||||
mHighlightColor, mNormalColor);
|
|
||||||
contractBackgroundColorAnimator.setInterpolator(Interpolators.LINEAR);
|
|
||||||
contractBackgroundColorAnimator.setStartDelay(CONTRACT_ANIMATION_DELAY_MS);
|
|
||||||
contractBackgroundColorAnimator.setDuration(CONTRACT_ANIMATION_MS);
|
|
||||||
contractBackgroundColorAnimator.addUpdateListener(
|
|
||||||
animator -> mBackground.setColor((int) animator.getAnimatedValue()));
|
|
||||||
|
|
||||||
ValueAnimator contractTextColorAnimator =
|
|
||||||
ValueAnimator.ofObject(new ArgbEvaluator(), textColorPrimaryInverse,
|
|
||||||
textColorPrimary);
|
|
||||||
contractTextColorAnimator.setInterpolator(Interpolators.LINEAR);
|
|
||||||
contractTextColorAnimator.setStartDelay(CONTRACT_ANIMATION_DELAY_MS);
|
|
||||||
contractTextColorAnimator.setDuration(CONTRACT_ANIMATION_MS);
|
|
||||||
contractTextColorAnimator.addUpdateListener(valueAnimator -> {
|
|
||||||
if (digitTextView != null) {
|
|
||||||
digitTextView.setTextColor((int) valueAnimator.getAnimatedValue());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mContractAnimatorSet = new AnimatorSet();
|
|
||||||
mContractAnimatorSet.playTogether(mContractAnimator,
|
|
||||||
contractBackgroundColorAnimator, contractTextColorAnimator);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void expand() {
|
public void expand() {
|
||||||
@@ -160,6 +99,73 @@ class NumPadAnimator {
|
|||||||
a.recycle();
|
a.recycle();
|
||||||
|
|
||||||
mBackground.setColor(mNormalColor);
|
mBackground.setColor(mNormalColor);
|
||||||
|
createAnimators(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createAnimators(Context context) {
|
||||||
|
int textColorPrimary = Utils.getColorAttrDefaultColor(context,
|
||||||
|
android.R.attr.textColorPrimary);
|
||||||
|
int textColorPrimaryInverse = Utils.getColorAttrDefaultColor(context,
|
||||||
|
android.R.attr.textColorPrimaryInverse);
|
||||||
|
|
||||||
|
// Actual values will be updated later, usually during an onLayout() call
|
||||||
|
mExpandAnimator = ValueAnimator.ofFloat(0f, 1f);
|
||||||
|
mExpandAnimator.setDuration(EXPAND_ANIMATION_MS);
|
||||||
|
mExpandAnimator.setInterpolator(Interpolators.LINEAR);
|
||||||
|
mExpandAnimator.addUpdateListener(
|
||||||
|
anim -> mBackground.setCornerRadius((float) anim.getAnimatedValue()));
|
||||||
|
|
||||||
|
ValueAnimator expandBackgroundColorAnimator = ValueAnimator.ofObject(new ArgbEvaluator(),
|
||||||
|
mNormalColor, mHighlightColor);
|
||||||
|
expandBackgroundColorAnimator.setDuration(EXPAND_COLOR_ANIMATION_MS);
|
||||||
|
expandBackgroundColorAnimator.setInterpolator(Interpolators.LINEAR);
|
||||||
|
expandBackgroundColorAnimator.addUpdateListener(
|
||||||
|
animator -> mBackground.setColor((int) animator.getAnimatedValue()));
|
||||||
|
|
||||||
|
ValueAnimator expandTextColorAnimator =
|
||||||
|
ValueAnimator.ofObject(new ArgbEvaluator(),
|
||||||
|
textColorPrimary, textColorPrimaryInverse);
|
||||||
|
expandTextColorAnimator.setInterpolator(Interpolators.LINEAR);
|
||||||
|
expandTextColorAnimator.setDuration(EXPAND_COLOR_ANIMATION_MS);
|
||||||
|
expandTextColorAnimator.addUpdateListener(valueAnimator -> {
|
||||||
|
if (mDigitTextView != null) {
|
||||||
|
mDigitTextView.setTextColor((int) valueAnimator.getAnimatedValue());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mExpandAnimatorSet = new AnimatorSet();
|
||||||
|
mExpandAnimatorSet.playTogether(mExpandAnimator,
|
||||||
|
expandBackgroundColorAnimator, expandTextColorAnimator);
|
||||||
|
|
||||||
|
mContractAnimator = ValueAnimator.ofFloat(1f, 0f);
|
||||||
|
mContractAnimator.setStartDelay(CONTRACT_ANIMATION_DELAY_MS);
|
||||||
|
mContractAnimator.setDuration(CONTRACT_ANIMATION_MS);
|
||||||
|
mContractAnimator.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
|
||||||
|
mContractAnimator.addUpdateListener(
|
||||||
|
anim -> mBackground.setCornerRadius((float) anim.getAnimatedValue()));
|
||||||
|
ValueAnimator contractBackgroundColorAnimator = ValueAnimator.ofObject(new ArgbEvaluator(),
|
||||||
|
mHighlightColor, mNormalColor);
|
||||||
|
contractBackgroundColorAnimator.setInterpolator(Interpolators.LINEAR);
|
||||||
|
contractBackgroundColorAnimator.setStartDelay(CONTRACT_ANIMATION_DELAY_MS);
|
||||||
|
contractBackgroundColorAnimator.setDuration(CONTRACT_ANIMATION_MS);
|
||||||
|
contractBackgroundColorAnimator.addUpdateListener(
|
||||||
|
animator -> mBackground.setColor((int) animator.getAnimatedValue()));
|
||||||
|
|
||||||
|
ValueAnimator contractTextColorAnimator =
|
||||||
|
ValueAnimator.ofObject(new ArgbEvaluator(), textColorPrimaryInverse,
|
||||||
|
textColorPrimary);
|
||||||
|
contractTextColorAnimator.setInterpolator(Interpolators.LINEAR);
|
||||||
|
contractTextColorAnimator.setStartDelay(CONTRACT_ANIMATION_DELAY_MS);
|
||||||
|
contractTextColorAnimator.setDuration(CONTRACT_ANIMATION_MS);
|
||||||
|
contractTextColorAnimator.addUpdateListener(valueAnimator -> {
|
||||||
|
if (mDigitTextView != null) {
|
||||||
|
mDigitTextView.setTextColor((int) valueAnimator.getAnimatedValue());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mContractAnimatorSet = new AnimatorSet();
|
||||||
|
mContractAnimatorSet.playTogether(mContractAnimator,
|
||||||
|
contractBackgroundColorAnimator, contractTextColorAnimator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user