Make sure the PlaybackService task manager reloads the queue
This commit is contained in:
parent
4800cba021
commit
0d8d804aaa
@ -25,7 +25,6 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
import com.yqritc.recyclerviewflexibledivider.HorizontalDividerItemDecoration;
|
import com.yqritc.recyclerviewflexibledivider.HorizontalDividerItemDecoration;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
@ -165,8 +164,12 @@ public class QueueFragment extends Fragment {
|
|||||||
case MOVED:
|
case MOVED:
|
||||||
int from = FeedItemUtil.indexOfItemWithId(queue, event.item.getId());
|
int from = FeedItemUtil.indexOfItemWithId(queue, event.item.getId());
|
||||||
int to = event.position;
|
int to = event.position;
|
||||||
|
if(from != to) {
|
||||||
queue.add(to, queue.remove(from));
|
queue.add(to, queue.remove(from));
|
||||||
recyclerAdapter.notifyItemMoved(from, to);
|
recyclerAdapter.notifyItemMoved(from, to);
|
||||||
|
} else {
|
||||||
|
// QueueFragment itself sent the event and already moved the item
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
onFragmentLoaded();
|
onFragmentLoaded();
|
||||||
@ -367,7 +370,7 @@ public class QueueFragment extends Fragment {
|
|||||||
Log.d(TAG, "move(" + from + ", " + to + ")");
|
Log.d(TAG, "move(" + from + ", " + to + ")");
|
||||||
queue.add(to, queue.remove(from));
|
queue.add(to, queue.remove(from));
|
||||||
recyclerAdapter.notifyItemMoved(from, to);
|
recyclerAdapter.notifyItemMoved(from, to);
|
||||||
DBWriter.moveQueueItem(from, to, false);
|
DBWriter.moveQueueItem(from, to, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ import de.greenrobot.event.EventBus;
|
|||||||
* to notify the PlaybackService about updates from the running tasks.
|
* to notify the PlaybackService about updates from the running tasks.
|
||||||
*/
|
*/
|
||||||
public class PlaybackServiceTaskManager {
|
public class PlaybackServiceTaskManager {
|
||||||
private static final String TAG = "PlaybackServiceTaskManager";
|
private static final String TAG = "PlaybackServiceTaskMgr";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update interval of position saver in milliseconds.
|
* Update interval of position saver in milliseconds.
|
||||||
@ -81,6 +81,7 @@ public class PlaybackServiceTaskManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onEvent(QueueEvent event) {
|
public void onEvent(QueueEvent event) {
|
||||||
|
Log.d(TAG, "onEvent(QueueEvent " + event +")");
|
||||||
cancelQueueLoader();
|
cancelQueueLoader();
|
||||||
loadQueue();
|
loadQueue();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user