Updated deprecated palette methods and fixed a small bug in artist and album detail activity

This commit is contained in:
Karim Abou Zeid 2015-04-22 13:22:40 +02:00
commit 82c7128ea8
7 changed files with 98 additions and 88 deletions

View file

@ -138,19 +138,20 @@ public class AlbumAdapter extends RecyclerView.Adapter<AlbumAdapter.ViewHolder>
}
private void applyPalette(Bitmap bitmap, final TextView title, final TextView artist, final View footer) {
Palette.generateAsync(bitmap, new Palette.PaletteAsyncListener() {
@Override
public void onGenerated(Palette palette) {
final Palette.Swatch vibrantSwatch = palette.getVibrantSwatch();
if (vibrantSwatch != null) {
title.setTextColor(vibrantSwatch.getTitleTextColor());
artist.setTextColor(vibrantSwatch.getTitleTextColor());
ViewUtil.animateViewColor(footer, DialogUtils.resolveColor(activity, R.attr.default_bar_color), vibrantSwatch.getRgb());
} else {
paletteBlackAndWhite(title, artist, footer);
}
}
});
Palette.from(bitmap)
.generate(new Palette.PaletteAsyncListener() {
@Override
public void onGenerated(Palette palette) {
final Palette.Swatch vibrantSwatch = palette.getVibrantSwatch();
if (vibrantSwatch != null) {
title.setTextColor(vibrantSwatch.getTitleTextColor());
artist.setTextColor(vibrantSwatch.getTitleTextColor());
ViewUtil.animateViewColor(footer, DialogUtils.resolveColor(activity, R.attr.default_bar_color), vibrantSwatch.getRgb());
} else {
paletteBlackAndWhite(title, artist, footer);
}
}
});
}
private void paletteBlackAndWhite(final TextView title, final TextView artist, final View footer) {