1 /* 2 * Copyright (C) 2019 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 android.view.inputmethod; 18 19 import android.annotation.NonNull; 20 import android.annotation.Nullable; 21 import android.annotation.TestApi; 22 import android.os.Parcelable; 23 24 import com.android.internal.util.DataClass; 25 26 import java.util.ArrayList; 27 import java.util.List; 28 29 /** 30 * This class represents an inline suggestion response. See {@link InlineSuggestion} for more 31 * information. 32 */ 33 @DataClass(genEqualsHashCode = true, genToString = true, genHiddenConstructor = true) 34 public final class InlineSuggestionsResponse implements Parcelable { 35 /** 36 * List of {@link InlineSuggestion}s returned as a part of this response. 37 * 38 * <p>When the host app requests to inflate this <b>ordered</b> list of inline suggestions by 39 * calling {@link InlineSuggestion#inflate}, it is the host's responsibility to track the 40 * order of the inflated {@link android.view.View}s. These views are to be added in 41 * order to the view hierarchy, because the inflation calls will return asynchronously.</p> 42 * 43 * <p>The inflation ordering does not apply to the pinned icon.</p> 44 */ 45 @NonNull 46 private final List<InlineSuggestion> mInlineSuggestions; 47 48 /** 49 * Creates a new {@link InlineSuggestionsResponse}, for testing purpose. 50 * 51 * @hide 52 */ 53 @TestApi 54 @NonNull newInlineSuggestionsResponse( @onNull List<InlineSuggestion> inlineSuggestions)55 public static InlineSuggestionsResponse newInlineSuggestionsResponse( 56 @NonNull List<InlineSuggestion> inlineSuggestions) { 57 return new InlineSuggestionsResponse(inlineSuggestions); 58 } 59 60 61 62 // Code below generated by codegen v1.0.15. 63 // 64 // DO NOT MODIFY! 65 // CHECKSTYLE:OFF Generated code 66 // 67 // To regenerate run: 68 // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/view/inputmethod/InlineSuggestionsResponse.java 69 // 70 // To exclude the generated code from IntelliJ auto-formatting enable (one-time): 71 // Settings > Editor > Code Style > Formatter Control 72 //@formatter:off 73 74 75 /** 76 * Creates a new InlineSuggestionsResponse. 77 * 78 * @param inlineSuggestions 79 * List of {@link InlineSuggestion}s returned as a part of this response. 80 * 81 * <p>When the host app requests to inflate this <b>ordered</b> list of inline suggestions by 82 * calling {@link InlineSuggestion#inflate}, it is the host's responsibility to track the 83 * order of the inflated {@link android.view.View}s. These views are to be added in 84 * order to the view hierarchy, because the inflation calls will return asynchronously.</p> 85 * 86 * <p>The inflation ordering does not apply to the pinned icon.</p> 87 * @hide 88 */ 89 @DataClass.Generated.Member InlineSuggestionsResponse( @onNull List<InlineSuggestion> inlineSuggestions)90 public InlineSuggestionsResponse( 91 @NonNull List<InlineSuggestion> inlineSuggestions) { 92 this.mInlineSuggestions = inlineSuggestions; 93 com.android.internal.util.AnnotationValidations.validate( 94 NonNull.class, null, mInlineSuggestions); 95 96 // onConstructed(); // You can define this method to get a callback 97 } 98 99 /** 100 * List of {@link InlineSuggestion}s returned as a part of this response. 101 * 102 * <p>When the host app requests to inflate this <b>ordered</b> list of inline suggestions by 103 * calling {@link InlineSuggestion#inflate}, it is the host's responsibility to track the 104 * order of the inflated {@link android.view.View}s. These views are to be added in 105 * order to the view hierarchy, because the inflation calls will return asynchronously.</p> 106 * 107 * <p>The inflation ordering does not apply to the pinned icon.</p> 108 */ 109 @DataClass.Generated.Member getInlineSuggestions()110 public @NonNull List<InlineSuggestion> getInlineSuggestions() { 111 return mInlineSuggestions; 112 } 113 114 @Override 115 @DataClass.Generated.Member toString()116 public String toString() { 117 // You can override field toString logic by defining methods like: 118 // String fieldNameToString() { ... } 119 120 return "InlineSuggestionsResponse { " + 121 "inlineSuggestions = " + mInlineSuggestions + 122 " }"; 123 } 124 125 @Override 126 @DataClass.Generated.Member equals(@ullable Object o)127 public boolean equals(@Nullable Object o) { 128 // You can override field equality logic by defining either of the methods like: 129 // boolean fieldNameEquals(InlineSuggestionsResponse other) { ... } 130 // boolean fieldNameEquals(FieldType otherValue) { ... } 131 132 if (this == o) return true; 133 if (o == null || getClass() != o.getClass()) return false; 134 @SuppressWarnings("unchecked") 135 InlineSuggestionsResponse that = (InlineSuggestionsResponse) o; 136 //noinspection PointlessBooleanExpression 137 return true 138 && java.util.Objects.equals(mInlineSuggestions, that.mInlineSuggestions); 139 } 140 141 @Override 142 @DataClass.Generated.Member hashCode()143 public int hashCode() { 144 // You can override field hashCode logic by defining methods like: 145 // int fieldNameHashCode() { ... } 146 147 int _hash = 1; 148 _hash = 31 * _hash + java.util.Objects.hashCode(mInlineSuggestions); 149 return _hash; 150 } 151 152 @Override 153 @DataClass.Generated.Member writeToParcel(@onNull android.os.Parcel dest, int flags)154 public void writeToParcel(@NonNull android.os.Parcel dest, int flags) { 155 // You can override field parcelling by defining methods like: 156 // void parcelFieldName(Parcel dest, int flags) { ... } 157 158 dest.writeParcelableList(mInlineSuggestions, flags); 159 } 160 161 @Override 162 @DataClass.Generated.Member describeContents()163 public int describeContents() { return 0; } 164 165 /** @hide */ 166 @SuppressWarnings({"unchecked", "RedundantCast"}) 167 @DataClass.Generated.Member InlineSuggestionsResponse(@onNull android.os.Parcel in)168 /* package-private */ InlineSuggestionsResponse(@NonNull android.os.Parcel in) { 169 // You can override field unparcelling by defining methods like: 170 // static FieldType unparcelFieldName(Parcel in) { ... } 171 172 List<InlineSuggestion> inlineSuggestions = new ArrayList<>(); 173 in.readParcelableList(inlineSuggestions, InlineSuggestion.class.getClassLoader(), android.view.inputmethod.InlineSuggestion.class); 174 175 this.mInlineSuggestions = inlineSuggestions; 176 com.android.internal.util.AnnotationValidations.validate( 177 NonNull.class, null, mInlineSuggestions); 178 179 // onConstructed(); // You can define this method to get a callback 180 } 181 182 @DataClass.Generated.Member 183 public static final @NonNull Parcelable.Creator<InlineSuggestionsResponse> CREATOR 184 = new Parcelable.Creator<InlineSuggestionsResponse>() { 185 @Override 186 public InlineSuggestionsResponse[] newArray(int size) { 187 return new InlineSuggestionsResponse[size]; 188 } 189 190 @Override 191 public InlineSuggestionsResponse createFromParcel(@NonNull android.os.Parcel in) { 192 return new InlineSuggestionsResponse(in); 193 } 194 }; 195 196 @DataClass.Generated( 197 time = 1595891876037L, 198 codegenVersion = "1.0.15", 199 sourceFile = "frameworks/base/core/java/android/view/inputmethod/InlineSuggestionsResponse.java", 200 inputSignatures = "private final @android.annotation.NonNull java.util.List<android.view.inputmethod.InlineSuggestion> mInlineSuggestions\npublic static @android.annotation.TestApi @android.annotation.NonNull android.view.inputmethod.InlineSuggestionsResponse newInlineSuggestionsResponse(java.util.List<android.view.inputmethod.InlineSuggestion>)\nclass InlineSuggestionsResponse extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genEqualsHashCode=true, genToString=true, genHiddenConstructor=true)") 201 @Deprecated __metadata()202 private void __metadata() {} 203 204 205 //@formatter:on 206 // End of generated code 207 208 } 209