| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
package android.service.notification; |
| 17 |
|
| 18 |
import android.annotation.Nullable; |
| 19 |
import android.annotation.SystemApi; |
| 20 |
import android.os.Parcel; |
| 21 |
import android.os.Parcelable; |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
@SystemApi |
| 29 |
public final class SnoozeCriterion implements Parcelable { |
| 30 |
private final String mId; |
| 31 |
private final CharSequence mExplanation; |
| 32 |
private final CharSequence mConfirmation; |
| 33 |
|
| 34 |
public SnoozeCriterion(String id, CharSequence explanation, CharSequence confirmation) { |
| 35 |
mId = id; |
| 36 |
mExplanation = explanation; |
| 37 |
mConfirmation = confirmation; |
| 38 |
} |
| 39 |
|
| 40 |
protected SnoozeCriterion(Parcel in) { |
| 41 |
if (in.readByte() != 0) { |
| 42 |
mId = in.readString(); |
| 43 |
} else { |
| 44 |
mId = null; |
| 45 |
} |
| 46 |
if (in.readByte() != 0) { |
| 47 |
mExplanation = in.readCharSequence(); |
| 48 |
} else { |
| 49 |
mExplanation = null; |
| 50 |
} |
| 51 |
if (in.readByte() != 0) { |
| 52 |
mConfirmation = in.readCharSequence(); |
| 53 |
} else { |
| 54 |
mConfirmation = null; |
| 55 |
} |
| 56 |
} |
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
public String getId() { |
| 62 |
return mId; |
| 63 |
} |
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
public CharSequence getExplanation() { |
| 70 |
return mExplanation; |
| 71 |
} |
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
public CharSequence getConfirmation() { |
| 77 |
return mConfirmation; |
| 78 |
} |
| 79 |
|
| 80 |
public static final @android.annotation.NonNull Creator<SnoozeCriterion> CREATOR = new Creator<SnoozeCriterion>() { |
| 81 |
@Override |
| 82 |
public SnoozeCriterion createFromParcel(Parcel in) { |
| 83 |
return new SnoozeCriterion(in); |
| 84 |
} |
| 85 |
|
| 86 |
@Override |
| 87 |
public SnoozeCriterion[] newArray(int size) { |
| 88 |
return new SnoozeCriterion[size]; |
| 89 |
} |
| 90 |
}; |
| 91 |
|
| 92 |
@Override |
| 93 |
public int describeContents() { |
| 94 |
return 0; |
| 95 |
} |
| 96 |
|
| 97 |
@Override |
| 98 |
public void writeToParcel(Parcel dest, int flags) { |
| 99 |
if (mId != null) { |
| 100 |
dest.writeByte((byte) 1); |
| 101 |
dest.writeString(mId); |
| 102 |
} else { |
| 103 |
dest.writeByte((byte) 0); |
| 104 |
} |
| 105 |
if (mExplanation != null) { |
| 106 |
dest.writeByte((byte) 1); |
| 107 |
dest.writeCharSequence(mExplanation); |
| 108 |
} else { |
| 109 |
dest.writeByte((byte) 0); |
| 110 |
} |
| 111 |
if (mConfirmation != null) { |
| 112 |
dest.writeByte((byte) 1); |
| 113 |
dest.writeCharSequence(mConfirmation); |
| 114 |
} else { |
| 115 |
dest.writeByte((byte) 0); |
| 116 |
} |
| 117 |
} |
| 118 |
|
| 119 |
@Override |
| 120 |
public boolean equals(@Nullable Object o) { |
| 121 |
if (this == o) return true; |
| 122 |
if (o == null || getClass() != o.getClass()) return false; |
| 123 |
|
| 124 |
SnoozeCriterion that = (SnoozeCriterion) o; |
| 125 |
|
| 126 |
if (mId != null ? !mId.equals(that.mId) : that.mId != null) return false; |
| 127 |
if (mExplanation != null ? !mExplanation.equals(that.mExplanation) |
| 128 |
: that.mExplanation != null) { |
| 129 |
return false; |
| 130 |
} |
| 131 |
return mConfirmation != null ? mConfirmation.equals(that.mConfirmation) |
| 132 |
: that.mConfirmation == null; |
| 133 |
|
| 134 |
} |
| 135 |
|
| 136 |
@Override |
| 137 |
public int hashCode() { |
| 138 |
int result = mId != null ? mId.hashCode() : 0; |
| 139 |
result = 31 * result + (mExplanation != null ? mExplanation.hashCode() : 0); |
| 140 |
result = 31 * result + (mConfirmation != null ? mConfirmation.hashCode() : 0); |
| 141 |
return result; |
| 142 |
} |
| 143 |
} |