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.module
17 
18 import android.content.Context
19 import com.android.wallpaper.module.DefaultWallpaperPreferences
20 
21 open class DefaultCustomizationPreferences(context: Context) :
22     DefaultWallpaperPreferences(context), CustomizationPreferences {
23 
getSerializedCustomThemesnull24     override fun getSerializedCustomThemes(): String? {
25         return sharedPrefs.getString(CustomizationPreferences.KEY_CUSTOM_THEME, null)
26     }
27 
storeCustomThemesnull28     override fun storeCustomThemes(serializedCustomThemes: String) {
29         sharedPrefs
30             .edit()
31             .putString(CustomizationPreferences.KEY_CUSTOM_THEME, serializedCustomThemes)
32             .apply()
33     }
34 
getTabVisitednull35     override fun getTabVisited(id: String): Boolean {
36         return sharedPrefs.getBoolean(CustomizationPreferences.KEY_VISITED_PREFIX + id, false)
37     }
38 
setTabVisitednull39     override fun setTabVisited(id: String) {
40         sharedPrefs
41             .edit()
42             .putBoolean(CustomizationPreferences.KEY_VISITED_PREFIX + id, true)
43             .apply()
44     }
45 
getThemedIconEnablednull46     override fun getThemedIconEnabled(): Boolean {
47         return sharedPrefs.getBoolean(CustomizationPreferences.KEY_THEMED_ICON_ENABLED, false)
48     }
49 
setThemedIconEnablednull50     override fun setThemedIconEnabled(enabled: Boolean) {
51         sharedPrefs
52             .edit()
53             .putBoolean(CustomizationPreferences.KEY_THEMED_ICON_ENABLED, enabled)
54             .apply()
55     }
56 }
57