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


Java Palette.getLightVibrantColor方法代码示例

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


在下文中一共展示了Palette.getLightVibrantColor方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: getColor

import android.support.v7.graphics.Palette; //导入方法依赖的package包/类
public int getColor(Bitmap bm){
    int color = thumbRing.Color0;
    if(bm != null){
        Palette palette = Palette.from(bm).generate();
        int newColor = palette.getMutedColor(color);
        if(newColor == color){
            newColor = palette.getVibrantColor(color);
        }
        if(newColor == color){
            newColor = palette.getLightVibrantColor(color);
        }
        if(newColor == color){
            newColor = palette.getDarkVibrantColor(color);
        }
        color = newColor;
    }
    //Log.i("My","Color Exacted : " + color);
    return  color;
}
 
开发者ID:KishanV,项目名称:Android-Music-Player,代码行数:20,代码来源:thumbSlider.java

示例3: loadBitmaps

import android.support.v7.graphics.Palette; //导入方法依赖的package包/类
void loadBitmaps(){
    if(Ui.ef.MusicPlayer != null){
        musicPlayer mp = Ui.ef.MusicPlayer;
        final Bitmap bm = audioHandler.getAlubumArtBitmapById(Ui.ef.getContentResolver(),mp.handler.AID);
        if(bm != null){
            Palette palette = Palette.from(bm).generate();
            int color = thumbRing.Color0;
            int newColor = palette.getMutedColor(color);
            if(newColor == color){
                newColor = palette.getVibrantColor(color);
            }
            if(newColor == color){
                newColor = palette.getLightVibrantColor(color);
            }
            threeThumb.ring.img.maskPaint.setColor(newColor);
        }else{
            threeThumb.ring.img.maskPaint.setColor(thumbRing.Color0);
        }

        Ui.ef.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                //threeThumb.setImg(bm);
                threeThumb.invalidate();
                threeThumb.ring.invalidate();
            }
        });
    }
}
 
开发者ID:KishanV,项目名称:Android-Music-Player,代码行数:30,代码来源:thumbSlider.java

示例4: loadBitmaps

import android.support.v7.graphics.Palette; //导入方法依赖的package包/类
void loadBitmaps(){
    if(Ui.ef.MusicPlayer != null){
        musicPlayer mp = Ui.ef.MusicPlayer;
        final Bitmap bm = audioHandler.getAlubumArtBitmapById(Ui.ef.getContentResolver(),mp.handler.AID);
        if(bm != null){
            Palette palette = Palette.from(bm).generate();
            int color = thumbRing.Color0;
            int newColor = palette.getMutedColor(color);
            if(newColor == color){
                newColor = palette.getVibrantColor(color);
            }
            if(newColor == color){
                newColor = palette.getLightVibrantColor(color);
            }
            tRing.img.maskPaint.setColor(newColor);
        }else{
            tRing.img.maskPaint.setColor(thumbRing.Color0);
        }

        Ui.ef.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                tRing.invalidate();
                img.setImageDrawable(null);
                img.setImageBitmap(bm);
            }
        });

    }else{
        img.setImageDrawable(null);
        img.setImageBitmap(null);
    }
}
 
开发者ID:KishanV,项目名称:Android-Music-Player,代码行数:34,代码来源:Screen.java

示例5: 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.getLightVibrantColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。