Android PorterDuffColorFilter - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android PorterDuffColorFilter class.

This code example shows how to use the following methods:
     * @param filter The filter color to be applied using SRC_OVER mode. 
     */ 
    public void setColorWithFilter(int color, int filter) {
        mColorPaint = new Paint(mPaint);
        mColorPaint.setColor(color);
        mColorPaint.setColorFilter(new PorterDuffColorFilter(filter, PorterDuff.Mode.SRC_OVER));
    } 
 
    /** 
     * Set the alpha for the linear gradient used with the bitmap's shader. 
     * 
     * @param startAlpha The starting alpha (0..255) value to be applied to the LinearGradient. 
     * @param startAlpha The ending alpha (0..255) value to be applied to the LinearGradient. 
     */ 
    public void setAlpha(int startAlpha, int endAlpha) {
        mStartColor = startAlpha << 24;
        mEndColor = endAlpha << 24;
        initializeBitmapShader(); 
    } 
 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
        ((ViewGroup) findViewById(R.id.list1).getParent()).setChildrenLayersEnabled(true);
    } 
     
    private void setupList(int listId) {
        final Paint p = new Paint();
        p.setColorFilter(new PorterDuffColorFilter(0xff00ff00, PorterDuff.Mode.MULTIPLY));
 
        final ListView list = (ListView) findViewById(listId);
        list.setAdapter(new SimpleListAdapter(this));
        list.setLayerType(View.LAYER_TYPE_HARDWARE, p);
    } 
 
    private static class SimpleListAdapter extends ArrayAdapter<String> {
        public SimpleListAdapter(Context context) {
            super(context, android.R.layout.simple_list_item_1, DATA_LIST);
        } 
 
        @Override 
        public View getView(int position, View convertView, ViewGroup parent) {
            TextView v = (TextView) super.getView(position, convertView, parent);
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
		super.onRestart(); 
		 
		// Set up the view 
		int x = mSharedPrefs.getInt("theme_color", -1);
		if(x != -1)
			ThemeTools.setColorOverlay(new PorterDuffColorFilter(x, 
					PorterDuff.Mode.MULTIPLY), background, header);
	} 
} 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
		toast.setDuration( duration );
		toast.setView( layout );
		toast.show();
	} 
	 
	static PorterDuffColorFilter mWhiteMultiplyFilter = new PorterDuffColorFilter( 0xFFFFFFFF, Mode.MULTIPLY );
 
	/** 
	 * Draw folder icon. 
	 *  
	 * @param folder 
	 *           the folder 
	 * @param icon 
	 *           the icon 
	 * @param icon_new 
	 *           the icon_new 
	 * @return the drawable 
	 */ 
	public static Drawable drawFolderIcon( Drawable folder, Drawable icon, float ratio ) {
 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
 
    public DragListView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        // µ±Ä³¸öitem±»ÍÏקʱ£¬½«ÆäÑÕÉ«¸Ä±ä 
        final int srcColor = context.getResources().getColor(Color.GREEN);
        mPaint.setColorFilter(new PorterDuffColorFilter(srcColor, PorterDuff.Mode.SRC_ATOP));
        mScaledTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
    } 
 
    @Override 
    protected void dispatchDraw(Canvas canvas) {
        super.dispatchDraw(canvas);
        if (mDragging && mDragBitmap != null) {
            final int scrollX = getScrollX();
            final int scrollY = getScrollY();
            float left = scrollX + mLastMotionX - mTouchOffsetX - mBitmapOffsetX;
            float top = scrollY + mLastMotionY - mTouchOffsetY - mBitmapOffsetY;
            canvas.drawBitmap(mDragBitmap, left, top, mPaint);
        } 
    } 
Full Snippet Info
3
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android PorterDuffColorFilter Questions & Answers:

See Code Examples for Android PorterDuffColorFilter Methods: