Remove Settings preference_widget_primary_switch
File content same as SettingsLib's preference_widget_primary_switch
Bug: 285231003
Test: m Settings
Change-Id: I4b9f92435ffb5c253241e294c4680025fe0447fc
diff --git a/res/layout/preference_widget_primary_switch.xml b/res/layout/preference_widget_primary_switch.xml
deleted file mode 100644
index 53c06b5..0000000
--- a/res/layout/preference_widget_primary_switch.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2017 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<Switch
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/switchWidget"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:minWidth="@dimen/two_target_min_width"
- android:gravity="center_vertical"
- android:clickable="false" />
diff --git a/src/com/android/settings/accessibility/ShortcutPreference.java b/src/com/android/settings/accessibility/ShortcutPreference.java
index ec911a9..81bc586 100644
--- a/src/com/android/settings/accessibility/ShortcutPreference.java
+++ b/src/com/android/settings/accessibility/ShortcutPreference.java
@@ -62,7 +62,7 @@
ShortcutPreference(Context context, AttributeSet attrs) {
super(context, attrs);
setLayoutResource(R.layout.accessibility_shortcut_secondary_action);
- setWidgetLayoutResource(R.layout.preference_widget_primary_switch);
+ setWidgetLayoutResource(com.android.settingslib.R.layout.preference_widget_primary_switch);
setIconSpaceReserved(false);
// Treat onSettingsClicked as this preference's click.
setOnPreferenceClickListener(preference -> {
@@ -88,7 +88,8 @@
mSettingsEditable ? outValue.resourceId : /* Remove background */ 0);
}
- Switch switchWidget = holder.itemView.findViewById(R.id.switchWidget);
+ Switch switchWidget =
+ holder.itemView.findViewById(com.android.settingslib.R.id.switchWidget);
if (switchWidget != null) {
// Consumes move events to ignore drag actions.
switchWidget.setOnTouchListener((v, event) -> {
diff --git a/src/com/android/settings/applications/credentials/CredentialManagerPreferenceController.java b/src/com/android/settings/applications/credentials/CredentialManagerPreferenceController.java
index de06806..4021110 100644
--- a/src/com/android/settings/applications/credentials/CredentialManagerPreferenceController.java
+++ b/src/com/android/settings/applications/credentials/CredentialManagerPreferenceController.java
@@ -1012,7 +1012,7 @@
@Override
protected int getSecondTargetResId() {
- return R.layout.preference_widget_primary_switch;
+ return com.android.settingslib.R.layout.preference_widget_primary_switch;
}
@Override
@@ -1020,9 +1020,9 @@
super.onBindViewHolder(view);
// Setup the switch.
- View checkableView = view.itemView.findViewById(R.id.switchWidget);
- if (checkableView != null && checkableView instanceof Switch) {
- final Switch switchView = (Switch) checkableView;
+ View checkableView =
+ view.itemView.findViewById(com.android.settingslib.R.id.switchWidget);
+ if (checkableView instanceof Switch switchView) {
switchView.setChecked(mChecked);
switchView.setOnClickListener(mListener);
diff --git a/src/com/android/settings/applications/manageapplications/ApplicationViewHolder.java b/src/com/android/settings/applications/manageapplications/ApplicationViewHolder.java
index 1f15aec..dbb97e9 100644
--- a/src/com/android/settings/applications/manageapplications/ApplicationViewHolder.java
+++ b/src/com/android/settings/applications/manageapplications/ApplicationViewHolder.java
@@ -46,11 +46,16 @@
import com.android.settingslib.applications.ApplicationsState;
import com.android.settingslib.applications.ApplicationsState.AppEntry;
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
+import com.android.settingslib.spaprivileged.template.app.AppListItemKt;
+import com.android.settingslib.spaprivileged.template.app.AppListPageKt;
import com.android.settingslib.widget.LottieColorUtils;
import com.airbnb.lottie.LottieAnimationView;
-
+/**
+ * @deprecated Will be removed, use {@link AppListItemKt} {@link AppListPageKt} instead.
+ */
+@Deprecated(forRemoval = true)
public class ApplicationViewHolder extends RecyclerView.ViewHolder {
@VisibleForTesting
@@ -74,7 +79,7 @@
mAppIcon = itemView.findViewById(android.R.id.icon);
mSummary = itemView.findViewById(android.R.id.summary);
mDisabled = itemView.findViewById(com.android.settingslib.widget.preference.app.R.id.appendix);
- mSwitch = itemView.findViewById(R.id.switchWidget);
+ mSwitch = itemView.findViewById(com.android.settingslib.R.id.switchWidget);
mWidgetContainer = itemView.findViewById(android.R.id.widget_frame);
mAddIcon = itemView.findViewById(R.id.add_preference_widget);
mProgressBar = itemView.findViewById(R.id.progressBar_cyclic);
@@ -94,8 +99,9 @@
LayoutInflater.from(parent.getContext())
.inflate(R.layout.preference_widget_add_progressbar, widgetFrame, true);
} else {
- LayoutInflater.from(parent.getContext())
- .inflate(R.layout.preference_widget_primary_switch, widgetFrame, true);
+ LayoutInflater.from(parent.getContext()).inflate(
+ com.android.settingslib.R.layout.preference_widget_primary_switch,
+ widgetFrame, true);
}
View divider = LayoutInflater.from(parent.getContext()).inflate(
com.android.settingslib.widget.preference.twotarget.R.layout.preference_two_target_divider,