1 /*
2  * Copyright (C) 2022 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 
17 package com.android.settings.dream;
18 
19 import android.graphics.drawable.Drawable;
20 
21 import androidx.annotation.Nullable;
22 
23 /**
24  * Interface representing a dream item to be displayed.
25  */
26 public interface IDreamItem {
27     /**
28      * Gets the title of this dream.
29      */
getTitle()30     CharSequence getTitle();
31 
32     /**
33      * Gets the summary of this dream, or null if the dream doesn't provide one.
34      */
35     @Nullable
getSummary()36     CharSequence getSummary();
37 
38     /**
39      * Gets the icon for the dream.
40      */
getIcon()41     Drawable getIcon();
42 
43     /**
44      * Callback which can be implemented to handle clicks on this dream.
45      */
onItemClicked()46     void onItemClicked();
47 
48     /**
49      * Callback which can be implemented to handle the customization of this dream.
50      */
onCustomizeClicked()51     default void onCustomizeClicked() {
52     }
53 
54     /**
55      * Gets the preview image of this dream.
56      */
getPreviewImage()57     Drawable getPreviewImage();
58 
59     /**
60      * Returns whether or not this dream is currently active.
61      */
isActive()62     boolean isActive();
63 
64     /**
65      * Returns whether to allow customization of this dream or not.
66      */
allowCustomization()67     default boolean allowCustomization() {
68         return false;
69     }
70 
71     /**
72      * Returns whether or not this item is the no screensaver item.
73      */
viewType()74     default @DreamItemViewTypes.ViewType int viewType() {
75         return DreamItemViewTypes.DREAM_ITEM;
76     }
77 }
78