From c61097a80a3c76ba1ae52533bd7cef8685ec8325 Mon Sep 17 00:00:00 2001
From: Iiro <iiro.krankka@gmail.com>
Date: Mon, 21 Mar 2016 14:57:43 +0200
Subject: [PATCH 1/3] Fixed issues on tablets when using the attachShy method.

---
 .../java/com/roughike/bottombar/BottomBar.java     | 28 ++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java b/bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java
index e051566..c48b983 100644
--- a/bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java
+++ b/bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java
@@ -175,6 +175,15 @@ public static BottomBar attach(View view, Bundle savedInstanceState) {
     }
 
     /**
+     * Deprecated. Breaks support for tablets.
+     * Use {@link #attachShy(CoordinatorLayout, View, Bundle)} instead.
+     */
+    @Deprecated
+    public static BottomBar attachShy(CoordinatorLayout coordinatorLayout, Bundle savedInstanceState) {
+        return attachShy(coordinatorLayout, null, savedInstanceState);
+    }
+
+    /**
      * Adds the BottomBar inside of your CoordinatorLayout and shows / hides
      * it according to scroll state changes.
      * <p/>
@@ -182,14 +191,21 @@ public static BottomBar attach(View view, Bundle savedInstanceState) {
      * of your {@link Activity#onSaveInstanceState(Bundle)} to restore the state.
      *
      * @param coordinatorLayout  a CoordinatorLayout for the BottomBar to add itself into
+     * @param userContentView    the view (usually a NestedScrollView) that has your scrolling content.
+     *                           Needed for tablet support.
      * @param savedInstanceState a Bundle for restoring the state on configuration change.
      * @return a BottomBar at the bottom of the screen.
      */
-    public static BottomBar attachShy(CoordinatorLayout coordinatorLayout, Bundle savedInstanceState) {
+    public static BottomBar attachShy(CoordinatorLayout coordinatorLayout, View userContentView, Bundle savedInstanceState) {
         final BottomBar bottomBar = new BottomBar(coordinatorLayout.getContext());
         bottomBar.toughChildHood(ViewCompat.getFitsSystemWindows(coordinatorLayout));
         bottomBar.onRestoreInstanceState(savedInstanceState);
 
+        if (userContentView != null && coordinatorLayout.getContext()
+                .getResources().getBoolean(R.bool.bb_bottom_bar_is_tablet_mode)) {
+            bottomBar.setPendingUserContentView(userContentView);
+        }
+
         coordinatorLayout.addView(bottomBar);
         return bottomBar;
     }
@@ -588,6 +604,10 @@ private void initializeViews() {
         mBackgroundView = rootView.findViewById(R.id.bb_bottom_bar_background_view);
         mBackgroundOverlay = rootView.findViewById(R.id.bb_bottom_bar_background_overlay);
 
+        if (mIsShy && mIgnoreTabletLayout) {
+            mPendingUserContentView = null;
+        }
+
         if (mPendingUserContentView != null) {
             ViewGroup.LayoutParams params = mPendingUserContentView.getLayoutParams();
 
@@ -596,6 +616,10 @@ private void initializeViews() {
                         ViewGroup.LayoutParams.MATCH_PARENT);
             }
 
+            if (mIsTabletMode && mIsShy) {
+                ((ViewGroup) mPendingUserContentView.getParent()).removeView(mPendingUserContentView);
+            }
+
             mUserContentContainer.addView(mPendingUserContentView, 0, params);
         }
 
@@ -697,7 +721,7 @@ public boolean onLongClick(View v) {
         return true;
     }
 
-    private void updateItems(BottomBarItemBase[] bottomBarItems) {
+    private void updateItems(final BottomBarItemBase[] bottomBarItems) {
         if (mItemContainer == null) {
             initializeViews();
         }

From 806ee7a3317ad0853c10ff9f1cfb2aeefcd7425c Mon Sep 17 00:00:00 2001
From: Iiro <iiro.krankka@gmail.com>
Date: Mon, 21 Mar 2016 15:08:36 +0200
Subject: [PATCH 2/3] Get rid of pending user content view after we no longer
 need it.

---
 bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java b/bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java
index c48b983..12888fb 100644
--- a/bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java
+++ b/bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java
@@ -621,6 +621,7 @@ private void initializeViews() {
             }
 
             mUserContentContainer.addView(mPendingUserContentView, 0, params);
+            mPendingUserContentView = null;
         }
 
         if (mIsShy && !mIsTabletMode) {

From ae3ebfbeb429a1c9c73fbe03c595d96ae66e3d59 Mon Sep 17 00:00:00 2001
From: Iiro <iiro.krankka@gmail.com>
Date: Mon, 21 Mar 2016 15:08:55 +0200
Subject: [PATCH 3/3] Updated library version.

---
 bottom-bar/bottom-bar.iml | 2 +-
 bottom-bar/build.gradle   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/bottom-bar/bottom-bar.iml b/bottom-bar/bottom-bar.iml
index d9fb75b..44bfee9 100644
--- a/bottom-bar/bottom-bar.iml
+++ b/bottom-bar/bottom-bar.iml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<module external.linked.project.id=":bottom-bar" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="com.roughike" external.system.module.version="1.1.5" type="JAVA_MODULE" version="4">
+<module external.linked.project.id=":bottom-bar" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="com.roughike" external.system.module.version="1.1.6" type="JAVA_MODULE" version="4">
   <component name="FacetManager">
     <facet type="android-gradle" name="Android-Gradle">
       <configuration>
diff --git a/bottom-bar/build.gradle b/bottom-bar/build.gradle
index a0f5a6f..ede8814 100644
--- a/bottom-bar/build.gradle
+++ b/bottom-bar/build.gradle
@@ -13,7 +13,7 @@ ext {
     siteUrl = 'https://github.com/roughike/BottomBar'
     gitUrl = 'https://github.com/roughike/BottomBar.git'
 
-    libraryVersion = '1.1.5'
+    libraryVersion = '1.1.6'
 
     developerId = 'roughike'
     developerName = 'Iiro Krankka'
