From a1ce4f8b6ffec4915e38962130fc625408041583 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Fri, 13 Apr 2018 16:23:01 +0200 Subject: [PATCH] Use better header in feed info and settings --- .../antennapod/activity/FeedInfoActivity.java | 22 ++++++++- .../activity/FeedSettingsActivity.java | 22 +++++++++ app/src/main/res/layout/feedinfo.xml | 48 ++----------------- app/src/main/res/layout/feedsettings.xml | 46 ++---------------- 4 files changed, 49 insertions(+), 89 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java index ca8681ef8..6b1272b01 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java @@ -3,6 +3,7 @@ package de.danoeh.antennapod.activity; import android.content.ClipData; import android.content.Context; import android.content.Intent; +import android.graphics.LightingColorFilter; import android.net.Uri; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; @@ -21,6 +22,7 @@ import de.danoeh.antennapod.R; import de.danoeh.antennapod.core.dialog.DownloadRequestErrorDialogCreator; import de.danoeh.antennapod.core.feed.Feed; import de.danoeh.antennapod.core.glide.ApGlideSettings; +import de.danoeh.antennapod.core.glide.FastBlurTransformation; import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.DownloadRequestException; @@ -82,14 +84,21 @@ public class FeedInfoActivity extends AppCompatActivity { imgvCover = (ImageView) findViewById(R.id.imgvCover); txtvTitle = (TextView) findViewById(R.id.txtvTitle); + TextView txtvAuthorHeader = (TextView) findViewById(R.id.txtvAuthor); + ImageView imgvBackground = (ImageView) findViewById(R.id.imgvBackground); + findViewById(R.id.butShowInfo).setVisibility(View.INVISIBLE); + findViewById(R.id.butShowSettings).setVisibility(View.INVISIBLE); + // https://github.com/bumptech/glide/issues/529 + imgvBackground.setColorFilter(new LightingColorFilter(0xff828282, 0x000000)); + + txtvDescription = (TextView) findViewById(R.id.txtvDescription); lblLanguage = (TextView) findViewById(R.id.lblLanguage); txtvLanguage = (TextView) findViewById(R.id.txtvLanguage); lblAuthor = (TextView) findViewById(R.id.lblAuthor); - txtvAuthor = (TextView) findViewById(R.id.txtvAuthor); + txtvAuthor = (TextView) findViewById(R.id.txtvDetailsAuthor); txtvUrl = (TextView) findViewById(R.id.txtvUrl); - txtvUrl.setOnClickListener(copyUrlToClipboard); subscription = Observable.fromCallable(()-> DBReader.getFeed(feedId)) @@ -112,6 +121,14 @@ public class FeedInfoActivity extends AppCompatActivity { .fitCenter() .dontAnimate() .into(imgvCover); + Glide.with(FeedInfoActivity.this) + .load(feed.getImageLocation()) + .placeholder(R.color.image_readability_tint) + .error(R.color.image_readability_tint) + .diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY) + .transform(new FastBlurTransformation(FeedInfoActivity.this)) + .dontAnimate() + .into(imgvBackground); txtvTitle.setText(feed.getTitle()); @@ -129,6 +146,7 @@ public class FeedInfoActivity extends AppCompatActivity { if (!TextUtils.isEmpty(feed.getAuthor())) { txtvAuthor.setText(feed.getAuthor()); + txtvAuthorHeader.setText(feed.getAuthor()); } else { lblAuthor.setVisibility(View.GONE); txtvAuthor.setVisibility(View.GONE); diff --git a/app/src/main/java/de/danoeh/antennapod/activity/FeedSettingsActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/FeedSettingsActivity.java index d962da25a..5e15585a5 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/FeedSettingsActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/FeedSettingsActivity.java @@ -4,10 +4,12 @@ import android.content.ClipData; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; +import android.graphics.LightingColorFilter; import android.net.Uri; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.text.Editable; +import android.text.TextUtils; import android.text.TextWatcher; import android.util.Log; import android.view.Menu; @@ -31,6 +33,7 @@ import de.danoeh.antennapod.core.feed.Feed; import de.danoeh.antennapod.core.feed.FeedFilter; import de.danoeh.antennapod.core.feed.FeedPreferences; import de.danoeh.antennapod.core.glide.ApGlideSettings; +import de.danoeh.antennapod.core.glide.FastBlurTransformation; import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.DBWriter; @@ -126,6 +129,13 @@ public class FeedSettingsActivity extends AppCompatActivity { imgvCover = (ImageView) findViewById(R.id.imgvCover); txtvTitle = (TextView) findViewById(R.id.txtvTitle); + TextView txtvAuthorHeader = (TextView) findViewById(R.id.txtvAuthor); + ImageView imgvBackground = (ImageView) findViewById(R.id.imgvBackground); + findViewById(R.id.butShowInfo).setVisibility(View.INVISIBLE); + findViewById(R.id.butShowSettings).setVisibility(View.INVISIBLE); + // https://github.com/bumptech/glide/issues/529 + imgvBackground.setColorFilter(new LightingColorFilter(0xff828282, 0x000000)); + cbxAutoDownload = (CheckBox) findViewById(R.id.cbxAutoDownload); cbxKeepUpdated = (CheckBox) findViewById(R.id.cbxKeepUpdated); spnAutoDelete = (Spinner) findViewById(R.id.spnAutoDelete); @@ -161,9 +171,21 @@ public class FeedSettingsActivity extends AppCompatActivity { .fitCenter() .dontAnimate() .into(imgvCover); + Glide.with(FeedSettingsActivity.this) + .load(feed.getImageLocation()) + .placeholder(R.color.image_readability_tint) + .error(R.color.image_readability_tint) + .diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY) + .transform(new FastBlurTransformation(FeedSettingsActivity.this)) + .dontAnimate() + .into(imgvBackground); txtvTitle.setText(feed.getTitle()); + if (!TextUtils.isEmpty(feed.getAuthor())) { + txtvAuthorHeader.setText(feed.getAuthor()); + } + cbxAutoDownload.setEnabled(UserPreferences.isEnableAutodownload()); cbxAutoDownload.setChecked(prefs.getAutoDownload()); cbxAutoDownload.setOnCheckedChangeListener((compoundButton, checked) -> { diff --git a/app/src/main/res/layout/feedinfo.xml b/app/src/main/res/layout/feedinfo.xml index 4214e8f53..428571aee 100644 --- a/app/src/main/res/layout/feedinfo.xml +++ b/app/src/main/res/layout/feedinfo.xml @@ -6,48 +6,7 @@ android:layout_height="match_parent" android:orientation="vertical"> - - - - - - - - + + android:paddingBottom="8dp" + android:clipToPadding="false"> - - - - - - - - + + android:paddingBottom="8dp" + android:clipToPadding="false">