Merge pull request #1610 from mfietz/issue/1602-player-background
Audio Player: Themed background Color
This commit is contained in:
commit
a2c4d6b4ea
|
@ -13,7 +13,6 @@ dependencies {
|
||||||
compile "com.android.support:appcompat-v7:$supportVersion"
|
compile "com.android.support:appcompat-v7:$supportVersion"
|
||||||
compile "com.android.support:design:$supportVersion"
|
compile "com.android.support:design:$supportVersion"
|
||||||
compile "com.android.support:gridlayout-v7:$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:percent:$supportVersion"
|
||||||
compile "com.android.support:recyclerview-v7:$supportVersion"
|
compile "com.android.support:recyclerview-v7:$supportVersion"
|
||||||
compile "org.apache.commons:commons-lang3:$commonslangVersion"
|
compile "org.apache.commons:commons-lang3:$commonslangVersion"
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
package de.danoeh.antennapod.fragment;
|
package de.danoeh.antennapod.fragment;
|
||||||
|
|
||||||
import android.graphics.Bitmap;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v7.graphics.Palette;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -12,8 +10,6 @@ import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
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.R;
|
||||||
import de.danoeh.antennapod.activity.AudioplayerActivity.AudioplayerContentFragment;
|
import de.danoeh.antennapod.activity.AudioplayerActivity.AudioplayerContentFragment;
|
||||||
|
@ -78,26 +74,10 @@ public class CoverFragment extends Fragment implements
|
||||||
imgvCover.post(() -> {
|
imgvCover.post(() -> {
|
||||||
Glide.with(this)
|
Glide.with(this)
|
||||||
.load(media.getImageUri())
|
.load(media.getImageUri())
|
||||||
.asBitmap()
|
|
||||||
.placeholder(R.color.light_gray)
|
|
||||||
.error(R.color.light_gray)
|
|
||||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||||
.dontAnimate()
|
.dontAnimate()
|
||||||
.into(new BitmapImageViewTarget(imgvCover) {
|
.fitCenter()
|
||||||
@Override
|
.into(imgvCover);
|
||||||
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());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Log.w(TAG, "loadMediaInfo was called while media was null");
|
Log.w(TAG, "loadMediaInfo was called while media was null");
|
||||||
|
|
|
@ -7,6 +7,8 @@ import android.content.ClipData;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
|
import android.graphics.Color;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -115,9 +117,12 @@ public class ItemDescriptionFragment extends Fragment implements AudioplayerCont
|
||||||
if (Build.VERSION.SDK_INT >= 11) {
|
if (Build.VERSION.SDK_INT >= 11) {
|
||||||
webvDescription.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
webvDescription.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
||||||
}
|
}
|
||||||
if (UserPreferences.getTheme() == R.style.Theme_AntennaPod_Dark) {
|
TypedArray ta = getActivity().getTheme().obtainStyledAttributes(new int[]
|
||||||
webvDescription.setBackgroundColor(getResources().getColor(R.color.black));
|
{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().setUseWideViewPort(false);
|
||||||
webvDescription.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
|
webvDescription.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
|
||||||
webvDescription.getSettings().setLoadWithOverviewMode(true);
|
webvDescription.getSettings().setLoadWithOverviewMode(true);
|
||||||
|
|
|
@ -5,8 +5,7 @@
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
android:background="@color/actionbar_gray">
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imgvCover"
|
android:id="@+id/imgvCover"
|
||||||
|
@ -37,7 +36,8 @@
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:maxLines="2"
|
android:maxLines="2"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:text="Podcast" />
|
android:text="Podcast"
|
||||||
|
android:textColor="?android:attr/textColorSecondary" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -59,7 +59,8 @@
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:maxLines="2"
|
android:maxLines="2"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:text="Episode" />
|
android:text="Episode"
|
||||||
|
android:textColor="?android:attr/textColorPrimary" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue