1 /* 2 * Copyright (C) 2018 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.settings.panel; 18 19 import android.content.Intent; 20 import android.net.Uri; 21 22 import androidx.core.graphics.drawable.IconCompat; 23 import androidx.fragment.app.FragmentActivity; 24 25 import com.android.settingslib.core.instrumentation.Instrumentable; 26 27 import java.util.List; 28 29 /** 30 * Represents the data class needed to create a Settings Panel. See {@link PanelFragment}. 31 * 32 * @deprecated this is no longer used after V and will be removed. 33 */ 34 @Deprecated(forRemoval = true) 35 public interface PanelContent extends Instrumentable { 36 37 int VIEW_TYPE_SLIDER = 1; 38 39 /** 40 * @return a icon for the title of the Panel. 41 */ getIcon()42 default IconCompat getIcon() { 43 return null; 44 } 45 46 /** 47 * @return a string for the subtitle of the Panel. 48 */ getSubTitle()49 default CharSequence getSubTitle() { 50 return null; 51 } 52 53 /** 54 * @return a string for the title of the Panel. 55 */ getTitle()56 CharSequence getTitle(); 57 58 /** 59 * @return an ordered list of the Slices to be displayed in the Panel. The first item in the 60 * list is shown on top of the Panel. 61 */ getSlices()62 List<Uri> getSlices(); 63 64 /** 65 * @return an {@link Intent} to the full content in Settings that is summarized by the Panel. 66 * 67 * <p> 68 * For example, for the connectivity panel you would intent to the Network & Internet page. 69 * </p> 70 */ getSeeMoreIntent()71 Intent getSeeMoreIntent(); 72 73 /** 74 * @return an {@link Intent} to the go to the target activity. 75 * 76 * <p> 77 * A common usage is to go back to previous panel. 78 * </p> 79 */ getHeaderIconIntent()80 default Intent getHeaderIconIntent() { 81 return null; 82 } 83 84 /** 85 * @return {@code true} to enable custom button to replace see more button, 86 * {@code false} otherwise. 87 */ isCustomizedButtonUsed()88 default boolean isCustomizedButtonUsed() { 89 return false; 90 } 91 92 /** 93 * @return a string for the title of the customized button. 94 */ getCustomizedButtonTitle()95 default CharSequence getCustomizedButtonTitle() { 96 return null; 97 } 98 99 /** 100 * Implement the click event for custom button. 101 * 102 * @param panelActivity the FragmentActivity from PanelFragment, the user can decide whether 103 * to finish activity or not. 104 */ onClickCustomizedButton(FragmentActivity panelActivity)105 default void onClickCustomizedButton(FragmentActivity panelActivity) {} 106 107 /** 108 * Register to start receiving callbacks for custom button events. 109 * 110 * @param callback the callback to add. 111 */ registerCallback(PanelContentCallback callback)112 default void registerCallback(PanelContentCallback callback) {} 113 114 /** 115 * @return a view type to customized it. 0 for default layout. 116 */ getViewType()117 default int getViewType() { 118 return 0; 119 } 120 121 /** 122 * @return {@code true} to enable progress bar visibility, {@code false} otherwise. 123 */ isProgressBarVisible()124 default boolean isProgressBarVisible() { 125 return false; 126 } 127 } 128