Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
… into drag_drop
  • Loading branch information
rubensousa committed Jun 15, 2024
2 parents ec379ff + df9a21e commit 5fba769
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,20 +128,21 @@ open class DpadRecyclerView @JvmOverloads constructor(
): PivotLayoutManager {
val properties = LayoutManager.getProperties(context, attrs, 0, 0)
val layout = PivotLayoutManager(properties)
val config = layout.getConfig()
layout.setFocusOutAllowed(
throughFront = typedArray.getBoolean(
R.styleable.DpadRecyclerView_dpadRecyclerViewFocusOutFront, false
R.styleable.DpadRecyclerView_dpadRecyclerViewFocusOutFront, config.focusOutFront
),
throughBack = typedArray.getBoolean(
R.styleable.DpadRecyclerView_dpadRecyclerViewFocusOutBack, false
R.styleable.DpadRecyclerView_dpadRecyclerViewFocusOutBack, config.focusOutBack
)
)
layout.setFocusOutSideAllowed(
throughFront = typedArray.getBoolean(
R.styleable.DpadRecyclerView_dpadRecyclerViewFocusOutSideFront, true
R.styleable.DpadRecyclerView_dpadRecyclerViewFocusOutSideFront, config.focusOutSideFront
),
throughBack = typedArray.getBoolean(
R.styleable.DpadRecyclerView_dpadRecyclerViewFocusOutSideBack, true
R.styleable.DpadRecyclerView_dpadRecyclerViewFocusOutSideBack, config.focusOutSideBack
)
)
layout.setFocusableDirection(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ internal class LayoutConfiguration(properties: Properties) {
* For horizontal orientation, this means navigating out from the start of the first view
* For vertical orientation, this means navigation out from the top of the first view
*/
var focusOutFront = false
var focusOutFront = true
private set

/**
Expand All @@ -54,7 +54,7 @@ internal class LayoutConfiguration(properties: Properties) {
* For horizontal orientation, this means navigating out from the end of the last view
* For vertical orientation, this means navigation out from the bottom of the last view
*/
var focusOutBack = false
var focusOutBack = true
private set

/**
Expand Down
10 changes: 9 additions & 1 deletion sample/src/main/res/layout/screen_recyclerview.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@
android:layout_height="match_parent"
android:clipChildren="false">

<View
android:id="@+id/placeholderView"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="@drawable/list_item_background"
android:focusable="true"
android:focusableInTouchMode="true"
app:layout_constraintTop_toTopOf="parent" />

<com.rubensousa.dpadrecyclerview.DpadRecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
Expand All @@ -37,5 +46,4 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />


</androidx.constraintlayout.widget.ConstraintLayout>

0 comments on commit 5fba769

Please sign in to comment.