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