Java Code Examples for android.graphics.PorterDuff#Mode

The following examples show how to use android.graphics.PorterDuff#Mode . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RecordingCanvas.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
@Override
public final void drawColor(@ColorInt int color, @NonNull PorterDuff.Mode mode) {
    nDrawColor(mNativeCanvasWrapper, color, mode.nativeInt);
}
 
Example 2
Source File: ImageView.java    From android_9.0.0_r45 with Apache License 2.0 3 votes vote down vote up
/**
 * Specifies the blending mode used to apply the tint specified by
 * {@link #setImageTintList(ColorStateList)}} to the image drawable. The default
 * mode is {@link PorterDuff.Mode#SRC_IN}.
 *
 * @param tintMode the blending mode used to apply the tint, may be
 *                 {@code null} to clear tint
 * @attr ref android.R.styleable#ImageView_tintMode
 * @see #getImageTintMode()
 * @see Drawable#setTintMode(PorterDuff.Mode)
 */
public void setImageTintMode(@Nullable PorterDuff.Mode tintMode) {
    mDrawableTintMode = tintMode;
    mHasDrawableTintMode = true;

    applyImageTint();
}
 
Example 3
Source File: CheckedTextView.java    From android_9.0.0_r45 with Apache License 2.0 3 votes vote down vote up
/**
 * Specifies the blending mode used to apply the tint specified by
 * {@link #setCheckMarkTintList(ColorStateList)} to the check mark
 * drawable. The default mode is {@link PorterDuff.Mode#SRC_IN}.
 *
 * @param tintMode the blending mode used to apply the tint, may be
 *                 {@code null} to clear tint
 * @attr ref android.R.styleable#CheckedTextView_checkMarkTintMode
 * @see #setCheckMarkTintList(ColorStateList)
 * @see Drawable#setTintMode(PorterDuff.Mode)
 */
public void setCheckMarkTintMode(@Nullable PorterDuff.Mode tintMode) {
    mCheckMarkTintMode = tintMode;
    mHasCheckMarkTintMode = true;

    applyCheckMarkTint();
}
 
Example 4
Source File: ProgressBar.java    From android_9.0.0_r45 with Apache License 2.0 3 votes vote down vote up
/**
 * Specifies the blending mode used to apply the tint specified by
 * {@link #setIndeterminateTintList(ColorStateList)} to the indeterminate
 * drawable. The default mode is {@link PorterDuff.Mode#SRC_IN}.
 *
 * @param tintMode the blending mode used to apply the tint, may be
 *                 {@code null} to clear tint
 * @attr ref android.R.styleable#ProgressBar_indeterminateTintMode
 * @see #setIndeterminateTintList(ColorStateList)
 * @see Drawable#setTintMode(PorterDuff.Mode)
 */
public void setIndeterminateTintMode(@Nullable PorterDuff.Mode tintMode) {
    if (mProgressTintInfo == null) {
        mProgressTintInfo = new ProgressTintInfo();
    }
    mProgressTintInfo.mIndeterminateTintMode = tintMode;
    mProgressTintInfo.mHasIndeterminateTintMode = true;

    applyIndeterminateTint();
}
 
Example 5
Source File: AbsSeekBar.java    From android_9.0.0_r45 with Apache License 2.0 3 votes vote down vote up
/**
 * Specifies the blending mode used to apply the tint specified by
 * {@link #setThumbTintList(ColorStateList)}} to the thumb drawable. The
 * default mode is {@link PorterDuff.Mode#SRC_IN}.
 *
 * @param tintMode the blending mode used to apply the tint, may be
 *                 {@code null} to clear tint
 *
 * @attr ref android.R.styleable#SeekBar_thumbTintMode
 * @see #getThumbTintMode()
 * @see Drawable#setTintMode(PorterDuff.Mode)
 */
public void setThumbTintMode(@Nullable PorterDuff.Mode tintMode) {
    mThumbTintMode = tintMode;
    mHasThumbTintMode = true;

    applyThumbTint();
}
 
Example 6
Source File: ProgressBar.java    From android_9.0.0_r45 with Apache License 2.0 3 votes vote down vote up
/**
 * Specifies the blending mode used to apply the tint specified by
 * {@link #setSecondaryProgressTintList(ColorStateList)}} to the secondary
 * progress indicator. The default mode is
 * {@link PorterDuff.Mode#SRC_ATOP}.
 *
 * @param tintMode the blending mode used to apply the tint, may be
 *                 {@code null} to clear tint
 * @attr ref android.R.styleable#ProgressBar_secondaryProgressTintMode
 * @see #setSecondaryProgressTintList(ColorStateList)
 * @see Drawable#setTintMode(PorterDuff.Mode)
 */
public void setSecondaryProgressTintMode(@Nullable PorterDuff.Mode tintMode) {
    if (mProgressTintInfo == null) {
        mProgressTintInfo = new ProgressTintInfo();
    }
    mProgressTintInfo.mSecondaryProgressTintMode = tintMode;
    mProgressTintInfo.mHasSecondaryProgressTintMode = true;

    if (mProgressDrawable != null) {
        applySecondaryProgressTint();
    }
}
 
Example 7
Source File: Switch.java    From android_9.0.0_r45 with Apache License 2.0 3 votes vote down vote up
/**
 * Specifies the blending mode used to apply the tint specified by
 * {@link #setThumbTintList(ColorStateList)}} to the thumb drawable.
 * The default mode is {@link PorterDuff.Mode#SRC_IN}.
 *
 * @param tintMode the blending mode used to apply the tint, may be
 *                 {@code null} to clear tint
 * @attr ref android.R.styleable#Switch_thumbTintMode
 * @see #getThumbTintMode()
 * @see Drawable#setTintMode(PorterDuff.Mode)
 */
public void setThumbTintMode(@Nullable PorterDuff.Mode tintMode) {
    mThumbTintMode = tintMode;
    mHasThumbTintMode = true;

    applyThumbTint();
}
 
Example 8
Source File: Switch.java    From android_9.0.0_r45 with Apache License 2.0 3 votes vote down vote up
/**
 * Specifies the blending mode used to apply the tint specified by
 * {@link #setTrackTintList(ColorStateList)}} to the track drawable.
 * The default mode is {@link PorterDuff.Mode#SRC_IN}.
 *
 * @param tintMode the blending mode used to apply the tint, may be
 *                 {@code null} to clear tint
 * @attr ref android.R.styleable#Switch_trackTintMode
 * @see #getTrackTintMode()
 * @see Drawable#setTintMode(PorterDuff.Mode)
 */
public void setTrackTintMode(@Nullable PorterDuff.Mode tintMode) {
    mTrackTintMode = tintMode;
    mHasTrackTintMode = true;

    applyTrackTint();
}
 
Example 9
Source File: Switch.java    From android_9.0.0_r45 with Apache License 2.0 2 votes vote down vote up
/**
 * @return the blending mode used to apply the tint to the track
 *         drawable
 * @attr ref android.R.styleable#Switch_trackTintMode
 * @see #setTrackTintMode(PorterDuff.Mode)
 */
@Nullable
public PorterDuff.Mode getTrackTintMode() {
    return mTrackTintMode;
}
 
Example 10
Source File: Switch.java    From android_9.0.0_r45 with Apache License 2.0 2 votes vote down vote up
/**
 * @return the blending mode used to apply the tint to the thumb
 *         drawable
 * @attr ref android.R.styleable#Switch_thumbTintMode
 * @see #setThumbTintMode(PorterDuff.Mode)
 */
@Nullable
public PorterDuff.Mode getThumbTintMode() {
    return mThumbTintMode;
}
 
Example 11
Source File: ProgressBar.java    From android_9.0.0_r45 with Apache License 2.0 2 votes vote down vote up
/**
 * @return the blending mode used to apply the tint to the progress
 *         background
 * @attr ref android.R.styleable#ProgressBar_progressBackgroundTintMode
 * @see #setProgressBackgroundTintMode(PorterDuff.Mode)
 */
@Nullable
public PorterDuff.Mode getProgressBackgroundTintMode() {
    return mProgressTintInfo != null ? mProgressTintInfo.mProgressBackgroundTintMode : null;
}
 
Example 12
Source File: ProgressBar.java    From android_9.0.0_r45 with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the blending mode used to apply the tint to the secondary
 * progress drawable, if specified.
 *
 * @return the blending mode used to apply the tint to the secondary
 *         progress drawable
 * @attr ref android.R.styleable#ProgressBar_secondaryProgressTintMode
 * @see #setSecondaryProgressTintMode(PorterDuff.Mode)
 */
@Nullable
public PorterDuff.Mode getSecondaryProgressTintMode() {
    return mProgressTintInfo != null ? mProgressTintInfo.mSecondaryProgressTintMode : null;
}
 
Example 13
Source File: ImageView.java    From android_9.0.0_r45 with Apache License 2.0 2 votes vote down vote up
/**
 * Sets a tinting option for the image.
 *
 * @param color Color tint to apply.
 * @param mode How to apply the color.  The standard mode is
 * {@link PorterDuff.Mode#SRC_ATOP}
 *
 * @attr ref android.R.styleable#ImageView_tint
 */
public final void setColorFilter(int color, PorterDuff.Mode mode) {
    setColorFilter(new PorterDuffColorFilter(color, mode));
}
 
Example 14
Source File: RemoteViews.java    From android_9.0.0_r45 with Apache License 2.0 2 votes vote down vote up
/**
 * @hide
 * Equivalent to calling
 * {@link Drawable#setColorFilter(int, android.graphics.PorterDuff.Mode)},
 * on the {@link Drawable} of a given view.
 * <p>
 *
 * @param viewId The id of the view that contains the target
 *            {@link Drawable}
 * @param targetBackground If true, apply these parameters to the
 *            {@link Drawable} returned by
 *            {@link android.view.View#getBackground()}. Otherwise, assume
 *            the target view is an {@link ImageView} and apply them to
 *            {@link ImageView#getDrawable()}.
 * @param colorFilter Specify a color for a
 *            {@link android.graphics.ColorFilter} for this drawable. This will be ignored if
 *            {@code mode} is {@code null}.
 * @param mode Specify a PorterDuff mode for this drawable, or null to leave
 *            unchanged.
 */
public void setDrawableTint(int viewId, boolean targetBackground,
        int colorFilter, @NonNull PorterDuff.Mode mode) {
    addAction(new SetDrawableTint(viewId, targetBackground, colorFilter, mode));
}
 
Example 15
Source File: CompoundButton.java    From android_9.0.0_r45 with Apache License 2.0 2 votes vote down vote up
/**
 * @return the blending mode used to apply the tint to the button drawable
 * @attr ref android.R.styleable#CompoundButton_buttonTintMode
 * @see #setButtonTintMode(PorterDuff.Mode)
 */
@Nullable
public PorterDuff.Mode getButtonTintMode() {
    return mButtonTintMode;
}
 
Example 16
Source File: MenuItem.java    From android_9.0.0_r45 with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the blending mode used to apply the tint to this item's icon, if specified.
 *
 * @return the blending mode used to apply the tint to this item's icon
 * @attr ref android.R.styleable#MenuItem_iconTintMode
 * @see #setIconTintMode(PorterDuff.Mode)
 */
@Nullable
public default PorterDuff.Mode getIconTintMode() { return null; }
 
Example 17
Source File: AbsSeekBar.java    From android_9.0.0_r45 with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the blending mode used to apply the tint to the thumb drawable,
 * if specified.
 *
 * @return the blending mode used to apply the tint to the thumb drawable
 * @attr ref android.R.styleable#SeekBar_thumbTintMode
 * @see #setThumbTintMode(PorterDuff.Mode)
 */
@Nullable
public PorterDuff.Mode getThumbTintMode() {
    return mThumbTintMode;
}
 
Example 18
Source File: MenuItem.java    From android_9.0.0_r45 with Apache License 2.0 2 votes vote down vote up
/**
 * Specifies the blending mode used to apply the tint specified by
 * {@link #setIconTintList(ColorStateList)} to this item's icon. The default mode is
 * {@link PorterDuff.Mode#SRC_IN}.
 *
 * @param tintMode the blending mode used to apply the tint, may be
 *                 {@code null} to clear tint
 * @attr ref android.R.styleable#MenuItem_iconTintMode
 * @see #setIconTintList(ColorStateList)
 * @see Drawable#setTintMode(PorterDuff.Mode)
 */
public default MenuItem setIconTintMode(@Nullable PorterDuff.Mode tintMode) { return this; }
 
Example 19
Source File: AbsSeekBar.java    From android_9.0.0_r45 with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the blending mode used to apply the tint to the tick mark drawable,
 * if specified.
 *
 * @return the blending mode used to apply the tint to the tick mark drawable
 * @attr ref android.R.styleable#SeekBar_tickMarkTintMode
 * @see #setTickMarkTintMode(PorterDuff.Mode)
 */
@Nullable
public PorterDuff.Mode getTickMarkTintMode() {
    return mTickMarkTintMode;
}
 
Example 20
Source File: DrawableTintingFragment.java    From graphics-samples with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the {@link android.graphics.PorterDuff.Mode} for the selected tint mode option.
 *
 * @return selected tint mode
 */
public PorterDuff.Mode getTintMode() {
    return MODES[mBlendSpinner.getSelectedItemPosition()];
}