|
@@ -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();
|
|
|
}
|
|
|
0 comments on commit
c61097a