Merge changes from topic "ss_next_alarm" into sc-dev
* changes: Smartspace - Next alarm Cleanup support for multiple PIN views
This commit is contained in:
@@ -20,7 +20,7 @@ import android.app.PendingIntent;
|
|||||||
import android.app.smartspace.SmartspaceAction;
|
import android.app.smartspace.SmartspaceAction;
|
||||||
import android.app.smartspace.SmartspaceTarget;
|
import android.app.smartspace.SmartspaceTarget;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.drawable.Icon;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@@ -93,9 +93,14 @@ public interface BcSmartspaceDataPlugin extends Plugin {
|
|||||||
void setFalsingManager(com.android.systemui.plugins.FalsingManager falsingManager);
|
void setFalsingManager(com.android.systemui.plugins.FalsingManager falsingManager);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set or clear any Do Not Disturb information.
|
* Set or clear Do Not Disturb information.
|
||||||
*/
|
*/
|
||||||
void setDnd(@Nullable Icon dndIcon, @Nullable String description);
|
void setDnd(@Nullable Drawable image, @Nullable String description);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set or clear next alarm information
|
||||||
|
*/
|
||||||
|
void setNextAlarm(@Nullable Drawable image, @Nullable String description);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Interface for launching Intents, which can differ on the lockscreen */
|
/** Interface for launching Intents, which can differ on the lockscreen */
|
||||||
|
|||||||
@@ -16,23 +16,14 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
-->
|
-->
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
<ripple
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:color="?android:attr/colorControlHighlight">
|
||||||
<item android:id="@+id/background">
|
<item android:id="@+id/background">
|
||||||
<shape>
|
<shape>
|
||||||
<solid android:color="?android:attr/colorControlNormal" />
|
<solid android:color="?android:attr/colorControlNormal" />
|
||||||
<corners android:radius="10dp" />
|
<corners android:radius="10dp" />
|
||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
<item android:id="@+id/ripple">
|
</ripple>
|
||||||
<ripple
|
|
||||||
android:color="?android:attr/colorControlHighlight">
|
|
||||||
<item android:id="@android:id/mask">
|
|
||||||
<shape android:shape="rectangle">
|
|
||||||
<solid android:color="?android:attr/colorControlNormal" />
|
|
||||||
<corners android:radius="10dp" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
</ripple>
|
|
||||||
</item>
|
|
||||||
</layer-list>
|
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ import com.android.keyguard.KeyguardSecurityModel.SecurityMode;
|
|||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.classifier.FalsingCollector;
|
import com.android.systemui.classifier.FalsingCollector;
|
||||||
import com.android.systemui.dagger.qualifiers.Main;
|
import com.android.systemui.dagger.qualifiers.Main;
|
||||||
import com.android.systemui.statusbar.FeatureFlags;
|
|
||||||
import com.android.systemui.util.ViewController;
|
import com.android.systemui.util.ViewController;
|
||||||
import com.android.systemui.util.concurrency.DelayableExecutor;
|
import com.android.systemui.util.concurrency.DelayableExecutor;
|
||||||
|
|
||||||
@@ -167,7 +166,6 @@ public abstract class KeyguardInputViewController<T extends KeyguardInputView>
|
|||||||
private final TelephonyManager mTelephonyManager;
|
private final TelephonyManager mTelephonyManager;
|
||||||
private final EmergencyButtonController.Factory mEmergencyButtonControllerFactory;
|
private final EmergencyButtonController.Factory mEmergencyButtonControllerFactory;
|
||||||
private final FalsingCollector mFalsingCollector;
|
private final FalsingCollector mFalsingCollector;
|
||||||
private final boolean mIsNewLayoutEnabled;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public Factory(KeyguardUpdateMonitor keyguardUpdateMonitor,
|
public Factory(KeyguardUpdateMonitor keyguardUpdateMonitor,
|
||||||
@@ -177,8 +175,7 @@ public abstract class KeyguardInputViewController<T extends KeyguardInputView>
|
|||||||
InputMethodManager inputMethodManager, @Main DelayableExecutor mainExecutor,
|
InputMethodManager inputMethodManager, @Main DelayableExecutor mainExecutor,
|
||||||
@Main Resources resources, LiftToActivateListener liftToActivateListener,
|
@Main Resources resources, LiftToActivateListener liftToActivateListener,
|
||||||
TelephonyManager telephonyManager, FalsingCollector falsingCollector,
|
TelephonyManager telephonyManager, FalsingCollector falsingCollector,
|
||||||
EmergencyButtonController.Factory emergencyButtonControllerFactory,
|
EmergencyButtonController.Factory emergencyButtonControllerFactory) {
|
||||||
FeatureFlags featureFlags) {
|
|
||||||
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
|
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
|
||||||
mLockPatternUtils = lockPatternUtils;
|
mLockPatternUtils = lockPatternUtils;
|
||||||
mLatencyTracker = latencyTracker;
|
mLatencyTracker = latencyTracker;
|
||||||
@@ -190,7 +187,6 @@ public abstract class KeyguardInputViewController<T extends KeyguardInputView>
|
|||||||
mTelephonyManager = telephonyManager;
|
mTelephonyManager = telephonyManager;
|
||||||
mEmergencyButtonControllerFactory = emergencyButtonControllerFactory;
|
mEmergencyButtonControllerFactory = emergencyButtonControllerFactory;
|
||||||
mFalsingCollector = falsingCollector;
|
mFalsingCollector = falsingCollector;
|
||||||
mIsNewLayoutEnabled = featureFlags.isKeyguardLayoutEnabled();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Create a new {@link KeyguardInputViewController}. */
|
/** Create a new {@link KeyguardInputViewController}. */
|
||||||
@@ -216,20 +212,19 @@ public abstract class KeyguardInputViewController<T extends KeyguardInputView>
|
|||||||
return new KeyguardPinViewController((KeyguardPINView) keyguardInputView,
|
return new KeyguardPinViewController((KeyguardPINView) keyguardInputView,
|
||||||
mKeyguardUpdateMonitor, securityMode, mLockPatternUtils,
|
mKeyguardUpdateMonitor, securityMode, mLockPatternUtils,
|
||||||
keyguardSecurityCallback, mMessageAreaControllerFactory, mLatencyTracker,
|
keyguardSecurityCallback, mMessageAreaControllerFactory, mLatencyTracker,
|
||||||
mLiftToActivateListener, emergencyButtonController, mFalsingCollector,
|
mLiftToActivateListener, emergencyButtonController, mFalsingCollector);
|
||||||
mIsNewLayoutEnabled);
|
|
||||||
} else if (keyguardInputView instanceof KeyguardSimPinView) {
|
} else if (keyguardInputView instanceof KeyguardSimPinView) {
|
||||||
return new KeyguardSimPinViewController((KeyguardSimPinView) keyguardInputView,
|
return new KeyguardSimPinViewController((KeyguardSimPinView) keyguardInputView,
|
||||||
mKeyguardUpdateMonitor, securityMode, mLockPatternUtils,
|
mKeyguardUpdateMonitor, securityMode, mLockPatternUtils,
|
||||||
keyguardSecurityCallback, mMessageAreaControllerFactory, mLatencyTracker,
|
keyguardSecurityCallback, mMessageAreaControllerFactory, mLatencyTracker,
|
||||||
mLiftToActivateListener, mTelephonyManager, mFalsingCollector,
|
mLiftToActivateListener, mTelephonyManager, mFalsingCollector,
|
||||||
emergencyButtonController, mIsNewLayoutEnabled);
|
emergencyButtonController);
|
||||||
} else if (keyguardInputView instanceof KeyguardSimPukView) {
|
} else if (keyguardInputView instanceof KeyguardSimPukView) {
|
||||||
return new KeyguardSimPukViewController((KeyguardSimPukView) keyguardInputView,
|
return new KeyguardSimPukViewController((KeyguardSimPukView) keyguardInputView,
|
||||||
mKeyguardUpdateMonitor, securityMode, mLockPatternUtils,
|
mKeyguardUpdateMonitor, securityMode, mLockPatternUtils,
|
||||||
keyguardSecurityCallback, mMessageAreaControllerFactory, mLatencyTracker,
|
keyguardSecurityCallback, mMessageAreaControllerFactory, mLatencyTracker,
|
||||||
mLiftToActivateListener, mTelephonyManager, mFalsingCollector,
|
mLiftToActivateListener, mTelephonyManager, mFalsingCollector,
|
||||||
emergencyButtonController, mIsNewLayoutEnabled);
|
emergencyButtonController);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new RuntimeException("Unable to find controller for " + keyguardInputView);
|
throw new RuntimeException("Unable to find controller for " + keyguardInputView);
|
||||||
|
|||||||
@@ -168,20 +168,6 @@ public abstract class KeyguardPinBasedInputView extends KeyguardAbsKeyInputView
|
|||||||
return mButtons;
|
return mButtons;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* By default, the new layout will be enabled. When false, revert to the old style.
|
|
||||||
*/
|
|
||||||
public void setIsNewLayoutEnabled(boolean isEnabled) {
|
|
||||||
if (!isEnabled) {
|
|
||||||
for (int i = 0; i < mButtons.length; i++) {
|
|
||||||
mButtons[i].disableNewLayout();
|
|
||||||
}
|
|
||||||
mDeleteButton.disableNewLayout();
|
|
||||||
mOkButton.disableNewLayout();
|
|
||||||
reloadColors();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reload colors from resources.
|
* Reload colors from resources.
|
||||||
**/
|
**/
|
||||||
|
|||||||
@@ -35,12 +35,11 @@ public class KeyguardPinViewController
|
|||||||
KeyguardMessageAreaController.Factory messageAreaControllerFactory,
|
KeyguardMessageAreaController.Factory messageAreaControllerFactory,
|
||||||
LatencyTracker latencyTracker, LiftToActivateListener liftToActivateListener,
|
LatencyTracker latencyTracker, LiftToActivateListener liftToActivateListener,
|
||||||
EmergencyButtonController emergencyButtonController,
|
EmergencyButtonController emergencyButtonController,
|
||||||
FalsingCollector falsingCollector, boolean isNewLayoutEnabled) {
|
FalsingCollector falsingCollector) {
|
||||||
super(view, keyguardUpdateMonitor, securityMode, lockPatternUtils, keyguardSecurityCallback,
|
super(view, keyguardUpdateMonitor, securityMode, lockPatternUtils, keyguardSecurityCallback,
|
||||||
messageAreaControllerFactory, latencyTracker, liftToActivateListener,
|
messageAreaControllerFactory, latencyTracker, liftToActivateListener,
|
||||||
emergencyButtonController, falsingCollector);
|
emergencyButtonController, falsingCollector);
|
||||||
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
|
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
|
||||||
view.setIsNewLayoutEnabled(isNewLayoutEnabled);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -79,14 +79,13 @@ public class KeyguardSimPinViewController
|
|||||||
KeyguardMessageAreaController.Factory messageAreaControllerFactory,
|
KeyguardMessageAreaController.Factory messageAreaControllerFactory,
|
||||||
LatencyTracker latencyTracker, LiftToActivateListener liftToActivateListener,
|
LatencyTracker latencyTracker, LiftToActivateListener liftToActivateListener,
|
||||||
TelephonyManager telephonyManager, FalsingCollector falsingCollector,
|
TelephonyManager telephonyManager, FalsingCollector falsingCollector,
|
||||||
EmergencyButtonController emergencyButtonController, boolean isNewLayoutEnabled) {
|
EmergencyButtonController emergencyButtonController) {
|
||||||
super(view, keyguardUpdateMonitor, securityMode, lockPatternUtils, keyguardSecurityCallback,
|
super(view, keyguardUpdateMonitor, securityMode, lockPatternUtils, keyguardSecurityCallback,
|
||||||
messageAreaControllerFactory, latencyTracker, liftToActivateListener,
|
messageAreaControllerFactory, latencyTracker, liftToActivateListener,
|
||||||
emergencyButtonController, falsingCollector);
|
emergencyButtonController, falsingCollector);
|
||||||
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
|
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
|
||||||
mTelephonyManager = telephonyManager;
|
mTelephonyManager = telephonyManager;
|
||||||
mSimImageView = mView.findViewById(R.id.keyguard_sim);
|
mSimImageView = mView.findViewById(R.id.keyguard_sim);
|
||||||
view.setIsNewLayoutEnabled(isNewLayoutEnabled);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -85,14 +85,13 @@ public class KeyguardSimPukViewController
|
|||||||
KeyguardMessageAreaController.Factory messageAreaControllerFactory,
|
KeyguardMessageAreaController.Factory messageAreaControllerFactory,
|
||||||
LatencyTracker latencyTracker, LiftToActivateListener liftToActivateListener,
|
LatencyTracker latencyTracker, LiftToActivateListener liftToActivateListener,
|
||||||
TelephonyManager telephonyManager, FalsingCollector falsingCollector,
|
TelephonyManager telephonyManager, FalsingCollector falsingCollector,
|
||||||
EmergencyButtonController emergencyButtonController, boolean isNewLayoutEnabled) {
|
EmergencyButtonController emergencyButtonController) {
|
||||||
super(view, keyguardUpdateMonitor, securityMode, lockPatternUtils, keyguardSecurityCallback,
|
super(view, keyguardUpdateMonitor, securityMode, lockPatternUtils, keyguardSecurityCallback,
|
||||||
messageAreaControllerFactory, latencyTracker, liftToActivateListener,
|
messageAreaControllerFactory, latencyTracker, liftToActivateListener,
|
||||||
emergencyButtonController, falsingCollector);
|
emergencyButtonController, falsingCollector);
|
||||||
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
|
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
|
||||||
mTelephonyManager = telephonyManager;
|
mTelephonyManager = telephonyManager;
|
||||||
mSimImageView = mView.findViewById(R.id.keyguard_sim);
|
mSimImageView = mView.findViewById(R.id.keyguard_sim);
|
||||||
view.setIsNewLayoutEnabled(isNewLayoutEnabled);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import android.content.Context;
|
|||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.drawable.GradientDrawable;
|
import android.graphics.drawable.GradientDrawable;
|
||||||
import android.graphics.drawable.LayerDrawable;
|
|
||||||
import android.graphics.drawable.RippleDrawable;
|
import android.graphics.drawable.RippleDrawable;
|
||||||
import android.view.ContextThemeWrapper;
|
import android.view.ContextThemeWrapper;
|
||||||
|
|
||||||
@@ -40,17 +39,14 @@ class NumPadAnimator {
|
|||||||
private ValueAnimator mContractAnimator;
|
private ValueAnimator mContractAnimator;
|
||||||
private GradientDrawable mBackground;
|
private GradientDrawable mBackground;
|
||||||
private RippleDrawable mRipple;
|
private RippleDrawable mRipple;
|
||||||
private GradientDrawable mRippleMask;
|
|
||||||
private int mNormalColor;
|
private int mNormalColor;
|
||||||
private int mHighlightColor;
|
private int mHighlightColor;
|
||||||
private int mStyle;
|
private int mStyle;
|
||||||
|
|
||||||
NumPadAnimator(Context context, LayerDrawable drawable, @StyleRes int style) {
|
NumPadAnimator(Context context, final RippleDrawable drawable, @StyleRes int style) {
|
||||||
LayerDrawable ld = (LayerDrawable) drawable.mutate();
|
|
||||||
mBackground = (GradientDrawable) ld.findDrawableByLayerId(R.id.background);
|
|
||||||
mRipple = (RippleDrawable) ld.findDrawableByLayerId(R.id.ripple);
|
|
||||||
mRippleMask = (GradientDrawable) mRipple.findDrawableByLayerId(android.R.id.mask);
|
|
||||||
mStyle = style;
|
mStyle = style;
|
||||||
|
mRipple = (RippleDrawable) drawable.mutate();
|
||||||
|
mBackground = (GradientDrawable) mRipple.findDrawableByLayerId(R.id.background);
|
||||||
|
|
||||||
reloadColors(context);
|
reloadColors(context);
|
||||||
|
|
||||||
@@ -62,7 +58,7 @@ class NumPadAnimator {
|
|||||||
mExpandAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
mExpandAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||||
public void onAnimationUpdate(ValueAnimator anim) {
|
public void onAnimationUpdate(ValueAnimator anim) {
|
||||||
mBackground.setCornerRadius((float) anim.getAnimatedValue());
|
mBackground.setCornerRadius((float) anim.getAnimatedValue());
|
||||||
mRippleMask.setCornerRadius((float) anim.getAnimatedValue());
|
mRipple.invalidateSelf();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -73,7 +69,7 @@ class NumPadAnimator {
|
|||||||
mContractAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
mContractAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||||
public void onAnimationUpdate(ValueAnimator anim) {
|
public void onAnimationUpdate(ValueAnimator anim) {
|
||||||
mBackground.setCornerRadius((float) anim.getAnimatedValue());
|
mBackground.setCornerRadius((float) anim.getAnimatedValue());
|
||||||
mRippleMask.setCornerRadius((float) anim.getAnimatedValue());
|
mRipple.invalidateSelf();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mAnimator.playSequentially(mExpandAnimator, mContractAnimator);
|
mAnimator.playSequentially(mExpandAnimator, mContractAnimator);
|
||||||
|
|||||||
@@ -16,37 +16,22 @@
|
|||||||
package com.android.keyguard;
|
package com.android.keyguard;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.ColorStateList;
|
import android.graphics.drawable.RippleDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.graphics.drawable.LayerDrawable;
|
|
||||||
import android.graphics.drawable.VectorDrawable;
|
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.ContextThemeWrapper;
|
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
|
|
||||||
import com.android.settingslib.Utils;
|
|
||||||
import com.android.systemui.R;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Similar to the {@link NumPadKey}, but displays an image.
|
* Similar to the {@link NumPadKey}, but displays an image.
|
||||||
*/
|
*/
|
||||||
public class NumPadButton extends AlphaOptimizedImageButton {
|
public class NumPadButton extends AlphaOptimizedImageButton {
|
||||||
|
|
||||||
@Nullable
|
|
||||||
private NumPadAnimator mAnimator;
|
private NumPadAnimator mAnimator;
|
||||||
|
|
||||||
public NumPadButton(Context context, AttributeSet attrs) {
|
public NumPadButton(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
|
|
||||||
Drawable background = getBackground();
|
mAnimator = new NumPadAnimator(context, (RippleDrawable) getBackground(),
|
||||||
if (background instanceof LayerDrawable) {
|
attrs.getStyleAttribute());
|
||||||
mAnimator = new NumPadAnimator(context, (LayerDrawable) background,
|
|
||||||
attrs.getStyleAttribute());
|
|
||||||
} else {
|
|
||||||
mAnimator = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -56,7 +41,7 @@ public class NumPadButton extends AlphaOptimizedImageButton {
|
|||||||
// Set width/height to the same value to ensure a smooth circle for the bg, but shrink
|
// Set width/height to the same value to ensure a smooth circle for the bg, but shrink
|
||||||
// the height to match the old pin bouncer
|
// the height to match the old pin bouncer
|
||||||
int width = getMeasuredWidth();
|
int width = getMeasuredWidth();
|
||||||
int height = mAnimator == null ? (int) (width * .75f) : width;
|
int height = width;
|
||||||
|
|
||||||
setMeasuredDimension(getMeasuredWidth(), height);
|
setMeasuredDimension(getMeasuredWidth(), height);
|
||||||
}
|
}
|
||||||
@@ -65,13 +50,13 @@ public class NumPadButton extends AlphaOptimizedImageButton {
|
|||||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||||
super.onLayout(changed, l, t, r, b);
|
super.onLayout(changed, l, t, r, b);
|
||||||
|
|
||||||
if (mAnimator != null) mAnimator.onLayout(b - t);
|
mAnimator.onLayout(b - t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouchEvent(MotionEvent event) {
|
public boolean onTouchEvent(MotionEvent event) {
|
||||||
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
|
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
|
||||||
if (mAnimator != null) mAnimator.start();
|
mAnimator.start();
|
||||||
}
|
}
|
||||||
return super.onTouchEvent(event);
|
return super.onTouchEvent(event);
|
||||||
}
|
}
|
||||||
@@ -80,25 +65,6 @@ public class NumPadButton extends AlphaOptimizedImageButton {
|
|||||||
* Reload colors from resources.
|
* Reload colors from resources.
|
||||||
**/
|
**/
|
||||||
public void reloadColors() {
|
public void reloadColors() {
|
||||||
if (mAnimator != null) {
|
mAnimator.reloadColors(getContext());
|
||||||
mAnimator.reloadColors(getContext());
|
|
||||||
} else {
|
|
||||||
// Needed for old style pin
|
|
||||||
int textColor = Utils.getColorAttr(getContext(), android.R.attr.textColorPrimary)
|
|
||||||
.getDefaultColor();
|
|
||||||
((VectorDrawable) getDrawable()).setTintList(ColorStateList.valueOf(textColor));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* By default, the new layout will be enabled. Invoking will revert to the old style
|
|
||||||
*/
|
|
||||||
public void disableNewLayout() {
|
|
||||||
if (mAnimator != null) {
|
|
||||||
mAnimator = null;
|
|
||||||
ContextThemeWrapper ctw = new ContextThemeWrapper(getContext(), R.style.NumPadKey);
|
|
||||||
setBackground(getContext().getResources().getDrawable(
|
|
||||||
R.drawable.ripple_drawable_pin, ctw.getTheme()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,12 +18,10 @@ package com.android.keyguard;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.RippleDrawable;
|
||||||
import android.graphics.drawable.LayerDrawable;
|
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.ContextThemeWrapper;
|
|
||||||
import android.view.HapticFeedbackConstants;
|
import android.view.HapticFeedbackConstants;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
@@ -32,8 +30,6 @@ import android.view.ViewGroup;
|
|||||||
import android.view.accessibility.AccessibilityManager;
|
import android.view.accessibility.AccessibilityManager;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
|
|
||||||
import com.android.internal.widget.LockPatternUtils;
|
import com.android.internal.widget.LockPatternUtils;
|
||||||
import com.android.settingslib.Utils;
|
import com.android.settingslib.Utils;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
@@ -51,7 +47,6 @@ public class NumPadKey extends ViewGroup {
|
|||||||
private int mTextViewResId;
|
private int mTextViewResId;
|
||||||
private PasswordTextView mTextView;
|
private PasswordTextView mTextView;
|
||||||
|
|
||||||
@Nullable
|
|
||||||
private NumPadAnimator mAnimator;
|
private NumPadAnimator mAnimator;
|
||||||
|
|
||||||
private View.OnClickListener mListener = new View.OnClickListener() {
|
private View.OnClickListener mListener = new View.OnClickListener() {
|
||||||
@@ -131,26 +126,8 @@ public class NumPadKey extends ViewGroup {
|
|||||||
|
|
||||||
setContentDescription(mDigitText.getText().toString());
|
setContentDescription(mDigitText.getText().toString());
|
||||||
|
|
||||||
Drawable background = getBackground();
|
mAnimator = new NumPadAnimator(context, (RippleDrawable) getBackground(),
|
||||||
if (background instanceof LayerDrawable) {
|
R.style.NumPadKey);
|
||||||
mAnimator = new NumPadAnimator(context, (LayerDrawable) background,
|
|
||||||
R.style.NumPadKey);
|
|
||||||
} else {
|
|
||||||
mAnimator = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* By default, the new layout will be enabled. Invoking will revert to the old style
|
|
||||||
*/
|
|
||||||
public void disableNewLayout() {
|
|
||||||
findViewById(R.id.klondike_text).setVisibility(View.VISIBLE);
|
|
||||||
if (mAnimator != null) {
|
|
||||||
mAnimator = null;
|
|
||||||
ContextThemeWrapper ctw = new ContextThemeWrapper(getContext(), R.style.NumPadKey);
|
|
||||||
setBackground(getContext().getResources().getDrawable(
|
|
||||||
R.drawable.ripple_drawable_pin, ctw.getTheme()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -164,14 +141,14 @@ public class NumPadKey extends ViewGroup {
|
|||||||
mDigitText.setTextColor(textColor);
|
mDigitText.setTextColor(textColor);
|
||||||
mKlondikeText.setTextColor(klondikeColor);
|
mKlondikeText.setTextColor(klondikeColor);
|
||||||
|
|
||||||
if (mAnimator != null) mAnimator.reloadColors(getContext());
|
mAnimator.reloadColors(getContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouchEvent(MotionEvent event) {
|
public boolean onTouchEvent(MotionEvent event) {
|
||||||
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
|
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
|
||||||
doHapticKeyClick();
|
doHapticKeyClick();
|
||||||
if (mAnimator != null) mAnimator.start();
|
mAnimator.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.onTouchEvent(event);
|
return super.onTouchEvent(event);
|
||||||
@@ -185,7 +162,7 @@ public class NumPadKey extends ViewGroup {
|
|||||||
// Set width/height to the same value to ensure a smooth circle for the bg, but shrink
|
// Set width/height to the same value to ensure a smooth circle for the bg, but shrink
|
||||||
// the height to match the old pin bouncer
|
// the height to match the old pin bouncer
|
||||||
int width = getMeasuredWidth();
|
int width = getMeasuredWidth();
|
||||||
int height = mAnimator == null ? (int) (width * .75f) : width;
|
int height = width;
|
||||||
|
|
||||||
setMeasuredDimension(getMeasuredWidth(), height);
|
setMeasuredDimension(getMeasuredWidth(), height);
|
||||||
}
|
}
|
||||||
@@ -206,7 +183,7 @@ public class NumPadKey extends ViewGroup {
|
|||||||
left = centerX - mKlondikeText.getMeasuredWidth() / 2;
|
left = centerX - mKlondikeText.getMeasuredWidth() / 2;
|
||||||
mKlondikeText.layout(left, top, left + mKlondikeText.getMeasuredWidth(), bottom);
|
mKlondikeText.layout(left, top, left + mKlondikeText.getMeasuredWidth(), bottom);
|
||||||
|
|
||||||
if (mAnimator != null) mAnimator.onLayout(b - t);
|
mAnimator.onLayout(b - t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import android.app.smartspace.SmartspaceTarget;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.UserInfo;
|
import android.content.pm.UserInfo;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.drawable.Icon;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.test.suitebuilder.annotation.SmallTest;
|
import android.test.suitebuilder.annotation.SmallTest;
|
||||||
@@ -394,6 +394,8 @@ public class KeyguardClockSwitchControllerTest extends SysuiTestCase {
|
|||||||
|
|
||||||
public void setFalsingManager(FalsingManager falsingManager) { }
|
public void setFalsingManager(FalsingManager falsingManager) { }
|
||||||
|
|
||||||
public void setDnd(@Nullable Icon dndIcon, @Nullable String description) { }
|
public void setDnd(@Nullable Drawable dndIcon, @Nullable String description) { }
|
||||||
|
|
||||||
|
public void setNextAlarm(@Nullable Drawable dndIcon, @Nullable String description) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user