Add play or enqueue library action; make it the default

As suggested by Jonas Thiem
This commit is contained in:
Christopher Eby 2012-05-15 13:43:08 -05:00
parent d578f2441d
commit be9e298a72
4 changed files with 11 additions and 2 deletions

View File

@ -73,6 +73,7 @@ THE SOFTWARE.
<string name="done">Done</string>
<string name="remove">Remove</string>
<string name="clear_search">Clear search</string>
<string name="play_or_enqueue">Enqueue if playing; Play if paused</string>
<plurals name="playing">
<item quantity="one">1 song playing.</item>

View File

@ -46,6 +46,7 @@ THE SOFTWARE.
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
</string-array>
<string-array name="swipe_action_values">
<!-- This must match the order of swipe_action_entries exactly and
@ -98,6 +99,7 @@ THE SOFTWARE.
<item>@string/enqueue_all</item>
<item>@string/do_nothing</item>
<item>@string/expand</item>
<item>@string/play_or_enqueue</item>
</string-array>
<string-array name="notification_mode_entries">
<item>@string/never_show</item>

View File

@ -40,7 +40,7 @@ THE SOFTWARE.
android:title="@string/default_action_title"
android:entries="@array/default_action_entries"
android:entryValues="@array/entry_values"
android:defaultValue="0" />
android:defaultValue="7" />
<org.kreed.vanilla.ListPreferenceSummary
android:key="default_playlist_action"
android:title="@string/default_playlist_action_title"

View File

@ -103,6 +103,10 @@ public class LibraryActivity
* Action for row click: expand the row.
*/
public static final int ACTION_EXPAND = 6;
/**
* Action for row click: play if paused or enqueue if playing.
*/
public static final int ACTION_PLAY_OR_ENQUEUE = 7;
/**
* The SongTimeline add song modes corresponding to each relevant action.
*/
@ -264,7 +268,7 @@ public class LibraryActivity
finish();
startActivity(new Intent(this, LibraryActivity.class));
}
mDefaultAction = Integer.parseInt(settings.getString(PrefKeys.DEFAULT_ACTION_INT, "0"));
mDefaultAction = Integer.parseInt(settings.getString(PrefKeys.DEFAULT_ACTION_INT, "7"));
mLastActedId = LibraryAdapter.INVALID_ID;
updateHeaders();
}
@ -507,6 +511,8 @@ public class LibraryActivity
// default to playing when trying to expand something that can't
// be expanded
action = ACTION_PLAY;
} else if (action == ACTION_PLAY_OR_ENQUEUE) {
action = (mState & PlaybackService.FLAG_PLAYING) == 0 ? ACTION_PLAY : ACTION_ENQUEUE;
}
pickSongs(rowData, action);
}