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

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

源代码1 项目: TelePlus-Android   文件: AndroidUtilities.java
@SuppressLint("NewApi")
public static void clearDrawableAnimation(View view)
{
    if (Build.VERSION.SDK_INT < 21 || view == null)
    {
        return;
    }
    Drawable drawable;
    if (view instanceof ListView)
    {
        drawable = ((ListView) view).getSelector();
        if (drawable != null)
        {
            drawable.setState(StateSet.NOTHING);
        }
    }
    else
    {
        drawable = view.getBackground();
        if (drawable != null)
        {
            drawable.setState(StateSet.NOTHING);
            drawable.jumpToCurrentState();
        }
    }
}
 
源代码2 项目: TelePlus-Android   文件: AndroidUtilities.java
@SuppressLint("NewApi")
public static void clearDrawableAnimation(View view)
{
    if (Build.VERSION.SDK_INT < 21 || view == null)
    {
        return;
    }
    Drawable drawable;
    if (view instanceof ListView)
    {
        drawable = ((ListView) view).getSelector();
        if (drawable != null)
        {
            drawable.setState(StateSet.NOTHING);
        }
    }
    else
    {
        drawable = view.getBackground();
        if (drawable != null)
        {
            drawable.setState(StateSet.NOTHING);
            drawable.jumpToCurrentState();
        }
    }
}
 
源代码3 项目: SSForms   文件: DirectoryFragment.java
private static void clearDrawableAnimation(View view) {
    if (view == null) {
        return;
    }
    Drawable drawable = null;
    if (view instanceof ListView) {
        drawable = ((ListView) view).getSelector();
        if (drawable != null) {
            drawable.setState(StateSet.NOTHING);
        }
    } else {
        drawable = view.getBackground();
        if (drawable != null) {
            drawable.setState(StateSet.NOTHING);
            drawable.jumpToCurrentState();
        }
    }
}
 
源代码4 项目: KrGallery   文件: AndroidUtilities.java
@SuppressLint("NewApi")
public static void clearDrawableAnimation(View view) {
    if (Build.VERSION.SDK_INT < 21 || view == null) {
        return;
    }
    Drawable drawable;
    if (view instanceof ListView) {
        drawable = ((ListView) view).getSelector();
        if (drawable != null) {
            drawable.setState(StateSet.NOTHING);
        }
    } else {
        drawable = view.getBackground();
        if (drawable != null) {
            drawable.setState(StateSet.NOTHING);
            drawable.jumpToCurrentState();
        }
    }
}
 
源代码5 项目: Telegram-FOSS   文件: AndroidUtilities.java
@SuppressLint("NewApi")
public static void clearDrawableAnimation(View view) {
    if (Build.VERSION.SDK_INT < 21 || view == null) {
        return;
    }
    Drawable drawable;
    if (view instanceof ListView) {
        drawable = ((ListView) view).getSelector();
        if (drawable != null) {
            drawable.setState(StateSet.NOTHING);
        }
    } else {
        drawable = view.getBackground();
        if (drawable != null) {
            drawable.setState(StateSet.NOTHING);
            drawable.jumpToCurrentState();
        }
    }
}
 
源代码6 项目: v2ex   文件: LUtils.java
public void setOrAnimatePlusCheckIcon(final ImageView imageView, boolean isCheck,
                                      boolean allowAnimate) {
    if (!hasL()) {
        compatSetOrAnimatePlusCheckIcon(imageView, isCheck, allowAnimate);
        return;
    }

    Drawable drawable = imageView.getDrawable();
    if (!(drawable instanceof AnimatedStateListDrawable)) {
        drawable = mActivity.getResources().getDrawable(R.drawable.add_schedule_fab_icon_anim);
        imageView.setImageDrawable(drawable);
    }
    imageView.setColorFilter(isCheck ?
            mActivity.getResources().getColor(R.color.theme_accent_1) : Color.WHITE);
    if (allowAnimate) {
        imageView.setImageState(isCheck ? STATE_UNCHECKED : STATE_CHECKED, false);
        drawable.jumpToCurrentState();
        imageView.setImageState(isCheck ? STATE_CHECKED : STATE_UNCHECKED, false);
    } else {
        imageView.setImageState(isCheck ? STATE_CHECKED : STATE_UNCHECKED, false);
        drawable.jumpToCurrentState();
    }
}
 
源代码7 项目: Telegram   文件: AndroidUtilities.java
@SuppressLint("NewApi")
public static void clearDrawableAnimation(View view) {
    if (Build.VERSION.SDK_INT < 21 || view == null) {
        return;
    }
    Drawable drawable;
    if (view instanceof ListView) {
        drawable = ((ListView) view).getSelector();
        if (drawable != null) {
            drawable.setState(StateSet.NOTHING);
        }
    } else {
        drawable = view.getBackground();
        if (drawable != null) {
            drawable.setState(StateSet.NOTHING);
            drawable.jumpToCurrentState();
        }
    }
}
 
源代码8 项目: timecat   文件: TintRadioButton.java
@Override
protected void drawableStateChanged() {
    super.drawableStateChanged();
    if (ThemeUtils.isSkipAnimatedSelector()) {
        Drawable drawable = CompoundButtonCompat.getButtonDrawable(this);
        try {
            if (ThemeUtils.getWrapperDrawable(drawable) instanceof AnimatedStateListDrawable) {
                drawable.jumpToCurrentState();
            }
        } catch (NoClassDefFoundError error) {
            error.printStackTrace();
        }
    }
}
 
源代码9 项目: timecat   文件: TintCheckBox.java
@Override
protected void drawableStateChanged() {
    super.drawableStateChanged();
    if (ThemeUtils.isSkipAnimatedSelector()) {
        Drawable drawable = CompoundButtonCompat.getButtonDrawable(this);
        try {
            if (ThemeUtils.getWrapperDrawable(drawable) instanceof AnimatedStateListDrawable) {
                drawable.jumpToCurrentState();
            }
        } catch (NoClassDefFoundError error) {
            error.printStackTrace();
        }
    }
}
 
源代码10 项目: MagicaSakura   文件: TintRadioButton.java
@Override
protected void drawableStateChanged() {
    super.drawableStateChanged();
    if (ThemeUtils.isSkipAnimatedSelector()) {
        Drawable drawable = CompoundButtonCompat.getButtonDrawable(this);
        try {
            if (ThemeUtils.getWrapperDrawable(drawable) instanceof AnimatedStateListDrawable) {
                drawable.jumpToCurrentState();
            }
        } catch (NoClassDefFoundError error) {
            error.printStackTrace();
        }
    }
}
 
源代码11 项目: MagicaSakura   文件: TintCheckBox.java
@Override
protected void drawableStateChanged() {
    super.drawableStateChanged();
    if (ThemeUtils.isSkipAnimatedSelector()) {
        Drawable drawable = CompoundButtonCompat.getButtonDrawable(this);
        try {
            if (ThemeUtils.getWrapperDrawable(drawable) instanceof AnimatedStateListDrawable) {
                drawable.jumpToCurrentState();
            }
        } catch (NoClassDefFoundError error) {
            error.printStackTrace();
        }
    }
}
 
源代码12 项目: MagicaSakura   文件: TintSwitchCompat.java
@Override
protected void drawableStateChanged() {
    super.drawableStateChanged();
    if (ThemeUtils.isSkipAnimatedSelector()) {
        Drawable drawable = CompoundButtonCompat.getButtonDrawable(this);
        try {
            if (ThemeUtils.getWrapperDrawable(drawable) instanceof AnimatedStateListDrawable) {
                drawable.jumpToCurrentState();
            }
        } catch (NoClassDefFoundError error) {
            error.printStackTrace();
        }
    }
}
 
源代码13 项目: RecyclerViewExtensions   文件: Selector.java
/**
 * Binds the {@code holder} according to its selected state using
 * {@link View#setActivated(boolean)}.
 *
 * @param jumpToCurrentState When set, the background will have its {@link
 *                           Drawable#jumpToCurrentState()} called. In general, this should be
 *                           true for full binds, and false for partial binds that contain
 *                           {@link #PAYLOAD_SELECT}.
 */
public boolean bind(@NonNull RecyclerView.ViewHolder holder, boolean jumpToCurrentState) {
    boolean isSelected = isSelected(holder.getItemId());
    holder.itemView.setActivated(isSelected);

    if (jumpToCurrentState) {
        // Ensure background jumps immediately to the current state.
        Drawable background = holder.itemView.getBackground();
        if (background != null) {
            background.jumpToCurrentState();
        }
    }

    return isSelected;
}
 
源代码14 项目: CSipSimple   文件: Utility11.java
@Override
public void jumpToCurrentState(Drawable indeterminateDrawable) {
    indeterminateDrawable.jumpToCurrentState();
}
 
源代码15 项目: MiBandDecompiled   文件: d.java
public static void a(Drawable drawable)
{
    drawable.jumpToCurrentState();
}
 
源代码16 项目: CodenameOne   文件: DrawableCompatHoneycomb.java
public static void jumpToCurrentState(Drawable drawable) {
    drawable.jumpToCurrentState();
}
 
public static void jumpToCurrentState(Drawable drawable) {
    drawable.jumpToCurrentState();
}
 
源代码18 项目: V.FlyoutTest   文件: DrawableCompatHoneycomb.java
public static void jumpToCurrentState(Drawable drawable) {
    drawable.jumpToCurrentState();
}
 
源代码19 项目: guideshow   文件: DrawableCompatHoneycomb.java
public static void jumpToCurrentState(Drawable drawable) {
    drawable.jumpToCurrentState();
}