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;
|
return false;
|
||||||
}
|
}
|
||||||
Playable media = controller.getMedia();
|
Playable media = controller.getMedia();
|
||||||
|
boolean isFeedMedia = media != null && (media instanceof FeedMedia);
|
||||||
|
|
||||||
menu.findItem(R.id.support_item).setVisible(
|
menu.findItem(R.id.support_item).setVisible(isFeedMedia && media.getPaymentLink() != null &&
|
||||||
media != null && media.getPaymentLink() != null &&
|
|
||||||
(media instanceof FeedMedia) &&
|
|
||||||
((FeedMedia) media).getItem() != null &&
|
((FeedMedia) media).getItem() != null &&
|
||||||
((FeedMedia) media).getItem().getFlattrStatus().flattrable()
|
((FeedMedia) media).getItem().getFlattrStatus().flattrable()
|
||||||
);
|
);
|
||||||
@ -320,20 +319,21 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements
|
|||||||
boolean hasWebsiteLink = media != null && media.getWebsiteLink() != null;
|
boolean hasWebsiteLink = media != null && media.getWebsiteLink() != null;
|
||||||
menu.findItem(R.id.visit_website_item).setVisible(hasWebsiteLink);
|
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;
|
((FeedMedia) media).getItem() != null && ((FeedMedia) media).getItem().getLink() != null;
|
||||||
menu.findItem(R.id.share_link_item).setVisible(isItemAndHasLink);
|
menu.findItem(R.id.share_link_item).setVisible(isItemAndHasLink);
|
||||||
menu.findItem(R.id.share_link_with_position_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_item).setVisible(isItemHasDownloadLink);
|
||||||
menu.findItem(R.id.share_download_url_with_position_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.share_item).setVisible(hasWebsiteLink || isItemAndHasLink || isItemHasDownloadLink);
|
||||||
|
|
||||||
menu.findItem(R.id.add_to_favorites_item).setVisible(false);
|
menu.findItem(R.id.add_to_favorites_item).setVisible(false);
|
||||||
menu.findItem(R.id.remove_from_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.add_to_favorites_item).setVisible(!isFavorite);
|
||||||
menu.findItem(R.id.remove_from_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);
|
ShareUtils.shareFeedItemDownloadLink(this, ((FeedMedia) media).getItem(), true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case R.id.share_file:
|
||||||
|
if (media instanceof FeedMedia) {
|
||||||
|
ShareUtils.shareFeedItemFile(this, ((FeedMedia) media));
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
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_download_url_with_position_item, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mi.setItemVisibility(R.id.share_file, hasMedia && selectedItem.getMedia().fileExists());
|
||||||
|
|
||||||
if (selectedItem.isPlayed()) {
|
if (selectedItem.isPlayed()) {
|
||||||
mi.setItemVisibility(R.id.mark_read_item, false);
|
mi.setItemVisibility(R.id.mark_read_item, false);
|
||||||
} else {
|
} else {
|
||||||
@ -239,6 +241,9 @@ public class FeedItemMenuHandler {
|
|||||||
case R.id.share_download_url_with_position_item:
|
case R.id.share_download_url_with_position_item:
|
||||||
ShareUtils.shareFeedItemDownloadLink(context, selectedItem, true);
|
ShareUtils.shareFeedItemDownloadLink(context, selectedItem, true);
|
||||||
break;
|
break;
|
||||||
|
case R.id.share_file:
|
||||||
|
ShareUtils.shareFeedItemFile(context, selectedItem.getMedia());
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
Log.d(TAG, "Unknown menuItemId: " + menuItemId);
|
Log.d(TAG, "Unknown menuItemId: " + menuItemId);
|
||||||
return false;
|
return false;
|
||||||
|
@ -71,6 +71,10 @@
|
|||||||
android:id="@+id/share_download_url_with_position_item"
|
android:id="@+id/share_download_url_with_position_item"
|
||||||
android:menuCategory="container"
|
android:menuCategory="container"
|
||||||
android:title="@string/share_item_url_with_position_label" />
|
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>
|
</menu>
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
|
@ -84,6 +84,10 @@
|
|||||||
android:id="@+id/share_download_url_with_position_item"
|
android:id="@+id/share_download_url_with_position_item"
|
||||||
android:menuCategory="container"
|
android:menuCategory="container"
|
||||||
android:title="@string/share_item_url_with_position_label" />
|
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>
|
</menu>
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
|
@ -73,6 +73,10 @@
|
|||||||
android:id="@+id/share_download_url_with_position_item"
|
android:id="@+id/share_download_url_with_position_item"
|
||||||
android:menuCategory="container"
|
android:menuCategory="container"
|
||||||
android:title="@string/share_item_url_with_position_label" />
|
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>
|
</menu>
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
|
@ -64,6 +64,10 @@
|
|||||||
android:id="@+id/share_download_url_with_position_item"
|
android:id="@+id/share_download_url_with_position_item"
|
||||||
android:menuCategory="container"
|
android:menuCategory="container"
|
||||||
android:title="@string/share_item_url_with_position_label" />
|
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>
|
</menu>
|
||||||
</item>
|
</item>
|
||||||
<item
|
<item
|
||||||
|
@ -74,6 +74,10 @@
|
|||||||
android:id="@+id/share_download_url_with_position_item"
|
android:id="@+id/share_download_url_with_position_item"
|
||||||
android:menuCategory="container"
|
android:menuCategory="container"
|
||||||
android:title="@string/share_item_url_with_position_label" />
|
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>
|
</menu>
|
||||||
</item>
|
</item>
|
||||||
<item
|
<item
|
||||||
|
@ -21,7 +21,7 @@ public class FeedUpdateReceiver extends BroadcastReceiver {
|
|||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
Log.d(TAG, "Received intent");
|
Log.d(TAG, "Received intent");
|
||||||
ClientConfig.initialize(context);
|
ClientConfig.initialize(context);
|
||||||
if (NetworkUtils.isDownloadAllowed()) {
|
if (NetworkUtils.networkAvailable() && NetworkUtils.isDownloadAllowed()) {
|
||||||
DBTasks.refreshAllFeeds(context, null);
|
DBTasks.refreshAllFeeds(context, null);
|
||||||
} else {
|
} else {
|
||||||
Log.d(TAG, "Blocking automatic update: no wifi available / no mobile updates allowed");
|
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.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
|
||||||
|
import android.net.Uri;
|
||||||
import de.danoeh.antennapod.core.R;
|
import de.danoeh.antennapod.core.R;
|
||||||
import de.danoeh.antennapod.core.feed.Feed;
|
import de.danoeh.antennapod.core.feed.Feed;
|
||||||
import de.danoeh.antennapod.core.feed.FeedItem;
|
import de.danoeh.antennapod.core.feed.FeedItem;
|
||||||
|
import de.danoeh.antennapod.core.feed.FeedMedia;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
/** Utility methods for sharing data */
|
/** Utility methods for sharing data */
|
||||||
public class ShareUtils {
|
public class ShareUtils {
|
||||||
@ -58,4 +62,11 @@ public class ShareUtils {
|
|||||||
shareLink(context, text);
|
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();
|
checkMediaInfoLoaded();
|
||||||
postStatusMsg(R.string.player_ready_msg, false);
|
postStatusMsg(R.string.player_ready_msg, false);
|
||||||
updatePlayButtonAppearance(playResource, playText);
|
updatePlayButtonAppearance(playResource, playText);
|
||||||
|
onPositionObserverUpdate();
|
||||||
break;
|
break;
|
||||||
case SEEKING:
|
case SEEKING:
|
||||||
onPositionObserverUpdate();
|
onPositionObserverUpdate();
|
||||||
|
@ -126,6 +126,7 @@
|
|||||||
<string name="remove_feed_label">Remove Podcast</string>
|
<string name="remove_feed_label">Remove Podcast</string>
|
||||||
<string name="share_label">Share…</string>
|
<string name="share_label">Share…</string>
|
||||||
<string name="share_link_label">Share Link</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_link_with_position_label">Share Link with Position</string>
|
||||||
<string name="share_feed_url_label">Share Feed URL</string>
|
<string name="share_feed_url_label">Share Feed URL</string>
|
||||||
<string name="share_item_url_label">Share Episode File URL</string>
|
<string name="share_item_url_label">Share Episode File URL</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user