Merge "Set the same density to all displays" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
ddef40edd0
@@ -325,11 +325,10 @@ public class ScreenResolutionFragment extends RadioButtonPickerFragment {
|
||||
}
|
||||
|
||||
final DisplayDensityUtils density = new DisplayDensityUtils(mContext);
|
||||
final int currentIndex = density.getCurrentIndexForDefaultDisplay();
|
||||
final int defaultDensity = density.getDefaultDensityForDefaultDisplay();
|
||||
final int currentIndex = density.getCurrentIndex();
|
||||
final int defaultDensity = density.getDefaultDensity();
|
||||
|
||||
if (density.getDefaultDisplayDensityValues()[mCurrentIndex]
|
||||
== density.getDefaultDensityForDefaultDisplay()) {
|
||||
if (density.getValues()[mCurrentIndex] == density.getDefaultDensity()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -373,20 +372,19 @@ public class ScreenResolutionFragment extends RadioButtonPickerFragment {
|
||||
/* If current density is the same as a default density of other resolutions,
|
||||
* then mCurrentIndex may be out of boundary.
|
||||
*/
|
||||
if (density.getDefaultDisplayDensityValues().length <= mCurrentIndex) {
|
||||
mCurrentIndex = density.getCurrentIndexForDefaultDisplay();
|
||||
if (density.getValues().length <= mCurrentIndex) {
|
||||
mCurrentIndex = density.getCurrentIndex();
|
||||
}
|
||||
if (density.getDefaultDisplayDensityValues()[mCurrentIndex]
|
||||
!= density.getDefaultDensityForDefaultDisplay()) {
|
||||
if (density.getValues()[mCurrentIndex] != density.getDefaultDensity()) {
|
||||
density.setForcedDisplayDensity(mCurrentIndex);
|
||||
}
|
||||
|
||||
mDefaultDensity = density.getDefaultDensityForDefaultDisplay();
|
||||
mDefaultDensity = density.getDefaultDensity();
|
||||
}
|
||||
|
||||
private boolean isDensityChanged() {
|
||||
final DisplayDensityUtils density = new DisplayDensityUtils(mContext);
|
||||
if (density.getDefaultDensityForDefaultDisplay() == mDefaultDensity) {
|
||||
if (density.getDefaultDensity() == mDefaultDensity) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,13 +36,13 @@ public class ScreenZoomPreference extends Preference {
|
||||
android.R.attr.preferenceStyle));
|
||||
|
||||
final DisplayDensityUtils density = new DisplayDensityUtils(context);
|
||||
final int defaultIndex = density.getCurrentIndexForDefaultDisplay();
|
||||
final int defaultIndex = density.getCurrentIndex();
|
||||
if (defaultIndex < 0) {
|
||||
setVisible(false);
|
||||
setEnabled(false);
|
||||
} else if (TextUtils.isEmpty(getSummary())) {
|
||||
final String[] entries = density.getDefaultDisplayDensityEntries();
|
||||
final int currentIndex = density.getCurrentIndexForDefaultDisplay();
|
||||
final String[] entries = density.getEntries();
|
||||
final int currentIndex = density.getCurrentIndex();
|
||||
setSummary(entries[currentIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user