Remove palette

This commit is contained in:
Martin Fietz 2016-01-25 00:34:33 +01:00
parent 0eefa8c541
commit 3319dc7c07
3 changed files with 7 additions and 27 deletions

View File

@ -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"

View File

@ -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");

View File

@ -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>