From 7c50c924f921f12fe8d918688fa7063ef0ba2a36 Mon Sep 17 00:00:00 2001 From: shay-rom Date: Fri, 22 May 2015 14:55:55 +0300 Subject: [PATCH] bug: view disappear after orientation change. fix: saving the drawable visibility onSaveInstanceState --- .../java/com/balysv/materialmenu/MaterialMenuDrawable.java | 4 ++++ .../main/java/com/balysv/materialmenu/MaterialMenuView.java | 1 + 2 files changed, 5 insertions(+) diff --git a/library/src/main/java/com/balysv/materialmenu/MaterialMenuDrawable.java b/library/src/main/java/com/balysv/materialmenu/MaterialMenuDrawable.java index d83b81a..1c33e17 100644 --- a/library/src/main/java/com/balysv/materialmenu/MaterialMenuDrawable.java +++ b/library/src/main/java/com/balysv/materialmenu/MaterialMenuDrawable.java @@ -857,4 +857,8 @@ public int getChangingConfigurations() { static float dpToPx(Resources resources, float dp) { return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, resources.getDisplayMetrics()); } + + boolean isDrawableVisible(){ + return visible; + } } diff --git a/library/src/main/java/com/balysv/materialmenu/MaterialMenuView.java b/library/src/main/java/com/balysv/materialmenu/MaterialMenuView.java index d767133..8fce991 100644 --- a/library/src/main/java/com/balysv/materialmenu/MaterialMenuView.java +++ b/library/src/main/java/com/balysv/materialmenu/MaterialMenuView.java @@ -193,6 +193,7 @@ public Parcelable onSaveInstanceState() { Parcelable superState = super.onSaveInstanceState(); SavedState savedState = new SavedState(superState); savedState.state = currentState; + savedState.visible = ((drawable != null) ? drawable.isDrawableVisible() : false); return savedState; }