Reinitialize dimens to fix issues with changing display/font size.

Fixes: 189411240
Test: change display size and back without rebooting
Change-Id: Id8b56ab1a8b985bffcc4f087d9e5db70f2a01c5f
This commit is contained in:
Josh Tsuji
2021-06-10 17:41:31 -04:00
parent 20da155df4
commit e6147842f5

View File

@@ -151,12 +151,12 @@ public class VolumeDialogImpl implements VolumeDialog,
private final int mDialogShowAnimationDurationMs;
private final int mDialogHideAnimationDurationMs;
private final int mDialogWidth;
private final int mDialogCornerRadius;
private final int mRingerDrawerItemSize;
private final int mRingerRowsPadding;
private final boolean mShowVibrate;
private final int mRingerCount;
private int mDialogWidth;
private int mDialogCornerRadius;
private int mRingerDrawerItemSize;
private int mRingerRowsPadding;
private boolean mShowVibrate;
private int mRingerCount;
private final boolean mShowLowMediaVolumeIcon;
private final boolean mChangeVolumeRowTintWhenInactive;
@@ -288,18 +288,8 @@ public class VolumeDialogImpl implements VolumeDialog,
mDialogRowsView.invalidate();
};
}
mDialogWidth = mContext.getResources().getDimensionPixelSize(
R.dimen.volume_dialog_panel_width);
mDialogCornerRadius = mContext.getResources().getDimensionPixelSize(
R.dimen.volume_dialog_panel_width_half);
mRingerDrawerItemSize = mContext.getResources().getDimensionPixelSize(
R.dimen.volume_ringer_drawer_item_size);
mRingerRowsPadding = mContext.getResources().getDimensionPixelSize(
R.dimen.volume_dialog_ringer_rows_padding);
mShowVibrate = mController.hasVibrator();
// Normal, mute, and possibly vibrate.
mRingerCount = mShowVibrate ? 3 : 2;
initDimens();
}
@Override
@@ -378,6 +368,8 @@ public class VolumeDialogImpl implements VolumeDialog,
private void initDialog() {
mDialog = new CustomDialog(mContext);
initDimens();
mConfigurableTexts = new ConfigurableTexts(mContext);
mHovering = false;
mShowing = false;
@@ -569,6 +561,21 @@ public class VolumeDialogImpl implements VolumeDialog,
initODICaptionsH();
}
private void initDimens() {
mDialogWidth = mContext.getResources().getDimensionPixelSize(
R.dimen.volume_dialog_panel_width);
mDialogCornerRadius = mContext.getResources().getDimensionPixelSize(
R.dimen.volume_dialog_panel_width_half);
mRingerDrawerItemSize = mContext.getResources().getDimensionPixelSize(
R.dimen.volume_ringer_drawer_item_size);
mRingerRowsPadding = mContext.getResources().getDimensionPixelSize(
R.dimen.volume_dialog_ringer_rows_padding);
mShowVibrate = mController.hasVibrator();
// Normal, mute, and possibly vibrate.
mRingerCount = mShowVibrate ? 3 : 2;
}
protected ViewGroup getDialogView() {
return mDialogView;
}