Merge branch 'develop' of github.com:AntennaPod/AntennaPod into develop
This commit is contained in:
commit
a8d72b3c6f
|
@ -309,10 +309,9 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements
|
|||
return false;
|
||||
}
|
||||
Playable media = controller.getMedia();
|
||||
boolean isFeedMedia = media != null && (media instanceof FeedMedia);
|
||||
|
||||
menu.findItem(R.id.support_item).setVisible(
|
||||
media != null && media.getPaymentLink() != null &&
|
||||
(media instanceof FeedMedia) &&
|
||||
menu.findItem(R.id.support_item).setVisible(isFeedMedia && media.getPaymentLink() != null &&
|
||||
((FeedMedia) media).getItem() != null &&
|
||||
((FeedMedia) media).getItem().getFlattrStatus().flattrable()
|
||||
);
|
||||
|
@ -320,20 +319,21 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements
|
|||
boolean hasWebsiteLink = media != null && media.getWebsiteLink() != null;
|
||||
menu.findItem(R.id.visit_website_item).setVisible(hasWebsiteLink);
|
||||
|
||||
boolean isItemAndHasLink = media != null && (media instanceof FeedMedia) &&
|
||||
boolean isItemAndHasLink = isFeedMedia &&
|
||||
((FeedMedia) media).getItem() != null && ((FeedMedia) media).getItem().getLink() != null;
|
||||
menu.findItem(R.id.share_link_item).setVisible(isItemAndHasLink);
|
||||
menu.findItem(R.id.share_link_with_position_item).setVisible(isItemAndHasLink);
|
||||
|
||||
boolean isItemHasDownloadLink = media != null && (media instanceof FeedMedia) && ((FeedMedia) media).getDownload_url() != null;
|
||||
boolean isItemHasDownloadLink = isFeedMedia && ((FeedMedia) media).getDownload_url() != null;
|
||||
menu.findItem(R.id.share_download_url_item).setVisible(isItemHasDownloadLink);
|
||||
menu.findItem(R.id.share_download_url_with_position_item).setVisible(isItemHasDownloadLink);
|
||||
menu.findItem(R.id.share_file).setVisible(isFeedMedia && ((FeedMedia) media).fileExists());
|
||||
|
||||
menu.findItem(R.id.share_item).setVisible(hasWebsiteLink || isItemAndHasLink || isItemHasDownloadLink);
|
||||
|
||||
menu.findItem(R.id.add_to_favorites_item).setVisible(false);
|
||||
menu.findItem(R.id.remove_from_favorites_item).setVisible(false);
|
||||
if(media != null && media instanceof FeedMedia) {
|
||||
if (isFeedMedia) {
|
||||
menu.findItem(R.id.add_to_favorites_item).setVisible(!isFavorite);
|
||||
menu.findItem(R.id.remove_from_favorites_item).setVisible(isFavorite);
|
||||
}
|
||||
|
@ -574,6 +574,11 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements
|
|||
ShareUtils.shareFeedItemDownloadLink(this, ((FeedMedia) media).getItem(), true);
|
||||
}
|
||||
break;
|
||||
case R.id.share_file:
|
||||
if (media instanceof FeedMedia) {
|
||||
ShareUtils.shareFeedItemFile(this, ((FeedMedia) media));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -101,6 +101,8 @@ public class FeedItemMenuHandler {
|
|||
mi.setItemVisibility(R.id.share_download_url_with_position_item, false);
|
||||
}
|
||||
|
||||
mi.setItemVisibility(R.id.share_file, hasMedia && selectedItem.getMedia().fileExists());
|
||||
|
||||
if (selectedItem.isPlayed()) {
|
||||
mi.setItemVisibility(R.id.mark_read_item, false);
|
||||
} else {
|
||||
|
@ -239,6 +241,9 @@ public class FeedItemMenuHandler {
|
|||
case R.id.share_download_url_with_position_item:
|
||||
ShareUtils.shareFeedItemDownloadLink(context, selectedItem, true);
|
||||
break;
|
||||
case R.id.share_file:
|
||||
ShareUtils.shareFeedItemFile(context, selectedItem.getMedia());
|
||||
break;
|
||||
default:
|
||||
Log.d(TAG, "Unknown menuItemId: " + menuItemId);
|
||||
return false;
|
||||
|
|
|
@ -71,6 +71,10 @@
|
|||
android:id="@+id/share_download_url_with_position_item"
|
||||
android:menuCategory="container"
|
||||
android:title="@string/share_item_url_with_position_label" />
|
||||
<item
|
||||
android:id="@+id/share_file"
|
||||
android:menuCategory="container"
|
||||
android:title="@string/share_file_label" />
|
||||
</menu>
|
||||
</item>
|
||||
|
||||
|
|
|
@ -84,6 +84,10 @@
|
|||
android:id="@+id/share_download_url_with_position_item"
|
||||
android:menuCategory="container"
|
||||
android:title="@string/share_item_url_with_position_label" />
|
||||
<item
|
||||
android:id="@+id/share_file"
|
||||
android:menuCategory="container"
|
||||
android:title="@string/share_file_label" />
|
||||
</menu>
|
||||
</item>
|
||||
|
||||
|
|
|
@ -73,6 +73,10 @@
|
|||
android:id="@+id/share_download_url_with_position_item"
|
||||
android:menuCategory="container"
|
||||
android:title="@string/share_item_url_with_position_label" />
|
||||
<item
|
||||
android:id="@+id/share_file"
|
||||
android:menuCategory="container"
|
||||
android:title="@string/share_file_label" />
|
||||
</menu>
|
||||
</item>
|
||||
|
||||
|
|
|
@ -64,6 +64,10 @@
|
|||
android:id="@+id/share_download_url_with_position_item"
|
||||
android:menuCategory="container"
|
||||
android:title="@string/share_item_url_with_position_label" />
|
||||
<item
|
||||
android:id="@+id/share_file"
|
||||
android:menuCategory="container"
|
||||
android:title="@string/share_file_label" />
|
||||
</menu>
|
||||
</item>
|
||||
<item
|
||||
|
|
|
@ -74,6 +74,10 @@
|
|||
android:id="@+id/share_download_url_with_position_item"
|
||||
android:menuCategory="container"
|
||||
android:title="@string/share_item_url_with_position_label" />
|
||||
<item
|
||||
android:id="@+id/share_file"
|
||||
android:menuCategory="container"
|
||||
android:title="@string/share_file_label" />
|
||||
</menu>
|
||||
</item>
|
||||
<item
|
||||
|
|
|
@ -21,7 +21,7 @@ public class FeedUpdateReceiver extends BroadcastReceiver {
|
|||
public void onReceive(Context context, Intent intent) {
|
||||
Log.d(TAG, "Received intent");
|
||||
ClientConfig.initialize(context);
|
||||
if (NetworkUtils.isDownloadAllowed()) {
|
||||
if (NetworkUtils.networkAvailable() && NetworkUtils.isDownloadAllowed()) {
|
||||
DBTasks.refreshAllFeeds(context, null);
|
||||
} else {
|
||||
Log.d(TAG, "Blocking automatic update: no wifi available / no mobile updates allowed");
|
||||
|
|
|
@ -3,9 +3,13 @@ package de.danoeh.antennapod.core.util;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import android.net.Uri;
|
||||
import de.danoeh.antennapod.core.R;
|
||||
import de.danoeh.antennapod.core.feed.Feed;
|
||||
import de.danoeh.antennapod.core.feed.FeedItem;
|
||||
import de.danoeh.antennapod.core.feed.FeedMedia;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/** Utility methods for sharing data */
|
||||
public class ShareUtils {
|
||||
|
@ -58,4 +62,11 @@ public class ShareUtils {
|
|||
shareLink(context, text);
|
||||
}
|
||||
|
||||
public static void shareFeedItemFile(Context context, FeedMedia media) {
|
||||
Intent i = new Intent(Intent.ACTION_SEND);
|
||||
i.setType(media.getMime_type());
|
||||
i.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(media.getLocalMediaUrl())));
|
||||
i.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
context.startActivity(Intent.createChooser(i, context.getString(R.string.share_file_label)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -461,6 +461,7 @@ public abstract class PlaybackController {
|
|||
checkMediaInfoLoaded();
|
||||
postStatusMsg(R.string.player_ready_msg, false);
|
||||
updatePlayButtonAppearance(playResource, playText);
|
||||
onPositionObserverUpdate();
|
||||
break;
|
||||
case SEEKING:
|
||||
onPositionObserverUpdate();
|
||||
|
|
|
@ -126,6 +126,7 @@
|
|||
<string name="remove_feed_label">Remove Podcast</string>
|
||||
<string name="share_label">Share…</string>
|
||||
<string name="share_link_label">Share Link</string>
|
||||
<string name="share_file_label">Share File</string>
|
||||
<string name="share_link_with_position_label">Share Link with Position</string>
|
||||
<string name="share_feed_url_label">Share Feed URL</string>
|
||||
<string name="share_item_url_label">Share Episode File URL</string>
|
||||
|
|
Loading…
Reference in New Issue