From ffc12060be9bb284255b7c9c37ce1581dfb2fb85 Mon Sep 17 00:00:00 2001 From: Thom Merrilin Date: Sun, 3 Jan 2021 13:17:01 +0000 Subject: [PATCH] Added share icon to feed_info menu, moved the Website Address and Podcast Feed URL into a submenu of this icon. Will resolve #4734 Details: Website Address and Podcast Feed URL menu options were previously always in the overflow menu, which is inconsistent with over menus such as the FeedList menu where these options are under a "Share..." submenu. Two new vector drawables were added for the black and white options of a "Share" icon, these are used to create a submenu for Website Address and Podcast Feed URL if there's room, otherwise the submenu text "Share..." is used in the overflow menu. --- .../antennapod/fragment/FeedInfoFragment.java | 10 +++++-- app/src/main/res/menu/feedinfo.xml | 26 ++++++++++++------- core/src/main/res/drawable/ic_share_black.xml | 7 +++++ core/src/main/res/drawable/ic_share_white.xml | 7 +++++ core/src/main/res/values/attrs.xml | 1 + core/src/main/res/values/styles.xml | 2 ++ 6 files changed, 42 insertions(+), 11 deletions(-) create mode 100644 core/src/main/res/drawable/ic_share_black.xml create mode 100644 core/src/main/res/drawable/ic_share_white.xml diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java index abb597e60..ddfcd06ad 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java @@ -130,6 +130,8 @@ public class FeedInfoFragment extends Fragment implements Toolbar.OnMenuItemClic protected void doTint(Context themedContext) { toolbar.getMenu().findItem(R.id.visit_website_item) .setIcon(ThemeUtils.getDrawableFromAttr(themedContext, R.attr.location_web_site)); + toolbar.getMenu().findItem(R.id.share_parent) + .setIcon(ThemeUtils.getDrawableFromAttr(themedContext, R.attr.ic_share)); } }; iconTintManager.updateTint(); @@ -284,9 +286,13 @@ public class FeedInfoFragment extends Fragment implements Toolbar.OnMenuItemClic } private void refreshToolbarState() { + boolean shareLinkVisible = feed != null && feed.getLink() != null; + boolean downloadUrlVisible = feed != null && !feed.isLocalFeed(); + toolbar.getMenu().findItem(R.id.reconnect_local_folder).setVisible(feed != null && feed.isLocalFeed()); - toolbar.getMenu().findItem(R.id.share_download_url_item).setVisible(feed != null && !feed.isLocalFeed()); - toolbar.getMenu().findItem(R.id.share_link_item).setVisible(feed != null && feed.getLink() != null); + toolbar.getMenu().findItem(R.id.share_download_url_item).setVisible(downloadUrlVisible); + toolbar.getMenu().findItem(R.id.share_link_item).setVisible(shareLinkVisible); + toolbar.getMenu().findItem(R.id.share_parent).setVisible(downloadUrlVisible || shareLinkVisible); toolbar.getMenu().findItem(R.id.visit_website_item).setVisible(feed != null && feed.getLink() != null && IntentUtils.isCallable(getContext(), new Intent(Intent.ACTION_VIEW, Uri.parse(feed.getLink())))); } diff --git a/app/src/main/res/menu/feedinfo.xml b/app/src/main/res/menu/feedinfo.xml index b1daf1f36..a5fbe0c20 100644 --- a/app/src/main/res/menu/feedinfo.xml +++ b/app/src/main/res/menu/feedinfo.xml @@ -8,17 +8,25 @@ android:title="@string/visit_website_label" android:visible="true"/> - + android:id="@+id/share_parent" + custom:showAsAction="ifRoom" + android:title="@string/share_label_with_ellipses" + android:icon="?attr/ic_share" + android:visible="true"> + + + + + - - + \ No newline at end of file diff --git a/core/src/main/res/drawable/ic_share_black.xml b/core/src/main/res/drawable/ic_share_black.xml new file mode 100644 index 000000000..f396c50de --- /dev/null +++ b/core/src/main/res/drawable/ic_share_black.xml @@ -0,0 +1,7 @@ + + + diff --git a/core/src/main/res/drawable/ic_share_white.xml b/core/src/main/res/drawable/ic_share_white.xml new file mode 100644 index 000000000..ae1b3d12b --- /dev/null +++ b/core/src/main/res/drawable/ic_share_white.xml @@ -0,0 +1,7 @@ + + + diff --git a/core/src/main/res/values/attrs.xml b/core/src/main/res/values/attrs.xml index 0a2a8916d..a6879b006 100644 --- a/core/src/main/res/values/attrs.xml +++ b/core/src/main/res/values/attrs.xml @@ -62,6 +62,7 @@ + diff --git a/core/src/main/res/values/styles.xml b/core/src/main/res/values/styles.xml index 7f7ecfe1e..43e3823c5 100644 --- a/core/src/main/res/values/styles.xml +++ b/core/src/main/res/values/styles.xml @@ -78,6 +78,7 @@ @color/filter_dialog_clear_light @drawable/filter_dialog_background_light @drawable/ic_notifications_black + @drawable/ic_share_black