|
| 1 | +/* |
| 2 | + * Copyright (C) 2020 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.app.search; |
| 18 | + |
| 19 | +import androidx.annotation.StringDef; |
| 20 | + |
| 21 | +import java.lang.annotation.Retention; |
| 22 | +import java.lang.annotation.RetentionPolicy; |
| 23 | + |
| 24 | +/** |
| 25 | + * Constants to be used with {@link SearchTarget}. |
| 26 | + */ |
| 27 | +public class LayoutType { |
| 28 | + |
| 29 | + @StringDef(value = { |
| 30 | + ICON_SINGLE_VERTICAL_TEXT, |
| 31 | + ICON_HORIZONTAL_TEXT, |
| 32 | + HORIZONTAL_MEDIUM_TEXT, |
| 33 | + EXTRA_TALL_ICON_ROW, |
| 34 | + SMALL_ICON_HORIZONTAL_TEXT, |
| 35 | + SMALL_ICON_HORIZONTAL_TEXT_THUMBNAIL, |
| 36 | + ICON_CONTAINER, |
| 37 | + THUMBNAIL_CONTAINER, |
| 38 | + BIG_ICON_MEDIUM_HEIGHT_ROW, |
| 39 | + THUMBNAIL, |
| 40 | + ICON_SLICE, |
| 41 | + WIDGET_PREVIEW, |
| 42 | + WIDGET_LIVE, |
| 43 | + PEOPLE_TILE, |
| 44 | + TEXT_HEADER, |
| 45 | + DIVIDER, |
| 46 | + EMPTY_DIVIDER, |
| 47 | + CALCULATOR, |
| 48 | + SECTION_HEADER, |
| 49 | + TALL_CARD_WITH_IMAGE_NO_ICON, |
| 50 | + TEXT_HEADER_ROW, |
| 51 | + QS_TILE, |
| 52 | + PLACEHOLDER, |
| 53 | + RICHANSWER_PLACEHOLDER, |
| 54 | + EMPTY_STATE, |
| 55 | + SEARCH_SETTINGS, |
| 56 | + }) |
| 57 | + @Retention(RetentionPolicy.SOURCE) |
| 58 | + public @interface SearchLayoutType {} |
| 59 | + |
| 60 | + // ------ |
| 61 | + // | icon | |
| 62 | + // ------ |
| 63 | + // text |
| 64 | + public static final String ICON_SINGLE_VERTICAL_TEXT = "icon"; |
| 65 | + |
| 66 | + // Below three layouts (to be deprecated) and two layouts render |
| 67 | + // {@link SearchTarget}s in following layout. |
| 68 | + // ------ ------ ------ |
| 69 | + // | | title |(opt)| |(opt)| |
| 70 | + // | icon | subtitle (optional) | icon| | icon| |
| 71 | + // ------ ------ ------ |
| 72 | + @Deprecated |
| 73 | + public static final String ICON_SINGLE_HORIZONTAL_TEXT = "icon_text_row"; |
| 74 | + @Deprecated |
| 75 | + public static final String ICON_DOUBLE_HORIZONTAL_TEXT = "icon_texts_row"; |
| 76 | + @Deprecated |
| 77 | + public static final String ICON_DOUBLE_HORIZONTAL_TEXT_BUTTON = "icon_texts_button"; |
| 78 | + |
| 79 | + // will replace ICON_DOUBLE_* ICON_SINGLE_* layouts |
| 80 | + public static final String ICON_HORIZONTAL_TEXT = "icon_row"; |
| 81 | + public static final String HORIZONTAL_MEDIUM_TEXT = "icon_row_medium"; |
| 82 | + public static final String EXTRA_TALL_ICON_ROW = "extra_tall_icon_row"; |
| 83 | + public static final String SMALL_ICON_HORIZONTAL_TEXT = "short_icon_row"; |
| 84 | + public static final String SMALL_ICON_HORIZONTAL_TEXT_THUMBNAIL = "short_icon_row_thumbnail"; |
| 85 | + |
| 86 | + // This layout contains a series of icon results (currently up to 4 per row). |
| 87 | + // The container does not support stretching for its children, and can only contain |
| 88 | + // {@link #ICON_SINGLE_VERTICAL_TEXT} layout types. |
| 89 | + public static final String ICON_CONTAINER = "icon_container"; |
| 90 | + |
| 91 | + // This layout contains a series of thumbnails (currently up to 3 per row). |
| 92 | + // The container supports stretching for its children, and can only contain {@link #THUMBNAIL} |
| 93 | + // layout types. |
| 94 | + public static final String THUMBNAIL_CONTAINER = "thumbnail_container"; |
| 95 | + |
| 96 | + // This layout creates a container for people grouping |
| 97 | + // Only available above version code 2 |
| 98 | + public static final String BIG_ICON_MEDIUM_HEIGHT_ROW = "big_icon_medium_row"; |
| 99 | + |
| 100 | + // This layout creates square thumbnail image (currently 3 column) |
| 101 | + public static final String THUMBNAIL = "thumbnail"; |
| 102 | + |
| 103 | + // This layout contains an icon and slice |
| 104 | + public static final String ICON_SLICE = "slice"; |
| 105 | + |
| 106 | + // Widget bitmap preview |
| 107 | + public static final String WIDGET_PREVIEW = "widget_preview"; |
| 108 | + |
| 109 | + // Live widget search result |
| 110 | + public static final String WIDGET_LIVE = "widget_live"; |
| 111 | + |
| 112 | + // Layout type used to display people tiles using shortcut info |
| 113 | + public static final String PEOPLE_TILE = "people_tile"; |
| 114 | + |
| 115 | + // Deprecated |
| 116 | + // text based header to group various layouts in low confidence section of the results. |
| 117 | + public static final String TEXT_HEADER = "header"; |
| 118 | + |
| 119 | + // horizontal bar to be inserted between fallback search results and low confidence section |
| 120 | + public static final String EMPTY_DIVIDER = "empty_divider"; |
| 121 | + |
| 122 | + @Deprecated(since = "Use EMPTY_DIVIDER instead") |
| 123 | + public static final String DIVIDER = EMPTY_DIVIDER; |
| 124 | + |
| 125 | + // layout representing quick calculations |
| 126 | + public static final String CALCULATOR = "calculator"; |
| 127 | + |
| 128 | + // From version code 4, if TEXT_HEADER_ROW is used, no need to insert this on-device |
| 129 | + // section header. |
| 130 | + public static final String SECTION_HEADER = "section_header"; |
| 131 | + |
| 132 | + // layout for a tall card with header and image, and no icon. |
| 133 | + public static final String TALL_CARD_WITH_IMAGE_NO_ICON = "tall_card_with_image_no_icon"; |
| 134 | + |
| 135 | + // Layout for a text header |
| 136 | + // Available for SearchUiManager proxy service to use above version code 3 |
| 137 | + public static final String TEXT_HEADER_ROW = "text_header_row"; |
| 138 | + |
| 139 | + // Layout for a quick settings tile |
| 140 | + public static final String QS_TILE = "qs_tile"; |
| 141 | + |
| 142 | + // Placeholder for web suggest. |
| 143 | + public static final String PLACEHOLDER = "placeholder"; |
| 144 | + |
| 145 | + // Placeholder for rich answer cards. |
| 146 | + // Only available on or above version code 3. |
| 147 | + public static final String RICHANSWER_PLACEHOLDER = "richanswer_placeholder"; |
| 148 | + |
| 149 | + |
| 150 | + // layout representing the empty, no query state |
| 151 | + public static final String EMPTY_STATE = "empty_state"; |
| 152 | + |
| 153 | + // layout representing search settings |
| 154 | + public static final String SEARCH_SETTINGS = "launcher_settings"; |
| 155 | +} |
0 commit comments