@@ -6,9 +6,13 @@ import timber.log.Timber
66
77class 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