Merge pull request #3789 from ByteHamster/fix-download-button

Fix download button when 'prefer streaming' is active
This commit is contained in:
H. Lehmann 2020-01-26 21:39:58 +01:00 committed by GitHub
commit f41a133f2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 7 deletions

View File

@ -187,7 +187,7 @@ public class AllEpisodesRecycleAdapter extends RecyclerView.Adapter<AllEpisodesR
holder.queueStatus.setVisibility(View.INVISIBLE);
}
ItemActionButton actionButton = ItemActionButton.forItem(item, isInQueue);
ItemActionButton actionButton = ItemActionButton.forItem(item, isInQueue, true);
actionButton.configure(holder.butSecondary, mainActivityRef.get());
holder.butSecondary.setFocusable(false);

View File

@ -189,7 +189,7 @@ public class FeedItemlistAdapter extends BaseAdapter {
}
}
ItemActionButton actionButton = ItemActionButton.forItem(item, isInQueue);
ItemActionButton actionButton = ItemActionButton.forItem(item, isInQueue, true);
actionButton.configure(holder.butAction, context);
holder.butAction.setFocusable(false);

View File

@ -296,7 +296,7 @@ public class QueueRecyclerAdapter extends RecyclerView.Adapter<QueueRecyclerAdap
}
}
ItemActionButton actionButton = ItemActionButton.forItem(item, true);
ItemActionButton actionButton = ItemActionButton.forItem(item, true, true);
actionButton.configure(butSecondary, mainActivity.get());
butSecondary.setFocusable(false);

View File

@ -33,7 +33,7 @@ public abstract class ItemActionButton {
}
@NonNull
public static ItemActionButton forItem(@NonNull FeedItem item, boolean isInQueue) {
public static ItemActionButton forItem(@NonNull FeedItem item, boolean isInQueue, boolean allowStream) {
final FeedMedia media = item.getMedia();
if (media == null) {
return new MarkAsPlayedActionButton(item);
@ -44,9 +44,10 @@ public abstract class ItemActionButton {
return new PlayActionButton(item);
} else if (isDownloadingMedia) {
return new CancelDownloadActionButton(item);
} else if (UserPreferences.streamOverDownload()) {
} else if (UserPreferences.streamOverDownload() && allowStream) {
return new StreamActionButton(item);
} else if (MobileDownloadHelper.userAllowedMobileDownloads() || !MobileDownloadHelper.userChoseAddToQueue() || isInQueue) {
} else if (MobileDownloadHelper.userAllowedMobileDownloads()
|| !MobileDownloadHelper.userChoseAddToQueue() || isInQueue) {
return new DownloadActionButton(item, isInQueue);
} else {
return new AddToQueueActionButton(item);

View File

@ -183,7 +183,7 @@ public class ItemFragment extends Fragment {
if (item == null) {
return;
}
ItemActionButton actionButton = ItemActionButton.forItem(item, item.isTagged(FeedItem.TAG_QUEUE));
ItemActionButton actionButton = ItemActionButton.forItem(item, item.isTagged(FeedItem.TAG_QUEUE), false);
actionButton.onClick(getActivity());
FeedMedia media = item.getMedia();