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/main/java/de/danoeh | |
parent | 4931734d94a30d4b9b83c13a7869fc84bbf22a11 (diff) | |
download | AntennaPod-01f1927770b65bb9052fedd40068770c8abf15b1.zip |
Add more spacing to OnlineFeedViewActivity, use MD3 styles (#6670)
Diffstat (limited to 'app/src/main/java/de/danoeh')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java | 25 | ||||
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistDescriptionAdapter.java | 2 |
2 files changed, 13 insertions, 14 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); |