| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.app.contentsuggestions; |
| 18 |
|
| 19 |
import android.annotation.NonNull; |
| 20 |
import android.annotation.Nullable; |
| 21 |
import android.annotation.SystemApi; |
| 22 |
import android.graphics.Point; |
| 23 |
import android.os.Bundle; |
| 24 |
import android.os.Parcel; |
| 25 |
import android.os.Parcelable; |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
@SystemApi |
| 37 |
public final class SelectionsRequest implements Parcelable { |
| 38 |
private final int mTaskId; |
| 39 |
@Nullable |
| 40 |
private final Point mInterestPoint; |
| 41 |
@Nullable |
| 42 |
private final Bundle mExtras; |
| 43 |
|
| 44 |
private SelectionsRequest(int taskId, @Nullable Point interestPoint, @Nullable Bundle extras) { |
| 45 |
mTaskId = taskId; |
| 46 |
mInterestPoint = interestPoint; |
| 47 |
mExtras = extras; |
| 48 |
} |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
public int getTaskId() { |
| 54 |
return mTaskId; |
| 55 |
} |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
public @Nullable Point getInterestPoint() { |
| 62 |
return mInterestPoint; |
| 63 |
} |
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
public @NonNull Bundle getExtras() { |
| 69 |
return mExtras == null ? new Bundle() : mExtras; |
| 70 |
} |
| 71 |
|
| 72 |
@Override |
| 73 |
public int describeContents() { |
| 74 |
return 0; |
| 75 |
} |
| 76 |
|
| 77 |
@Override |
| 78 |
public void writeToParcel(Parcel dest, int flags) { |
| 79 |
dest.writeInt(mTaskId); |
| 80 |
dest.writeTypedObject(mInterestPoint, flags); |
| 81 |
dest.writeBundle(mExtras); |
| 82 |
} |
| 83 |
|
| 84 |
public static final @android.annotation.NonNull Creator<SelectionsRequest> CREATOR = |
| 85 |
new Creator<SelectionsRequest>() { |
| 86 |
@Override |
| 87 |
public SelectionsRequest createFromParcel(Parcel source) { |
| 88 |
return new SelectionsRequest( |
| 89 |
source.readInt(), source.readTypedObject(Point.CREATOR), source.readBundle()); |
| 90 |
} |
| 91 |
|
| 92 |
@Override |
| 93 |
public SelectionsRequest[] newArray(int size) { |
| 94 |
return new SelectionsRequest[size]; |
| 95 |
} |
| 96 |
}; |
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
@SystemApi |
| 103 |
public static final class Builder { |
| 104 |
|
| 105 |
private final int mTaskId; |
| 106 |
private Point mInterestPoint; |
| 107 |
private Bundle mExtras; |
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
public Builder(int taskId) { |
| 115 |
mTaskId = taskId; |
| 116 |
} |
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
public @NonNull Builder setExtras(@NonNull Bundle extras) { |
| 122 |
mExtras = extras; |
| 123 |
return this; |
| 124 |
} |
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
public @NonNull Builder setInterestPoint(@NonNull Point interestPoint) { |
| 130 |
mInterestPoint = interestPoint; |
| 131 |
return this; |
| 132 |
} |
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
public @NonNull SelectionsRequest build() { |
| 138 |
return new SelectionsRequest(mTaskId, mInterestPoint, mExtras); |
| 139 |
} |
| 140 |
} |
| 141 |
} |