Skip to content

Commit 66fcf03

Browse files
Refactor to restrict to channel/chapter overlay.
1 parent ed9557d commit 66fcf03

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

app/src/main/java/org/jellyfin/androidtv/ui/playback/CustomPlaybackOverlayFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
187187
.findFragmentById(R.id.rows_area);
188188
}
189189

190-
mPopupRowPresenter = new PositionableListRowPresenter();
190+
mPopupRowPresenter = new PositionableListRowPresenter(null, true);
191191
mPopupRowAdapter = new ArrayObjectAdapter(mPopupRowPresenter);
192192
mPopupRowsFragment.setAdapter(mPopupRowAdapter);
193193
mPopupRowsFragment.setOnItemViewClickedListener(itemViewClickedListener);

app/src/main/java/org/jellyfin/androidtv/ui/presentation/PositionableListRowPresenter.kt

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@ import timber.log.Timber
66

77
class PositionableListRowPresenter : CustomListRowPresenter {
88
private var viewHolder: ViewHolder? = null
9+
private val trapFocusAtStart: Boolean
910

10-
constructor() : super()
11-
constructor(padding: Int?) : super(padding)
11+
constructor() : this(padding = null, trapFocusAtStart = false)
12+
constructor(padding: Int?) : this(padding, trapFocusAtStart = false)
13+
constructor(padding: Int? = null, trapFocusAtStart: Boolean = false) : super(padding) {
14+
this.trapFocusAtStart = trapFocusAtStart
15+
}
1216

1317
init {
1418
shadowEnabled = false
@@ -23,11 +27,13 @@ class PositionableListRowPresenter : CustomListRowPresenter {
2327
if (holder !is ViewHolder) return
2428

2529
viewHolder = holder
26-
// Prevent focus from escaping the grid at the left boundary so the user
27-
// stays inside the popup (channel changer / chapter selector).
28-
holder.gridView?.setOnKeyInterceptListener { event ->
29-
event.keyCode == KeyEvent.KEYCODE_DPAD_LEFT &&
30-
(holder.gridView?.selectedPosition ?: -1) <= 0
30+
if (trapFocusAtStart) {
31+
// Prevent focus from escaping the grid at the left boundary so the user
32+
// stays inside the popup (channel changer / chapter selector).
33+
holder.gridView?.setOnKeyInterceptListener { event ->
34+
event.keyCode == KeyEvent.KEYCODE_DPAD_LEFT &&
35+
(holder.gridView?.selectedPosition ?: -1) <= 0
36+
}
3137
}
3238
}
3339

0 commit comments

Comments
 (0)