Add expand and do nothing library actions
This commit is contained in:
parent
cd1c8c6c54
commit
38d5623ed2
@ -42,6 +42,8 @@ THE SOFTWARE.
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
<item>4</item>
|
||||
<item>5</item>
|
||||
<item>6</item>
|
||||
</string-array>
|
||||
<string-array name="swipe_action_values">
|
||||
<!-- This must match the order of swipe_action_entries exactly and
|
||||
@ -78,12 +80,22 @@ THE SOFTWARE.
|
||||
<item>@string/clear_queue</item>
|
||||
<item>@string/toggle_controls</item>
|
||||
</string-array>
|
||||
<string-array name="default_playlist_action_entries">
|
||||
<item>@string/play</item>
|
||||
<item>@string/enqueue</item>
|
||||
<item>@string/last_used_action</item>
|
||||
<item>@string/play_all</item>
|
||||
<item>@string/enqueue_all</item>
|
||||
<item>@string/do_nothing</item>
|
||||
</string-array>
|
||||
<string-array name="default_action_entries">
|
||||
<item>@string/play</item>
|
||||
<item>@string/enqueue</item>
|
||||
<item>@string/last_used_action</item>
|
||||
<item>@string/play_all</item>
|
||||
<item>@string/enqueue_all</item>
|
||||
<item>@string/do_nothing</item>
|
||||
<item>@string/expand</item>
|
||||
</string-array>
|
||||
<string-array name="notification_mode_entries">
|
||||
<item>@string/never_show</item>
|
||||
|
@ -124,7 +124,7 @@ THE SOFTWARE.
|
||||
<org.kreed.vanilla.ListPreferenceSummary
|
||||
android:key="default_playlist_action"
|
||||
android:title="@string/default_playlist_action_title"
|
||||
android:entries="@array/default_action_entries"
|
||||
android:entries="@array/default_playlist_action_entries"
|
||||
android:entryValues="@array/entry_values"
|
||||
android:defaultValue="3" />
|
||||
</PreferenceCategory>
|
||||
|
@ -81,6 +81,8 @@ public class LibraryActivity
|
||||
public static final int ACTION_LAST_USED = 2;
|
||||
public static final int ACTION_PLAY_ALL = 3;
|
||||
public static final int ACTION_ENQUEUE_ALL = 4;
|
||||
public static final int ACTION_DO_NOTHING = 5;
|
||||
public static final int ACTION_EXPAND = 6;
|
||||
private static final int[] modeForAction =
|
||||
{ SongTimeline.MODE_PLAY, SongTimeline.MODE_ENQUEUE, -1,
|
||||
SongTimeline.MODE_PLAY_ID_FIRST, SongTimeline.MODE_ENQUEUE_ID_FIRST };
|
||||
@ -464,15 +466,21 @@ public class LibraryActivity
|
||||
{
|
||||
MediaView mediaView = (MediaView)view;
|
||||
LibraryAdapter adapter = (LibraryAdapter)list.getAdapter();
|
||||
if (mediaView.isRightBitmapPressed()) {
|
||||
int action = mDefaultAction;
|
||||
if (mediaView.isRightBitmapPressed() || (action == ACTION_EXPAND && mediaView.hasRightBitmap())) {
|
||||
if (adapter == mPlaylistAdapter)
|
||||
editPlaylist(mediaView.getMediaId(), mediaView.getTitle());
|
||||
else
|
||||
expand(createClickIntent(adapter, mediaView));
|
||||
} else if (id == mLastActedId) {
|
||||
openPlaybackActivity();
|
||||
} else {
|
||||
pickSongs(createClickIntent(adapter, mediaView), mDefaultAction);
|
||||
} else if (action != ACTION_DO_NOTHING) {
|
||||
if (action == ACTION_EXPAND) {
|
||||
// default to playing when trying to expand something that can't
|
||||
// be expanded
|
||||
action = ACTION_PLAY;
|
||||
}
|
||||
pickSongs(createClickIntent(adapter, mediaView), action);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,6 @@ import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.os.HandlerThread;
|
||||
import android.os.Looper;
|
||||
@ -257,7 +256,7 @@ public class PlaylistActivity extends Activity
|
||||
MediaView mediaView = (MediaView)view;
|
||||
if (mediaView.isRightBitmapPressed()) {
|
||||
mAdapter.remove(id);
|
||||
} else if (!mEditing) {
|
||||
} else if (!mEditing && mDefaultAction != LibraryActivity.ACTION_DO_NOTHING) {
|
||||
performAction(mDefaultAction, position, (Long)mediaView.getTag());
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user