-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CheckedSavedState.java
41 lines (31 loc) · 1.13 KB
/
CheckedSavedState.java
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
package io.errorlab.widget;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.customview.view.AbsSavedState;
class CheckedSavedState extends AbsSavedState {
public static final Creator<CheckedSavedState> CREATOR = new ClassLoaderCreator<CheckedSavedState>() {
public CheckedSavedState createFromParcel(Parcel source, ClassLoader loader) {
return new CheckedSavedState(source, loader);
}
public CheckedSavedState createFromParcel(Parcel source) {
return new CheckedSavedState(source, null);
}
public CheckedSavedState[] newArray(int size) {
return new CheckedSavedState[size];
}
};
protected boolean checked;
protected CheckedSavedState(Parcelable superState) {
super(superState);
}
@SuppressWarnings("WeakerAccess")
CheckedSavedState(Parcel source, ClassLoader loader) {
super(source, loader);
checked = source.readInt() == 1;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
super.writeToParcel(dest, flags);
dest.writeInt(checked ? 1 : 0);
}
}