当前位置: 首页>>代码示例>>Java>>正文


Java Palette.getLightMutedColor方法代码示例

本文整理汇总了Java中android.support.v7.graphics.Palette.getLightMutedColor方法的典型用法代码示例。如果您正苦于以下问题:Java Palette.getLightMutedColor方法的具体用法?Java Palette.getLightMutedColor怎么用?Java Palette.getLightMutedColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v7.graphics.Palette的用法示例。


在下文中一共展示了Palette.getLightMutedColor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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};
}
 
开发者ID:jathak,项目名称:musicwidget,代码行数:27,代码来源:StandardWidget.java

示例2: 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;
    }
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:35,代码来源:IconColorExtractor.java

示例3: 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) {}
	};
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:69,代码来源:ChannelActivity.java


注:本文中的android.support.v7.graphics.Palette.getLightMutedColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。