Conditionpublic class Condition extends Object implements android.os.ParcelableCondition information from condition providers. |
Fields Summary |
---|
public static final String | SCHEME | public static final int | STATE_FALSE | public static final int | STATE_TRUE | public static final int | STATE_UNKNOWN | public static final int | STATE_ERROR | public static final int | FLAG_RELEVANT_NOW | public static final int | FLAG_RELEVANT_ALWAYS | public final android.net.Uri | id | public final String | summary | public final String | line1 | public final String | line2 | public final int | icon | public final int | state | public final int | flags | public static final Parcelable.Creator | CREATOR |
Constructors Summary |
---|
public Condition(android.net.Uri id, String summary, String line1, String line2, int icon, int state, int flags)
if (id == null) throw new IllegalArgumentException("id is required");
if (summary == null) throw new IllegalArgumentException("summary is required");
if (line1 == null) throw new IllegalArgumentException("line1 is required");
if (line2 == null) throw new IllegalArgumentException("line2 is required");
if (!isValidState(state)) throw new IllegalArgumentException("state is invalid: " + state);
this.id = id;
this.summary = summary;
this.line1 = line1;
this.line2 = line2;
this.icon = icon;
this.state = state;
this.flags = flags;
| private Condition(android.os.Parcel source)
this((Uri)source.readParcelable(Condition.class.getClassLoader()),
source.readString(),
source.readString(),
source.readString(),
source.readInt(),
source.readInt(),
source.readInt());
|
Methods Summary |
---|
public android.service.notification.Condition | copy()
final Parcel parcel = Parcel.obtain();
try {
writeToParcel(parcel, 0);
parcel.setDataPosition(0);
return new Condition(parcel);
} finally {
parcel.recycle();
}
| public int | describeContents()
return 0;
| public boolean | equals(java.lang.Object o)
if (!(o instanceof Condition)) return false;
if (o == this) return true;
final Condition other = (Condition) o;
return Objects.equals(other.id, id)
&& Objects.equals(other.summary, summary)
&& Objects.equals(other.line1, line1)
&& Objects.equals(other.line2, line2)
&& other.icon == icon
&& other.state == state
&& other.flags == flags;
| public int | hashCode()
return Objects.hash(id, summary, line1, line2, icon, state, flags);
| public static boolean | isValidId(android.net.Uri id, java.lang.String pkg)
return id != null && SCHEME.equals(id.getScheme()) && pkg.equals(id.getAuthority());
| private static boolean | isValidState(int state)
return state >= STATE_FALSE && state <= STATE_ERROR;
| public static Uri.Builder | newId(android.content.Context context)
return new Uri.Builder().scheme(SCHEME).authority(context.getPackageName());
| public static java.lang.String | relevanceToString(int flags)
final boolean now = (flags & FLAG_RELEVANT_NOW) != 0;
final boolean always = (flags & FLAG_RELEVANT_ALWAYS) != 0;
if (!now && !always) return "NONE";
if (now && always) return "NOW, ALWAYS";
return now ? "NOW" : "ALWAYS";
| public static java.lang.String | stateToString(int state)
if (state == STATE_FALSE) return "STATE_FALSE";
if (state == STATE_TRUE) return "STATE_TRUE";
if (state == STATE_UNKNOWN) return "STATE_UNKNOWN";
if (state == STATE_ERROR) return "STATE_ERROR";
throw new IllegalArgumentException("state is invalid: " + state);
| public java.lang.String | toString()
return new StringBuilder(Condition.class.getSimpleName()).append('[")
.append("id=").append(id)
.append(",summary=").append(summary)
.append(",line1=").append(line1)
.append(",line2=").append(line2)
.append(",icon=").append(icon)
.append(",state=").append(stateToString(state))
.append(",flags=").append(flags)
.append(']").toString();
| public void | writeToParcel(android.os.Parcel dest, int flags)
dest.writeParcelable(id, 0);
dest.writeString(summary);
dest.writeString(line1);
dest.writeString(line2);
dest.writeInt(icon);
dest.writeInt(state);
dest.writeInt(this.flags);
|
|