From 2d115a0ec582d26a0598e19a8dcc86f57833ab4b Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Wed, 30 Nov 2022 19:11:08 +0100 Subject: [PATCH 1/4] Refresh home screen when new episodes arrive in inbox --- .../de/danoeh/antennapod/ui/home/sections/InboxSection.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/de/danoeh/antennapod/ui/home/sections/InboxSection.java b/app/src/main/java/de/danoeh/antennapod/ui/home/sections/InboxSection.java index 92bb0c381..3e7b02fd3 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/home/sections/InboxSection.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/home/sections/InboxSection.java @@ -20,6 +20,7 @@ import de.danoeh.antennapod.core.menuhandler.MenuItemUtils; import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.util.FeedItemUtil; import de.danoeh.antennapod.event.FeedItemEvent; +import de.danoeh.antennapod.event.FeedListUpdateEvent; import de.danoeh.antennapod.event.UnreadItemsUpdateEvent; import de.danoeh.antennapod.fragment.InboxFragment; import de.danoeh.antennapod.fragment.swipeactions.SwipeActions; @@ -89,6 +90,11 @@ public class InboxSection extends HomeSection { loadItems(); } + @Subscribe(threadMode = ThreadMode.MAIN) + public void onFeedListChanged(FeedListUpdateEvent event) { + loadItems(); + } + @Subscribe(sticky = true, threadMode = ThreadMode.MAIN) public void onEventMainThread(DownloadEvent event) { Log.d(TAG, "onEventMainThread() called with DownloadEvent"); From 1c085434307250b78b5165a6f78a862b6989bd8c Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Wed, 30 Nov 2022 19:27:55 +0100 Subject: [PATCH 2/4] Highlight currently playing card --- .../view/viewholder/HorizontalItemViewHolder.java | 11 +++++++++-- app/src/main/res/layout/horizontal_itemlist_item.xml | 1 - core/src/main/res/values/attrs.xml | 2 ++ core/src/main/res/values/styles.xml | 4 ++++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/view/viewholder/HorizontalItemViewHolder.java b/app/src/main/java/de/danoeh/antennapod/view/viewholder/HorizontalItemViewHolder.java index 5293338b6..42b0cb57c 100644 --- a/app/src/main/java/de/danoeh/antennapod/view/viewholder/HorizontalItemViewHolder.java +++ b/app/src/main/java/de/danoeh/antennapod/view/viewholder/HorizontalItemViewHolder.java @@ -1,11 +1,11 @@ package de.danoeh.antennapod.view.viewholder; import android.view.LayoutInflater; -import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; +import androidx.cardview.widget.CardView; import androidx.recyclerview.widget.RecyclerView; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.MainActivity; @@ -21,9 +21,10 @@ import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.ui.common.CircularProgressBar; import de.danoeh.antennapod.ui.common.SquareImageView; +import de.danoeh.antennapod.ui.common.ThemeUtils; public class HorizontalItemViewHolder extends RecyclerView.ViewHolder { - public final View card; + public final CardView card; public final ImageView secondaryActionIcon; private final SquareImageView cover; private final TextView title; @@ -67,6 +68,12 @@ public class HorizontalItemViewHolder extends RecyclerView.ViewHolder { if (media == null) { circularProgressBar.setPercentage(0, item); } else { + if (PlaybackStatus.isCurrentlyPlaying(media)) { + card.setCardBackgroundColor(ThemeUtils.getColorFromAttr(activity, R.attr.card_background_playing)); + } else { + card.setCardBackgroundColor(ThemeUtils.getColorFromAttr(activity, R.attr.card_background)); + } + if (item.getMedia().getDuration() > 0) { progressBar.setProgress(100 * item.getMedia().getPosition() / item.getMedia().getDuration()); } diff --git a/app/src/main/res/layout/horizontal_itemlist_item.xml b/app/src/main/res/layout/horizontal_itemlist_item.xml index 5b4787d11..b69a3f445 100644 --- a/app/src/main/res/layout/horizontal_itemlist_item.xml +++ b/app/src/main/res/layout/horizontal_itemlist_item.xml @@ -21,7 +21,6 @@ + + diff --git a/core/src/main/res/values/styles.xml b/core/src/main/res/values/styles.xml index ad1216f26..c398dfa8d 100644 --- a/core/src/main/res/values/styles.xml +++ b/core/src/main/res/values/styles.xml @@ -29,6 +29,8 @@ @drawable/navigation_up @drawable/ic_drag_lighttheme @drawable/scrollbar_thumb_light + #EFEEEE + #D8D8D8 #CF1800 #F59F00 #008537 @@ -68,6 +70,8 @@ @drawable/navigation_up_dark @drawable/ic_drag_darktheme @drawable/scrollbar_thumb_dark + #2d3337 + #444D53 #CF1800 #F59F00 #008537 From d5e80b089b716638aeb407f064d3a9c3f2766eab Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Wed, 30 Nov 2022 19:44:01 +0100 Subject: [PATCH 3/4] Fix search for subscriptions --- .../de/danoeh/antennapod/storage/database/PodDBAdapter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/database/src/main/java/de/danoeh/antennapod/storage/database/PodDBAdapter.java b/storage/database/src/main/java/de/danoeh/antennapod/storage/database/PodDBAdapter.java index 39454a106..63ced1973 100644 --- a/storage/database/src/main/java/de/danoeh/antennapod/storage/database/PodDBAdapter.java +++ b/storage/database/src/main/java/de/danoeh/antennapod/storage/database/PodDBAdapter.java @@ -1434,7 +1434,7 @@ public class PodDBAdapter { public Cursor searchFeeds(String searchQuery) { String[] queryWords = prepareSearchQuery(searchQuery); - String queryStart = "SELECT * FROM " + TABLE_NAME_FEEDS + " WHERE "; + String queryStart = "SELECT " + KEYS_FEED + " FROM " + TABLE_NAME_FEEDS + " WHERE "; StringBuilder sb = new StringBuilder(queryStart); for (int i = 0; i < queryWords.length; i++) { From 63c5e2dc72d66edcad797aabed9c6f9c67756344 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Wed, 30 Nov 2022 19:48:29 +0100 Subject: [PATCH 4/4] Convert drawer settings to Material --- .../de/danoeh/antennapod/dialog/DrawerPreferencesDialog.java | 4 ++-- .../danoeh/antennapod/ui/home/HomeSectionsSettingsDialog.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/DrawerPreferencesDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/DrawerPreferencesDialog.java index e8cfe81f0..8f174f207 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/DrawerPreferencesDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/DrawerPreferencesDialog.java @@ -1,7 +1,7 @@ package de.danoeh.antennapod.dialog; import android.content.Context; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import de.danoeh.antennapod.R; import de.danoeh.antennapod.storage.preferences.UserPreferences; import de.danoeh.antennapod.fragment.NavDrawerFragment; @@ -19,7 +19,7 @@ public class DrawerPreferencesDialog { checked[i] = true; } } - AlertDialog.Builder builder = new AlertDialog.Builder(context); + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(context); builder.setTitle(R.string.drawer_preferences); builder.setMultiChoiceItems(navTitles, checked, (dialog, which, isChecked) -> { if (isChecked) { diff --git a/app/src/main/java/de/danoeh/antennapod/ui/home/HomeSectionsSettingsDialog.java b/app/src/main/java/de/danoeh/antennapod/ui/home/HomeSectionsSettingsDialog.java index aa8ef8de3..e651aea48 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/home/HomeSectionsSettingsDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/home/HomeSectionsSettingsDialog.java @@ -4,7 +4,7 @@ import android.content.Context; import android.content.DialogInterface; import android.content.SharedPreferences; import android.text.TextUtils; -import androidx.appcompat.app.AlertDialog; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import de.danoeh.antennapod.R; import java.util.List; @@ -22,7 +22,7 @@ public class HomeSectionsSettingsDialog { } } - AlertDialog.Builder builder = new AlertDialog.Builder(context); + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(context); builder.setTitle(R.string.configure_home); builder.setMultiChoiceItems(sectionLabels, checked, (dialog, which, isChecked) -> { if (isChecked) {