diff options
author | Bhaskar Kaura <85757758+bhaskarblur@users.noreply.github.com> | 2023-10-29 20:43:51 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-29 16:13:51 +0100 |
commit | 01f1927770b65bb9052fedd40068770c8abf15b1 (patch) | |
tree | 5c13539c7f914d3d52786d11bb5c3d528904d6f1 /app/src | |
parent | 4931734d94a30d4b9b83c13a7869fc84bbf22a11 (diff) | |
download | AntennaPod-01f1927770b65bb9052fedd40068770c8abf15b1.zip |
Add more spacing to OnlineFeedViewActivity, use MD3 styles (#6670)
Diffstat (limited to 'app/src')
6 files changed, 90 insertions, 101 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java index d8225b6c2..c5d656aa0 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java @@ -17,7 +17,6 @@ import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; -import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -37,6 +36,7 @@ import de.danoeh.antennapod.core.feed.FeedUrlNotFoundException; import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.core.service.playback.PlaybackServiceInterface; import de.danoeh.antennapod.core.util.DownloadErrorLabel; +import de.danoeh.antennapod.databinding.OnlinefeedviewHeaderBinding; import de.danoeh.antennapod.event.EpisodeDownloadEvent; import de.danoeh.antennapod.event.FeedListUpdateEvent; import de.danoeh.antennapod.event.PlayerStatusEvent; @@ -100,6 +100,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity { private static final String TAG = "OnlineFeedViewActivity"; private static final String PREFS = "OnlineFeedViewActivityPreferences"; private static final String PREF_LAST_AUTO_DOWNLOAD = "lastAutoDownload"; + private static final int DESCRIPTION_MAX_LINES_COLLAPSED = 4; private volatile List<Feed> feeds; private String selectedDownloadUrl; @@ -117,6 +118,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity { private Disposable parser; private Disposable updater; + private OnlinefeedviewHeaderBinding headerBinding; private OnlinefeedviewActivityBinding viewBinding; @Override @@ -128,8 +130,10 @@ public class OnlineFeedViewActivity extends AppCompatActivity { setContentView(viewBinding.getRoot()); viewBinding.transparentBackground.setOnClickListener(v -> finish()); + viewBinding.closeButton.setOnClickListener(view -> finish()); viewBinding.card.setOnClickListener(null); viewBinding.card.setCardBackgroundColor(ThemeUtils.getColorFromAttr(this, R.attr.colorSurface)); + headerBinding = OnlinefeedviewHeaderBinding.inflate(getLayoutInflater()); String feedUrl = null; if (getIntent().hasExtra(ARG_FEEDURL)) { @@ -416,14 +420,10 @@ public class OnlineFeedViewActivity extends AppCompatActivity { viewBinding.backgroundImage.setColorFilter(new LightingColorFilter(0xff828282, 0x000000)); - View header = View.inflate(this, R.layout.onlinefeedview_header, null); - - viewBinding.listView.addHeaderView(header); + viewBinding.listView.addHeaderView(headerBinding.getRoot()); viewBinding.listView.setSelector(android.R.color.transparent); viewBinding.listView.setAdapter(new FeedItemlistDescriptionAdapter(this, 0, feed.getItems())); - TextView description = header.findViewById(R.id.txtvDescription); - if (StringUtils.isNotBlank(feed.getImageUrl())) { Glide.with(this) .load(feed.getImageUrl()) @@ -445,7 +445,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity { viewBinding.titleLabel.setText(feed.getTitle()); viewBinding.authorLabel.setText(feed.getAuthor()); - description.setText(HtmlToPlainText.getPlainText(feed.getDescription())); + headerBinding.txtvDescription.setText(HtmlToPlainText.getPlainText(feed.getDescription())); viewBinding.subscribeButton.setOnClickListener(v -> { if (feedInFeedlist()) { @@ -467,13 +467,12 @@ public class OnlineFeedViewActivity extends AppCompatActivity { viewBinding.autoDownloadCheckBox.setChecked(preferences.getBoolean(PREF_LAST_AUTO_DOWNLOAD, true)); } - final int MAX_LINES_COLLAPSED = 10; - description.setMaxLines(MAX_LINES_COLLAPSED); - description.setOnClickListener(v -> { - if (description.getMaxLines() > MAX_LINES_COLLAPSED) { - description.setMaxLines(MAX_LINES_COLLAPSED); + headerBinding.txtvDescription.setMaxLines(DESCRIPTION_MAX_LINES_COLLAPSED); + headerBinding.txtvDescription.setOnClickListener(v -> { + if (headerBinding.txtvDescription.getMaxLines() > DESCRIPTION_MAX_LINES_COLLAPSED) { + headerBinding.txtvDescription.setMaxLines(DESCRIPTION_MAX_LINES_COLLAPSED); } else { - description.setMaxLines(2000); + headerBinding.txtvDescription.setMaxLines(2000); } }); diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistDescriptionAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistDescriptionAdapter.java index f790a5784..2827c2590 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistDescriptionAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistDescriptionAdapter.java @@ -29,7 +29,7 @@ import java.util.List; * List adapter for showing a list of FeedItems with their title and description. */ public class FeedItemlistDescriptionAdapter extends ArrayAdapter<FeedItem> { - private static final int MAX_LINES_COLLAPSED = 3; + private static final int MAX_LINES_COLLAPSED = 2; public FeedItemlistDescriptionAdapter(Context context, int resource, List<FeedItem> objects) { super(context, resource, objects); diff --git a/app/src/main/res/layout/itemdescription_listitem.xml b/app/src/main/res/layout/itemdescription_listitem.xml index 6ed856796..c3f8c24b8 100644 --- a/app/src/main/res/layout/itemdescription_listitem.xml +++ b/app/src/main/res/layout/itemdescription_listitem.xml @@ -1,46 +1,31 @@ <?xml version="1.0" encoding="utf-8"?> - -<RelativeLayout +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingTop="8dp" - android:paddingLeft="16dp" - android:paddingRight="16dp" - android:paddingBottom="8dp" - tools:background="@android:color/holo_orange_light"> + android:orientation="vertical" + android:paddingHorizontal="20dp" + android:paddingVertical="16dp"> <TextView android:id="@+id/txtvPubDate" - style="@android:style/TextAppearance.Small" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentRight="true" - android:layout_alignParentEnd="true" - android:layout_alignParentTop="true" - android:layout_marginLeft="8dp" - android:layout_marginStart="8dp" - android:textSize="14sp" - android:textColor="?android:textColorSecondary" android:ellipsize="end" android:lines="1" + style="@android:style/TextAppearance.Small" tools:text="22 Jan 2016" tools:background="@android:color/holo_green_dark" /> <TextView android:id="@+id/txtvTitle" - android:layout_width="wrap_content" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_alignParentLeft="true" - android:layout_alignParentStart="true" - android:layout_alignParentTop="true" - android:layout_toLeftOf="@id/txtvPubDate" - android:layout_toStartOf="@id/txtvPubDate" - android:textSize="16sp" - android:textColor="?android:attr/textColorPrimary" + android:layout_marginVertical="12dp" android:ellipsize="end" android:maxLines="2" + style="@style/AntennaPod.TextView.ListItemPrimaryTitle" tools:text="Feed item title" tools:background="@android:color/holo_green_dark" /> @@ -48,22 +33,19 @@ android:id="@+id/txtvDescription" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_below="@id/txtvTitle" - android:textSize="14sp" - android:textColor="?android:attr/textColorSecondary" android:ellipsize="end" - android:maxLines="3" + android:maxLines="2" + style="@style/AntennaPod.TextView.ListItemBody" tools:text="Feed item description" tools:background="@android:color/holo_green_dark" /> <Button android:id="@+id/butPreview" - android:layout_below="@id/txtvDescription" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentStart="true" - android:layout_alignParentLeft="true" - style="@style/Widget.MaterialComponents.Button.TextButton" - android:text="@string/preview_episode"/> + android:layout_marginTop="8dp" + android:text="@string/preview_episode" + android:layout_gravity="end|right" + style="@style/Widget.MaterialComponents.Button.OutlinedButton" /> -</RelativeLayout> +</LinearLayout> diff --git a/app/src/main/res/layout/itunes_podcast_listitem.xml b/app/src/main/res/layout/itunes_podcast_listitem.xml index fe53e1944..da2de457b 100644 --- a/app/src/main/res/layout/itunes_podcast_listitem.xml +++ b/app/src/main/res/layout/itunes_podcast_listitem.xml @@ -1,5 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> - <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" @@ -37,24 +36,23 @@ <TextView android:id="@+id/txtvTitle" - style="@style/AntennaPod.TextView.ListItemPrimaryTitle2" android:layout_width="match_parent" android:layout_height="wrap_content" - android:maxLines="2" + style="@style/AntennaPod.TextView.ListItemPrimaryTitle" tools:background="@android:color/holo_green_dark" tools:text="Podcast title" /> <TextView android:id="@+id/txtvAuthor" - style="android:style/TextAppearance.Small" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="14sp" android:textColor="?android:attr/textColorSecondary" android:ellipsize="middle" android:maxLines="2" + style="android:style/TextAppearance.Small" tools:text="author" - tools:background="@android:color/holo_green_dark"/> + tools:background="@android:color/holo_green_dark" /> </LinearLayout> diff --git a/app/src/main/res/layout/onlinefeedview_activity.xml b/app/src/main/res/layout/onlinefeedview_activity.xml index c9ee91ead..88b87da1a 100644 --- a/app/src/main/res/layout/onlinefeedview_activity.xml +++ b/app/src/main/res/layout/onlinefeedview_activity.xml @@ -11,7 +11,7 @@ android:id="@+id/card" android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_margin="32dp" + android:layout_margin="24dp" android:elevation="16dp" app:cardCornerRadius="8dp"> @@ -35,13 +35,14 @@ <RelativeLayout android:layout_width="match_parent" - android:layout_height="wrap_content" + android:layout_height="@dimen/feeditemlist_header_height" + android:layout_marginBottom="12dp" android:background="@color/feed_image_bg"> <ImageView android:id="@+id/backgroundImage" android:layout_width="match_parent" - android:layout_height="@dimen/feeditemlist_header_height" + android:layout_height="match_parent" android:scaleType="centerCrop" /> <ImageView @@ -52,10 +53,12 @@ android:layout_alignParentStart="true" android:layout_alignParentTop="true" android:layout_centerVertical="true" - android:layout_marginBottom="16dp" + android:layout_marginBottom="12dp" android:layout_marginLeft="16dp" android:layout_marginStart="16dp" - android:layout_marginTop="16dp" + android:layout_marginTop="24dp" + android:background="@drawable/bg_rounded_corners" + android:clipToOutline="true" android:importantForAccessibility="no" tools:src="@tools:sample/avatars" /> @@ -64,12 +67,12 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_alignParentTop="true" - android:layout_marginBottom="16dp" + android:layout_marginBottom="8dp" android:layout_marginLeft="16dp" android:layout_marginStart="16dp" - android:layout_marginTop="16dp" - android:layout_marginRight="16dp" - android:layout_marginEnd="16dp" + android:layout_marginTop="24dp" + android:layout_marginRight="24dp" + android:layout_marginEnd="24dp" android:layout_alignParentEnd="true" android:layout_alignParentRight="true" android:layout_toRightOf="@id/coverImage" @@ -79,7 +82,8 @@ android:shadowColor="@color/black" android:shadowRadius="3" android:textColor="@color/white" - style="@style/AntennaPod.TextView.Heading" + android:textSize="20sp" + android:textFontWeight="800" tools:text="Podcast title" /> <TextView @@ -104,21 +108,28 @@ android:textSize="@dimen/text_size_small" tools:text="Podcast author" /> + <ImageButton + android:id="@+id/closeButton" + android:layout_width="16dp" + android:layout_height="16dp" + android:layout_alignParentRight="true" + android:layout_marginTop="12dp" + android:layout_marginRight="12dp" + android:background="@android:color/transparent" + android:src="@drawable/ic_close_white" /> + </RelativeLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginStart="8dp" - android:layout_marginEnd="8dp" - android:layout_marginBottom="16dp" + android:paddingHorizontal="16dp" android:orientation="vertical"> <Spinner android:id="@+id/alternate_urls_spinner" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="8dp" android:dropDownWidth="match_parent" android:padding="8dp" android:textColor="?android:attr/textColorPrimary" @@ -128,10 +139,7 @@ android:id="@+id/subscribeButton" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginStart="8dp" - android:layout_marginTop="16dp" - android:layout_marginEnd="8dp" - android:focusable="false" + android:layout_marginTop="4dp" android:text="@string/subscribe_label" /> <CheckBox @@ -139,8 +147,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="left" - android:focusable="false" android:checked="true" + android:layout_marginTop="8dp" android:text="@string/auto_download_label" android:visibility="gone" tools:visibility="visible" /> @@ -149,8 +157,7 @@ android:id="@+id/stopPreviewButton" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_margin="8dp" - android:focusable="false" + android:layout_marginTop="4dp" android:text="@string/stop_preview" android:visibility="gone" tools:visibility="visible" /> @@ -160,7 +167,9 @@ <ListView android:id="@+id/listView" android:layout_width="match_parent" - android:layout_height="match_parent" /> + android:layout_height="match_parent" + android:paddingTop="16dp" + android:clipToPadding="false" /> </LinearLayout> diff --git a/app/src/main/res/layout/onlinefeedview_header.xml b/app/src/main/res/layout/onlinefeedview_header.xml index aa690e142..6d740c772 100644 --- a/app/src/main/res/layout/onlinefeedview_header.xml +++ b/app/src/main/res/layout/onlinefeedview_header.xml @@ -1,35 +1,36 @@ <?xml version="1.0" encoding="utf-8"?> <LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:orientation="vertical" + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingLeft="20dp" + android:paddingRight="20dp" + android:layout_marginBottom="8dp"> + + <TextView + android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_width="match_parent"> + android:layout_marginBottom="8dp" + android:text="@string/description_label" + style="@style/TextAppearance.Material3.TitleMedium" /> <TextView - android:id="@+id/txtvDescription" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginBottom="16dp" - android:layout_marginLeft="16dp" - android:layout_marginStart="16dp" - android:layout_marginRight="16dp" - android:layout_marginEnd="16dp" - android:ellipsize="end" - android:textColor="?android:attr/textColorSecondary" - android:textSize="@dimen/text_size_small" - tools:text="@string/design_time_lorem_ipsum" - tools:background="@android:color/holo_green_dark"/> + android:id="@+id/txtvDescription" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="16dp" + android:ellipsize="end" + android:lineHeight="20dp" + style="@style/AntennaPod.TextView.ListItemBody" + tools:text="@string/design_time_lorem_ipsum" /> <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginBottom="16dp" - android:layout_marginLeft="16dp" - android:layout_marginStart="16dp" - android:layout_marginRight="16dp" - android:layout_marginEnd="16dp" - android:textSize="@dimen/text_size_medium" - android:text="@string/episodes_label"/> + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="16dp" + android:text="@string/episodes_label" + style="@style/TextAppearance.Material3.TitleMedium" /> -</LinearLayout>
\ No newline at end of file +</LinearLayout> |