fix(non linear font scaling): fix QQS clock text right padding may not proper when font sclaing changed
After increasing the font size and resetting to normal, the clock text in QQS has too much right padding. The reason is the clock cached wid th are not reset so it would keep using the width that cached for large font size. Therefore, we reset the cached width when font scaling changed so that it would be updated when next onMeasure for clock view. Bug: 282111042 Test: manually - video attached in bug Change-Id: If1a0855e8676435721913d714b4fa584ef9377e6
This commit is contained in:
@@ -266,6 +266,7 @@ constructor(
|
||||
lastInsets?.let { updateConstraintsForInsets(header, it) }
|
||||
updateResources()
|
||||
updateCarrierGroupPadding()
|
||||
clock.onDensityOrFontScaleChanged()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -374,6 +374,13 @@ public class Clock extends TextView implements
|
||||
|
||||
@Override
|
||||
public void onDensityOrFontScaleChanged() {
|
||||
reloadDimens();
|
||||
}
|
||||
|
||||
private void reloadDimens() {
|
||||
// reset mCachedWidth so the new width would be updated properly when next onMeasure
|
||||
mCachedWidth = -1;
|
||||
|
||||
FontSizeUtils.updateFontSize(this, R.dimen.status_bar_clock_size);
|
||||
setPaddingRelative(
|
||||
mContext.getResources().getDimensionPixelSize(
|
||||
|
||||
Reference in New Issue
Block a user