Clean ups
This commit is contained in:
parent
62a84454ff
commit
44ba560d77
28 changed files with 243 additions and 422 deletions
|
|
@ -4,10 +4,11 @@ import android.graphics.drawable.Drawable;
|
|||
import android.widget.ImageView;
|
||||
|
||||
import com.bumptech.glide.request.animation.GlideAnimation;
|
||||
import com.kabouzeid.appthemehelper.util.ATHUtil;
|
||||
import com.kabouzeid.gramophone.R;
|
||||
import com.kabouzeid.gramophone.glide.palette.BitmapPaletteTarget;
|
||||
import com.kabouzeid.gramophone.glide.palette.BitmapPaletteWrapper;
|
||||
import com.kabouzeid.gramophone.util.ColorUtil;
|
||||
import com.kabouzeid.gramophone.util.PhonographColorUtil;
|
||||
|
||||
public abstract class PhonographColoredTarget extends BitmapPaletteTarget {
|
||||
public PhonographColoredTarget(ImageView view) {
|
||||
|
|
@ -23,11 +24,11 @@ public abstract class PhonographColoredTarget extends BitmapPaletteTarget {
|
|||
@Override
|
||||
public void onResourceReady(BitmapPaletteWrapper resource, GlideAnimation<? super BitmapPaletteWrapper> glideAnimation) {
|
||||
super.onResourceReady(resource, glideAnimation);
|
||||
onColorReady(ColorUtil.getColor(resource.getPalette(), getDefaultBarColor()));
|
||||
onColorReady(PhonographColorUtil.getColor(resource.getPalette(), getDefaultBarColor()));
|
||||
}
|
||||
|
||||
protected int getDefaultBarColor() {
|
||||
return ColorUtil.resolveColor(getView().getContext(), R.attr.default_bar_color);
|
||||
return ATHUtil.resolveColor(getView().getContext(), R.attr.default_bar_color);
|
||||
}
|
||||
|
||||
public abstract void onColorReady(int color);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import com.bumptech.glide.Glide;
|
|||
import com.bumptech.glide.load.engine.Resource;
|
||||
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
||||
import com.bumptech.glide.load.resource.transcode.ResourceTranscoder;
|
||||
import com.kabouzeid.gramophone.util.ColorUtil;
|
||||
import com.kabouzeid.gramophone.util.PhonographColorUtil;
|
||||
|
||||
public class BitmapPaletteTranscoder implements ResourceTranscoder<Bitmap, BitmapPaletteWrapper> {
|
||||
private final BitmapPool bitmapPool;
|
||||
|
|
@ -23,7 +23,7 @@ public class BitmapPaletteTranscoder implements ResourceTranscoder<Bitmap, Bitma
|
|||
@Override
|
||||
public Resource<BitmapPaletteWrapper> transcode(Resource<Bitmap> bitmapResource) {
|
||||
Bitmap bitmap = bitmapResource.get();
|
||||
BitmapPaletteWrapper bitmapPaletteWrapper = new BitmapPaletteWrapper(bitmap, ColorUtil.generatePalette(bitmap));
|
||||
BitmapPaletteWrapper bitmapPaletteWrapper = new BitmapPaletteWrapper(bitmap, PhonographColorUtil.generatePalette(bitmap));
|
||||
return new BitmapPaletteResource(bitmapPaletteWrapper, bitmapPool);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
package com.kabouzeid.gramophone.glide.palette;
|
||||
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.support.v7.graphics.Palette;
|
||||
|
||||
import com.github.florent37.glidepalette.common.BaseColorGenerator;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public class CustomTextColorGenerator extends BaseColorGenerator {
|
||||
private final int titleDark;
|
||||
private final int titleLight;
|
||||
private final int bodyDark;
|
||||
private final int bodyLight;
|
||||
|
||||
public CustomTextColorGenerator(@ColorInt int titleDark, @ColorInt int titleLight, @ColorInt int bodyDark, @ColorInt int bodyLight) {
|
||||
this.titleDark = titleDark;
|
||||
this.titleLight = titleLight;
|
||||
this.bodyDark = bodyDark;
|
||||
this.bodyLight = bodyLight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTitleTextColor(Palette.Swatch swatch) {
|
||||
return super.getTitleTextColor(swatch);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBodyTextColor(Palette.Swatch swatch) {
|
||||
return super.getBodyTextColor(swatch);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue