it.sephiroth.android.library.bottomnavigation.BottomNavigation Java Examples

The following examples show how to use it.sephiroth.android.library.bottomnavigation.BottomNavigation. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FloatingActionButtonBehavior.java    From mvvm-template with GNU General Public License v3.0 5 votes vote down vote up
@Override public boolean layoutDependsOn(final CoordinatorLayout parent, final FloatingActionButton child, final View dependency) {
    if (BottomNavigation.class.isInstance(dependency)) {
        return true;
    } else if (Snackbar.SnackbarLayout.class.isInstance(dependency)) {
        return true;
    }
    return super.layoutDependsOn(parent, child, dependency);
}
 
Example #2
Source File: FloatingActionButtonBehavior.java    From mvvm-template with GNU General Public License v3.0 5 votes vote down vote up
@Override public boolean onDependentViewChanged(@NonNull
                                                final CoordinatorLayout parent, @NonNull
                                                final FloatingActionButton child, final View dependency) {
    log(TAG, INFO, "onDependentViewChanged: " + dependency);
    final List<View> list = parent.getDependencies(child);
    ViewGroup.MarginLayoutParams params = ((ViewGroup.MarginLayoutParams) child.getLayoutParams());
    int bottomMargin = (params.bottomMargin + params.rightMargin) - (params.topMargin + params.leftMargin);
    float t = 0;
    float t2 = 0;
    float t3 = 0;
    boolean result = false;
    for (View dep : list) {
        if (Snackbar.SnackbarLayout.class.isInstance(dep)) {
            t += dep.getTranslationY() - dep.getHeight();
            result = true;
        } else if (BottomNavigation.class.isInstance(dep)) {
            BottomNavigation navigation = (BottomNavigation) dep;
            t2 = navigation.getTranslationY() - navigation.getHeight() + bottomMargin;
            t += t2;
            result = true;

            if (navigationBarHeight > 0) {
                if (!navigation.isExpanded()) {
                    child.hide();
                } else {
                    child.show();
                }
            }
        }
    }

    if (navigationBarHeight > 0 && t2 < 0) {
        t = Math.min(t2, t + navigationBarHeight);
    }

    child.setTranslationY(t);
    return result;
}
 
Example #3
Source File: MainPresenter.java    From FastAccess with GNU General Public License v3.0 5 votes vote down vote up
@Override public void onActivityStarted(@Nullable Bundle savedInstance,
                                        @NonNull MainView mainView,
                                        @NonNull BottomNavigation bottomNavigation,
                                        @NonNull NavigationView navigationView) {
    navigationView.setNavigationItemSelectedListener(this);
    Typeface myTypeface = TypeFaceHelper.getTypeface();
    bottomNavigation.setDefaultTypeface(myTypeface);
    bottomNavigation.setOnMenuItemClickListener(this);
    if (savedInstance == null) {
        bottomNavigation.setDefaultSelectedIndex(0);
    }
}
 
Example #4
Source File: TabletBehavior.java    From mvvm-template with GNU General Public License v3.0 4 votes vote down vote up
public boolean layoutDependsOn(CoordinatorLayout parent, BottomNavigation child, View dependency) {
    return AppBarLayout.class.isInstance(dependency) || Toolbar.class.isInstance(dependency);
}
 
Example #5
Source File: TabletBehavior.java    From mvvm-template with GNU General Public License v3.0 4 votes vote down vote up
public boolean onDependentViewChanged(CoordinatorLayout parent, BottomNavigation child, View dependency) {
    return true;
}
 
Example #6
Source File: TabletBehavior.java    From mvvm-template with GNU General Public License v3.0 4 votes vote down vote up
public void onDependentViewRemoved(CoordinatorLayout parent, BottomNavigation child, View dependency) {
    super.onDependentViewRemoved(parent, child, dependency);
}
 
Example #7
Source File: TabletBehavior.java    From mvvm-template with GNU General Public License v3.0 4 votes vote down vote up
public boolean onLayoutChild(CoordinatorLayout parent, BottomNavigation child, int layoutDirection) {
    return super.onLayoutChild(parent, child, layoutDirection);
}
 
Example #8
Source File: TabletBehavior.java    From mvvm-template with GNU General Public License v3.0 4 votes vote down vote up
public void onNestedVerticalOverScroll(CoordinatorLayout coordinatorLayout, BottomNavigation child, int direction, int currentOverScroll, int
        totalOverScroll) {
}
 
Example #9
Source File: TabletBehavior.java    From mvvm-template with GNU General Public License v3.0 4 votes vote down vote up
public void onDirectionNestedPreScroll(CoordinatorLayout coordinatorLayout, BottomNavigation child, View target, int dx, int dy, int[]
        consumed, int scrollDirection) {
}
 
Example #10
Source File: TabletBehavior.java    From mvvm-template with GNU General Public License v3.0 4 votes vote down vote up
protected boolean onNestedDirectionFling(CoordinatorLayout coordinatorLayout, BottomNavigation child, View target, float velocityX, float
        velocityY, int scrollDirection) {
    return false;
}
 
Example #11
Source File: MainMvp.java    From FastAccess with GNU General Public License v3.0 4 votes vote down vote up
void onActivityStarted(@Nullable Bundle savedInstance, @NonNull MainView mainView,
@NonNull BottomNavigation bottomNavigation,
@NonNull NavigationView navigationView);