summaryrefslogtreecommitdiff
path: root/packages/SystemUI/src/com/android/keyguard/AnimatableClockView.java
diff options
context:
space:
mode:
Diffstat (limited to 'packages/SystemUI/src/com/android/keyguard/AnimatableClockView.java')
-rw-r--r--packages/SystemUI/src/com/android/keyguard/AnimatableClockView.java50
1 files changed, 29 insertions, 21 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/AnimatableClockView.java b/packages/SystemUI/src/com/android/keyguard/AnimatableClockView.java
index ef3104a21708..2a0c2855c3b2 100644
--- a/packages/SystemUI/src/com/android/keyguard/AnimatableClockView.java
+++ b/packages/SystemUI/src/com/android/keyguard/AnimatableClockView.java
@@ -27,7 +27,6 @@ import android.util.AttributeSet;
import android.widget.TextView;
import com.android.systemui.R;
-import com.android.systemui.statusbar.phone.KeyguardBypassController;
import java.util.Calendar;
import java.util.Locale;
@@ -111,6 +110,28 @@ public class AnimatableClockView extends TextView {
super.onDetachedFromWindow();
}
+ int getDozingWeight() {
+ if (useBoldedVersion()) {
+ return mDozingWeight + 100;
+ }
+ return mDozingWeight;
+ }
+
+ int getLockScreenWeight() {
+ if (useBoldedVersion()) {
+ return mLockScreenWeight + 100;
+ }
+ return mLockScreenWeight;
+ }
+
+ /**
+ * Whether to use a bolded version based on the user specified fontWeightAdjustment.
+ */
+ boolean useBoldedVersion() {
+ // "Bold text" fontWeightAdjustment is 300.
+ return getResources().getConfiguration().fontWeightAdjustment > 100;
+ }
+
void refreshTime() {
mTime.setTimeInMillis(System.currentTimeMillis());
setText(DateFormat.format(mFormat, mTime));
@@ -162,7 +183,7 @@ public class AnimatableClockView extends TextView {
}
setTextStyle(
- mDozingWeight,
+ getDozingWeight(),
-1 /* text size, no update */,
mLockScreenColor,
false /* animate */,
@@ -171,7 +192,7 @@ public class AnimatableClockView extends TextView {
null /* onAnimationEnd */);
setTextStyle(
- mLockScreenWeight,
+ getLockScreenWeight(),
-1 /* text size, no update */,
mLockScreenColor,
true, /* animate */
@@ -180,35 +201,22 @@ public class AnimatableClockView extends TextView {
null /* onAnimationEnd */);
}
- void animateDisappear() {
- if (mTextAnimator == null) {
- return;
- }
-
- setTextStyle(
- 0 /* weight */,
- -1 /* text size, no update */,
- null /* color, no update */,
- true /* animate */,
- KeyguardBypassController.BYPASS_FADE_DURATION /* duration */,
- 0 /* delay */,
- null /* onAnimationEnd */);
- }
-
void animateCharge(DozeStateGetter dozeStateGetter) {
if (mTextAnimator == null || mTextAnimator.isRunning()) {
// Skip charge animation if dozing animation is already playing.
return;
}
Runnable startAnimPhase2 = () -> setTextStyle(
- dozeStateGetter.isDozing() ? mDozingWeight : mLockScreenWeight/* weight */,
+ dozeStateGetter.isDozing() ? getDozingWeight() : getLockScreenWeight() /* weight */,
-1,
null,
true /* animate */,
CHARGE_ANIM_DURATION_PHASE_1,
0 /* delay */,
null /* onAnimationEnd */);
- setTextStyle(dozeStateGetter.isDozing() ? mLockScreenWeight : mDozingWeight/* weight */,
+ setTextStyle(dozeStateGetter.isDozing()
+ ? getLockScreenWeight()
+ : getDozingWeight()/* weight */,
-1,
null,
true /* animate */,
@@ -218,7 +226,7 @@ public class AnimatableClockView extends TextView {
}
void animateDoze(boolean isDozing, boolean animate) {
- setTextStyle(isDozing ? mDozingWeight : mLockScreenWeight /* weight */,
+ setTextStyle(isDozing ? getDozingWeight() : getLockScreenWeight() /* weight */,
-1,
isDozing ? mDozingColor : mLockScreenColor,
animate,