Migrate ShortcutPreference to SwitchCompat
Settings use SwitchCompat instead of Switch in the future, for new Material 3 UI. Bug: 306658427 Test: manual - on Accessibility pages Change-Id: Idf87eb6fcf1a57bd98a6fd0eca3c8c325127ce17
This commit is contained in:
@@ -93,7 +93,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="end|center_vertical"
|
||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||
android:paddingHorizontal="?android:attr/listPreferredItemPaddingEnd"
|
||||
android:minWidth="58dp"
|
||||
android:orientation="vertical" />
|
||||
|
||||
|
@@ -62,7 +62,7 @@ public class ShortcutPreference extends Preference {
|
||||
ShortcutPreference(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
setLayoutResource(R.layout.accessibility_shortcut_secondary_action);
|
||||
setWidgetLayoutResource(com.android.settingslib.R.layout.preference_widget_primary_switch);
|
||||
setWidgetLayoutResource(androidx.preference.R.layout.preference_widget_switch_compat);
|
||||
setIconSpaceReserved(false);
|
||||
// Treat onSettingsClicked as this preference's click.
|
||||
setOnPreferenceClickListener(preference -> {
|
||||
@@ -89,7 +89,7 @@ public class ShortcutPreference extends Preference {
|
||||
}
|
||||
|
||||
CompoundButton switchWidget =
|
||||
holder.itemView.findViewById(com.android.settingslib.R.id.switchWidget);
|
||||
holder.itemView.findViewById(androidx.preference.R.id.switchWidget);
|
||||
if (switchWidget != null) {
|
||||
// Consumes move events to ignore drag actions.
|
||||
switchWidget.setOnTouchListener((v, event) -> {
|
||||
|
Reference in New Issue
Block a user