use of net.steamcrafted.materialiconlib.MaterialDrawableBuilder in project Timber by naman14.
the class Timber5 method updateShuffleState.
@Override
public void updateShuffleState() {
if (shuffle != null && getActivity() != null) {
MaterialDrawableBuilder builder = MaterialDrawableBuilder.with(getActivity()).setIcon(MaterialDrawableBuilder.IconValue.SHUFFLE).setSizeDp(30);
if (MusicPlayer.getShuffleMode() == 0) {
builder.setColor(Color.WHITE);
} else
builder.setColor(accentColor);
shuffle.setImageDrawable(builder.build());
shuffle.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
MusicPlayer.cycleShuffle();
updateShuffleState();
updateRepeatState();
}
});
}
}
use of net.steamcrafted.materialiconlib.MaterialDrawableBuilder in project Timber by naman14.
the class AlbumDetailFragment method setAlbumart.
private void setAlbumart() {
ImageLoader.getInstance().displayImage(TimberUtils.getAlbumArtUri(albumID).toString(), albumArt, new DisplayImageOptions.Builder().cacheInMemory(true).showImageOnFail(R.drawable.ic_empty_music2).resetViewBeforeLoading(true).build(), new ImageLoadingListener() {
@Override
public void onLoadingStarted(String imageUri, View view) {
}
@Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
loadFailed = true;
MaterialDrawableBuilder builder = MaterialDrawableBuilder.with(context).setIcon(MaterialDrawableBuilder.IconValue.SHUFFLE).setColor(TimberUtils.getBlackWhiteColor(Config.accentColor(context, Helpers.getATEKey(context))));
ATEUtils.setFabBackgroundTint(fab, Config.accentColor(context, Helpers.getATEKey(context)));
fab.setImageDrawable(builder.build());
}
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
try {
new Palette.Builder(loadedImage).generate(new Palette.PaletteAsyncListener() {
@Override
public void onGenerated(Palette palette) {
Palette.Swatch swatch = palette.getVibrantSwatch();
if (swatch != null) {
primaryColor = swatch.getRgb();
collapsingToolbarLayout.setContentScrimColor(primaryColor);
if (getActivity() != null)
ATEUtils.setStatusBarColor(getActivity(), Helpers.getATEKey(getActivity()), primaryColor);
} else {
Palette.Swatch swatchMuted = palette.getMutedSwatch();
if (swatchMuted != null) {
primaryColor = swatchMuted.getRgb();
collapsingToolbarLayout.setContentScrimColor(primaryColor);
if (getActivity() != null)
ATEUtils.setStatusBarColor(getActivity(), Helpers.getATEKey(getActivity()), primaryColor);
}
}
MaterialDrawableBuilder builder = MaterialDrawableBuilder.with(getActivity()).setIcon(MaterialDrawableBuilder.IconValue.SHUFFLE).setSizeDp(30);
if (primaryColor != -1) {
builder.setColor(TimberUtils.getBlackWhiteColor(primaryColor));
ATEUtils.setFabBackgroundTint(fab, primaryColor);
fab.setImageDrawable(builder.build());
} else {
if (context != null) {
ATEUtils.setFabBackgroundTint(fab, Config.accentColor(context, Helpers.getATEKey(context)));
builder.setColor(TimberUtils.getBlackWhiteColor(Config.accentColor(context, Helpers.getATEKey(context))));
fab.setImageDrawable(builder.build());
}
}
}
});
} catch (Exception ignored) {
}
}
@Override
public void onLoadingCancelled(String imageUri, View view) {
}
});
}
Aggregations