From 2ecaf4d6b4bbc2915ee983788aba821c6e814a45 Mon Sep 17 00:00:00 2001 From: Chris Pierick Date: Thu, 22 Jan 2015 19:17:45 -0500 Subject: [PATCH] Small touch up with not allowing animation when dialog is not showing. --- .../java/com/cocosw/bottomsheet/BottomSheet.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/library/src/main/java/com/cocosw/bottomsheet/BottomSheet.java b/library/src/main/java/com/cocosw/bottomsheet/BottomSheet.java index e6c34f6..b7d04f8 100644 --- a/library/src/main/java/com/cocosw/bottomsheet/BottomSheet.java +++ b/library/src/main/java/com/cocosw/bottomsheet/BottomSheet.java @@ -331,13 +331,23 @@ public void showItem(int itemId, boolean visible) { public void showItem(int itemId) { getAdapter().showItem(itemId); - + // If we're not showing we don't want to animate. + if (!isShowing()) getAdapter().notifyDataSetChanged(); invalidateDialogLayout(); } public void hideItem(int itemId) { getAdapter().hideItem(itemId); + if (list == null) return; + + if (isShowing()) { + // If we're not showing we don't want to animate. + getAdapter().notifyDataSetChanged(); + invalidateDialogLayout(); + return; + } + list.post(new Runnable() { @Override public void run() {