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 
52     @Override
getIcon()53     public IconCompat getIcon() {
54         return mIcon;
55     }
56 
setIcon(IconCompat icon)57     public void setIcon(IconCompat icon) {
58         mIcon = icon;
59     }
60 
61     @Override
getSubTitle()62     public CharSequence getSubTitle() {
63         return mSubTitle;
64     }
65 
setSubTitle(CharSequence subTitle)66     public void setSubTitle(CharSequence subTitle) {
67         mSubTitle = subTitle;
68     }
69 
70     @Override
getTitle()71     public CharSequence getTitle() {
72         return mTitle;
73     }
74 
setTitle(CharSequence title)75     public void setTitle(CharSequence title) {
76         mTitle = title;
77     }
78 
79     @Override
getSlices()80     public List<Uri> getSlices() {
81         return SLICE_URIS;
82     }
83 
84     @Override
getSeeMoreIntent()85     public Intent getSeeMoreIntent() {
86         return INTENT;
87     }
88 
89     @Override
getMetricsCategory()90     public int getMetricsCategory() {
91         return SettingsEnums.TESTING;
92     }
93 
setViewType(int viewType)94     public void setViewType(int viewType) {
95         mViewType = viewType;
96     }
97 
98     @Override
getViewType()99     public int getViewType() {
100         return mViewType;
101     }
102 
103     @Override
isCustomizedButtonUsed()104     public boolean isCustomizedButtonUsed() {
105         return mIsCustomizedButtonUsed;
106     }
107 
setIsCustomizedButtonUsed(boolean isUsed)108     public void setIsCustomizedButtonUsed(boolean isUsed) {
109         mIsCustomizedButtonUsed = isUsed;
110     }
111 
112     @Override
getCustomizedButtonTitle()113     public CharSequence getCustomizedButtonTitle() {
114         return mCustomizedButtonTitle;
115     }
116 
setCustomizedButtonTitle(CharSequence title)117     public void setCustomizedButtonTitle(CharSequence title) {
118         mCustomizedButtonTitle = title;
119     }
120 }
121