Skip to content

Instantly share code, notes, and snippets.

View danielwilson1702's full-sized avatar

Daniel Wilson danielwilson1702

View GitHub Profile
binding.slidingPaneLayout.lockMode = SlidingPaneLayout.LOCK_MODE_LOCKED
class TwoPaneOnBackPressedCallback(
private val slidingPaneLayout: SlidingPaneLayout
) : OnBackPressedCallback(
// Set the default 'enabled' state to true only if it is slidable (i.e., the panes
// are overlapping) and open (i.e., the detail pane is visible).
slidingPaneLayout.isSlideable && slidingPaneLayout.isOpen
), SlidingPaneLayout.PanelSlideListener {
init {
slidingPaneLayout.addPanelSlideListener(this)
<?xml version="1.0" encoding="utf-8"?>
<androidx.slidingpanelayout.widget.SlidingPaneLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/sliding_pane_layout">
<androidx.fragment.app.FragmentContainerView
android:id="@+id/primary_nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="@dimen/list_width"