Prevent deletion of currently playing item

Was already prevented in the download list but not on the details fragment.
Added alpha to make disabled state clear.

Closes #2285
This commit is contained in:
ByteHamster 2018-05-05 11:27:16 +02:00
parent e16a111a12
commit 1628360c4b
2 changed files with 12 additions and 0 deletions

View File

@ -100,8 +100,10 @@ public class DownloadedEpisodesListAdapter extends BaseAdapter {
FeedItem.State state = item.getState();
if (state == FeedItem.State.PLAYING) {
holder.butSecondary.setEnabled(false);
holder.butSecondary.setAlpha(0.5f);
} else {
holder.butSecondary.setEnabled(true);
holder.butSecondary.setAlpha(1.0f);
}
holder.butSecondary.setFocusable(false);
holder.butSecondary.setTag(item);

View File

@ -432,6 +432,16 @@ public class ItemFragment extends Fragment implements OnSwipeGesture {
butAction1Text = R.string.download_label;
}
}
FeedItem.State state = item.getState();
if (butAction2Text == R.string.delete_label && state == FeedItem.State.PLAYING) {
butAction2.setEnabled(false);
butAction2.setAlpha(0.5f);
} else {
butAction2.setEnabled(true);
butAction2.setAlpha(1.0f);
}
if(butAction1Icon != null && butAction1Text != 0) {
butAction1.setText(butAction1Icon +"\u0020\u0020" + getActivity().getString(butAction1Text));
Iconify.addIcons(butAction1);