Compare commits

...

4 Commits

Author SHA1 Message Date
Tony Tam e97a02b5ed
Merge 83bd3ff6ed into 2827f41430 2024-05-07 13:49:33 +02:00
flofriday 2827f41430
Improve layout for missing chapter images (#7164)
If only some chapters have images the other chapters don't display
anything but reserve space for the image.

Now those chapters display the image of the episode. If no chapters have
images no images will be displayed (just like before).
2024-05-06 22:14:26 +02:00
flofriday 6f572faa77
Fix inconsistent icons in the app toolbar. (#7163) 2024-05-06 22:04:24 +02:00
Tony Tam 83bd3ff6ed show social comment icon on playing screen and item description 2024-04-21 16:48:22 +02:00
21 changed files with 90 additions and 28 deletions

View File

@ -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");

View File

@ -19,6 +19,7 @@ import de.danoeh.antennapod.R;
import de.danoeh.antennapod.model.feed.Chapter;
import de.danoeh.antennapod.ui.common.Converter;
import de.danoeh.antennapod.model.feed.EmbeddedChapterImage;
import de.danoeh.antennapod.ui.common.ImagePlaceholder;
import de.danoeh.antennapod.ui.common.IntentUtils;
import de.danoeh.antennapod.model.playback.Playable;
import de.danoeh.antennapod.ui.common.CircularProgressBar;
@ -99,15 +100,27 @@ public class ChaptersListAdapter extends RecyclerView.Adapter<ChaptersListAdapte
if (hasImages) {
holder.image.setVisibility(View.VISIBLE);
float radius = 4 * context.getResources().getDisplayMetrics().density;
RequestOptions options = new RequestOptions()
.placeholder(ImagePlaceholder.getDrawable(context, radius))
.dontAnimate()
.transform(new FitCenter(), new RoundedCorners((int) radius));
if (TextUtils.isEmpty(sc.getImageUrl())) {
Glide.with(context).clear(holder.image);
if (media.getImageLocation() == null) {
Glide.with(context).clear(holder.image);
holder.image.setVisibility(View.GONE);
} else {
Glide.with(context)
.load(media.getImageLocation())
.apply(options)
.into(holder.image);
}
} else {
Glide.with(context)
.load(EmbeddedChapterImage.getModelFor(media, position))
.apply(new RequestOptions()
.dontAnimate()
.transform(new FitCenter(), new RoundedCorners((int)
(4 * context.getResources().getDisplayMetrics().density))))
.apply(options)
.into(holder.image);
}
} else {

View File

@ -157,7 +157,7 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem
viewBinding.progressBar.setVisibility(View.VISIBLE);
ToolbarIconTintManager iconTintManager = new ToolbarIconTintManager(
getContext(), viewBinding.toolbar, viewBinding.collapsingToolbar) {
viewBinding.toolbar.getContext(), viewBinding.toolbar, viewBinding.collapsingToolbar) {
@Override
protected void doTint(Context themedContext) {
viewBinding.toolbar.getMenu().findItem(R.id.refresh_item)

View File

@ -18,7 +18,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:title="@string/add_feed_label"
app:navigationContentDescription="@string/toolbar_back_button_content_description"
app:navigationIcon="?homeAsUpIndicator" />

View File

@ -26,7 +26,6 @@
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:navigationContentDescription="@string/toolbar_back_button_content_description"
app:navigationIcon="@drawable/ic_arrow_down" />

View File

@ -11,7 +11,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
android:layout_alignParentTop="true"
app:title="@string/downloads_log_label" />

View File

@ -41,7 +41,6 @@
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:layout_collapseMode="pin"
app:navigationContentDescription="@string/toolbar_back_button_content_description"
app:navigationIcon="?homeAsUpIndicator" />

View File

@ -12,7 +12,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:navigationContentDescription="@string/toolbar_back_button_content_description"
app:navigationIcon="?homeAsUpIndicator" />

View File

@ -12,8 +12,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
android:elevation="4dp"
app:title="@string/feed_settings_label"
app:navigationContentDescription="@string/toolbar_back_button_content_description"
app:navigationIcon="?homeAsUpIndicator" />

View File

@ -17,7 +17,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:title="@string/search_label"
app:navigationContentDescription="@string/toolbar_back_button_content_description"
app:navigationIcon="?homeAsUpIndicator" />

View File

@ -25,7 +25,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
android:layout_alignParentTop="true" />
<View

View File

@ -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"

View File

@ -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"

View File

@ -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() {

View File

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

View File

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

View File

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

View File

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

View File

@ -12,7 +12,6 @@
<style name="Theme.Base.AntennaPod.Dynamic.Light" parent="Theme.Material3.DynamicColors.Light">
<item name="progressBarTheme">@style/ProgressBarLight</item>
<item name="background_color">@color/background_light</item>
<item name="actionBarStyle">@style/Widget.AntennaPod.ActionBar</item>
<item name="background_elevated">@color/background_elevated_light</item>
<item name="action_icon_color">@color/black</item>
<item name="android:textAllCaps">false</item>
@ -27,6 +26,7 @@
<item name="android:splitMotionEvents">false</item>
<item name="android:fitsSystemWindows">false</item>
<item name="android:windowContentTransitions">true</item>
<item name="toolbarStyle">@style/Style.AntennaPod.Toolbar</item>
<item name="preferenceTheme">@style/AppPreferenceThemeOverlay</item>
</style>
@ -52,7 +52,6 @@
<style name="Theme.Base.AntennaPod.Dynamic.Dark" parent="Theme.Material3.DynamicColors.Dark">
<item name="progressBarTheme">@style/ProgressBarDark</item>
<item name="background_color">@color/background_darktheme</item>
<item name="actionBarStyle">@style/Widget.AntennaPod.ActionBar</item>
<item name="background_elevated">@color/background_elevated_darktheme</item>
<item name="action_icon_color">@color/white</item>
<item name="android:textAllCaps">false</item>
@ -70,6 +69,7 @@
<item name="android:windowLightStatusBar" tools:targetApi="m">false</item>
<item name="android:windowContentTransitions">true</item>
<item name="android:navigationBarColor">@color/background_darktheme</item>
<item name="toolbarStyle">@style/Style.AntennaPod.Toolbar</item>
<item name="preferenceTheme">@style/AppPreferenceThemeOverlay</item>
</style>
@ -227,6 +227,15 @@
<item name="windowSplashScreenAnimatedIcon">@drawable/launcher_animate</item>
</style>
<style name="Style.AntennaPod.Toolbar" parent="Widget.Material3.Toolbar">
<item name="materialThemeOverlay">@style/Theme.AntennaPod.Toolbar</item>
</style>
<style name="Theme.AntennaPod.Toolbar" parent="ThemeOverlay.MaterialComponents.Toolbar.Surface">
<item name="action_icon_color">?attr/colorOnSurface</item>
<item name="colorControlNormal">?attr/colorOnSurface</item>
</style>
<style name="Theme.AntennaPod.VideoPlayer" parent="@style/Theme.AntennaPod.Dark">
<item name="windowActionBarOverlay">true</item>
</style>
@ -280,11 +289,6 @@
<item name="fastScrollVerticalTrackDrawable">@drawable/scrollbar_track</item>
</style>
<style name="Widget.AntennaPod.ActionBar" parent="Widget.Material3.Light.ActionBar.Solid">
<item name="background">?android:attr/colorBackground</item>
<item name="elevation">0dp</item>
</style>
<style name="AddPodcastTextView">
<item name="android:drawablePadding">8dp</item>
<item name="android:paddingTop">8dp</item>

View File

@ -19,7 +19,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:title="@string/discover"
app:navigationContentDescription="@string/toolbar_back_button_content_description"
app:navigationIcon="?homeAsUpIndicator" />

View File

@ -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>