Merge "Migrate ShortcutPreference to SwitchCompat" into main
This commit is contained in:
@@ -93,7 +93,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:gravity="end|center_vertical"
|
android:gravity="end|center_vertical"
|
||||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
android:paddingHorizontal="?android:attr/listPreferredItemPaddingEnd"
|
||||||
android:minWidth="58dp"
|
android:minWidth="58dp"
|
||||||
android:orientation="vertical" />
|
android:orientation="vertical" />
|
||||||
|
|
||||||
|
@@ -62,7 +62,7 @@ public class ShortcutPreference extends Preference {
|
|||||||
ShortcutPreference(Context context, AttributeSet attrs) {
|
ShortcutPreference(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
setLayoutResource(R.layout.accessibility_shortcut_secondary_action);
|
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);
|
setIconSpaceReserved(false);
|
||||||
// Treat onSettingsClicked as this preference's click.
|
// Treat onSettingsClicked as this preference's click.
|
||||||
setOnPreferenceClickListener(preference -> {
|
setOnPreferenceClickListener(preference -> {
|
||||||
@@ -89,7 +89,7 @@ public class ShortcutPreference extends Preference {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CompoundButton switchWidget =
|
CompoundButton switchWidget =
|
||||||
holder.itemView.findViewById(com.android.settingslib.R.id.switchWidget);
|
holder.itemView.findViewById(androidx.preference.R.id.switchWidget);
|
||||||
if (switchWidget != null) {
|
if (switchWidget != null) {
|
||||||
// Consumes move events to ignore drag actions.
|
// Consumes move events to ignore drag actions.
|
||||||
switchWidget.setOnTouchListener((v, event) -> {
|
switchWidget.setOnTouchListener((v, event) -> {
|
||||||
|
Reference in New Issue
Block a user