• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2017 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.tv.twopanelsettings.slices.compat.core;
18 
19 import static java.lang.annotation.RetentionPolicy.SOURCE;
20 
21 import androidx.annotation.IntDef;
22 import java.lang.annotation.Retention;
23 
24 /** Temporary class to contain hint constants for slices to be used. */
25 // @RestrictTo(LIBRARY_GROUP_PREFIX)
26 // @Deprecated // Supported for TV
27 public class SliceHints {
28 
29   /** Subtype indicating that this content is the minimum value for a range. */
30   public static final String SUBTYPE_MIN = "min";
31 
32   /** Indicates that the content is the determinate mode for a range. */
33   public static final int DETERMINATE_RANGE = 0;
34 
35   /** Indicates that the content is the indeterminate mode for a range. */
36   public static final int INDETERMINATE_RANGE = 1;
37 
38   /** Indicates that the content is the star rating mode for a range. */
39   public static final int STAR_RATING = 2;
40 
41   /**
42    * The meta-data key that allows an activity to easily be linked directly to a slice.
43    *
44    * <p>An activity can be statically linked to a slice uri by including a meta-data item for this
45    * key that contains a valid slice uri for the same application declaring the activity.
46    */
47   public static final String SLICE_METADATA_KEY = "android.metadata.SLICE_URI";
48 
49   /**
50    * Subtype to tag an item as representing a time in milliseconds since midnight, January 1, 1970
51    * UTC.
52    */
53   public static final String SUBTYPE_MILLIS = "millis";
54 
55   /** Hint indicating that the action/slice tagged with this will launch an activity. */
56   public static final String HINT_ACTIVITY = "activity";
57 
58   /**
59    * Hint indicating that this slice is the end of section and may need some form of visual
60    * separation.
61    */
62   public static final String HINT_END_OF_SECTION = "end_of_section";
63 
64   /** Hint indicating that this slice was parsed from a serialized format. */
65   public static final String HINT_CACHED = "cached";
66 
67   /**
68    * Hint indicating that the content in this slice should be left unaltered as much as possible.
69    */
70   public static final String HINT_RAW = "raw";
71 
72   /** Hint indicating that the text in this slice should be used to overlay an image. */
73   public static final String HINT_OVERLAY = "overlay";
74 
75   /** Hint indicating that the button in this slice should be shown as text button. */
76   public static final String HINT_SHOW_LABEL = "show_label";
77 
78   /**
79    * Subtype indicating that this slice represents a selection. The options will be included as
80    * sub-slices.
81    */
82   public static final String SUBTYPE_SELECTION = "selection";
83 
84   /** Subtype indicating that this slice represents a Date Picker. */
85   public static final String SUBTYPE_DATE_PICKER = "date_picker";
86 
87   /** Subtype indicating that this slice represents a Time Picker. */
88   public static final String SUBTYPE_TIME_PICKER = "time_picker";
89 
90   /**
91    * Hint indicating that this slice represents an option selectable in a selection slice. The
92    * parent of this slice must be of subtype {@link #SUBTYPE_SELECTION}.
93    */
94   public static final String HINT_SELECTION_OPTION = "selection_option";
95 
96   /**
97    * Subtype indicating that this slice represents the key passed back to the application when the
98    * user selects this option. The parent of this slice must have hint {@link
99    * #HINT_SELECTION_OPTION}.
100    *
101    * <p>Expected to be an item of format {@link
102    * com.android.tv.twopanelsettings.slices.compat.SliceItem@FORMAT_TEXT}.
103    */
104   public static final String SUBTYPE_SELECTION_OPTION_KEY = "selection_option_key";
105 
106   /**
107    * Subtype indicating that this slice represents the text displayed to the user for this option.
108    * The parent of this slice must have hint {@link #HINT_SELECTION_OPTION}.
109    *
110    * <p>Expected to be an item of format {@link
111    * com.android.tv.twopanelsettings.slices.compat.SliceItem@FORMAT_TEXT}.
112    */
113   public static final String SUBTYPE_SELECTION_OPTION_VALUE = "selection_option_value";
114 
115   public static final String SUBTYPE_HOST_EXTRAS = "host_extras";
116 
117   public static final String SUBTYPE_ACTION_KEY = "action_key";
118 
119   /** Indicates that an image should be presented as an icon and it can be tinted. */
120   public static final int ICON_IMAGE = 0;
121 
122   /** Indicates that an image should be presented in a smaller size and it shouldn't be tinted. */
123   public static final int SMALL_IMAGE = 1;
124 
125   /** Indicates that an image presented in a larger size and it shouldn't be tinted. */
126   public static final int LARGE_IMAGE = 2;
127 
128   /**
129    * Indicates that an image should be presented in its intrinsic size and shouldn't be tinted. If
130    * SliceView in the call-site doesn't support RAW_IMAGE, fallback to SMALL_IMAGE instead.
131    */
132   public static final int RAW_IMAGE_SMALL = 3;
133 
134   /**
135    * Indicates that an image should be presented in its intrinsic size and shouldn't be tinted. If
136    * SliceView in the call-site doesn't support RAW_IMAGE, fallback to LARGE_IMAGE instead.
137    */
138   public static final int RAW_IMAGE_LARGE = 4;
139 
140   /** Indicates that an image mode is unknown. */
141   public static final int UNKNOWN_IMAGE = 5;
142 
143   /** Indicates that an action with label. */
144   public static final int ACTION_WITH_LABEL = 6;
145 
146   /** */
147   @IntDef({
148     LARGE_IMAGE,
149     SMALL_IMAGE,
150     ICON_IMAGE,
151     RAW_IMAGE_SMALL,
152     RAW_IMAGE_LARGE,
153     UNKNOWN_IMAGE,
154     ACTION_WITH_LABEL
155   })
156   @Retention(SOURCE)
157   public @interface ImageMode {}
158 
159   /** Constant representing infinity. */
160   public static final long INFINITY = -1;
161 
SliceHints()162   private SliceHints() {}
163 }
164