Skip to content

Commit

Permalink
FireTV: switch focus to menu bar on play/pause key
Browse files Browse the repository at this point in the history
  • Loading branch information
ge0rg committed Oct 14, 2021
1 parent 8b50531 commit 898e1bc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions res/layout/mapview.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:focusable="true"
/>
<ProgressBar
style="@android:style/Widget.ProgressBar.Large.Inverse"
Expand Down
8 changes: 8 additions & 0 deletions src/MapAct.scala
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class MapAct extends MapActivity with MapMenuHelper {
setKeepScreenOn()
setVolumeControls()
checkPermissions(Array(Manifest.permission.WRITE_EXTERNAL_STORAGE), RELOAD_MAP)
mapview.requestFocus()
}

override def onConfigurationChanged(c : Configuration) = {
Expand Down Expand Up @@ -141,6 +142,13 @@ class MapAct extends MapActivity with MapMenuHelper {
KeyEvent.KEYCODE_MEDIA_PREVIOUS =>
changeZoom(-1)
true
case KeyEvent.KEYCODE_MEDIA_PLAY |
KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE =>
if (mapview.hasFocus())
mapview.focusSearch(View.FOCUS_FORWARD).requestFocus()
else
mapview.requestFocus()
true
case _ => super.onKeyDown(keyCode, event)
}
}
Expand Down

0 comments on commit 898e1bc

Please sign in to comment.