Added option to remove songs from the playing queue
This commit is contained in:
parent
aba7ded001
commit
b1b1aa093d
2 changed files with 30 additions and 1 deletions
|
|
@ -4,8 +4,11 @@ import android.support.annotation.LayoutRes;
|
|||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
||||
import com.kabouzeid.gramophone.R;
|
||||
import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
|
||||
import com.kabouzeid.gramophone.interfaces.CabHolder;
|
||||
import com.kabouzeid.gramophone.model.Song;
|
||||
|
||||
|
|
@ -26,6 +29,11 @@ public class PlayingQueueAdapter extends SongAdapter {
|
|||
super(activity, dataSet, itemLayoutRes, usePalette, cabHolder);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SongAdapter.ViewHolder createViewHolder(View view) {
|
||||
return new ViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull SongAdapter.ViewHolder holder, int position) {
|
||||
super.onBindViewHolder(holder, position);
|
||||
|
|
@ -74,4 +82,26 @@ public class PlayingQueueAdapter extends SongAdapter {
|
|||
holder.paletteColorContainer.setAlpha(alpha);
|
||||
}
|
||||
}
|
||||
|
||||
public class ViewHolder extends SongAdapter.ViewHolder {
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getSongMenuRes() {
|
||||
return R.menu.menu_item_playing_queue_song;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onSongMenuItemClick(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_remove_from_playing_queue:
|
||||
MusicPlayerRemote.removeFromQueue(getAdapterPosition());
|
||||
return true;
|
||||
}
|
||||
return super.onSongMenuItemClick(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
android:id="@+id/action_remove_from_playing_queue"
|
||||
android:title="@string/action_remove_from_playing_queue"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_add_to_playlist"
|
||||
android:title="@string/action_add_to_playlist"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue