Update clock position

Take into account the descent of the font.
For numeral fonts that support languages such as
Burmese, this space can be significant.

Test: atest KeyguardClockSwitchControllerTest
Test: manual
Fixes: 220158349
Change-Id: I778d9988e78ddde89a245f0383954ec9203bc185
This commit is contained in:
Beverly
2022-02-23 19:02:37 +00:00
committed by Beverly Tai
parent 5bfedf550f
commit d519839411
2 changed files with 14 additions and 2 deletions

View File

@@ -163,6 +163,18 @@ public class AnimatableClockController extends ViewController<AnimatableClockVie
mStatusBarStateController.removeCallback(mStatusBarStateListener);
}
/**
* @return the number of pixels below the baseline. For fonts that support languages such as
* Burmese, this space can be significant.
*/
public float getBottom() {
if (mView.getPaint() != null && mView.getPaint().getFontMetrics() != null) {
return mView.getPaint().getFontMetrics().bottom;
}
return 0f;
}
/** Animate the clock appearance */
public void animateAppear() {
if (!mIsDozing) mView.animateAppearOnLockscreen();

View File

@@ -292,8 +292,8 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
private void updateClockLayout() {
int largeClockTopMargin = getContext().getResources().getDimensionPixelSize(
R.dimen.keyguard_large_clock_top_margin);
R.dimen.keyguard_large_clock_top_margin)
- (int) mLargeClockViewController.getBottom();
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(MATCH_PARENT,
MATCH_PARENT);
lp.topMargin = largeClockTopMargin;