Migrate to TwoStatePreference
SwitchPreference and SwitchPreferenceCompat are both TwoStatePreference. Using TwoStatePreference in Java will helps migration in the future. Bug: 306771414 Test: manual - check Settings pages Change-Id: I84e1d7b09451106797c2b23d127855c6976678ca
This commit is contained in:
@@ -22,7 +22,7 @@ import android.sysprop.DisplayProperties;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.internal.app.LocalePicker;
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
@@ -59,7 +59,7 @@ public class RtlLayoutPreferenceController extends DeveloperOptionsPreferenceCon
|
||||
public void updateState(Preference preference) {
|
||||
int rtlLayoutMode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||
Settings.Global.DEVELOPMENT_FORCE_RTL, SETTING_VALUE_OFF);
|
||||
((SwitchPreference) mPreference).setChecked(rtlLayoutMode != SETTING_VALUE_OFF);
|
||||
((TwoStatePreference) mPreference).setChecked(rtlLayoutMode != SETTING_VALUE_OFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,7 +67,7 @@ public class RtlLayoutPreferenceController extends DeveloperOptionsPreferenceCon
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
writeToForceRtlLayoutSetting(false);
|
||||
updateLocales();
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
((TwoStatePreference) mPreference).setChecked(false);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
Reference in New Issue
Block a user