Search in sources :

Example 1 with FullDraggableContainer

use of com.drakeet.drawer.FullDraggableContainer in project Anki-Android by ankidroid.

the class NavigationDrawerActivity method setContentView.

@Override
public void setContentView(@LayoutRes int layoutResID) {
    SharedPreferences preferences = AnkiDroidApp.getSharedPrefs(getBaseContext());
    // Using ClosableDrawerLayout as a parent view.
    ClosableDrawerLayout closableDrawerLayout = (ClosableDrawerLayout) LayoutInflater.from(this).inflate(getNavigationDrawerLayout(), null, false);
    // Get CoordinatorLayout using resource ID
    CoordinatorLayout coordinatorLayout = (CoordinatorLayout) LayoutInflater.from(this).inflate(layoutResID, closableDrawerLayout, false);
    if (preferences.getBoolean(FULL_SCREEN_NAVIGATION_DRAWER, false)) {
        // If full screen navigation drawer is needed, then add FullDraggableContainer as a child view of closableDrawerLayout.
        // Then add coordinatorLayout as a child view of fullDraggableContainer.
        FullDraggableContainer fullDraggableContainer = new FullDraggableContainer(this);
        fullDraggableContainer.addView(coordinatorLayout);
        closableDrawerLayout.addView(fullDraggableContainer, 0);
    } else {
        // If full screen navigation drawer is not needed, then directly add coordinatorLayout as the child view.
        closableDrawerLayout.addView(coordinatorLayout, 0);
    }
    setContentView(closableDrawerLayout);
}
Also used : CoordinatorLayout(androidx.coordinatorlayout.widget.CoordinatorLayout) SharedPreferences(android.content.SharedPreferences) ClosableDrawerLayout(androidx.drawerlayout.widget.ClosableDrawerLayout) FullDraggableContainer(com.drakeet.drawer.FullDraggableContainer)

Aggregations

SharedPreferences (android.content.SharedPreferences)1 CoordinatorLayout (androidx.coordinatorlayout.widget.CoordinatorLayout)1 ClosableDrawerLayout (androidx.drawerlayout.widget.ClosableDrawerLayout)1 FullDraggableContainer (com.drakeet.drawer.FullDraggableContainer)1