1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278
|
/*
* Copyright (C) 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.service.autofill;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.widget.RemoteViews;
import com.android.internal.util.DataClass;
/**
* Holds presentations used to visualize autofill suggestions for each available UI type.
*
* @see Field
*/
@DataClass(genBuilder = true)
public final class Presentations {
/**
* The presentation used to visualize this field in fill UI.
*
* <p>Note: Before Android 13, this was referred to simply as "presentation" in the SDK.
*
* <p>Theme does not work with RemoteViews layout. Avoid hardcoded text color
* or background color: Autofill on different platforms may have different themes.
*/
private @Nullable RemoteViews mMenuPresentation;
/**
* The {@link InlinePresentation} used to visualize this dataset as inline suggestions.
* If the dataset supports inline suggestions, this should not be null.
*/
private @Nullable InlinePresentation mInlinePresentation;
/**
* The presentation used to visualize this field in the
* <a href="Dataset.html#FillDialogUI">fill dialog UI</a>
*
* <p>Theme does not work with RemoteViews layout. Avoid hardcoded text color
* or background color: Autofill on different platforms may have different themes.
*/
private @Nullable RemoteViews mDialogPresentation;
/**
* The {@link InlinePresentation} used to show the tooltip for the
* {@code mInlinePresentation}. If the set this field, the
* {@code mInlinePresentation} should not be null.
*/
private @Nullable InlinePresentation mInlineTooltipPresentation;
private static RemoteViews defaultMenuPresentation() {
return null;
}
private static InlinePresentation defaultInlinePresentation() {
return null;
}
private static RemoteViews defaultDialogPresentation() {
return null;
}
private static InlinePresentation defaultInlineTooltipPresentation() {
return null;
}
private void onConstructed() {
if (mMenuPresentation == null
&& mInlinePresentation == null
&& mDialogPresentation == null) {
throw new IllegalStateException("All presentations are null.");
}
if (mInlineTooltipPresentation != null && mInlinePresentation == null) {
throw new IllegalStateException(
"The inline presentation is required for mInlineTooltipPresentation.");
}
}
// Code below generated by codegen v1.0.23.
//
// DO NOT MODIFY!
// CHECKSTYLE:OFF Generated code
//
// To regenerate run:
// $ codegen $ANDROID_BUILD_TOP/./frameworks/base/core/java/android/service/autofill/Presentations.java
//
// To exclude the generated code from IntelliJ auto-formatting enable (one-time):
// Settings > Editor > Code Style > Formatter Control
//@formatter:off
@DataClass.Generated.Member
/* package-private */ Presentations(
@Nullable RemoteViews menuPresentation,
@Nullable InlinePresentation inlinePresentation,
@Nullable RemoteViews dialogPresentation,
@Nullable InlinePresentation inlineTooltipPresentation) {
this.mMenuPresentation = menuPresentation;
this.mInlinePresentation = inlinePresentation;
this.mDialogPresentation = dialogPresentation;
this.mInlineTooltipPresentation = inlineTooltipPresentation;
onConstructed();
}
/**
* The presentation used to visualize this field in fill UI.
*
* <p>Theme does not work with RemoteViews layout. Avoid hardcoded text color
* or background color: Autofill on different platforms may have different themes.
*/
@DataClass.Generated.Member
public @Nullable RemoteViews getMenuPresentation() {
return mMenuPresentation;
}
/**
* The {@link InlinePresentation} used to visualize this dataset as inline suggestions.
* If the dataset supports inline suggestions, this should not be null.
*/
@DataClass.Generated.Member
public @Nullable InlinePresentation getInlinePresentation() {
return mInlinePresentation;
}
/**
* The presentation used to visualize this field in the fill dialog UI.
*
* <p>Theme does not work with RemoteViews layout. Avoid hardcoded text color
* or background color: Autofill on different platforms may have different themes.
*/
@DataClass.Generated.Member
public @Nullable RemoteViews getDialogPresentation() {
return mDialogPresentation;
}
/**
* The {@link InlinePresentation} used to show the tooltip for the
* {@code mInlinePresentation}. If the set this field, the
* {@code mInlinePresentation} should not be null.
*/
@DataClass.Generated.Member
public @Nullable InlinePresentation getInlineTooltipPresentation() {
return mInlineTooltipPresentation;
}
/**
* A builder for {@link Presentations}
*/
@SuppressWarnings("WeakerAccess")
@DataClass.Generated.Member
public static final class Builder {
private @Nullable RemoteViews mMenuPresentation;
private @Nullable InlinePresentation mInlinePresentation;
private @Nullable RemoteViews mDialogPresentation;
private @Nullable InlinePresentation mInlineTooltipPresentation;
private long mBuilderFieldsSet = 0L;
public Builder() {
}
/**
* The presentation used to visualize this field in fill UI.
*
* <p>Theme does not work with RemoteViews layout. Avoid hardcoded text color
* or background color: Autofill on different platforms may have different themes.
*/
@DataClass.Generated.Member
public @NonNull Builder setMenuPresentation(@NonNull RemoteViews value) {
checkNotUsed();
mBuilderFieldsSet |= 0x1;
mMenuPresentation = value;
return this;
}
/**
* The {@link InlinePresentation} used to visualize this dataset as inline suggestions.
* If the dataset supports inline suggestions, this should not be null.
*/
@DataClass.Generated.Member
public @NonNull Builder setInlinePresentation(@NonNull InlinePresentation value) {
checkNotUsed();
mBuilderFieldsSet |= 0x2;
mInlinePresentation = value;
return this;
}
/**
* The presentation used to visualize this field in the fill dialog UI.
*
* <p>Theme does not work with RemoteViews layout. Avoid hardcoded text color
* or background color: Autofill on different platforms may have different themes.
*/
@DataClass.Generated.Member
public @NonNull Builder setDialogPresentation(@NonNull RemoteViews value) {
checkNotUsed();
mBuilderFieldsSet |= 0x4;
mDialogPresentation = value;
return this;
}
/**
* The {@link InlinePresentation} used to show the tooltip for the
* {@code mInlinePresentation}. If the set this field, the
* {@code mInlinePresentation} should not be null.
*/
@DataClass.Generated.Member
public @NonNull Builder setInlineTooltipPresentation(@NonNull InlinePresentation value) {
checkNotUsed();
mBuilderFieldsSet |= 0x8;
mInlineTooltipPresentation = value;
return this;
}
/** Builds the instance. This builder should not be touched after calling this! */
public @NonNull Presentations build() {
checkNotUsed();
mBuilderFieldsSet |= 0x10; // Mark builder used
if ((mBuilderFieldsSet & 0x1) == 0) {
mMenuPresentation = defaultMenuPresentation();
}
if ((mBuilderFieldsSet & 0x2) == 0) {
mInlinePresentation = defaultInlinePresentation();
}
if ((mBuilderFieldsSet & 0x4) == 0) {
mDialogPresentation = defaultDialogPresentation();
}
if ((mBuilderFieldsSet & 0x8) == 0) {
mInlineTooltipPresentation = defaultInlineTooltipPresentation();
}
Presentations o = new Presentations(
mMenuPresentation,
mInlinePresentation,
mDialogPresentation,
mInlineTooltipPresentation);
return o;
}
private void checkNotUsed() {
if ((mBuilderFieldsSet & 0x10) != 0) {
throw new IllegalStateException(
"This Builder should not be reused. Use a new Builder instance instead");
}
}
}
@DataClass.Generated(
time = 1643083242164L,
codegenVersion = "1.0.23",
sourceFile = "frameworks/base/core/java/android/service/autofill/Presentations.java",
inputSignatures = "private @android.annotation.Nullable android.widget.RemoteViews mMenuPresentation\nprivate @android.annotation.Nullable android.service.autofill.InlinePresentation mInlinePresentation\nprivate @android.annotation.Nullable android.widget.RemoteViews mDialogPresentation\nprivate @android.annotation.Nullable android.service.autofill.InlinePresentation mInlineTooltipPresentation\nprivate static android.widget.RemoteViews defaultMenuPresentation()\nprivate static android.service.autofill.InlinePresentation defaultInlinePresentation()\nprivate static android.widget.RemoteViews defaultDialogPresentation()\nprivate static android.service.autofill.InlinePresentation defaultInlineTooltipPresentation()\nprivate void onConstructed()\nclass Presentations extends java.lang.Object implements []\n@com.android.internal.util.DataClass(genBuilder=true)")
@Deprecated
private void __metadata() {}
//@formatter:on
// End of generated code
}
|