@@ -78,7 +78,6 @@ import androidx.draganddrop.DropHelper
7878import androidx.fragment.app.commit
7979import androidx.lifecycle.flowWithLifecycle
8080import androidx.lifecycle.lifecycleScope
81- import androidx.recyclerview.widget.DividerItemDecoration
8281import androidx.recyclerview.widget.LinearLayoutManager
8382import androidx.recyclerview.widget.RecyclerView
8483import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
@@ -160,6 +159,7 @@ import com.ichi2.anki.settings.Prefs
160159import com.ichi2.anki.snackbar.BaseSnackbarBuilderProvider
161160import com.ichi2.anki.snackbar.SnackbarBuilder
162161import com.ichi2.anki.snackbar.showSnackbar
162+ import com.ichi2.anki.ui.ResizablePaneManager
163163import com.ichi2.anki.utils.ext.dismissAllDialogFragments
164164import com.ichi2.anki.utils.ext.setFragmentResultListener
165165import com.ichi2.anki.utils.ext.showDialogFragment
@@ -528,6 +528,27 @@ open class DeckPicker :
528528 // Open StudyOptionsFragment if in fragmented mode
529529 if (fragmented && ! startupError) {
530530 loadStudyOptionsFragment(false )
531+
532+ val resizingDivider = findViewById<View >(R .id.resizing_divider)
533+ val parentLayout = findViewById<LinearLayout >(R .id.deckpicker_xl_view)
534+
535+ // Get references to the panes
536+ val deckPickerPane = findViewById<View >(R .id.deck_picker_pane)
537+ val studyOptionsPane = findViewById<View >(R .id.studyoptions_fragment)
538+
539+ if (deckPickerPane == null || studyOptionsPane == null ) {
540+ Timber .w(" DeckPicker or StudyOptions pane not found. Resizing divider will not function." )
541+ }
542+ // Initialize the ResizablePaneManager
543+ ResizablePaneManager (
544+ parentLayout = parentLayout,
545+ divider = resizingDivider,
546+ leftPane = deckPickerPane,
547+ rightPane = studyOptionsPane,
548+ sharedPrefs = this .sharedPrefs(),
549+ leftPaneWeightKey = PREF_DECK_PICKER_PANE_WEIGHT ,
550+ rightPaneWeightKey = PREF_STUDY_OPTIONS_PANE_WEIGHT ,
551+ )
531552 }
532553 registerReceiver()
533554
@@ -542,15 +563,9 @@ open class DeckPicker :
542563 deckPickerContent.visibility = View .GONE
543564 noDecksPlaceholder.visibility = View .GONE
544565
545- // specify a LinearLayoutManager and set up item dividers for the RecyclerView
566+ // specify a LinearLayoutManager for the RecyclerView
546567 recyclerViewLayoutManager = LinearLayoutManager (this )
547568 recyclerView.layoutManager = recyclerViewLayoutManager
548- val ta = this .obtainStyledAttributes(intArrayOf(R .attr.deckDivider))
549- val divider = ta.getDrawable(0 )
550- ta.recycle()
551- val dividerDecorator = DividerItemDecoration (this , recyclerViewLayoutManager.orientation)
552- dividerDecorator.setDrawable(divider!! )
553- recyclerView.addItemDecoration(dividerDecorator)
554569
555570 // Add background to Deckpicker activity
556571 val view = if (fragmented) findViewById(R .id.deckpicker_xl_view) else findViewById<View >(R .id.root_layout)
@@ -2565,6 +2580,9 @@ open class DeckPicker :
25652580 private const val AUTOMATIC_SYNC_MINIMAL_INTERVAL_IN_MINUTES : Long = 10
25662581 private const val SWIPE_TO_SYNC_TRIGGER_DISTANCE = 400
25672582
2583+ private const val PREF_DECK_PICKER_PANE_WEIGHT = " deckPickerPaneWeight"
2584+ private const val PREF_STUDY_OPTIONS_PANE_WEIGHT = " studyOptionsPaneWeight"
2585+
25682586 // Animation utility methods used by renderPage() method
25692587 fun fadeIn (
25702588 view : View ? ,
0 commit comments