Merge pull request #6204 from ByteHamster/various-tweaks

Various tweaks
This commit is contained in:
ByteHamster 2022-11-30 20:20:02 +01:00 committed by GitHub
commit 97ab1725db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 26 additions and 8 deletions

View File

@ -1,7 +1,7 @@
package de.danoeh.antennapod.dialog; package de.danoeh.antennapod.dialog;
import android.content.Context; 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.R;
import de.danoeh.antennapod.storage.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.fragment.NavDrawerFragment; import de.danoeh.antennapod.fragment.NavDrawerFragment;
@ -19,7 +19,7 @@ public class DrawerPreferencesDialog {
checked[i] = true; checked[i] = true;
} }
} }
AlertDialog.Builder builder = new AlertDialog.Builder(context); MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(context);
builder.setTitle(R.string.drawer_preferences); builder.setTitle(R.string.drawer_preferences);
builder.setMultiChoiceItems(navTitles, checked, (dialog, which, isChecked) -> { builder.setMultiChoiceItems(navTitles, checked, (dialog, which, isChecked) -> {
if (isChecked) { if (isChecked) {

View File

@ -4,7 +4,7 @@ import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.text.TextUtils; import android.text.TextUtils;
import androidx.appcompat.app.AlertDialog; import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import java.util.List; 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.setTitle(R.string.configure_home);
builder.setMultiChoiceItems(sectionLabels, checked, (dialog, which, isChecked) -> { builder.setMultiChoiceItems(sectionLabels, checked, (dialog, which, isChecked) -> {
if (isChecked) { if (isChecked) {

View File

@ -20,6 +20,7 @@ import de.danoeh.antennapod.core.menuhandler.MenuItemUtils;
import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.core.util.FeedItemUtil; import de.danoeh.antennapod.core.util.FeedItemUtil;
import de.danoeh.antennapod.event.FeedItemEvent; import de.danoeh.antennapod.event.FeedItemEvent;
import de.danoeh.antennapod.event.FeedListUpdateEvent;
import de.danoeh.antennapod.event.UnreadItemsUpdateEvent; import de.danoeh.antennapod.event.UnreadItemsUpdateEvent;
import de.danoeh.antennapod.fragment.InboxFragment; import de.danoeh.antennapod.fragment.InboxFragment;
import de.danoeh.antennapod.fragment.swipeactions.SwipeActions; import de.danoeh.antennapod.fragment.swipeactions.SwipeActions;
@ -89,6 +90,11 @@ public class InboxSection extends HomeSection {
loadItems(); loadItems();
} }
@Subscribe(threadMode = ThreadMode.MAIN)
public void onFeedListChanged(FeedListUpdateEvent event) {
loadItems();
}
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN) @Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public void onEventMainThread(DownloadEvent event) { public void onEventMainThread(DownloadEvent event) {
Log.d(TAG, "onEventMainThread() called with DownloadEvent"); Log.d(TAG, "onEventMainThread() called with DownloadEvent");

View File

@ -1,11 +1,11 @@
package de.danoeh.antennapod.view.viewholder; package de.danoeh.antennapod.view.viewholder;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity; 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.model.feed.FeedMedia;
import de.danoeh.antennapod.ui.common.CircularProgressBar; import de.danoeh.antennapod.ui.common.CircularProgressBar;
import de.danoeh.antennapod.ui.common.SquareImageView; import de.danoeh.antennapod.ui.common.SquareImageView;
import de.danoeh.antennapod.ui.common.ThemeUtils;
public class HorizontalItemViewHolder extends RecyclerView.ViewHolder { public class HorizontalItemViewHolder extends RecyclerView.ViewHolder {
public final View card; public final CardView card;
public final ImageView secondaryActionIcon; public final ImageView secondaryActionIcon;
private final SquareImageView cover; private final SquareImageView cover;
private final TextView title; private final TextView title;
@ -67,6 +68,12 @@ public class HorizontalItemViewHolder extends RecyclerView.ViewHolder {
if (media == null) { if (media == null) {
circularProgressBar.setPercentage(0, item); circularProgressBar.setPercentage(0, item);
} else { } 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) { if (item.getMedia().getDuration() > 0) {
progressBar.setProgress(100 * item.getMedia().getPosition() / item.getMedia().getDuration()); progressBar.setProgress(100 * item.getMedia().getPosition() / item.getMedia().getDuration());
} }

View File

@ -21,7 +21,6 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/background_elevated"
android:orientation="vertical"> android:orientation="vertical">
<androidx.cardview.widget.CardView <androidx.cardview.widget.CardView

View File

@ -16,4 +16,6 @@
<attr name="icon_green" format="color" /> <attr name="icon_green" format="color" />
<attr name="icon_purple" format="color" /> <attr name="icon_purple" format="color" />
<attr name="icon_gray" format="color" /> <attr name="icon_gray" format="color" />
<attr name="card_background" format="color" />
<attr name="card_background_playing" format="color" />
</resources> </resources>

View File

@ -29,6 +29,8 @@
<item name="navigation_up">@drawable/navigation_up</item> <item name="navigation_up">@drawable/navigation_up</item>
<item name="dragview_background">@drawable/ic_drag_lighttheme</item> <item name="dragview_background">@drawable/ic_drag_lighttheme</item>
<item name="scrollbar_thumb">@drawable/scrollbar_thumb_light</item> <item name="scrollbar_thumb">@drawable/scrollbar_thumb_light</item>
<item name="card_background">#EFEEEE</item>
<item name="card_background_playing">#D8D8D8</item>
<item name="icon_red">#CF1800</item> <item name="icon_red">#CF1800</item>
<item name="icon_yellow">#F59F00</item> <item name="icon_yellow">#F59F00</item>
<item name="icon_green">#008537</item> <item name="icon_green">#008537</item>
@ -68,6 +70,8 @@
<item name="navigation_up">@drawable/navigation_up_dark</item> <item name="navigation_up">@drawable/navigation_up_dark</item>
<item name="dragview_background">@drawable/ic_drag_darktheme</item> <item name="dragview_background">@drawable/ic_drag_darktheme</item>
<item name="scrollbar_thumb">@drawable/scrollbar_thumb_dark</item> <item name="scrollbar_thumb">@drawable/scrollbar_thumb_dark</item>
<item name="card_background">#2d3337</item>
<item name="card_background_playing">#444D53</item>
<item name="icon_red">#CF1800</item> <item name="icon_red">#CF1800</item>
<item name="icon_yellow">#F59F00</item> <item name="icon_yellow">#F59F00</item>
<item name="icon_green">#008537</item> <item name="icon_green">#008537</item>

View File

@ -1434,7 +1434,7 @@ public class PodDBAdapter {
public Cursor searchFeeds(String searchQuery) { public Cursor searchFeeds(String searchQuery) {
String[] queryWords = prepareSearchQuery(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); StringBuilder sb = new StringBuilder(queryStart);
for (int i = 0; i < queryWords.length; i++) { for (int i = 0; i < queryWords.length; i++) {