Use dpad left/right for skipping and seeking only when the play buttons are focused.
diff --git a/res/layout-land-finger/audio_player.xml b/res/layout-land-finger/audio_player.xml
index 6d68f4d..a9c17f1 100644
--- a/res/layout-land-finger/audio_player.xml
+++ b/res/layout-land-finger/audio_player.xml
@@ -53,7 +53,8 @@
android:src="@drawable/ic_mp_current_playlist_btn"
android:layout_width="82dip"
android:layout_height="45dip"
- android:layout_marginRight="8dip" />
+ android:layout_marginRight="8dip"
+ android:nextFocusLeft="@id/curplaylist" />
<ImageButton android:id="@+id/shuffle"
android:layout_width="82dip"
diff --git a/src/com/android/music/MediaPlaybackActivity.java b/src/com/android/music/MediaPlaybackActivity.java
index 478ae0b..8688fbb 100644
--- a/src/com/android/music/MediaPlaybackActivity.java
+++ b/src/com/android/music/MediaPlaybackActivity.java
@@ -70,7 +70,7 @@
private boolean mOneShot = false;
private boolean mSeeking = false;
- private boolean mDeviceHasNoDpad;
+ private boolean mDeviceHasDpad;
private long mStartSeekPos = 0;
private long mLastSeekEventTime;
private IMediaPlaybackService mService = null;
@@ -133,7 +133,7 @@
mNextButton.setRepeatListener(mFfwdListener, 260);
seekmethod = 1;
- mDeviceHasNoDpad = (getResources().getConfiguration().navigation !=
+ mDeviceHasDpad = (getResources().getConfiguration().navigation ==
Configuration.NAVIGATION_DPAD);
mQueueButton = (ImageButton) findViewById(R.id.curplaylist);
@@ -742,7 +742,7 @@
switch(keyCode)
{
case KeyEvent.KEYCODE_DPAD_LEFT:
- if (mDeviceHasNoDpad) {
+ if (!useDpadMusicControl()) {
break;
}
if (mService != null) {
@@ -763,7 +763,7 @@
mPosOverride = -1;
return true;
case KeyEvent.KEYCODE_DPAD_RIGHT:
- if (mDeviceHasNoDpad) {
+ if (!useDpadMusicControl()) {
break;
}
if (mService != null) {
@@ -785,6 +785,15 @@
return super.onKeyUp(keyCode, event);
}
+ private boolean useDpadMusicControl() {
+ if (mDeviceHasDpad && (mPrevButton.isFocused() ||
+ mNextButton.isFocused() ||
+ mPauseButton.isFocused())) {
+ return true;
+ }
+ return false;
+ }
+
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
@@ -821,7 +830,7 @@
return true;
case KeyEvent.KEYCODE_DPAD_LEFT:
- if (mDeviceHasNoDpad) {
+ if (!useDpadMusicControl()) {
break;
}
if (!mPrevButton.hasFocus()) {
@@ -830,7 +839,7 @@
scanBackward(repcnt, event.getEventTime() - event.getDownTime());
return true;
case KeyEvent.KEYCODE_DPAD_RIGHT:
- if (mDeviceHasNoDpad) {
+ if (!useDpadMusicControl()) {
break;
}
if (!mNextButton.hasFocus()) {