Compare commits
2 Commits
e97a02b5ed
...
9298bb0d63
Author | SHA1 | Date |
---|---|---|
Tony Tam | 9298bb0d63 | |
Tony Tam | 83bd3ff6ed |
|
@ -71,6 +71,7 @@ public class FeedItemMenuHandler {
|
|||
setItemVisibility(menu, R.id.mark_read_item, !selectedItem.isPlayed());
|
||||
setItemVisibility(menu, R.id.mark_unread_item, selectedItem.isPlayed());
|
||||
setItemVisibility(menu, R.id.reset_position, hasMedia && selectedItem.getMedia().getPosition() != 0);
|
||||
setItemVisibility(menu, R.id.visit_social_interest_website, selectedItem.getPodcastIndexSocialUrl() != null);
|
||||
|
||||
// Display proper strings when item has no media
|
||||
if (hasMedia) {
|
||||
|
@ -197,6 +198,8 @@ public class FeedItemMenuHandler {
|
|||
DBWriter.markItemPlayed(selectedItem, FeedItem.UNPLAYED, true);
|
||||
} else if (menuItemId == R.id.visit_website_item) {
|
||||
IntentUtils.openInBrowser(context, selectedItem.getLinkWithFallback());
|
||||
} else if (menuItemId == R.id.visit_social_interest_website) {
|
||||
IntentUtils.openInBrowser(context, selectedItem.getPodcastIndexSocialUrl());
|
||||
} else if (menuItemId == R.id.share_item) {
|
||||
ShareDialog shareDialog = ShareDialog.newInstance(selectedItem);
|
||||
shareDialog.show((fragment.getActivity().getSupportFragmentManager()), "ShareEpisodeDialog");
|
||||
|
|
|
@ -56,6 +56,15 @@
|
|||
custom:showAsAction="ifRoom|collapseActionView"
|
||||
android:title="@string/visit_website_label">
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:id="@+id/visit_social_interest_website"
|
||||
android:icon="@drawable/ic_chat"
|
||||
custom:showAsAction="ifRoom|collapseActionView"
|
||||
android:title="@string/visit_social_interest_label"
|
||||
android:visible="true">
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:id="@+id/share_item"
|
||||
android:menuCategory="container"
|
||||
|
|
|
@ -2,6 +2,14 @@
|
|||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:custom="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/visit_social_interest_website"
|
||||
android:icon="@drawable/ic_chat"
|
||||
custom:showAsAction="always"
|
||||
android:title="@string/visit_social_interest_label"
|
||||
android:visible="true">
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:id="@+id/add_to_favorites_item"
|
||||
android:icon="@drawable/ic_star_border"
|
||||
|
@ -58,6 +66,7 @@
|
|||
android:visible="false">
|
||||
</item>
|
||||
|
||||
|
||||
<item
|
||||
android:id="@+id/player_switch_to_audio_only"
|
||||
custom:showAsAction="collapseActionView"
|
||||
|
|
|
@ -43,6 +43,7 @@ public class FeedItem implements Serializable {
|
|||
private transient Feed feed;
|
||||
private long feedId;
|
||||
private String podcastIndexChapterUrl;
|
||||
private String socialInteractUrl;
|
||||
|
||||
private int state;
|
||||
public static final int NEW = -1;
|
||||
|
@ -83,7 +84,8 @@ public class FeedItem implements Serializable {
|
|||
* */
|
||||
public FeedItem(long id, String title, String link, Date pubDate, String paymentLink, long feedId,
|
||||
boolean hasChapters, String imageUrl, int state,
|
||||
String itemIdentifier, boolean autoDownloadEnabled, String podcastIndexChapterUrl) {
|
||||
String itemIdentifier, boolean autoDownloadEnabled, String podcastIndexChapterUrl,
|
||||
String socialInteractUrl) {
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
this.link = link;
|
||||
|
@ -96,6 +98,7 @@ public class FeedItem implements Serializable {
|
|||
this.itemIdentifier = itemIdentifier;
|
||||
this.autoDownloadEnabled = autoDownloadEnabled;
|
||||
this.podcastIndexChapterUrl = podcastIndexChapterUrl;
|
||||
this.socialInteractUrl = socialInteractUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -162,6 +165,10 @@ public class FeedItem implements Serializable {
|
|||
if (other.podcastIndexChapterUrl != null) {
|
||||
podcastIndexChapterUrl = other.podcastIndexChapterUrl;
|
||||
}
|
||||
|
||||
if (other.socialInteractUrl != null) {
|
||||
socialInteractUrl = other.socialInteractUrl;
|
||||
}
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
|
@ -413,6 +420,14 @@ public class FeedItem implements Serializable {
|
|||
podcastIndexChapterUrl = url;
|
||||
}
|
||||
|
||||
public void setPodcastIndexSocialUrl(String url) {
|
||||
socialInteractUrl = url;
|
||||
}
|
||||
|
||||
public String getPodcastIndexSocialUrl() {
|
||||
return socialInteractUrl;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
|
|
|
@ -12,8 +12,10 @@ public class PodcastIndex extends Namespace {
|
|||
public static final String NSURI = "https://github.com/Podcastindex-org/podcast-namespace/blob/main/docs/1.0.md";
|
||||
public static final String NSURI2 = "https://podcastindex.org/namespace/1.0";
|
||||
private static final String URL = "url";
|
||||
private static final String URI = "uri";
|
||||
private static final String FUNDING = "funding";
|
||||
private static final String CHAPTERS = "chapters";
|
||||
private static final String SOCIAL_INTERACT = "socialInteract";
|
||||
|
||||
@Override
|
||||
public SyndElement handleElementStart(String localName, HandlerState state,
|
||||
|
@ -28,6 +30,11 @@ public class PodcastIndex extends Namespace {
|
|||
if (!TextUtils.isEmpty(href)) {
|
||||
state.getCurrentItem().setPodcastIndexChapterUrl(href);
|
||||
}
|
||||
} else if (SOCIAL_INTERACT.equals(localName)) {
|
||||
String href = attributes.getValue(URI);
|
||||
if (!TextUtils.isEmpty(href) && state.getCurrentItem() != null) {
|
||||
state.getCurrentItem().setPodcastIndexSocialUrl(href);
|
||||
}
|
||||
}
|
||||
return new SyndElement(localName, this);
|
||||
}
|
||||
|
|
|
@ -338,6 +338,10 @@ class DBUpgrader {
|
|||
db.execSQL("ALTER TABLE " + PodDBAdapter.TABLE_NAME_FEEDS
|
||||
+ " ADD COLUMN " + PodDBAdapter.KEY_FEED_SKIP_SILENCE + " INTEGER");
|
||||
}
|
||||
if (oldVersion < 3050000) {
|
||||
db.execSQL("ALTER TABLE " + PodDBAdapter.TABLE_NAME_FEED_ITEMS
|
||||
+ " ADD COLUMN " + PodDBAdapter.KEY_PODCASTINDEX_SOCIAL_URL + " TEXT");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ public class PodDBAdapter {
|
|||
|
||||
private static final String TAG = "PodDBAdapter";
|
||||
public static final String DATABASE_NAME = "Antennapod.db";
|
||||
public static final int VERSION = 3040000;
|
||||
public static final int VERSION = 3050000;
|
||||
|
||||
/**
|
||||
* Maximum number of arguments for IN-operator.
|
||||
|
@ -121,6 +121,7 @@ public class PodDBAdapter {
|
|||
public static final String KEY_EPISODE_NOTIFICATION = "episode_notification";
|
||||
public static final String KEY_NEW_EPISODES_ACTION = "new_episodes_action";
|
||||
public static final String KEY_PODCASTINDEX_CHAPTER_URL = "podcastindex_chapter_url";
|
||||
public static final String KEY_PODCASTINDEX_SOCIAL_URL = "podcastindex_social_url";
|
||||
|
||||
// Table names
|
||||
public static final String TABLE_NAME_FEEDS = "Feeds";
|
||||
|
@ -182,7 +183,8 @@ public class PodDBAdapter {
|
|||
+ KEY_HAS_CHAPTERS + " INTEGER," + KEY_ITEM_IDENTIFIER + " TEXT,"
|
||||
+ KEY_IMAGE_URL + " TEXT,"
|
||||
+ KEY_AUTO_DOWNLOAD_ENABLED + " INTEGER,"
|
||||
+ KEY_PODCASTINDEX_CHAPTER_URL + " TEXT)";
|
||||
+ KEY_PODCASTINDEX_CHAPTER_URL + " TEXT,"
|
||||
+ KEY_PODCASTINDEX_SOCIAL_URL + " TEXT)";
|
||||
|
||||
private static final String CREATE_TABLE_FEED_MEDIA = "CREATE TABLE "
|
||||
+ TABLE_NAME_FEED_MEDIA + " (" + TABLE_PRIMARY_KEY + KEY_DURATION
|
||||
|
@ -270,7 +272,8 @@ public class PodDBAdapter {
|
|||
+ TABLE_NAME_FEED_ITEMS + "." + KEY_ITEM_IDENTIFIER + ", "
|
||||
+ TABLE_NAME_FEED_ITEMS + "." + KEY_IMAGE_URL + ", "
|
||||
+ TABLE_NAME_FEED_ITEMS + "." + KEY_AUTO_DOWNLOAD_ENABLED + ", "
|
||||
+ TABLE_NAME_FEED_ITEMS + "." + KEY_PODCASTINDEX_CHAPTER_URL;
|
||||
+ TABLE_NAME_FEED_ITEMS + "." + KEY_PODCASTINDEX_CHAPTER_URL + ", "
|
||||
+ TABLE_NAME_FEED_ITEMS + "." + KEY_PODCASTINDEX_SOCIAL_URL;
|
||||
|
||||
private static final String KEYS_FEED_MEDIA =
|
||||
TABLE_NAME_FEED_MEDIA + "." + KEY_ID + " AS " + SELECT_KEY_MEDIA_ID + ", "
|
||||
|
@ -667,6 +670,7 @@ public class PodDBAdapter {
|
|||
values.put(KEY_AUTO_DOWNLOAD_ENABLED, item.isAutoDownloadEnabled());
|
||||
values.put(KEY_IMAGE_URL, item.getImageUrl());
|
||||
values.put(KEY_PODCASTINDEX_CHAPTER_URL, item.getPodcastIndexChapterUrl());
|
||||
values.put(KEY_PODCASTINDEX_SOCIAL_URL, item.getPodcastIndexSocialUrl());
|
||||
|
||||
if (item.getId() == 0) {
|
||||
item.setId(db.insert(TABLE_NAME_FEED_ITEMS, null, values));
|
||||
|
|
|
@ -25,6 +25,7 @@ public class FeedItemCursor extends CursorWrapper {
|
|||
private final int indexAutoDownload;
|
||||
private final int indexImageUrl;
|
||||
private final int indexPodcastIndexChapterUrl;
|
||||
private final int indexPodcastIndexSocialUrl;
|
||||
private final int indexMediaId;
|
||||
|
||||
public FeedItemCursor(Cursor cursor) {
|
||||
|
@ -43,6 +44,7 @@ public class FeedItemCursor extends CursorWrapper {
|
|||
indexImageUrl = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_IMAGE_URL);
|
||||
indexPodcastIndexChapterUrl = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_PODCASTINDEX_CHAPTER_URL);
|
||||
indexMediaId = cursor.getColumnIndexOrThrow(PodDBAdapter.SELECT_KEY_MEDIA_ID);
|
||||
indexPodcastIndexSocialUrl = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_PODCASTINDEX_SOCIAL_URL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -62,7 +64,8 @@ public class FeedItemCursor extends CursorWrapper {
|
|||
getInt(indexRead),
|
||||
getString(indexItemIdentifier),
|
||||
getLong(indexAutoDownload) > 0,
|
||||
getString(indexPodcastIndexChapterUrl));
|
||||
getString(indexPodcastIndexChapterUrl),
|
||||
getString(indexPodcastIndexSocialUrl));
|
||||
if (!isNull(indexMediaId)) {
|
||||
item.setMedia(feedMediaCursor.getFeedMedia());
|
||||
}
|
||||
|
|
|
@ -260,6 +260,7 @@
|
|||
<string name="add_to_favorite_label">Add to favorites</string>
|
||||
<string name="remove_from_favorite_label">Remove from favorites</string>
|
||||
<string name="visit_website_label">Visit website</string>
|
||||
<string name="visit_social_interest_label">Social comments</string>
|
||||
<string name="skip_episode_label">Skip episode</string>
|
||||
<string name="reset_position">Reset playback position</string>
|
||||
<string name="no_items_selected">No items selected</string>
|
||||
|
|
Loading…
Reference in New Issue