@@ -42,6 +42,7 @@ import androidx.core.view.size
4242import androidx.drawerlayout.widget.ClosableDrawerLayout
4343import androidx.drawerlayout.widget.DrawerLayout
4444import androidx.fragment.app.Fragment
45+ import androidx.viewbinding.ViewBinding
4546import com.google.android.material.color.MaterialColors
4647import com.google.android.material.navigation.NavigationView
4748import com.ichi2.anki.NoteEditorFragment.Companion.NoteEditorCaller
@@ -84,6 +85,31 @@ abstract class NavigationDrawerActivity :
8485 }
8586 }
8687
88+ override fun setViewBinding (binding : ViewBinding ) {
89+ val preferences = baseContext.sharedPrefs()
90+
91+ // Using ClosableDrawerLayout as a parent view.
92+ val closableDrawerLayout =
93+ LayoutInflater .from(this ).inflate(
94+ navigationDrawerLayout,
95+ null ,
96+ false ,
97+ ) as ClosableDrawerLayout
98+
99+ val coordinatorLayout = binding.root
100+ if (preferences.getBoolean(FULL_SCREEN_NAVIGATION_DRAWER , false )) {
101+ // If full screen navigation drawer is needed, then add FullDraggableContainer as a child view of closableDrawerLayout.
102+ // Then add coordinatorLayout as a child view of fullDraggableContainer.
103+ val fullDraggableContainer = FullDraggableContainerFix (this )
104+ fullDraggableContainer.addView(coordinatorLayout)
105+ closableDrawerLayout.addView(fullDraggableContainer, 0 )
106+ } else {
107+ // If full screen navigation drawer is not needed, then directly add coordinatorLayout as the child view.
108+ closableDrawerLayout.addView(coordinatorLayout, 0 )
109+ }
110+ setContentView(closableDrawerLayout)
111+ }
112+
87113 override fun setContentView (
88114 @LayoutRes layoutResID : Int ,
89115 ) {
0 commit comments