improved visibility handling + order of items
This commit is contained in:
parent
532a167a48
commit
c76beb2d9f
|
@ -8,22 +8,32 @@
|
|||
android:title="@string/download_label"
|
||||
android:visible="false">
|
||||
</item>
|
||||
<item android:id="@+id/stream_item" android:icon="@drawable/action_stream" android:showAsAction="ifRoom" android:title="@string/stream_label" android:visible="false">
|
||||
</item><item android:id="@+id/play_item" android:icon="@drawable/av_play" android:showAsAction="ifRoom" android:title="@string/play_label" android:visible="false">
|
||||
</item><item
|
||||
<item
|
||||
android:id="@+id/stream_item"
|
||||
android:icon="@drawable/action_stream"
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="@string/stream_label"
|
||||
android:visible="false">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/play_item"
|
||||
android:icon="@drawable/av_play"
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="@string/play_label"
|
||||
android:visible="false">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/remove_item"
|
||||
android:icon="@drawable/content_discard"
|
||||
android:showAsAction="collapseActionView"
|
||||
android:title="@string/remove_label"
|
||||
android:visible="false">
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:id="@+id/cancel_download_item"
|
||||
android:icon="@drawable/navigation_cancel"
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="@string/cancel_download_label"
|
||||
android:visible="false">
|
||||
android:title="@string/cancel_download_label">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/mark_read_item"
|
||||
|
@ -49,7 +59,6 @@
|
|||
android:title="@string/remove_from_queue_label"
|
||||
android:visible="false">
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:id="@+id/share_link_item"
|
||||
android:showAsAction="collapseActionView"
|
||||
|
|
|
@ -21,6 +21,7 @@ public class FeedItemMenuHandler {
|
|||
|
||||
public static boolean onPrepareMenu(Menu menu, FeedItem selectedItem) {
|
||||
FeedManager manager = FeedManager.getInstance();
|
||||
DownloadRequester requester = DownloadRequester.getInstance();
|
||||
|
||||
if (selectedItem.getMedia() != null) {
|
||||
if (selectedItem.getMedia().isDownloaded()) {
|
||||
|
@ -29,17 +30,19 @@ public class FeedItemMenuHandler {
|
|||
} else if (selectedItem.getMedia().getFile_url() == null) {
|
||||
menu.findItem(R.id.download_item).setVisible(true);
|
||||
menu.findItem(R.id.stream_item).setVisible(true);
|
||||
} else {
|
||||
menu.findItem(R.id.cancel_download_item).setVisible(true);
|
||||
}
|
||||
|
||||
boolean isDownloading = requester.isDownloadingFile(selectedItem.getMedia());
|
||||
menu.findItem(R.id.cancel_download_item).setVisible(isDownloading);
|
||||
|
||||
if (manager.isInQueue(selectedItem)) {
|
||||
menu.findItem(R.id.remove_from_queue_item).setVisible(true);
|
||||
} else {
|
||||
menu.findItem(R.id.add_to_queue_item).setVisible(true);
|
||||
}
|
||||
|
||||
menu.findItem(R.id.share_link_item).setVisible(selectedItem.getLink() != null);
|
||||
|
||||
menu.findItem(R.id.share_link_item).setVisible(
|
||||
selectedItem.getLink() != null);
|
||||
}
|
||||
|
||||
if (selectedItem.isRead()) {
|
||||
|
@ -51,11 +54,11 @@ public class FeedItemMenuHandler {
|
|||
if (selectedItem.getLink() != null) {
|
||||
menu.findItem(R.id.visit_website_item).setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
if (selectedItem.getPaymentLink() != null) {
|
||||
menu.findItem(R.id.support_item).setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue