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.util.Log;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -63,7 +63,7 @@ public class NfcStackDebugLogPreferenceController extends
|
||||
try {
|
||||
final boolean isEnabled = SystemProperties.getBoolean(
|
||||
NFC_STACK_DEBUGLOG_ENABLED_PROPERTY, false /* default */);
|
||||
((SwitchPreference) mPreference).setChecked(isEnabled);
|
||||
((TwoStatePreference) mPreference).setChecked(isEnabled);
|
||||
} catch (RuntimeException e) {
|
||||
Log.e(TAG, "Fail to get nfc system property: " + e.getMessage());
|
||||
}
|
||||
@@ -74,7 +74,7 @@ public class NfcStackDebugLogPreferenceController extends
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
try {
|
||||
SystemProperties.set(NFC_STACK_DEBUGLOG_ENABLED_PROPERTY, "false");
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
((TwoStatePreference) mPreference).setChecked(false);
|
||||
} catch (RuntimeException e) {
|
||||
Log.e(TAG, "Fail to set nfc system property: " + e.getMessage());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user