Remove unnecessary onDeveloperOptionsSwitchEnabled/Disabled override.
- default implementation has been added in the super class to handle enabling/disabling the preference when the master developer options switch it turned on/off. Removing all subclass that originally implemented the methods that only contains the default behavior. Bug: 73955632 Test: make RunSettingsRoboTests Change-Id: I13c372c2ab498a5786b40cdc1ad3b5f3424abb5a
This commit is contained in:
@@ -20,22 +20,19 @@ import android.content.Context;
|
||||
import android.provider.Settings;
|
||||
import android.support.v7.preference.ListPreference;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceScreen;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
|
||||
public class SecondaryDisplayPreferenceController extends
|
||||
DeveloperOptionsPreferenceController implements
|
||||
Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
|
||||
public class SecondaryDisplayPreferenceController extends DeveloperOptionsPreferenceController
|
||||
implements Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
|
||||
|
||||
private static final String OVERLAY_DISPLAY_DEVICES_KEY = "overlay_display_devices";
|
||||
|
||||
private final String[] mListValues;
|
||||
private final String[] mListSummaries;
|
||||
private ListPreference mPreference;
|
||||
|
||||
public SecondaryDisplayPreferenceController(Context context) {
|
||||
super(context);
|
||||
@@ -50,13 +47,6 @@ public class SecondaryDisplayPreferenceController extends
|
||||
return OVERLAY_DISPLAY_DEVICES_KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayPreference(PreferenceScreen screen) {
|
||||
super.displayPreference(screen);
|
||||
|
||||
mPreference = (ListPreference) screen.findPreference(getPreferenceKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
writeSecondaryDisplayDevicesOption(newValue.toString());
|
||||
@@ -68,15 +58,10 @@ public class SecondaryDisplayPreferenceController extends
|
||||
updateSecondaryDisplayDevicesOptions();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDeveloperOptionsSwitchEnabled() {
|
||||
mPreference.setEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDeveloperOptionsSwitchDisabled() {
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
writeSecondaryDisplayDevicesOption(null);
|
||||
mPreference.setEnabled(false);
|
||||
}
|
||||
|
||||
private void updateSecondaryDisplayDevicesOptions() {
|
||||
@@ -89,8 +74,9 @@ public class SecondaryDisplayPreferenceController extends
|
||||
break;
|
||||
}
|
||||
}
|
||||
mPreference.setValue(mListValues[index]);
|
||||
mPreference.setSummary(mListSummaries[index]);
|
||||
final ListPreference listPreference = (ListPreference) mPreference;
|
||||
listPreference.setValue(mListValues[index]);
|
||||
listPreference.setSummary(mListSummaries[index]);
|
||||
}
|
||||
|
||||
private void writeSecondaryDisplayDevicesOption(String newValue) {
|
||||
|
Reference in New Issue
Block a user