From 1edf415c2d11414d261c7437f2f9a14081286962 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Wed, 11 Sep 2019 23:00:46 +0200 Subject: Showing full description when clicking item on podcast preview screen --- .../antennapod/adapter/FeedItemlistDescriptionAdapter.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'app/src/main/java/de/danoeh/antennapod') 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 c10bb7638..8d469c7a6 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistDescriptionAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistDescriptionAdapter.java @@ -1,6 +1,7 @@ package de.danoeh.antennapod.adapter; import android.content.Context; +import android.os.Build; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -51,6 +52,17 @@ public class FeedItemlistDescriptionAdapter extends ArrayAdapter { .replaceAll("\\s+", " ") .trim(); holder.description.setText(description); + + final int MAX_LINES_COLLAPSED = 3; + holder.description.setMaxLines(MAX_LINES_COLLAPSED); + holder.description.setOnClickListener(v -> { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN + && holder.description.getMaxLines() > MAX_LINES_COLLAPSED) { + holder.description.setMaxLines(MAX_LINES_COLLAPSED); + } else { + holder.description.setMaxLines(2000); + } + }); } return convertView; } -- cgit v1.2.3