Loading packages/SystemUI/src/com/android/keyguard/AnimatableClockView.kt +24 −6 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.annotation.IntRange import android.annotation.SuppressLint import android.content.Context import android.graphics.Canvas import android.text.TextUtils import android.text.format.DateFormat import android.util.AttributeSet import android.util.Log Loading Loading @@ -125,13 +126,30 @@ class AnimatableClockView @JvmOverloads constructor( fun refreshTime() { time.timeInMillis = System.currentTimeMillis() text = DateFormat.format(format, time) contentDescription = DateFormat.format(descFormat, time) Log.d(tag, "refreshTime this=$this" + val formattedText = DateFormat.format(format, time) // Setting text actually triggers a layout pass (because the text view is set to // wrap_content width and TextView always relayouts for this). Avoid needless // relayout if the text didn't actually change. if (!TextUtils.equals(text, formattedText)) { text = formattedText Log.d( tag, "refreshTime this=$this" + " currTimeContextDesc=$contentDescription" + " measuredHeight=$measuredHeight" + " lastMeasureCall=$lastMeasureCall" + " isSingleLineInternal=$isSingleLineInternal") " isSingleLineInternal=$isSingleLineInternal" ) } else { Log.d( tag, "refreshTime (skipped due to unchanged text)" + " this=$this" + " currTimeContextDesc=$contentDescription" + " measuredHeight=$measuredHeight" + " lastMeasureCall=$lastMeasureCall" + " isSingleLineInternal=$isSingleLineInternal" ) } } fun onTimeZoneChanged(timeZone: TimeZone?) { Loading packages/SystemUI/src/com/android/systemui/battery/BatteryMeterView.java +10 −2 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.os.UserHandle; import android.provider.Settings; import android.text.TextUtils; import android.util.AttributeSet; import android.util.TypedValue; import android.view.Gravity; Loading Loading @@ -267,8 +268,15 @@ public class BatteryMeterView extends LinearLayout implements DarkReceiver { if (mBatteryPercentView == null) { return; } mBatteryPercentView.setText( NumberFormat.getPercentInstance().format(mLevel / 100f)); String percentText = NumberFormat.getPercentInstance().format(mLevel / 100f); // Setting text actually triggers a layout pass (because the text view is set to // wrap_content width and TextView always relayouts for this). Avoid needless // relayout if the text didn't actually change. if (!TextUtils.equals(mBatteryPercentView.getText(), percentText)) { mBatteryPercentView.setText(percentText); } setContentDescription( getContext().getString(mCharging ? R.string.accessibility_battery_level_charging : R.string.accessibility_battery_level, mLevel)); Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java +8 −1 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.os.SystemClock; import android.os.UserHandle; import android.text.Spannable; import android.text.SpannableStringBuilder; import android.text.TextUtils; import android.text.format.DateFormat; import android.text.style.CharacterStyle; import android.text.style.RelativeSizeSpan; Loading Loading @@ -291,7 +292,13 @@ public class Clock extends TextView implements final void updateClock() { if (mDemoMode) return; mCalendar.setTimeInMillis(System.currentTimeMillis()); setText(getSmallTime()); CharSequence smallTime = getSmallTime(); // Setting text actually triggers a layout pass (because the text view is set to // wrap_content width and TextView always relayouts for this). Avoid needless // relayout if the text didn't actually change. if (!TextUtils.equals(smallTime, getText())) { setText(smallTime); } setContentDescription(mContentDescriptionFormat.format(mCalendar.getTime())); } Loading Loading
packages/SystemUI/src/com/android/keyguard/AnimatableClockView.kt +24 −6 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.annotation.IntRange import android.annotation.SuppressLint import android.content.Context import android.graphics.Canvas import android.text.TextUtils import android.text.format.DateFormat import android.util.AttributeSet import android.util.Log Loading Loading @@ -125,13 +126,30 @@ class AnimatableClockView @JvmOverloads constructor( fun refreshTime() { time.timeInMillis = System.currentTimeMillis() text = DateFormat.format(format, time) contentDescription = DateFormat.format(descFormat, time) Log.d(tag, "refreshTime this=$this" + val formattedText = DateFormat.format(format, time) // Setting text actually triggers a layout pass (because the text view is set to // wrap_content width and TextView always relayouts for this). Avoid needless // relayout if the text didn't actually change. if (!TextUtils.equals(text, formattedText)) { text = formattedText Log.d( tag, "refreshTime this=$this" + " currTimeContextDesc=$contentDescription" + " measuredHeight=$measuredHeight" + " lastMeasureCall=$lastMeasureCall" + " isSingleLineInternal=$isSingleLineInternal") " isSingleLineInternal=$isSingleLineInternal" ) } else { Log.d( tag, "refreshTime (skipped due to unchanged text)" + " this=$this" + " currTimeContextDesc=$contentDescription" + " measuredHeight=$measuredHeight" + " lastMeasureCall=$lastMeasureCall" + " isSingleLineInternal=$isSingleLineInternal" ) } } fun onTimeZoneChanged(timeZone: TimeZone?) { Loading
packages/SystemUI/src/com/android/systemui/battery/BatteryMeterView.java +10 −2 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.os.UserHandle; import android.provider.Settings; import android.text.TextUtils; import android.util.AttributeSet; import android.util.TypedValue; import android.view.Gravity; Loading Loading @@ -267,8 +268,15 @@ public class BatteryMeterView extends LinearLayout implements DarkReceiver { if (mBatteryPercentView == null) { return; } mBatteryPercentView.setText( NumberFormat.getPercentInstance().format(mLevel / 100f)); String percentText = NumberFormat.getPercentInstance().format(mLevel / 100f); // Setting text actually triggers a layout pass (because the text view is set to // wrap_content width and TextView always relayouts for this). Avoid needless // relayout if the text didn't actually change. if (!TextUtils.equals(mBatteryPercentView.getText(), percentText)) { mBatteryPercentView.setText(percentText); } setContentDescription( getContext().getString(mCharging ? R.string.accessibility_battery_level_charging : R.string.accessibility_battery_level, mLevel)); Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java +8 −1 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.os.SystemClock; import android.os.UserHandle; import android.text.Spannable; import android.text.SpannableStringBuilder; import android.text.TextUtils; import android.text.format.DateFormat; import android.text.style.CharacterStyle; import android.text.style.RelativeSizeSpan; Loading Loading @@ -291,7 +292,13 @@ public class Clock extends TextView implements final void updateClock() { if (mDemoMode) return; mCalendar.setTimeInMillis(System.currentTimeMillis()); setText(getSmallTime()); CharSequence smallTime = getSmallTime(); // Setting text actually triggers a layout pass (because the text view is set to // wrap_content width and TextView always relayouts for this). Avoid needless // relayout if the text didn't actually change. if (!TextUtils.equals(smallTime, getText())) { setText(smallTime); } setContentDescription(mContentDescriptionFormat.format(mCalendar.getTime())); } Loading