• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 package com.android.customization.testing;
17 
18 import android.content.Context;
19 
20 import com.android.customization.module.DefaultCustomizationPreferences;
21 
22 import java.util.HashSet;
23 import java.util.Set;
24 
25 /**
26  * Test implementation of {@link DefaultCustomizationPreferences}.
27  */
28 public class TestDefaultCustomizationPreferences extends DefaultCustomizationPreferences {
29 
30     private String mCustomThemes;
31     private final Set<String> mTabVisited = new HashSet<>();
32 
TestDefaultCustomizationPreferences(Context context)33     public TestDefaultCustomizationPreferences(Context context) {
34         super(context);
35     }
36 
37     @Override
getSerializedCustomThemes()38     public String getSerializedCustomThemes() {
39         return mCustomThemes;
40     }
41 
42     @Override
storeCustomThemes(String serializedCustomThemes)43     public void storeCustomThemes(String serializedCustomThemes) {
44         mCustomThemes = serializedCustomThemes;
45     }
46 
47     @Override
getTabVisited(String id)48     public boolean getTabVisited(String id) {
49         return mTabVisited.contains(id);
50     }
51 
52     @Override
setTabVisited(String id)53     public void setTabVisited(String id) {
54         mTabVisited.add(id);
55     }
56 }
57