List of usage examples for android.graphics ColorMatrix setSaturation
public void setSaturation(float sat)
From source file:com.example.RITW.proximity.FeaturesActivity.java
private void setupPluginsInDrawer(final ViewGroup container) { final LayoutInflater inflater = LayoutInflater.from(this); final PackageManager pm = getPackageManager(); // look for Master Control Panel final Intent mcpIntent = new Intent(Intent.ACTION_MAIN); mcpIntent.setClassName(MCP_PACKAGE, MCP_CLASS); final ResolveInfo mcpInfo = pm.resolveActivity(mcpIntent, 0); // configure link to Master Control Panel //final TextView mcpItem = (TextView) container.findViewById(R.id.link_mcp); if (mcpInfo == null) { // mcpItem.setTextColor(Color.GRAY); ColorMatrix grayscale = new ColorMatrix(); grayscale.setSaturation(0.0f); // mcpItem.getCompoundDrawables()[0].setColorFilter(new ColorMatrixColorFilter(grayscale)); }/*w w w . j a v a 2s . co m*/ /*mcpItem.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View v) { Intent action = mcpIntent; if (mcpInfo == null) action = new Intent(Intent.ACTION_VIEW, Uri.parse(MCP_MARKET_URI)); action.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); try { startActivity(action); } catch (final ActivityNotFoundException e) { Toast.makeText(FeaturesActivity.this, R.string.no_application_play, Toast.LENGTH_SHORT).show(); } mDrawerLayout.closeDrawers(); } });*/ // look for other plug-ins final Intent utilsIntent = new Intent(Intent.ACTION_MAIN); utilsIntent.addCategory(UTILS_CATEGORY); final List<ResolveInfo> appList = pm.queryIntentActivities(utilsIntent, 0); for (final ResolveInfo info : appList) { final View item = inflater.inflate(R.layout.drawer_plugin, container, false); final ImageView icon = (ImageView) item.findViewById(android.R.id.icon); final TextView label = (TextView) item.findViewById(android.R.id.text1); label.setText(info.loadLabel(pm)); icon.setImageDrawable(info.loadIcon(pm)); item.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View v) { final Intent intent = new Intent(); intent.setComponent(new ComponentName(info.activityInfo.packageName, info.activityInfo.name)); intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); startActivity(intent); mDrawerLayout.closeDrawers(); } }); container.addView(item); } }
From source file:app.geochat.ui.widgets.BezelImageView.java
public BezelImageView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // Attribute initialization final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BezelImageView, defStyle, 0); mMaskDrawable = a.getDrawable(R.styleable.BezelImageView_maskDrawable); if (mMaskDrawable != null) { mMaskDrawable.setCallback(this); }/*from w w w . ja va 2 s. c o m*/ mBorderDrawable = a.getDrawable(R.styleable.BezelImageView_borderDrawable); if (mBorderDrawable != null) { mBorderDrawable.setCallback(this); } mDesaturateOnPress = a.getBoolean(R.styleable.BezelImageView_desaturateOnPress, mDesaturateOnPress); a.recycle(); // Other initialization mBlackPaint = new Paint(); mBlackPaint.setColor(0xff000000); mMaskedPaint = new Paint(); mMaskedPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)); // Always want a cache allocated. mCacheBitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); if (mDesaturateOnPress) { // Create a desaturate color filter for pressed state. ColorMatrix cm = new ColorMatrix(); cm.setSaturation(0); mDesaturateColorFilter = new ColorMatrixColorFilter(cm); } }
From source file:com.aprz.easy_iosched.ui.widget.BezelImageView.java
public BezelImageView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // Attribute initialization. final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BezelImageView, defStyle, 0); mMaskDrawable = a.getDrawable(R.styleable.BezelImageView_maskDrawable); if (mMaskDrawable != null) { mMaskDrawable.setCallback(this); }/* w ww . ja v a 2 s. c om*/ mBorderDrawable = a.getDrawable(R.styleable.BezelImageView_borderDrawable); if (mBorderDrawable != null) { mBorderDrawable.setCallback(this); } mDesaturateOnPress = a.getBoolean(R.styleable.BezelImageView_desaturateOnPress, mDesaturateOnPress); a.recycle(); // Other initialization. mBlackPaint = new Paint(); mBlackPaint.setColor(0xff000000); mMaskedPaint = new Paint(); mMaskedPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)); // Always want a cache allocated. mCacheBitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); if (mDesaturateOnPress) { // Create a desaturate color filter for pressed state. ColorMatrix cm = new ColorMatrix(); cm.setSaturation(0); mDesaturateColorFilter = new ColorMatrixColorFilter(cm); } }
From source file:ng.codehaven.eko.ui.widgets.RoundedImageView.java
public RoundedImageView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // Attribute initialization final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RoundedImageView, defStyle, 0); mMaskDrawable = a.getDrawable(R.styleable.RoundedImageView_RmaskDrawable); if (mMaskDrawable != null) { mMaskDrawable.setCallback(this); }/*w w w . j a va 2 s. c o m*/ mBorderDrawable = a.getDrawable(R.styleable.RoundedImageView_RborderDrawable); if (mBorderDrawable != null) { mBorderDrawable.setCallback(this); } mDesaturateOnPress = a.getBoolean(R.styleable.RoundedImageView_RdesaturateOnPress, mDesaturateOnPress); a.recycle(); // Other initialization mBlackPaint = new Paint(); mBlackPaint.setColor(0xff000000); mMaskedPaint = new Paint(); mMaskedPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)); // Always want a cache allocated. mCacheBitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); if (mDesaturateOnPress) { // Create a desaturate color filter for pressed state. ColorMatrix cm = new ColorMatrix(); cm.setSaturation(0); mDesaturateColorFilter = new ColorMatrixColorFilter(cm); } }
From source file:me.zirko.epidroid.ui.widget.NetworkBezelImageView.java
public NetworkBezelImageView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // Attribute initialization final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.NetworkBezelImageView, defStyle, 0); mMaskDrawable = a.getDrawable(R.styleable.NetworkBezelImageView_maskDrawable); if (mMaskDrawable != null) { mMaskDrawable.setCallback(this); }//from w ww . j a va 2s . c o m mBorderDrawable = a.getDrawable(R.styleable.NetworkBezelImageView_borderDrawable); if (mBorderDrawable != null) { mBorderDrawable.setCallback(this); } mDesaturateOnPress = a.getBoolean(R.styleable.NetworkBezelImageView_desaturateOnPress, mDesaturateOnPress); a.recycle(); // Other initialization mBlackPaint = new Paint(); mBlackPaint.setColor(0xff000000); mMaskedPaint = new Paint(); mMaskedPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)); // Always want a cache allocated. mCacheBitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); if (mDesaturateOnPress) { // Create a desaturate color filter for pressed state. ColorMatrix cm = new ColorMatrix(); cm.setSaturation(0); mDesaturateColorFilter = new ColorMatrixColorFilter(cm); } }
From source file:com.saarang.samples.apps.iosched.ui.widget.BezelImageView.java
public BezelImageView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // Attribute initialization final TypedArray a = context.obtainStyledAttributes(attrs, com.saarang.samples.apps.iosched.R.styleable.BezelImageView, defStyle, 0); mMaskDrawable = a.getDrawable(com.saarang.samples.apps.iosched.R.styleable.BezelImageView_maskDrawable); if (mMaskDrawable != null) { mMaskDrawable.setCallback(this); }/*from w ww . jav a 2s . co m*/ mBorderDrawable = a.getDrawable(com.saarang.samples.apps.iosched.R.styleable.BezelImageView_borderDrawable); if (mBorderDrawable != null) { mBorderDrawable.setCallback(this); } mDesaturateOnPress = a.getBoolean( com.saarang.samples.apps.iosched.R.styleable.BezelImageView_desaturateOnPress, mDesaturateOnPress); a.recycle(); // Other initialization mBlackPaint = new Paint(); mBlackPaint.setColor(0xff000000); mMaskedPaint = new Paint(); mMaskedPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)); // Always want a cache allocated. mCacheBitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); if (mDesaturateOnPress) { // Create a desaturate color filter for pressed state. ColorMatrix cm = new ColorMatrix(); cm.setSaturation(0); mDesaturateColorFilter = new ColorMatrixColorFilter(cm); } }
From source file:com.dream.yzbb.wolfkiller.widget.BezelImageView.java
public BezelImageView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // Attribute initialization. final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BezelImageView, defStyle, 0);// w ww. j ava 2s .co m mMaskDrawable = a.getDrawable(R.styleable.BezelImageView_maskDrawable); if (mMaskDrawable != null) { mMaskDrawable.setCallback(this); } mBorderDrawable = a.getDrawable(R.styleable.BezelImageView_borderDrawable); if (mBorderDrawable != null) { mBorderDrawable.setCallback(this); } mDesaturateOnPress = a.getBoolean(R.styleable.BezelImageView_desaturateOnPress, mDesaturateOnPress); a.recycle(); // Other initialization. mBlackPaint = new Paint(); mBlackPaint.setColor(0xff000000); mMaskedPaint = new Paint(); mMaskedPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)); // Always want a cache allocated. mCacheBitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); if (mDesaturateOnPress) { // Create a desaturate color filter for pressed state. ColorMatrix cm = new ColorMatrix(); cm.setSaturation(0); mDesaturateColorFilter = new ColorMatrixColorFilter(cm); } }
From source file:com.popdeem.sdk.uikit.widget.PDUIBezelImageView.java
public PDUIBezelImageView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // Attribute initialization final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BezelImageView, defStyle, 0); mMaskDrawable = a.getDrawable(R.styleable.BezelImageView_maskDrawable); if (mMaskDrawable != null) { mMaskDrawable.setCallback(this); }// w w w .j a v a2s . com mBorderDrawable = a.getDrawable(R.styleable.BezelImageView_borderDrawable); if (mBorderDrawable != null) { mBorderDrawable.setCallback(this); } mDesaturateOnPress = a.getBoolean(R.styleable.BezelImageView_desaturateOnPress, mDesaturateOnPress); a.recycle(); // Other initialization mBlackPaint = new Paint(); mBlackPaint.setColor(0xff000000); mMaskedPaint = new Paint(); mMaskedPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)); // Always want a cache allocated. mCacheBitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); if (mDesaturateOnPress) { // Create a desaturate color filter for pressed state. ColorMatrix cm = new ColorMatrix(); cm.setSaturation(0); mDesaturateColorFilter = new ColorMatrixColorFilter(cm); } }
From source file:java_lang_programming.com.android_media_demo.article80.ImageFragment.java
/** * /*from w w w. j a v a2 s .c o m*/ * grayscale */ private void grayScale() { long start = System.currentTimeMillis(); ColorMatrix matrix = new ColorMatrix(); matrix.setSaturation(0); ColorMatrixColorFilter filter = new ColorMatrixColorFilter(matrix); long end = System.currentTimeMillis(); imageView.setColorFilter(filter); Log.d(TAG, ((end - start) + "ms")); }
From source file:me.ele.mars.view.BezelImageView.java
public BezelImageView(Context context, Drawable mMaskDrawable) { this(context); if (mMaskDrawable != null) { this.mMaskDrawable = mMaskDrawable; mMaskDrawable.setCallback(this); }//from w ww . ja v a 2 s. c om // Other initialization mBlackPaint = new Paint(); mBlackPaint.setColor(0xff000000); mMaskedPaint = new Paint(); mMaskedPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)); // Always want a cache allocated. mCacheBitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); if (mDesaturateOnPress) { // Create a desaturate color filter for pressed state. ColorMatrix cm = new ColorMatrix(); cm.setSaturation(0); mDesaturateColorFilter = new ColorMatrixColorFilter(cm); } }