Merge "Reinitialize dimens to fix issues with changing display/font size." into sc-dev

This commit is contained in:
Josh Tsuji
2021-06-15 14:56:29 +00:00
committed by Android (Google) Code Review

View File

@@ -151,12 +151,12 @@ public class VolumeDialogImpl implements VolumeDialog,
private final int mDialogShowAnimationDurationMs; private final int mDialogShowAnimationDurationMs;
private final int mDialogHideAnimationDurationMs; private final int mDialogHideAnimationDurationMs;
private final int mDialogWidth; private int mDialogWidth;
private final int mDialogCornerRadius; private int mDialogCornerRadius;
private final int mRingerDrawerItemSize; private int mRingerDrawerItemSize;
private final int mRingerRowsPadding; private int mRingerRowsPadding;
private final boolean mShowVibrate; private boolean mShowVibrate;
private final int mRingerCount; private int mRingerCount;
private final boolean mShowLowMediaVolumeIcon; private final boolean mShowLowMediaVolumeIcon;
private final boolean mChangeVolumeRowTintWhenInactive; private final boolean mChangeVolumeRowTintWhenInactive;
@@ -288,18 +288,8 @@ public class VolumeDialogImpl implements VolumeDialog,
mDialogRowsView.invalidate(); 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. initDimens();
mRingerCount = mShowVibrate ? 3 : 2;
} }
@Override @Override
@@ -378,6 +368,8 @@ public class VolumeDialogImpl implements VolumeDialog,
private void initDialog() { private void initDialog() {
mDialog = new CustomDialog(mContext); mDialog = new CustomDialog(mContext);
initDimens();
mConfigurableTexts = new ConfigurableTexts(mContext); mConfigurableTexts = new ConfigurableTexts(mContext);
mHovering = false; mHovering = false;
mShowing = false; mShowing = false;
@@ -569,6 +561,21 @@ public class VolumeDialogImpl implements VolumeDialog,
initODICaptionsH(); 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() { protected ViewGroup getDialogView() {
return mDialogView; return mDialogView;
} }