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 static com.android.settings.slices.CustomSliceRegistry.WIFI_SLICE_URI;
20 
21 import android.app.settings.SettingsEnums;
22 import android.content.Intent;
23 import android.net.Uri;
24 
25 import androidx.core.graphics.drawable.IconCompat;
26 
27 import java.util.Arrays;
28 import java.util.List;
29 
30 /**
31  * Fake PanelContent for testing.
32  */
33 public class FakePanelContent implements PanelContent {
34 
35     public static final String FAKE_ACTION = "fake_action";
36 
37     public static final CharSequence TITLE = "title";
38 
39     public static final List<Uri> SLICE_URIS = Arrays.asList(
40         WIFI_SLICE_URI
41     );
42 
43     public static final Intent INTENT = new Intent();
44 
45     private CharSequence mTitle = TITLE;
46     private CharSequence mSubTitle;
47     private IconCompat mIcon;
48     private int mViewType;
49     private boolean mIsCustomizedButtonUsed = false;
50     private CharSequence mCustomizedButtonTitle;
51     private boolean mIsProgressBarVisible;
52 
53     @Override
getIcon()54     public IconCompat getIcon() {
55         return mIcon;
56     }
57 
setIcon(IconCompat icon)58     public void setIcon(IconCompat icon) {
59         mIcon = icon;
60     }
61 
62     @Override
getSubTitle()63     public CharSequence getSubTitle() {
64         return mSubTitle;
65     }
66 
setSubTitle(CharSequence subTitle)67     public void setSubTitle(CharSequence subTitle) {
68         mSubTitle = subTitle;
69     }
70 
71     @Override
getTitle()72     public CharSequence getTitle() {
73         return mTitle;
74     }
75 
setTitle(CharSequence title)76     public void setTitle(CharSequence title) {
77         mTitle = title;
78     }
79 
80     @Override
getSlices()81     public List<Uri> getSlices() {
82         return SLICE_URIS;
83     }
84 
85     @Override
getSeeMoreIntent()86     public Intent getSeeMoreIntent() {
87         return INTENT;
88     }
89 
90     @Override
getMetricsCategory()91     public int getMetricsCategory() {
92         return SettingsEnums.TESTING;
93     }
94 
setViewType(int viewType)95     public void setViewType(int viewType) {
96         mViewType = viewType;
97     }
98 
99     @Override
getViewType()100     public int getViewType() {
101         return mViewType;
102     }
103 
104     @Override
isCustomizedButtonUsed()105     public boolean isCustomizedButtonUsed() {
106         return mIsCustomizedButtonUsed;
107     }
108 
setIsCustomizedButtonUsed(boolean isUsed)109     public void setIsCustomizedButtonUsed(boolean isUsed) {
110         mIsCustomizedButtonUsed = isUsed;
111     }
112 
113     @Override
getCustomizedButtonTitle()114     public CharSequence getCustomizedButtonTitle() {
115         return mCustomizedButtonTitle;
116     }
117 
setCustomizedButtonTitle(CharSequence title)118     public void setCustomizedButtonTitle(CharSequence title) {
119         mCustomizedButtonTitle = title;
120     }
121 
122     @Override
isProgressBarVisible()123     public boolean isProgressBarVisible() {
124         return mIsProgressBarVisible;
125     }
126 
setIsProgressBarVisible(boolean isProgressBarVisible)127     public void setIsProgressBarVisible(boolean isProgressBarVisible) {
128         mIsProgressBarVisible = isProgressBarVisible;
129     }
130 }
131