android.graphics.drawable.Drawable#setDither()源码实例Demo

下面列出了android.graphics.drawable.Drawable#setDither() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: LB-Launcher   文件: WallpaperPickerActivity.java
public static View createImageTileView(LayoutInflater layoutInflater,
        View convertView, ViewGroup parent, Drawable thumb) {
    View view;

    if (convertView == null) {
        view = layoutInflater.inflate(R.layout.wallpaper_picker_item, parent, false);
    } else {
        view = convertView;
    }

    setWallpaperItemPaddingToZero((FrameLayout) view);

    ImageView image = (ImageView) view.findViewById(R.id.wallpaper_image);

    if (thumb != null) {
        image.setImageDrawable(thumb);
        thumb.setDither(true);
    }

    return view;
}
 
源代码2 项目: fresco   文件: DrawableProperties.java
@SuppressLint("Range")
public void applyTo(Drawable drawable) {
  if (drawable == null) {
    return;
  }
  if (mAlpha != UNSET) {
    drawable.setAlpha(mAlpha);
  }
  if (mIsSetColorFilter) {
    drawable.setColorFilter(mColorFilter);
  }
  if (mDither != UNSET) {
    drawable.setDither(mDither != 0);
  }
  if (mFilterBitmap != UNSET) {
    drawable.setFilterBitmap(mFilterBitmap != 0);
  }
}
 
源代码3 项目: Trebuchet   文件: WallpaperPickerActivity.java
public static View createImageTileView(LayoutInflater layoutInflater,
        View convertView, ViewGroup parent, Drawable thumb) {
    View view;

    if (convertView == null) {
        view = layoutInflater.inflate(R.layout.wallpaper_picker_item, parent, false);
    } else {
        view = convertView;
    }

    ImageView image = (ImageView) view.findViewById(R.id.wallpaper_image);

    if (thumb != null) {
        image.setImageDrawable(thumb);
        thumb.setDither(true);
    }

    return view;
}
 
源代码4 项目: Pi-Locker   文件: ImageViewTouchBase.java
private void setImageBitmap(Bitmap bitmap, int rotation) {

        super.setImageBitmap(bitmap);
        Drawable d = getDrawable();
        if (d != null) {
            d.setDither(true);
        }

        Bitmap old = mBitmapDisplayed.getBitmap();
        mBitmapDisplayed.setBitmap(bitmap);
        mBitmapDisplayed.setRotation(rotation);

        if (old != null && old != bitmap && mRecycler != null) {
            mRecycler.recycle(old);
        }
    }
 
源代码5 项目: reader   文件: ImageViewTouchBase.java
private void setImageBitmap(Bitmap bitmap, int rotation) {
    super.setImageBitmap(bitmap);
    Drawable d = getDrawable();
    if (d != null) {
        d.setDither(true);
    }

    Bitmap old = mBitmapDisplayed.getBitmap();
    mBitmapDisplayed.setBitmap(bitmap);
    mBitmapDisplayed.setRotation(rotation);

    if (old != null && old != bitmap && mRecycler != null) {
        mRecycler.recycle(old);
    }
}
 
源代码6 项目: fanfouapp-opensource   文件: ImageViewTouchBase.java
/**
 * This is the ultimate method called when a new bitmap is set
 * 
 * @param bitmap
 * @param rotation
 */
protected void setImageBitmap(final Bitmap bitmap, final int rotation) {
    super.setImageBitmap(bitmap);
    final Drawable d = getDrawable();
    if (d != null) {
        d.setDither(true);
    }
    this.mBitmapDisplayed.setBitmap(bitmap);
    this.mBitmapDisplayed.setRotation(rotation);
}
 
源代码7 项目: LockDemo   文件: ImageViewTouchBase.java
private void setImageBitmap(Bitmap bitmap, int rotation) {
    super.setImageBitmap(bitmap);
    Drawable d = getDrawable();
    if (d != null) {
        d.setDither(true);
    }

    Bitmap old = bitmapDisplayed.getBitmap();
    bitmapDisplayed.setBitmap(bitmap);
    bitmapDisplayed.setRotation(rotation);

    if (old != null && old != bitmap && recycler != null) {
        recycler.recycle(old);
    }
}
 
源代码8 项目: yiim_v2   文件: ImageViewTouchBase.java
public void setImageBitmap(Bitmap bitmap) {
	super.setImageBitmap(bitmap);
	Drawable d = getDrawable();
	if (d != null) {
		d.setDither(true);
	}

	Bitmap old = mBitmapDisplayed;
	mBitmapDisplayed = bitmap;

	// if (old != null && old != bitmap && mRecycler != null) {
	// mRecycler.recycle(old);
	// }
}
 
源代码9 项目: UltimateAndroid   文件: ImageViewTouchBase.java
private void setImageBitmap(Bitmap bitmap, int rotation) {
    super.setImageBitmap(bitmap);
    Drawable d = getDrawable();
    if (d != null) {
        d.setDither(true);
    }

    Bitmap old = bitmapDisplayed.getBitmap();
    bitmapDisplayed.setBitmap(bitmap);
    bitmapDisplayed.setRotation(rotation);

    if (old != null && old != bitmap && recycler != null) {
        recycler.recycle(old);
    }
}
 
源代码10 项目: CloudPan   文件: ImageViewTouchBase.java
private void setImageBitmap(Bitmap bitmap, int rotation) {
    super.setImageBitmap(bitmap);
    Drawable d = getDrawable();
    if (d != null) {
        d.setDither(true);
    }

    Bitmap old = bitmapDisplayed.getBitmap();
    bitmapDisplayed.setBitmap(bitmap);
    bitmapDisplayed.setRotation(rotation);

    if (old != null && old != bitmap && recycler != null) {
        recycler.recycle(old);
    }
}
 
源代码11 项目: HaiNaBaiChuan   文件: ImageViewTouchBase.java
private void setImageBitmap(Bitmap bitmap, int rotation) {
    super.setImageBitmap(bitmap);
    Drawable d = getDrawable();
    if (d != null) {
        d.setDither(true);
    }

    Bitmap old = bitmapDisplayed.getBitmap();
    bitmapDisplayed.setBitmap(bitmap);
    bitmapDisplayed.setRotation(rotation);

    if (old != null && old != bitmap && recycler != null) {
        recycler.recycle(old);
    }
}
 
源代码12 项目: memoir   文件: ImageViewTouchBase.java
private void setImageBitmap(Bitmap bitmap, int rotation) {
    super.setImageBitmap(bitmap);
    Drawable d = getDrawable();
    if (d != null) {
        d.setDither(true);
    }

    Bitmap old = mBitmapDisplayed.getBitmap();
    mBitmapDisplayed.setBitmap(bitmap);
    mBitmapDisplayed.setRotation(rotation);

    if (old != null && old != bitmap && mRecycler != null) {
        mRecycler.recycle(old);
    }
}
 
源代码13 项目: memoir   文件: ImageViewTouchBase.java
private void setImageBitmap(Bitmap bitmap, int rotation) {
    super.setImageBitmap(bitmap);
    Drawable d = getDrawable();
    if (d != null) {
        d.setDither(true);
    }

    Bitmap old = mBitmapDisplayed.getBitmap();
    mBitmapDisplayed.setBitmap(bitmap);
    mBitmapDisplayed.setRotation(rotation);

    if (old != null && old != bitmap && mRecycler != null) {
        mRecycler.recycle(old);
    }
}
 
源代码14 项目: bither-android   文件: ImageViewTouchBase.java
private void setImageBitmap(Bitmap bitmap, int rotation) {
	super.setImageBitmap(bitmap);
	Drawable d = getDrawable();
	if (d != null) {
		d.setDither(true);
	}

	Bitmap old = mBitmapDisplayed.getBitmap();
	mBitmapDisplayed.setBitmap(bitmap);
	mBitmapDisplayed.setRotation(rotation);

	if (old != null && old != bitmap && mRecycler != null) {
	//	mRecycler.recycle(old);
	}
}
 
源代码15 项目: droidddle   文件: ImageViewTouchBase.java
private void setImageBitmap(Bitmap bitmap, int rotation) {
    super.setImageBitmap(bitmap);
    Drawable d = getDrawable();
    if (d != null) {
        d.setDither(true);
    }

    Bitmap old = mBitmapDisplayed.getBitmap();
    mBitmapDisplayed.setBitmap(bitmap);
    mBitmapDisplayed.setRotation(rotation);

    if (old != null && old != bitmap && mRecycler != null) {
        mRecycler.recycle(old);
    }
}
 
源代码16 项目: Android-RTEditor   文件: ImageViewTouchBase.java
private void setImageBitmap(Bitmap bitmap, int rotation) {
    super.setImageBitmap(bitmap);
    Drawable d = getDrawable();
    if (d != null) {
        d.setDither(true);
    }

    Bitmap old = mBitmapDisplayed.getBitmap();
    mBitmapDisplayed.setBitmap(bitmap);
    mBitmapDisplayed.setRotation(rotation);

    if (old != null && old != bitmap && mRecycler != null) {
        mRecycler.recycle(old);
    }
}
 
源代码17 项目: Carbon   文件: LayerDrawable.java
@Override
public void setDither(boolean dither) {
    final ChildDrawable[] array = mLayerState.mChildren;
    final int N = mLayerState.mNum;
    for (int i = 0; i < N; i++) {
        final Drawable dr = array[i].mDrawable;
        if (dr != null) {
            dr.setDither(dither);
        }
    }
}
 
源代码18 项目: WifiChat   文件: ImageViewTouchBase.java
private void setImageBitmap(Bitmap bitmap, int rotation) {
    super.setImageBitmap(bitmap);
    Drawable d = getDrawable();
    if (d != null) {
        d.setDither(true);
    }

    Bitmap old = mBitmapDisplayed.getBitmap();
    mBitmapDisplayed.setBitmap(bitmap);
    mBitmapDisplayed.setRotation(rotation);

    if (old != null && old != bitmap && mRecycler != null) {
        mRecycler.recycle(old);
    }
}
 
源代码19 项目: GalleryFinal   文件: ImageViewTouchBase.java
private void setImageBitmap(Bitmap bitmap, int rotation) {
    super.setImageBitmap(bitmap);
    Drawable d = getDrawable();
    if (d != null) {
        d.setDither(true);
    }

    Bitmap old = bitmapDisplayed.getBitmap();
    bitmapDisplayed.setBitmap(bitmap);
    bitmapDisplayed.setRotation(rotation);

    if (old != null && old != bitmap && recycler != null) {
        recycler.recycle(old);
    }
}
 
/**
 * Initializes a drawable for display in this container.
 *
 * @param d The drawable to initialize.
 */
private void initializeDrawableForDisplay(Drawable d) {
    if (mBlockInvalidateCallback == null) {
        mBlockInvalidateCallback = new BlockInvalidateCallback();
    }
    // Temporary fix for suspending callbacks during initialization. We
    // don't want any of these setters causing an invalidate() since that
    // may call back into DrawableContainer.
    d.setCallback(mBlockInvalidateCallback.wrap(d.getCallback()));
    try {
        if (mDrawableContainerState.mEnterFadeDuration <= 0 && mHasAlpha) {
            d.setAlpha(mAlpha);
        }
        if (mDrawableContainerState.mHasColorFilter) {
            // Color filter always overrides tint.
            d.setColorFilter(mDrawableContainerState.mColorFilter);
        } else {
            if (mDrawableContainerState.mHasTintList) {
                DrawableCompat.setTintList(d, mDrawableContainerState.mTintList);
            }
            if (mDrawableContainerState.mHasTintMode) {
                DrawableCompat.setTintMode(d, mDrawableContainerState.mTintMode);
            }
        }
        d.setVisible(isVisible(), true);
        d.setDither(mDrawableContainerState.mDither);
        d.setState(getState());
        d.setLevel(getLevel());
        d.setBounds(getBounds());
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            d.setLayoutDirection(getLayoutDirection());
        }
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            d.setAutoMirrored(mDrawableContainerState.mAutoMirrored);
        }
        final Rect hotspotBounds = mHotspotBounds;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && hotspotBounds != null) {
            d.setHotspotBounds(hotspotBounds.left, hotspotBounds.top,
                    hotspotBounds.right, hotspotBounds.bottom);
        }
    } finally {
        d.setCallback(mBlockInvalidateCallback.unwrap());
    }
}