1 /* 2 * Copyright (C) 2019 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.permissioncontroller.role.ui; 18 19 import androidx.annotation.NonNull; 20 import androidx.annotation.Nullable; 21 22 /** 23 * {@link androidx.preference.Preference} with the widget layout as a separate target. 24 * 25 * This has to be an interface because we may need to extend from either the SettingsLib 26 * {@link com.android.settingslib.widget.TwoTargetPreference} or the AndroidX 27 * {@link androidx.preference.Preference}. 28 * 29 * @see com.android.settingslib.widget.TwoTargetPreference 30 */ 31 public interface TwoTargetPreference { 32 33 /** 34 * Set the listener for second target click. 35 * 36 * @param listener the listener 37 */ setOnSecondTargetClickListener(@ullable OnSecondTargetClickListener listener)38 void setOnSecondTargetClickListener(@Nullable OnSecondTargetClickListener listener); 39 40 /** 41 * Listener for second target click. 42 */ 43 interface OnSecondTargetClickListener { 44 45 /** 46 * Callback when the second target is clicked. 47 * 48 * @param preference the {@link TwoTargetPreference} that was clicked 49 */ onSecondTargetClick(@onNull TwoTargetPreference preference)50 void onSecondTargetClick(@NonNull TwoTargetPreference preference); 51 } 52 } 53