From 8ade4242708f7ea8d1518126510dfd9c11219aa8 Mon Sep 17 00:00:00 2001 From: Joe Steele Date: Thu, 28 Aug 2014 17:48:37 -0400 Subject: [PATCH] Save/Restore the FoldableLinearLayout state --- res/layout/account_setup_basics.xml | 1 + .../fsck/k9/view/FoldableLinearLayout.java | 56 +++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/res/layout/account_setup_basics.xml b/res/layout/account_setup_basics.xml index 2521de031..7a3458649 100644 --- a/res/layout/account_setup_basics.xml +++ b/res/layout/account_setup_basics.xml @@ -48,6 +48,7 @@ android:visibility="gone" /> CREATOR = + new Parcelable.Creator() { + + @Override + public SavedState createFromParcel(Parcel source) { + return new SavedState(source); + } + + @Override + public SavedState[] newArray(int size) { + return new SavedState[size]; + } + }; + + private boolean mFolded; + + private SavedState(Parcel parcel) { + super(parcel); + mFolded = (parcel.readInt() == 1); + } + + private SavedState(Parcelable superState) { + super(superState); + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + super.writeToParcel(dest, flags); + dest.writeInt(mFolded ? 1 : 0); + } + } + /** * Migrates Child views as declared in xml to the inner foldableContainer */