Merge pull request #4831 from Thom-Merrilin/feed-info-share-icon

Added share icon/submenu to feed_info menu
This commit is contained in:
ByteHamster 2021-01-03 19:54:09 +01:00 committed by GitHub
commit 71fba0bc04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 42 additions and 11 deletions

View File

@ -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()))));
}

View File

@ -8,17 +8,25 @@
android:title="@string/visit_website_label"
android:visible="true"/>
<item
android:id="@+id/share_link_item"
custom:showAsAction="collapseActionView"
android:title="@string/share_website_url_label"/>
<item
android:id="@+id/share_download_url_item"
custom:showAsAction="collapseActionView"
android:title="@string/share_feed_url_label"/>
android:id="@+id/share_parent"
custom:showAsAction="ifRoom"
android:title="@string/share_label_with_ellipses"
android:icon="?attr/ic_share"
android:visible="true">
<menu android:id="@+id/share_submenu">
<item
android:id="@+id/share_link_item"
custom:showAsAction="collapseActionView"
android:title="@string/share_website_url_label"/>
<item
android:id="@+id/share_download_url_item"
custom:showAsAction="collapseActionView"
android:title="@string/share_feed_url_label"/>
</menu>
</item>
<item
android:id="@+id/reconnect_local_folder"
custom:showAsAction="collapseActionView"
android:title="@string/reconnect_local_folder"
android:visible="false" />
</menu>
</menu>

View File

@ -0,0 +1,7 @@
<vector android:height="24dp"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path
android:fillColor="#FF000000"
android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"/>
</vector>

View File

@ -0,0 +1,7 @@
<vector android:height="24dp"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"/>
</vector>

View File

@ -62,6 +62,7 @@
<attr name="filter_dialog_clear" format="color"/>
<attr name="filter_dialog_button_background" format="reference"/>
<attr name="ic_notifications" format="reference"/>
<attr name="ic_share" format="reference"/>
<declare-styleable name="SquareImageView">
<attr name="direction" format="enum">

View File

@ -78,6 +78,7 @@
<item name="filter_dialog_clear">@color/filter_dialog_clear_light</item>
<item name="filter_dialog_button_background">@drawable/filter_dialog_background_light</item>
<item name="ic_notifications">@drawable/ic_notifications_black</item>
<item name="ic_share">@drawable/ic_share_black</item>
</style>
<style name="Theme.AntennaPod.Dark" parent="Theme.Base.AntennaPod.Dark">
@ -158,6 +159,7 @@
<item name="filter_dialog_clear">@color/filter_dialog_clear_dark</item>
<item name="filter_dialog_button_background">@drawable/filter_dialog_background_dark</item>
<item name="ic_notifications">@drawable/ic_notifications_white</item>
<item name="ic_share">@drawable/ic_share_white</item>
</style>
<style name="Theme.AntennaPod.TrueBlack" parent="Theme.Base.AntennaPod.TrueBlack">