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 com.android.customization.module.CustomizationPreferences 19 import com.android.wallpaper.testing.TestWallpaperPreferences 20 import javax.inject.Inject 21 import javax.inject.Singleton 22 23 /** Test implementation of [CustomizationPreferences]. */ 24 @Singleton 25 open class TestDefaultCustomizationPreferences @Inject constructor() : 26 TestWallpaperPreferences(), CustomizationPreferences { 27 28 private var customThemes: String? = null 29 private val tabVisited: MutableSet<String> = HashSet() 30 private var themedIconEnabled = false 31 getSerializedCustomThemesnull32 override fun getSerializedCustomThemes(): String? { 33 return customThemes 34 } 35 storeCustomThemesnull36 override fun storeCustomThemes(serializedCustomThemes: String) { 37 customThemes = serializedCustomThemes 38 } 39 getTabVisitednull40 override fun getTabVisited(id: String): Boolean { 41 return tabVisited.contains(id) 42 } 43 setTabVisitednull44 override fun setTabVisited(id: String) { 45 tabVisited.add(id) 46 } 47 getThemedIconEnablednull48 override fun getThemedIconEnabled(): Boolean { 49 return themedIconEnabled 50 } 51 setThemedIconEnablednull52 override fun setThemedIconEnabled(enabled: Boolean) { 53 themedIconEnabled = enabled 54 } 55 } 56