本文整理汇总了Java中android.support.v7.graphics.Palette.getDarkMutedColor方法的典型用法代码示例。如果您正苦于以下问题:Java Palette.getDarkMutedColor方法的具体用法?Java Palette.getDarkMutedColor怎么用?Java Palette.getDarkMutedColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.graphics.Palette
的用法示例。
在下文中一共展示了Palette.getDarkMutedColor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onGenerated
import android.support.v7.graphics.Palette; //导入方法依赖的package包/类
/**
* Called when the {@link Palette} has been generated.
*
* @param palette
*/
@Override
public void onGenerated(Palette palette) {
int color;
if((color = palette.getDominantColor(0)) != 0) {
mFrameLayout.setBackgroundColor(color);
}
else if((color = palette.getVibrantColor(0)) != 0) {
mFrameLayout.setBackgroundColor(color);
}
else if((color = palette.getDarkVibrantColor(0)) != 0) {
mFrameLayout.setBackgroundColor(color);
}
else if((color = palette.getDarkMutedColor(0)) != 0) {
mFrameLayout.setBackgroundColor(color);
}
}
示例2: getPaletteColors
import android.support.v7.graphics.Palette; //导入方法依赖的package包/类
public static int[] getPaletteColors(Bitmap art){
int color = Color.TRANSPARENT;
int textColor = Color.WHITE;
int isLight = 0;
if(art != null){
Palette lastPalette = Palette.generate(currentArt);
color = lastPalette.getDarkVibrantColor(color);
if(color==Color.TRANSPARENT){
color = lastPalette.getLightVibrantColor(color);
if(color!=Color.TRANSPARENT){
textColor = Color.BLACK;
isLight = 1;
}else{
color = lastPalette.getLightMutedColor(color);
if(color!=Color.TRANSPARENT){
textColor = Color.BLACK;
isLight = 1;
}else{
color = lastPalette.getDarkMutedColor(color);
isLight = 0;
}
}
}
}
return new int[]{color,textColor,isLight};
}
示例3: palette
import android.support.v7.graphics.Palette; //导入方法依赖的package包/类
private static ArrayList<Integer> palette(Palette p, int defaultColor) {
ArrayList<Integer> extractedPalette = new ArrayList<>();
//get all palettes
Integer lightVibrant, vibrant, darkVibrant, lightMuted, muted, darkMuted;
lightVibrant = p.getVibrantColor(defaultColor);
vibrant = p.getVibrantColor(defaultColor);
darkVibrant = p.getDarkVibrantColor(defaultColor);
lightMuted = p.getLightMutedColor(defaultColor);
muted = p.getMutedColor(defaultColor);
darkMuted = p.getDarkMutedColor(defaultColor);
extractedPalette.add(lightVibrant);
extractedPalette.add(vibrant);
extractedPalette.add(darkVibrant);
extractedPalette.add(lightMuted);
extractedPalette.add(muted);
extractedPalette.add(darkMuted);
//add also default color, because if the next method fails we have a color anyway
extractedPalette.add(defaultColor);
//pass these palettes to a hashset to avoid duplicates
HashSet<Integer> hashSet = new HashSet<>();
hashSet.addAll(extractedPalette);
//add back these values to the palettes array list
extractedPalette.clear();
extractedPalette.addAll(hashSet);
return extractedPalette;
}
示例4: getLightThemeTarget
import android.support.v7.graphics.Palette; //导入方法依赖的package包/类
private Target getLightThemeTarget() {
return new Target() {
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
streamerImage.setImageBitmap(bitmap);
Palette palette = Palette.from(bitmap).generate();
int defaultColor = Service.getColorAttribute(R.attr.colorPrimary, R.color.primary, getBaseContext());
int defaultDarkColor = Service.getColorAttribute(R.attr.colorPrimaryDark, R.color.primaryDark, getBaseContext());
int vibrant = palette.getVibrantColor(defaultColor);
int vibrantDark = palette.getDarkVibrantColor(defaultColor);
int vibrantLight = palette.getLightVibrantColor(defaultColor);
int muted = palette.getMutedColor(defaultColor);
int mutedDark = palette.getDarkMutedColor(defaultColor);
int mutedLight = palette.getLightMutedColor(defaultColor);
Palette.Swatch swatch = null;
if (vibrant != defaultColor) {
swatch = palette.getVibrantSwatch();
} else if (vibrantDark != defaultColor) {
swatch = palette.getDarkVibrantSwatch();
} else if (vibrantLight != defaultColor){
swatch = palette.getLightVibrantSwatch();
} else if (muted != defaultColor) {
swatch = palette.getMutedSwatch();
} else if (mutedDark != defaultColor) {
swatch = palette.getDarkMutedSwatch();
} else {
swatch = palette.getLightMutedSwatch();
}
if (swatch != null) {
float[] swatchValues = swatch.getHsl();
float[] newSwatch = {swatchValues[0], (float) 0.85, (float) 0.85};
float[] newSwatchComposite = {(swatchValues[0] + 180) % 360, newSwatch[1], newSwatch[2]};
float[] newSwatchDark = {newSwatch[0], newSwatch[1], (float) 0.6};
int newColorDark = Color.HSVToColor(newSwatchDark);
int newColor = Color.HSVToColor(newSwatch);
int compositeNewColor = Color.HSVToColor(newSwatchComposite);
int primaryColor = Service.getBackgroundColorFromView(toolbar, defaultColor);
int primaryColorDark = Service.getBackgroundColorFromView(mTabs, defaultDarkColor);
Service.animateBackgroundColorChange(toolbar, newColor, primaryColor, COLOR_FADE_DURATION);
Service.animateBackgroundColorChange(additionalToolbar, newColor, primaryColor, COLOR_FADE_DURATION);
Service.animateBackgroundColorChange(mTabs, newColorDark, primaryColorDark, COLOR_FADE_DURATION);
mFab.setBackgroundTintList(ColorStateList.valueOf(compositeNewColor));
mTabs.setSelectedTabIndicatorColor(compositeNewColor);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(newColorDark);
}
}
}
@Override
public void onBitmapFailed(Drawable errorDrawable) {}
@Override
public void onPrepareLoad(Drawable placeHolderDrawable) {}
};
}