Skip to content
Browse files

Removed auto hide on tablets.

  • Loading branch information...
1 parent efedcdd commit bfa89de4cd45daf22cda8f404317b5307625d267 @roughike committed
View
40 bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java
@@ -191,6 +191,24 @@ public static BottomBar attachShy(CoordinatorLayout coordinatorLayout, Bundle sa
bottomBar.toughChildHood(ViewCompat.getFitsSystemWindows(coordinatorLayout));
bottomBar.onRestoreInstanceState(savedInstanceState);
+ if (!coordinatorLayout.getContext().getResources().getBoolean(R.bool.bb_bottom_bar_is_tablet_mode)) {
+ bottomBar.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
+ @SuppressWarnings("deprecation")
+ @Override
+ public void onGlobalLayout() {
+ ((CoordinatorLayout.LayoutParams) bottomBar.getLayoutParams())
+ .setBehavior(new BottomNavigationBehavior(bottomBar.getOuterContainer().getHeight(), 0));
+ ViewTreeObserver obs = bottomBar.getViewTreeObserver();
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
+ obs.removeOnGlobalLayoutListener(this);
+ } else {
+ obs.removeGlobalOnLayoutListener(this);
+ }
+ }
+ });
+ }
+
coordinatorLayout.addView(bottomBar);
return bottomBar;
}
@@ -664,28 +682,6 @@ private void updateItems(BottomBarItemBase[] bottomBarItems) {
darkThemeMagic();
}
- if (mIsShy) {
- if (!mIsTabletMode) {
- if (!mDrawBehindNavBar && !mIsShiftingMode) {
- getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
- @SuppressWarnings("deprecation")
- @Override
- public void onGlobalLayout() {
- ((CoordinatorLayout.LayoutParams) getLayoutParams())
- .setBehavior(new BottomNavigationBehavior(getOuterContainer().getHeight(), 0));
- ViewTreeObserver obs = getViewTreeObserver();
-
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
- obs.removeOnGlobalLayoutListener(this);
- } else {
- obs.removeGlobalOnLayoutListener(this);
- }
- }
- });
- }
- }
- }
-
View[] viewsToAdd = new View[bottomBarItems.length];
for (BottomBarItemBase bottomBarItemBase : bottomBarItems) {
View
4 bottom-bar/src/main/res/values-sw600dp/bools.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <bool name="bb_bottom_bar_is_tablet_mode">true</bool>
+</resources>
View
4 bottom-bar/src/main/res/values/bools.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <bool name="bb_bottom_bar_is_tablet_mode">false</bool>
+</resources>

0 comments on commit bfa89de

Please sign in to comment.
Something went wrong with that request. Please try again.