Loading src/com/android/settings/TrustedCredentialsFragment.java +3 −3 Original line number Diff line number Diff line Loading @@ -52,13 +52,13 @@ import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.BaseExpandableListAdapter; import android.widget.CompoundButton; import android.widget.ExpandableListView; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.ProgressBar; import android.widget.Switch; import android.widget.TextView; import androidx.annotation.NonNull; Loading Loading @@ -456,10 +456,10 @@ public class TrustedCredentialsFragment extends ObservableFragment return "Group" + getUserIdByGroup(groupPosition); } private class ViewHolder { private static class ViewHolder { private TextView mSubjectPrimaryView; private TextView mSubjectSecondaryView; private Switch mSwitch; private CompoundButton mSwitch; } } Loading src/com/android/settings/accessibility/ShortcutPreference.java +2 −2 Original line number Diff line number Diff line Loading @@ -21,8 +21,8 @@ import android.util.AttributeSet; import android.util.TypedValue; import android.view.MotionEvent; import android.view.View; import android.widget.CompoundButton; import android.widget.LinearLayout; import android.widget.Switch; import androidx.preference.Preference; import androidx.preference.PreferenceViewHolder; Loading Loading @@ -88,7 +88,7 @@ public class ShortcutPreference extends Preference { mSettingsEditable ? outValue.resourceId : /* Remove background */ 0); } Switch switchWidget = CompoundButton switchWidget = holder.itemView.findViewById(com.android.settingslib.R.id.switchWidget); if (switchWidget != null) { // Consumes move events to ignore drag actions. Loading src/com/android/settings/applications/appops/AppOpsCategory.java +5 −7 Original line number Diff line number Diff line Loading @@ -29,9 +29,9 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.CompoundButton; import android.widget.ImageView; import android.widget.ListView; import android.widget.Switch; import android.widget.TextView; import androidx.fragment.app.ListFragment; Loading Loading @@ -244,14 +244,12 @@ public class AppOpsCategory extends ListFragment implements public static class AppListAdapter extends BaseAdapter { private final Resources mResources; private final LayoutInflater mInflater; private final AppOpsState mState; List<AppOpEntry> mList; public AppListAdapter(Context context, AppOpsState state) { public AppListAdapter(Context context) { mResources = context.getResources(); mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mState = state; } public void setData(List<AppOpEntry> data) { Loading Loading @@ -294,7 +292,7 @@ public class AppOpsCategory extends ListFragment implements ((TextView) view.findViewById(R.id.op_name)).setText( item.getTimeText(mResources, false)); view.findViewById(R.id.op_time).setVisibility(View.GONE); ((Switch) view.findViewById(R.id.op_switch)).setChecked( ((CompoundButton) view.findViewById(R.id.op_switch)).setChecked( item.getPrimaryOpMode() == AppOpsManager.MODE_ALLOWED); return view; Loading @@ -318,7 +316,7 @@ public class AppOpsCategory extends ListFragment implements setHasOptionsMenu(true); // Create an empty adapter we will use to display the loaded data. mAdapter = new AppListAdapter(getActivity(), mState); mAdapter = new AppListAdapter(getActivity()); setListAdapter(mAdapter); // Start out with a progress indicator. Loading @@ -332,7 +330,7 @@ public class AppOpsCategory extends ListFragment implements AppOpEntry entry = mAdapter.getItem(position); if (entry != null) { // We treat this as tapping on the check box, toggling the app op state. Switch sw = v.findViewById(R.id.op_switch); CompoundButton sw = v.findViewById(R.id.op_switch); boolean checked = !sw.isChecked(); sw.setChecked(checked); AppOpsManager.OpEntry op = entry.getOpEntry(0); Loading src/com/android/settings/applications/credentials/CredentialManagerPreferenceController.java +3 −3 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ import android.service.autofill.AutofillServiceInfo; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.widget.Switch; import android.widget.CompoundButton; import androidx.appcompat.app.AlertDialog; import androidx.core.content.ContextCompat; Loading Loading @@ -969,7 +969,7 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl } // Stores a reference to the switch view. private @Nullable Switch mSwitch; private @Nullable CompoundButton mSwitch; // Switch text for on and off states private @NonNull boolean mChecked = false; Loading Loading @@ -1022,7 +1022,7 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl // Setup the switch. View checkableView = view.itemView.findViewById(com.android.settingslib.R.id.switchWidget); if (checkableView instanceof Switch switchView) { if (checkableView instanceof CompoundButton switchView) { switchView.setChecked(mChecked); switchView.setOnClickListener(mListener); Loading src/com/android/settings/applications/manageapplications/ApplicationViewHolder.java +4 −7 Original line number Diff line number Diff line Loading @@ -31,9 +31,9 @@ import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.CompoundButton; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.Switch; import android.widget.TextView; import androidx.annotation.StringRes; Loading Loading @@ -67,7 +67,7 @@ public class ApplicationViewHolder extends RecyclerView.ViewHolder { @VisibleForTesting final ViewGroup mWidgetContainer; @VisibleForTesting final Switch mSwitch; final CompoundButton mSwitch; final ImageView mAddIcon; final ProgressBar mProgressBar; Loading Loading @@ -173,10 +173,6 @@ public class ApplicationViewHolder extends RecyclerView.ViewHolder { mAppName.setContentDescription(contentDescription); } void setIcon(int drawableRes) { mAppIcon.setImageResource(drawableRes); } void setIcon(Drawable icon) { if (icon == null) { return; Loading Loading @@ -219,7 +215,8 @@ public class ApplicationViewHolder extends RecyclerView.ViewHolder { } } void updateSwitch(Switch.OnCheckedChangeListener listener, boolean enabled, boolean checked) { void updateSwitch(CompoundButton.OnCheckedChangeListener listener, boolean enabled, boolean checked) { if (mSwitch != null && mWidgetContainer != null) { mWidgetContainer.setFocusable(false); mWidgetContainer.setClickable(false); Loading Loading
src/com/android/settings/TrustedCredentialsFragment.java +3 −3 Original line number Diff line number Diff line Loading @@ -52,13 +52,13 @@ import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.BaseExpandableListAdapter; import android.widget.CompoundButton; import android.widget.ExpandableListView; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.ProgressBar; import android.widget.Switch; import android.widget.TextView; import androidx.annotation.NonNull; Loading Loading @@ -456,10 +456,10 @@ public class TrustedCredentialsFragment extends ObservableFragment return "Group" + getUserIdByGroup(groupPosition); } private class ViewHolder { private static class ViewHolder { private TextView mSubjectPrimaryView; private TextView mSubjectSecondaryView; private Switch mSwitch; private CompoundButton mSwitch; } } Loading
src/com/android/settings/accessibility/ShortcutPreference.java +2 −2 Original line number Diff line number Diff line Loading @@ -21,8 +21,8 @@ import android.util.AttributeSet; import android.util.TypedValue; import android.view.MotionEvent; import android.view.View; import android.widget.CompoundButton; import android.widget.LinearLayout; import android.widget.Switch; import androidx.preference.Preference; import androidx.preference.PreferenceViewHolder; Loading Loading @@ -88,7 +88,7 @@ public class ShortcutPreference extends Preference { mSettingsEditable ? outValue.resourceId : /* Remove background */ 0); } Switch switchWidget = CompoundButton switchWidget = holder.itemView.findViewById(com.android.settingslib.R.id.switchWidget); if (switchWidget != null) { // Consumes move events to ignore drag actions. Loading
src/com/android/settings/applications/appops/AppOpsCategory.java +5 −7 Original line number Diff line number Diff line Loading @@ -29,9 +29,9 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.CompoundButton; import android.widget.ImageView; import android.widget.ListView; import android.widget.Switch; import android.widget.TextView; import androidx.fragment.app.ListFragment; Loading Loading @@ -244,14 +244,12 @@ public class AppOpsCategory extends ListFragment implements public static class AppListAdapter extends BaseAdapter { private final Resources mResources; private final LayoutInflater mInflater; private final AppOpsState mState; List<AppOpEntry> mList; public AppListAdapter(Context context, AppOpsState state) { public AppListAdapter(Context context) { mResources = context.getResources(); mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mState = state; } public void setData(List<AppOpEntry> data) { Loading Loading @@ -294,7 +292,7 @@ public class AppOpsCategory extends ListFragment implements ((TextView) view.findViewById(R.id.op_name)).setText( item.getTimeText(mResources, false)); view.findViewById(R.id.op_time).setVisibility(View.GONE); ((Switch) view.findViewById(R.id.op_switch)).setChecked( ((CompoundButton) view.findViewById(R.id.op_switch)).setChecked( item.getPrimaryOpMode() == AppOpsManager.MODE_ALLOWED); return view; Loading @@ -318,7 +316,7 @@ public class AppOpsCategory extends ListFragment implements setHasOptionsMenu(true); // Create an empty adapter we will use to display the loaded data. mAdapter = new AppListAdapter(getActivity(), mState); mAdapter = new AppListAdapter(getActivity()); setListAdapter(mAdapter); // Start out with a progress indicator. Loading @@ -332,7 +330,7 @@ public class AppOpsCategory extends ListFragment implements AppOpEntry entry = mAdapter.getItem(position); if (entry != null) { // We treat this as tapping on the check box, toggling the app op state. Switch sw = v.findViewById(R.id.op_switch); CompoundButton sw = v.findViewById(R.id.op_switch); boolean checked = !sw.isChecked(); sw.setChecked(checked); AppOpsManager.OpEntry op = entry.getOpEntry(0); Loading
src/com/android/settings/applications/credentials/CredentialManagerPreferenceController.java +3 −3 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ import android.service.autofill.AutofillServiceInfo; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.widget.Switch; import android.widget.CompoundButton; import androidx.appcompat.app.AlertDialog; import androidx.core.content.ContextCompat; Loading Loading @@ -969,7 +969,7 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl } // Stores a reference to the switch view. private @Nullable Switch mSwitch; private @Nullable CompoundButton mSwitch; // Switch text for on and off states private @NonNull boolean mChecked = false; Loading Loading @@ -1022,7 +1022,7 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl // Setup the switch. View checkableView = view.itemView.findViewById(com.android.settingslib.R.id.switchWidget); if (checkableView instanceof Switch switchView) { if (checkableView instanceof CompoundButton switchView) { switchView.setChecked(mChecked); switchView.setOnClickListener(mListener); Loading
src/com/android/settings/applications/manageapplications/ApplicationViewHolder.java +4 −7 Original line number Diff line number Diff line Loading @@ -31,9 +31,9 @@ import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.CompoundButton; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.Switch; import android.widget.TextView; import androidx.annotation.StringRes; Loading Loading @@ -67,7 +67,7 @@ public class ApplicationViewHolder extends RecyclerView.ViewHolder { @VisibleForTesting final ViewGroup mWidgetContainer; @VisibleForTesting final Switch mSwitch; final CompoundButton mSwitch; final ImageView mAddIcon; final ProgressBar mProgressBar; Loading Loading @@ -173,10 +173,6 @@ public class ApplicationViewHolder extends RecyclerView.ViewHolder { mAppName.setContentDescription(contentDescription); } void setIcon(int drawableRes) { mAppIcon.setImageResource(drawableRes); } void setIcon(Drawable icon) { if (icon == null) { return; Loading Loading @@ -219,7 +215,8 @@ public class ApplicationViewHolder extends RecyclerView.ViewHolder { } } void updateSwitch(Switch.OnCheckedChangeListener listener, boolean enabled, boolean checked) { void updateSwitch(CompoundButton.OnCheckedChangeListener listener, boolean enabled, boolean checked) { if (mSwitch != null && mWidgetContainer != null) { mWidgetContainer.setFocusable(false); mWidgetContainer.setClickable(false); Loading