summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hennen <TomHennen@users.noreply.github.com>2016-01-24 18:48:46 -0500
committerTom Hennen <TomHennen@users.noreply.github.com>2016-01-24 18:48:46 -0500
commita2c4d6b4ea3c128914a03f941f49c29ea53fa0c5 (patch)
treee20d2b9176657f6b0b1b85d256588f76cb9ae421
parentf5f3477ac01356e17fb48768420d104a5d9919f2 (diff)
parent3fded4495a8be34db0b145ac52966b125e9279ea (diff)
downloadAntennaPod-a2c4d6b4ea3c128914a03f941f49c29ea53fa0c5.zip
Merge pull request #1610 from mfietz/issue/1602-player-background
Audio Player: Themed background Color
-rw-r--r--app/build.gradle1
-rw-r--r--app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java24
-rw-r--r--app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java11
-rw-r--r--app/src/main/res/layout/cover_fragment.xml9
4 files changed, 15 insertions, 30 deletions
diff --git a/app/build.gradle b/app/build.gradle
index f2888cf2f..55c1080ae 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -13,7 +13,6 @@ dependencies {
compile "com.android.support:appcompat-v7:$supportVersion"
compile "com.android.support:design:$supportVersion"
compile "com.android.support:gridlayout-v7:$supportVersion"
- compile "com.android.support:palette-v7:$supportVersion"
compile "com.android.support:percent:$supportVersion"
compile "com.android.support:recyclerview-v7:$supportVersion"
compile "org.apache.commons:commons-lang3:$commonslangVersion"
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java
index 0ffdf4e51..a3e9723ea 100644
--- a/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java
@@ -1,9 +1,7 @@
package de.danoeh.antennapod.fragment;
-import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.v4.app.Fragment;
-import android.support.v7.graphics.Palette;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@@ -12,8 +10,6 @@ import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
-import com.bumptech.glide.request.animation.GlideAnimation;
-import com.bumptech.glide.request.target.BitmapImageViewTarget;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.AudioplayerActivity.AudioplayerContentFragment;
@@ -78,26 +74,10 @@ public class CoverFragment extends Fragment implements
imgvCover.post(() -> {
Glide.with(this)
.load(media.getImageUri())
- .asBitmap()
- .placeholder(R.color.light_gray)
- .error(R.color.light_gray)
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
.dontAnimate()
- .into(new BitmapImageViewTarget(imgvCover) {
- @Override
- public void onResourceReady(Bitmap bitmap, GlideAnimation anim) {
- super.onResourceReady(bitmap, anim);
- Palette.Builder builder = new Palette.Builder(bitmap);
- builder.generate(palette -> {
- Palette.Swatch swatch = palette.getMutedSwatch();
- if(swatch != null) {
- root.setBackgroundColor(swatch.getRgb());
- txtvPodcastTitle.setTextColor(swatch.getTitleTextColor());
- txtvEpisodeTitle.setTextColor(swatch.getBodyTextColor());
- }
- });
- }
- });
+ .fitCenter()
+ .into(imgvCover);
});
} else {
Log.w(TAG, "loadMediaInfo was called while media was null");
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java
index f270dc22d..9790e66b3 100644
--- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java
@@ -7,6 +7,8 @@ import android.content.ClipData;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
+import android.content.res.TypedArray;
+import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
@@ -115,9 +117,12 @@ public class ItemDescriptionFragment extends Fragment implements AudioplayerCont
if (Build.VERSION.SDK_INT >= 11) {
webvDescription.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
- if (UserPreferences.getTheme() == R.style.Theme_AntennaPod_Dark) {
- webvDescription.setBackgroundColor(getResources().getColor(R.color.black));
- }
+ TypedArray ta = getActivity().getTheme().obtainStyledAttributes(new int[]
+ {android.R.attr.colorBackground});
+ int backgroundColor = ta.getColor(0, UserPreferences.getTheme() ==
+ R.style.Theme_AntennaPod_Dark ? Color.BLACK : Color.WHITE);
+ ta.recycle();
+ webvDescription.setBackgroundColor(backgroundColor);
webvDescription.getSettings().setUseWideViewPort(false);
webvDescription.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
webvDescription.getSettings().setLoadWithOverviewMode(true);
diff --git a/app/src/main/res/layout/cover_fragment.xml b/app/src/main/res/layout/cover_fragment.xml
index 13cfb0add..9ad1ff9c6 100644
--- a/app/src/main/res/layout/cover_fragment.xml
+++ b/app/src/main/res/layout/cover_fragment.xml
@@ -5,8 +5,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@color/actionbar_gray">
+ android:layout_height="match_parent">
<ImageView
android:id="@+id/imgvCover"
@@ -37,7 +36,8 @@
android:gravity="center"
android:maxLines="2"
android:ellipsize="end"
- android:text="Podcast" />
+ android:text="Podcast"
+ android:textColor="?android:attr/textColorSecondary" />
</LinearLayout>
@@ -59,7 +59,8 @@
android:gravity="center"
android:maxLines="2"
android:ellipsize="end"
- android:text="Episode" />
+ android:text="Episode"
+ android:textColor="?android:attr/textColorPrimary" />
</LinearLayout>