Merge pull request #2674 from ByteHamster/delete-while-playing

Prevent deletion of currently playing item
This commit is contained in:
Martin Fietz 2018-05-05 18:21:14 +02:00 committed by GitHub
commit e04e537829
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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);