make jump-to-enqueued-song an option
This commit is contained in:
parent
c7605a58d5
commit
f1b7d241fe
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2012 Christopher Eby <kreed@kreed.org>
|
||||
* Copyright (C) 2015-2017 Adrian Ulrich <adrian@blinkenlights.ch>
|
||||
* Copyright (C) 2015-2019 Adrian Ulrich <adrian@blinkenlights.ch>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -138,6 +138,10 @@ public class LibraryActivity
|
||||
* The action to execute when a row is tapped.
|
||||
*/
|
||||
private int mDefaultAction;
|
||||
/**
|
||||
* Whether or not to jump to songs if the are in the queue
|
||||
*/
|
||||
private boolean mJumpToEnqueuedOnPlay;
|
||||
/**
|
||||
* The last used action from the menu. Used with ACTION_LAST_USED.
|
||||
*/
|
||||
@ -202,21 +206,23 @@ public class LibraryActivity
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRestart()
|
||||
{
|
||||
super.onRestart();
|
||||
loadTabOrder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
super.onStart();
|
||||
|
||||
loadPreferences();
|
||||
loadTabOrder();
|
||||
updateHeaders();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load settings and cache them.
|
||||
*/
|
||||
private void loadPreferences() {
|
||||
SharedPreferences settings = PlaybackService.getSettings(this);
|
||||
mDefaultAction = Integer.parseInt(settings.getString(PrefKeys.DEFAULT_ACTION_INT, PrefDefaults.DEFAULT_ACTION_INT));
|
||||
updateHeaders();
|
||||
mJumpToEnqueuedOnPlay = settings.getBoolean(PrefKeys.JUMP_TO_ENQUEUED_ON_PLAY, PrefDefaults.JUMP_TO_ENQUEUED_ON_PLAY);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -383,7 +389,7 @@ public class LibraryActivity
|
||||
|
||||
// special handling if we pick one song to be played that is already in queue
|
||||
boolean songPicked = (id >= 0 && type == MediaUtils.TYPE_SONG); // not invalid, not play all
|
||||
if (songPicked && effectiveAction == ACTION_PLAY) {
|
||||
if (songPicked && effectiveAction == ACTION_PLAY && mJumpToEnqueuedOnPlay) {
|
||||
int songPosInQueue = PlaybackService.get(this).getQueuePositionForSongId(id);
|
||||
if (songPosInQueue > -1) {
|
||||
// we picked for play one song that is already present in the queue, just jump to it
|
||||
|
@ -74,4 +74,5 @@ public class PrefDefaults {
|
||||
public static final boolean KEEP_SCREEN_ON = false;
|
||||
public static final String PLAYLIST_SYNC_MODE = "0";
|
||||
public static final String PLAYLIST_SYNC_FOLDER = "/sdcard/Playlists";
|
||||
public static final boolean JUMP_TO_ENQUEUED_ON_PLAY = true;
|
||||
}
|
||||
|
@ -75,4 +75,5 @@ public class PrefKeys {
|
||||
public static final String KEEP_SCREEN_ON = "keep_screen_on";
|
||||
public static final String PLAYLIST_SYNC_MODE = "playlist_sync_mode";
|
||||
public static final String PLAYLIST_SYNC_FOLDER = "playlist_sync_folder";
|
||||
public static final String JUMP_TO_ENQUEUED_ON_PLAY = "jump_to_enqueued_on_play";
|
||||
}
|
||||
|
@ -257,6 +257,9 @@ THE SOFTWARE.
|
||||
<string name="queue_enable_scroll_to_song_title">Scroll to track title in queue</string>
|
||||
<string name="queue_enable_scroll_to_song_summary">Scroll to currently playing track in the queue on song change</string>
|
||||
|
||||
<string name="jump_to_enqueued_on_play_title">Jump to enqueued song on \'Play\'</string>
|
||||
<string name="jump_to_enqueued_on_play_summary">If the requested song is already in the queue, jump to it instead of flushing the queue</string>
|
||||
|
||||
<string name="coverloader_android_title">Load artwork from Android</string>
|
||||
<string name="coverloader_android_summary">Query Androids internal media database for album artwork</string>
|
||||
|
||||
|
@ -52,6 +52,11 @@ THE SOFTWARE.
|
||||
android:title="@string/queue_enable_scroll_to_song_title"
|
||||
android:summary="@string/queue_enable_scroll_to_song_summary"
|
||||
android:defaultValue="false" />
|
||||
<CheckBoxPreference
|
||||
android:key="jump_to_enqueued_on_play"
|
||||
android:title="@string/jump_to_enqueued_on_play_title"
|
||||
android:summary="@string/jump_to_enqueued_on_play_summary"
|
||||
android:defaultValue="true" />
|
||||
<PreferenceScreen
|
||||
android:title="@string/filebrowser_start"
|
||||
android:summary="@string/customize_filebrowser_start">
|
||||
|
Loading…
x
Reference in New Issue
Block a user