• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 package com.android.customization.model;
17 
18 import android.view.View;
19 
20 import androidx.annotation.LayoutRes;
21 
22 import com.android.wallpaper.R;
23 
24 
25 /**
26  * Represents an option of customization (eg, a ThemeBundle, a Clock face, a Grid size)
27  */
28 public interface CustomizationOption <T extends CustomizationOption> {
29 
30     /**
31      * Optional name or label for this option
32      */
getTitle()33     String getTitle();
34 
35     /**
36      * Will be called to bind the thumbnail tile to be displayed in the picker.
37      *
38      * @param view the View to bind, corresponding to a view inside the layout specified in
39      *        {@link #getLayoutResId()} with id {@link R.id#option_tile}
40      */
bindThumbnailTile(View view)41     void bindThumbnailTile(View view);
42 
43     /**
44      * Returns whether this option is the one currently set in the System.
45      */
isActive(CustomizationManager<T> manager)46     boolean isActive(CustomizationManager<T> manager);
47 
48     /**
49      * Return the id of the layout used to show this option in the UI. It must contain a view with
50      * id {@link com.android.wallpaper.R.id#option_tile} that will be passed to
51      * {@link #bindThumbnailTile(View)} on bind time, and optionally a TextView with id
52      * {@link R.id#option_label} that will be populated with the value from {@link #getTitle()} if
53      * present.
54      */
getLayoutResId()55     @LayoutRes int getLayoutResId();
56 }