diff options
Diffstat (limited to 'PermissionController/src/com/android/permissioncontroller/role/ui/handheld/HandheldRadioPreference.java')
-rw-r--r-- | PermissionController/src/com/android/permissioncontroller/role/ui/handheld/HandheldRadioPreference.java | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/PermissionController/src/com/android/permissioncontroller/role/ui/handheld/HandheldRadioPreference.java b/PermissionController/src/com/android/permissioncontroller/role/ui/handheld/HandheldRadioPreference.java new file mode 100644 index 000000000..d9ef047d6 --- /dev/null +++ b/PermissionController/src/com/android/permissioncontroller/role/ui/handheld/HandheldRadioPreference.java @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2023 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. + */ + +package com.android.permissioncontroller.role.ui.handheld; + +import android.content.Context; +import android.util.AttributeSet; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.preference.PreferenceViewHolder; + +import com.android.permissioncontroller.role.ui.RoleApplicationPreference; +import com.android.permissioncontroller.role.ui.UserRestrictionAwarePreferenceMixin; +import com.android.settingslib.widget.SelectorWithWidgetPreference; + +/** + * Preference used to represent apps that can be picked as a default app. + */ +public class HandheldRadioPreference extends SelectorWithWidgetPreference implements + RoleApplicationPreference { + + private final UserRestrictionAwarePreferenceMixin mUserRestrictionAwarePreferenceMixin = + new UserRestrictionAwarePreferenceMixin(this); + + public HandheldRadioPreference(@NonNull Context context, + @Nullable AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + } + + public HandheldRadioPreference(@NonNull Context context, + @Nullable AttributeSet attrs) { + super(context, attrs); + } + + public HandheldRadioPreference(@NonNull Context context, boolean isCheckbox) { + super(context, isCheckbox); + } + + public HandheldRadioPreference(@NonNull Context context) { + super(context); + } + + @Override + public void setUserRestriction( + @Nullable String userRestriction) { + mUserRestrictionAwarePreferenceMixin.setUserRestriction(userRestriction); + } + + @Override + public void onBindViewHolder(PreferenceViewHolder holder) { + super.onBindViewHolder(holder); + + mUserRestrictionAwarePreferenceMixin.onAfterBindViewHolder(holder); + } + + @NonNull + @Override + public HandheldRadioPreference asTwoStatePreference() { + return this; + } +} |