From f1612995a222bb19c0907b0955658dc9b2164f78 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Sun, 11 Aug 2019 14:18:41 +0200 Subject: [PATCH] Updated OnlineFeedView layout --- .../activity/OnlineFeedViewActivity.java | 28 ++++++ .../main/res/layout/onlinefeedview_header.xml | 99 ++++++------------- 2 files changed, 56 insertions(+), 71 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 35c423a47..ea7687bc9 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java @@ -4,6 +4,8 @@ import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; +import android.graphics.LightingColorFilter; +import android.os.Build; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.UiThread; @@ -30,6 +32,7 @@ import android.widget.TextView; import com.bumptech.glide.Glide; import com.bumptech.glide.request.RequestOptions; +import de.danoeh.antennapod.core.glide.FastBlurTransformation; import org.apache.commons.lang3.StringUtils; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; @@ -393,6 +396,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity { this.selectedDownloadUrl = feed.getDownload_url(); EventDistributor.getInstance().register(listener); ListView listView = findViewById(R.id.listview); + listView.setSelector(android.R.color.transparent); LayoutInflater inflater = LayoutInflater.from(this); View header = inflater.inflate(R.layout.onlinefeedview_header, listView, false); listView.addHeaderView(header); @@ -400,6 +404,10 @@ public class OnlineFeedViewActivity extends AppCompatActivity { listView.setAdapter(new FeedItemlistDescriptionAdapter(this, 0, feed.getItems())); ImageView cover = header.findViewById(R.id.imgvCover); + ImageView headerBackground = header.findViewById(R.id.imgvBackground); + header.findViewById(R.id.butShowInfo).setVisibility(View.INVISIBLE); + header.findViewById(R.id.butShowSettings).setVisibility(View.INVISIBLE); + headerBackground.setColorFilter(new LightingColorFilter(0xff828282, 0x000000)); TextView title = header.findViewById(R.id.txtvTitle); TextView author = header.findViewById(R.id.txtvAuthor); TextView description = header.findViewById(R.id.txtvDescription); @@ -417,6 +425,15 @@ public class OnlineFeedViewActivity extends AppCompatActivity { .fitCenter() .dontAnimate()) .into(cover); + Glide.with(this) + .load(feed.getImageUrl()) + .apply(new RequestOptions() + .placeholder(R.color.image_readability_tint) + .error(R.color.image_readability_tint) + .diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY) + .transform(new FastBlurTransformation()) + .dontAnimate()) + .into(headerBackground); } title.setText(feed.getTitle()); @@ -445,6 +462,17 @@ public class OnlineFeedViewActivity extends AppCompatActivity { } }); + final int MAX_LINES_COLLAPSED = 10; + description.setMaxLines(MAX_LINES_COLLAPSED); + description.setOnClickListener(v -> { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN + && description.getMaxLines() > MAX_LINES_COLLAPSED) { + description.setMaxLines(MAX_LINES_COLLAPSED); + } else { + description.setMaxLines(2000); + } + }); + if (alternateFeedUrls.isEmpty()) { spAlternateUrls.setVisibility(View.GONE); } else { diff --git a/app/src/main/res/layout/onlinefeedview_header.xml b/app/src/main/res/layout/onlinefeedview_header.xml index 4217322e4..057bfb379 100644 --- a/app/src/main/res/layout/onlinefeedview_header.xml +++ b/app/src/main/res/layout/onlinefeedview_header.xml @@ -1,88 +1,33 @@ - - - - - - + android:layout_width="match_parent"> - + - - - - + android:textSize="@dimen/text_size_micro"/> -