diff options
author | ByteHamster <ByteHamster@users.noreply.github.com> | 2024-04-14 11:45:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-14 11:45:12 +0200 |
commit | e9b3cc34fe211ab3b03c30c6c483078b99ba7561 (patch) | |
tree | cd59dd91aec6cebcbfda27f6f0b2c3776d39892c | |
parent | d6b2a49caa0edb13f9913f63574e3cdf8f660583 (diff) | |
download | AntennaPod-e9b3cc34fe211ab3b03c30c6c483078b99ba7561.zip |
Optionally display subscriptions as a simple list (#7087)
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionFragment.java | 30 | ||||
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionViewHolder.java | 104 | ||||
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionsRecyclerAdapter.java | 163 | ||||
-rw-r--r-- | app/src/main/res/layout/fragment_subscriptions.xml | 2 | ||||
-rw-r--r-- | app/src/main/res/layout/subscription_grid_item.xml (renamed from app/src/main/res/layout/subscription_item.xml) | 4 | ||||
-rw-r--r-- | app/src/main/res/layout/subscription_list_item.xml | 91 | ||||
-rw-r--r-- | app/src/main/res/menu/subscriptions.xml | 3 | ||||
-rw-r--r-- | app/src/main/res/values/ids.xml | 3 | ||||
-rw-r--r-- | ui/i18n/src/main/res/values/strings.xml | 1 |
9 files changed, 277 insertions, 124 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionFragment.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionFragment.java index a62e8775f..1176c948d 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionFragment.java @@ -64,8 +64,9 @@ public class SubscriptionFragment extends Fragment private static final String KEY_UP_ARROW = "up_arrow"; private static final String ARGUMENT_FOLDER = "folder"; - private static final int MIN_NUM_COLUMNS = 2; + private static final int MIN_NUM_COLUMNS = 1; private static final int[] COLUMN_CHECKBOX_IDS = { + R.id.subscription_display_list, R.id.subscription_num_columns_2, R.id.subscription_num_columns_3, R.id.subscription_num_columns_4, @@ -85,9 +86,8 @@ public class SubscriptionFragment extends Fragment private SharedPreferences prefs; private FloatingActionButton subscriptionAddButton; - private SpeedDialView speedDialView; - + private RecyclerView.ItemDecoration itemDecoration; private List<NavDrawerData.DrawerItem> listItems; public static SubscriptionFragment newInstance(String folderTitle) { @@ -121,7 +121,7 @@ public class SubscriptionFragment extends Fragment } ((MainActivity) getActivity()).setupToolbarToggle(toolbar, displayUpArrow); toolbar.inflateMenu(R.menu.subscriptions); - for (int i = 0; i < COLUMN_CHECKBOX_IDS.length; i++) { + for (int i = 1; i < COLUMN_CHECKBOX_IDS.length; i++) { // Do this in Java to localize numbers toolbar.getMenu().findItem(COLUMN_CHECKBOX_IDS[i]) .setTitle(String.format(Locale.getDefault(), "%d", i + MIN_NUM_COLUMNS)); @@ -136,7 +136,6 @@ public class SubscriptionFragment extends Fragment } subscriptionRecycler = root.findViewById(R.id.subscriptions_grid); - subscriptionRecycler.addItemDecoration(new SubscriptionsRecyclerAdapter.GridDividerItemDecorator()); registerForContextMenu(subscriptionRecycler); subscriptionRecycler.addOnScrollListener(new LiftOnScrollListener(root.findViewById(R.id.appbar))); subscriptionAdapter = new SubscriptionsRecyclerAdapter((MainActivity) getActivity()) { @@ -209,6 +208,9 @@ public class SubscriptionFragment extends Fragment } else if (itemId == R.id.subscriptions_sort) { FeedSortDialog.showDialog(requireContext()); return true; + } else if (itemId == R.id.subscription_display_list) { + setColumnNumber(1); + return true; } else if (itemId == R.id.subscription_num_columns_2) { setColumnNumber(2); return true; @@ -232,10 +234,22 @@ public class SubscriptionFragment extends Fragment } private void setColumnNumber(int columns) { - GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), - columns, RecyclerView.VERTICAL, false); + if (itemDecoration != null) { + subscriptionRecycler.removeItemDecoration(itemDecoration); + itemDecoration = null; + } + RecyclerView.LayoutManager layoutManager; + if (columns == 1 && getDefaultNumOfColumns() == 5) { // Tablet + layoutManager = new GridLayoutManager(getContext(), 2, RecyclerView.VERTICAL, false); + } else if (columns == 1) { + layoutManager = new GridLayoutManager(getContext(), 1, RecyclerView.VERTICAL, false); + } else { + layoutManager = new GridLayoutManager(getContext(), columns, RecyclerView.VERTICAL, false); + itemDecoration = new SubscriptionsRecyclerAdapter.GridDividerItemDecorator(); + subscriptionRecycler.addItemDecoration(itemDecoration); + } subscriptionAdapter.setColumnCount(columns); - subscriptionRecycler.setLayoutManager(gridLayoutManager); + subscriptionRecycler.setLayoutManager(layoutManager); prefs.edit().putInt(PREF_NUM_COLUMNS, columns).apply(); refreshToolbarState(); } diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionViewHolder.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionViewHolder.java new file mode 100644 index 000000000..b28c50bd1 --- /dev/null +++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionViewHolder.java @@ -0,0 +1,104 @@ +package de.danoeh.antennapod.ui.screen.subscriptions; + +import android.graphics.drawable.Drawable; +import android.view.View; +import android.widget.CheckBox; +import android.widget.FrameLayout; +import android.widget.ImageView; +import android.widget.TextView; +import androidx.annotation.NonNull; +import androidx.appcompat.content.res.AppCompatResources; +import androidx.cardview.widget.CardView; +import androidx.recyclerview.widget.RecyclerView; +import com.google.android.material.elevation.SurfaceColors; +import de.danoeh.antennapod.R; +import de.danoeh.antennapod.activity.MainActivity; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.storage.database.NavDrawerData; +import de.danoeh.antennapod.storage.preferences.UserPreferences; +import de.danoeh.antennapod.ui.CoverLoader; + +import java.lang.ref.WeakReference; +import java.text.NumberFormat; + +public class SubscriptionViewHolder extends RecyclerView.ViewHolder { + public final TextView title; + public final ImageView coverImage; + public final TextView count; + public final TextView fallbackTitle; + public final FrameLayout selectView; + public final CheckBox selectCheckbox; + public final CardView card; + public final View errorIcon; + public final WeakReference<MainActivity> mainActivityRef; + + public SubscriptionViewHolder(@NonNull View itemView, MainActivity mainActivity) { + super(itemView); + title = itemView.findViewById(R.id.titleLabel); + coverImage = itemView.findViewById(R.id.coverImage); + count = itemView.findViewById(R.id.countViewPill); + fallbackTitle = itemView.findViewById(R.id.fallbackTitleLabel); + selectView = itemView.findViewById(R.id.selectContainer); + selectCheckbox = itemView.findViewById(R.id.selectCheckBox); + card = itemView.findViewById(R.id.outerContainer); + errorIcon = itemView.findViewById(R.id.errorIcon); + this.mainActivityRef = new WeakReference<>(mainActivity); + } + + public void bind(NavDrawerData.DrawerItem drawerItem, int columnCount) { + if (selectView != null) { + Drawable drawable = AppCompatResources.getDrawable(selectView.getContext(), + R.drawable.ic_checkbox_background); + selectView.setBackground(drawable); // Setting this in XML crashes API <= 21 + } + title.setText(drawerItem.getTitle()); + fallbackTitle.setText(drawerItem.getTitle()); + coverImage.setContentDescription(drawerItem.getTitle()); + if (drawerItem.getCounter() > 0) { + count.setText(NumberFormat.getInstance().format(drawerItem.getCounter())); + count.setVisibility(View.VISIBLE); + } else { + count.setVisibility(View.GONE); + } + + CoverLoader coverLoader = new CoverLoader(); + boolean textAndImageCombined; + if (drawerItem.type == NavDrawerData.DrawerItem.Type.FEED) { + Feed feed = ((NavDrawerData.FeedDrawerItem) drawerItem).feed; + textAndImageCombined = feed.isLocalFeed() && feed.getImageUrl() != null + && feed.getImageUrl().startsWith(Feed.PREFIX_GENERATIVE_COVER); + coverLoader.withUri(feed.getImageUrl()); + errorIcon.setVisibility(feed.hasLastUpdateFailed() ? View.VISIBLE : View.GONE); + } else { + textAndImageCombined = true; + coverLoader.withResource(R.drawable.ic_tag); + errorIcon.setVisibility(View.GONE); + } + if (UserPreferences.shouldShowSubscriptionTitle() || columnCount == 1) { + // No need for fallback title when already showing title + fallbackTitle.setVisibility(View.GONE); + } else { + coverLoader.withPlaceholderView(fallbackTitle, textAndImageCombined); + } + coverLoader.withCoverView(coverImage); + coverLoader.load(); + + if (card != null) { + float density = mainActivityRef.get().getResources().getDisplayMetrics().density; + card.setCardBackgroundColor(SurfaceColors.getColorForElevation(mainActivityRef.get(), 1 * density)); + } + + int textPadding = columnCount <= 3 ? 16 : 8; + title.setPadding(textPadding, textPadding, textPadding, textPadding); + fallbackTitle.setPadding(textPadding, textPadding, textPadding, textPadding); + + int textSize = 14; + if (columnCount == 3) { + textSize = 15; + } else if (columnCount == 2) { + textSize = 16; + } + title.setTextSize(textSize); + fallbackTitle.setTextSize(textSize); + } +}
\ No newline at end of file diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionsRecyclerAdapter.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionsRecyclerAdapter.java index fecb191b3..2ca09ff4f 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionsRecyclerAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionsRecyclerAdapter.java @@ -3,7 +3,6 @@ package de.danoeh.antennapod.ui.screen.subscriptions; import android.content.Context; import android.graphics.Canvas; import android.graphics.Rect; -import android.graphics.drawable.Drawable; import android.os.Build; import android.view.ContextMenu; import android.view.InputDevice; @@ -13,39 +12,27 @@ import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; -import android.widget.CheckBox; -import android.widget.FrameLayout; -import android.widget.ImageView; -import android.widget.TextView; - import androidx.annotation.NonNull; -import androidx.appcompat.content.res.AppCompatResources; -import androidx.cardview.widget.CardView; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.RecyclerView; - -import com.google.android.material.elevation.SurfaceColors; -import java.lang.ref.WeakReference; -import java.text.NumberFormat; -import java.util.ArrayList; -import java.util.List; - import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.MainActivity; -import de.danoeh.antennapod.ui.CoverLoader; -import de.danoeh.antennapod.ui.SelectableAdapter; -import de.danoeh.antennapod.storage.preferences.UserPreferences; +import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.storage.database.NavDrawerData; +import de.danoeh.antennapod.storage.preferences.UserPreferences; +import de.danoeh.antennapod.ui.SelectableAdapter; +import de.danoeh.antennapod.ui.common.ThemeUtils; import de.danoeh.antennapod.ui.screen.feed.FeedItemlistFragment; -import de.danoeh.antennapod.model.feed.Feed; + +import java.lang.ref.WeakReference; +import java.util.ArrayList; +import java.util.List; /** * Adapter for subscriptions */ -public class SubscriptionsRecyclerAdapter extends SelectableAdapter<SubscriptionsRecyclerAdapter.SubscriptionViewHolder> +public class SubscriptionsRecyclerAdapter extends SelectableAdapter<SubscriptionViewHolder> implements View.OnCreateContextMenuListener { - private static final int COVER_WITH_TITLE = 1; - private final WeakReference<MainActivity> mainActivityRef; private List<NavDrawerData.DrawerItem> listItems; private NavDrawerData.DrawerItem selectedItem = null; @@ -74,30 +61,49 @@ public class SubscriptionsRecyclerAdapter extends SelectableAdapter<Subscription @NonNull @Override public SubscriptionViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - View itemView = LayoutInflater.from(mainActivityRef.get()).inflate(R.layout.subscription_item, parent, false); - itemView.findViewById(R.id.titleLabel).setVisibility(viewType == COVER_WITH_TITLE ? View.VISIBLE : View.GONE); - return new SubscriptionViewHolder(itemView); + if (viewType == R.id.view_type_subscription_list) { + View itemView = LayoutInflater.from(mainActivityRef.get()) + .inflate(R.layout.subscription_list_item, parent, false); + return new SubscriptionViewHolder(itemView, mainActivityRef.get()); + } + View itemView = LayoutInflater.from(mainActivityRef.get()) + .inflate(R.layout.subscription_grid_item, parent, false); + itemView.findViewById(R.id.titleLabel).setVisibility( + viewType == R.id.view_type_subscription_grid_with_title ? View.VISIBLE : View.GONE); + return new SubscriptionViewHolder(itemView, mainActivityRef.get()); } @Override public void onBindViewHolder(@NonNull SubscriptionViewHolder holder, int position) { NavDrawerData.DrawerItem drawerItem = listItems.get(position); boolean isFeed = drawerItem.type == NavDrawerData.DrawerItem.Type.FEED; - holder.bind(drawerItem); + holder.bind(drawerItem, columnCount); holder.itemView.setOnCreateContextMenuListener(this); if (inActionMode()) { - if (isFeed) { - holder.selectCheckbox.setVisibility(View.VISIBLE); - holder.selectView.setVisibility(View.VISIBLE); + if (holder.selectView != null) { + if (isFeed) { + holder.selectCheckbox.setVisibility(View.VISIBLE); + } + holder.selectView.setVisibility(isFeed ? View.VISIBLE : View.GONE); + holder.coverImage.setAlpha(0.6f); + holder.selectCheckbox.setChecked((isSelected(position))); + holder.selectCheckbox.setOnCheckedChangeListener((buttonView, isChecked) + -> setSelected(holder.getBindingAdapterPosition(), isChecked)); + holder.count.setVisibility(View.GONE); + } else { + holder.itemView.setBackgroundResource(android.R.color.transparent); + if (isSelected(position)) { + holder.itemView.setBackgroundColor(0x88000000 + + (0xffffff & ThemeUtils.getColorFromAttr(mainActivityRef.get(), R.attr.colorAccent))); + } } - holder.selectCheckbox.setChecked((isSelected(position))); - holder.selectCheckbox.setOnCheckedChangeListener((buttonView, isChecked) - -> setSelected(holder.getBindingAdapterPosition(), isChecked)); - holder.coverImage.setAlpha(0.6f); - holder.count.setVisibility(View.GONE); } else { - holder.selectView.setVisibility(View.GONE); - holder.coverImage.setAlpha(1.0f); + holder.itemView.setBackgroundResource(android.R.color.transparent); + if (holder.selectView != null) { + holder.selectCheckbox.setVisibility(View.GONE); + holder.selectView.setVisibility(View.GONE); + holder.coverImage.setAlpha(1.0f); + } } holder.itemView.setOnLongClickListener(v -> { @@ -127,7 +133,8 @@ public class SubscriptionsRecyclerAdapter extends SelectableAdapter<Subscription holder.itemView.setOnClickListener(v -> { if (isFeed) { if (inActionMode()) { - holder.selectCheckbox.setChecked(!isSelected(holder.getBindingAdapterPosition())); + setSelected(holder.getBindingAdapterPosition(), !isSelected(holder.getBindingAdapterPosition())); + notifyItemChanged(holder.getBindingAdapterPosition()); } else { Fragment fragment = FeedItemlistFragment .newInstance(((NavDrawerData.FeedDrawerItem) drawerItem).feed.getId()); @@ -206,82 +213,12 @@ public class SubscriptionsRecyclerAdapter extends SelectableAdapter<Subscription @Override public int getItemViewType(int position) { - return UserPreferences.shouldShowSubscriptionTitle() ? COVER_WITH_TITLE : 0; - } - - public class SubscriptionViewHolder extends RecyclerView.ViewHolder { - private final TextView title; - private final ImageView coverImage; - private final TextView count; - private final TextView fallbackTitle; - private final FrameLayout selectView; - private final CheckBox selectCheckbox; - private final CardView card; - private final View errorIcon; - - public SubscriptionViewHolder(@NonNull View itemView) { - super(itemView); - title = itemView.findViewById(R.id.titleLabel); - coverImage = itemView.findViewById(R.id.coverImage); - count = itemView.findViewById(R.id.countViewPill); - fallbackTitle = itemView.findViewById(R.id.fallbackTitleLabel); - selectView = itemView.findViewById(R.id.selectContainer); - selectCheckbox = itemView.findViewById(R.id.selectCheckBox); - card = itemView.findViewById(R.id.outerContainer); - errorIcon = itemView.findViewById(R.id.errorIcon); - } - - public void bind(NavDrawerData.DrawerItem drawerItem) { - Drawable drawable = AppCompatResources.getDrawable(selectView.getContext(), - R.drawable.ic_checkbox_background); - selectView.setBackground(drawable); // Setting this in XML crashes API <= 21 - title.setText(drawerItem.getTitle()); - fallbackTitle.setText(drawerItem.getTitle()); - coverImage.setContentDescription(drawerItem.getTitle()); - if (drawerItem.getCounter() > 0) { - count.setText(NumberFormat.getInstance().format(drawerItem.getCounter())); - count.setVisibility(View.VISIBLE); - } else { - count.setVisibility(View.GONE); - } - - CoverLoader coverLoader = new CoverLoader(); - boolean textAndImageCombined; - if (drawerItem.type == NavDrawerData.DrawerItem.Type.FEED) { - Feed feed = ((NavDrawerData.FeedDrawerItem) drawerItem).feed; - textAndImageCombined = feed.isLocalFeed() && feed.getImageUrl() != null - && feed.getImageUrl().startsWith(Feed.PREFIX_GENERATIVE_COVER); - coverLoader.withUri(feed.getImageUrl()); - errorIcon.setVisibility(feed.hasLastUpdateFailed() ? View.VISIBLE : View.GONE); - } else { - textAndImageCombined = true; - coverLoader.withResource(R.drawable.ic_tag); - errorIcon.setVisibility(View.GONE); - } - if (UserPreferences.shouldShowSubscriptionTitle()) { - // No need for fallback title when already showing title - fallbackTitle.setVisibility(View.GONE); - } else { - coverLoader.withPlaceholderView(fallbackTitle, textAndImageCombined); - } - coverLoader.withCoverView(coverImage); - coverLoader.load(); - - float density = mainActivityRef.get().getResources().getDisplayMetrics().density; - card.setCardBackgroundColor(SurfaceColors.getColorForElevation(mainActivityRef.get(), 1 * density)); - - int textPadding = columnCount <= 3 ? 16 : 8; - title.setPadding(textPadding, textPadding, textPadding, textPadding); - fallbackTitle.setPadding(textPadding, textPadding, textPadding, textPadding); - - int textSize = 14; - if (columnCount == 3) { - textSize = 15; - } else if (columnCount == 2) { - textSize = 16; - } - title.setTextSize(textSize); - fallbackTitle.setTextSize(textSize); + if (columnCount == 1) { + return R.id.view_type_subscription_list; + } else if (UserPreferences.shouldShowSubscriptionTitle()) { + return R.id.view_type_subscription_grid_with_title; + } else { + return R.id.view_type_subscription_grid_without_title; } } diff --git a/app/src/main/res/layout/fragment_subscriptions.xml b/app/src/main/res/layout/fragment_subscriptions.xml index ac40bf5a4..dbf0fc11d 100644 --- a/app/src/main/res/layout/fragment_subscriptions.xml +++ b/app/src/main/res/layout/fragment_subscriptions.xml @@ -61,7 +61,7 @@ android:layout_gravity="center_horizontal" android:paddingBottom="88dp" tools:itemCount="2" - tools:listitem="@layout/subscription_item" /> + tools:listitem="@layout/subscription_grid_item" /> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout> diff --git a/app/src/main/res/layout/subscription_item.xml b/app/src/main/res/layout/subscription_grid_item.xml index b3271ffa3..f5130a020 100644 --- a/app/src/main/res/layout/subscription_item.xml +++ b/app/src/main/res/layout/subscription_grid_item.xml @@ -26,7 +26,6 @@ <androidx.cardview.widget.CardView android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_margin="1px" android:clickable="false" app:cardBackgroundColor="@color/non_square_icon_background" app:cardCornerRadius="12dp" @@ -34,7 +33,8 @@ <RelativeLayout android:layout_width="wrap_content" - android:layout_height="wrap_content"> + android:layout_height="wrap_content" + android:layout_margin="1px"> <de.danoeh.antennapod.ui.common.SquareImageView android:id="@+id/coverImage" diff --git a/app/src/main/res/layout/subscription_list_item.xml b/app/src/main/res/layout/subscription_list_item.xml new file mode 100644 index 000000000..09a8c252a --- /dev/null +++ b/app/src/main/res/layout/subscription_list_item.xml @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:squareImageView="http://schemas.android.com/apk/de.danoeh.antennapod" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingHorizontal="16dp" + android:paddingVertical="8dp" + android:foreground="?attr/selectableItemBackground" + android:orientation="horizontal"> + + <androidx.cardview.widget.CardView + android:layout_width="56dp" + android:layout_height="56dp" + android:clickable="false" + app:cardBackgroundColor="@color/non_square_icon_background" + app:cardCornerRadius="12dp" + app:cardElevation="0dp"> + + <RelativeLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_margin="1px"> + + <de.danoeh.antennapod.ui.common.SquareImageView + android:id="@+id/coverImage" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:scaleType="fitCenter" + android:outlineProvider="background" + squareImageView:direction="width" + tools:src="@tools:sample/avatars" /> + + <TextView + android:id="@+id/fallbackTitleLabel" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignStart="@+id/coverImage" + android:layout_alignLeft="@+id/coverImage" + android:layout_alignTop="@+id/coverImage" + android:layout_alignEnd="@+id/coverImage" + android:layout_alignRight="@+id/coverImage" + android:layout_alignBottom="@+id/coverImage" + android:background="@color/feed_text_bg" + android:gravity="center" + android:ellipsize="end" + android:padding="6dp" + android:textColor="#fff" + tools:text="@sample/episodes.json/data/title" /> + + </RelativeLayout> + + </androidx.cardview.widget.CardView> + + <TextView + android:id="@+id/titleLabel" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginHorizontal="8dp" + android:layout_gravity="center_vertical" + android:layout_weight="1" + android:ellipsize="end" + android:gravity="start" + android:maxLines="2" + android:importantForAccessibility="no" + style="@style/AntennaPod.TextView.ListItemPrimaryTitle" + tools:text="@sample/episodes.json/data/title" /> + + <TextView + android:id="@+id/countViewPill" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:text="3" + android:textColor="?android:attr/textColorTertiary" + android:textSize="14sp" /> + + <ImageView + android:id="@+id/errorIcon" + android:layout_width="24dp" + android:layout_height="24dp" + android:layout_margin="8dp" + android:visibility="gone" + android:layout_gravity="center_vertical" + android:contentDescription="@string/refresh_failed_msg" + app:srcCompat="@drawable/ic_error" + tools:visibility="visible" /> + +</LinearLayout> diff --git a/app/src/main/res/menu/subscriptions.xml b/app/src/main/res/menu/subscriptions.xml index 3a2614149..95764aedb 100644 --- a/app/src/main/res/menu/subscriptions.xml +++ b/app/src/main/res/menu/subscriptions.xml @@ -32,6 +32,9 @@ <group android:checkableBehavior="single"> <item + android:id="@+id/subscription_display_list" + android:title="@string/subscription_display_list"/> + <item android:id="@+id/subscription_num_columns_2" android:title="2"/> <item diff --git a/app/src/main/res/values/ids.xml b/app/src/main/res/values/ids.xml index 8c4091390..545e79da7 100644 --- a/app/src/main/res/values/ids.xml +++ b/app/src/main/res/values/ids.xml @@ -14,4 +14,7 @@ <!-- View types --> <item name="view_type_episode_item" type="id"/> + <item name="view_type_subscription_grid_with_title" type="id"/> + <item name="view_type_subscription_grid_without_title" type="id"/> + <item name="view_type_subscription_list" type="id"/> </resources> diff --git a/ui/i18n/src/main/res/values/strings.xml b/ui/i18n/src/main/res/values/strings.xml index 6a4238779..b86792f20 100644 --- a/ui/i18n/src/main/res/values/strings.xml +++ b/ui/i18n/src/main/res/values/strings.xml @@ -823,6 +823,7 @@ <!-- Subscriptions fragment --> <string name="subscription_num_columns">Number of columns</string> + <string name="subscription_display_list">List</string> <!-- Notification channels --> <string name="notification_group_errors">Errors</string> |