本文整理了Java中android.graphics.drawable.Drawable.getCurrent()
方法的一些代码示例,展示了Drawable.getCurrent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Drawable.getCurrent()
方法的具体详情如下:
包路径:android.graphics.drawable.Drawable
类名称:Drawable
方法名:getCurrent
暂无
代码示例来源:origin: bumptech/glide
@NonNull
@Override
public Drawable getCurrent() {
return wrapped.getCurrent();
}
代码示例来源:origin: facebook/litho
@Override
public Drawable getCurrent() {
return mDrawable.getCurrent();
}
代码示例来源:origin: facebook/litho
@Override
public Drawable getCurrent() {
return mDrawable.getCurrent();
}
代码示例来源:origin: rey5137/material
@Override
public Drawable getCurrent() {
return mDrawable != null ? mDrawable.getCurrent() : null;
}
代码示例来源:origin: facebook/litho
@Override
public @Nullable Drawable getCurrent() {
return mDrawable == null ? null : mDrawable.getCurrent();
}
代码示例来源:origin: seven332/EhViewer
@NonNull
public Drawable getCurrent() {
return this.mDrawable.getCurrent();
}
代码示例来源:origin: eleme/UETool
private Bitmap getFrescoDrawableBitmap(Drawable drawable) {
try {
if (drawable instanceof ScaleTypeDrawable) {
return ((BitmapDrawable) drawable.getCurrent()).getBitmap();
} else if (drawable instanceof BitmapDrawable) {
return ((BitmapDrawable) drawable).getBitmap();
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
代码示例来源:origin: bumptech/glide
@Nullable
static Resource<Bitmap> convert(BitmapPool bitmapPool, Drawable drawable, int width, int height) {
// Handle DrawableContainer or StateListDrawables that may contain one or more BitmapDrawables.
drawable = drawable.getCurrent();
Bitmap result = null;
boolean isRecycleable = false;
if (drawable instanceof BitmapDrawable) {
result = ((BitmapDrawable) drawable).getBitmap();
} else if (!(drawable instanceof Animatable)) {
result = drawToBitmap(bitmapPool, drawable, width, height);
// We created and drew to the Bitmap, so it's safe for us to recycle or re-use.
isRecycleable = true;
}
BitmapPool toUse = isRecycleable ? bitmapPool : NO_RECYCLE_BITMAP_POOL;
return BitmapResource.obtain(result, toUse);
}
代码示例来源:origin: ZieIony/Carbon
public static int getDrawableAlpha(Drawable background) {
if (background == null)
return 255;
background = background.getCurrent();
if (background instanceof ColorDrawable)
return ((ColorDrawable) background).getAlpha();
if (background instanceof AlphaDrawable)
return ((AlphaDrawable) background).getAlpha();
return 255;
}
代码示例来源:origin: eleme/UETool
return ((BitmapDrawable) drawable.getCurrent()).getBitmap();
} else if (drawable instanceof VectorDrawableCompat) {
Field mVectorStateField = VectorDrawableCompat.class.getDeclaredField("mVectorState");
代码示例来源:origin: chentao0707/SimplifyReader
Drawable d = mSelector.getCurrent();
if (d != null && d instanceof TransitionDrawable) {
if (longClickable) {
代码示例来源:origin: chentao0707/SimplifyReader
setPressed(true);
if (mSelector != null) {
Drawable d = mSelector.getCurrent();
if (d != null && d instanceof TransitionDrawable) {
((TransitionDrawable) d).resetTransition();
代码示例来源:origin: westnordost/StreetComplete
@Override protected void drawableStateChanged()
{
super.drawableStateChanged();
// autostart
if(getDrawable().getCurrent() instanceof Animatable)
{
Animatable animatable = (Animatable) getDrawable().getCurrent();
if(!animatable.isRunning()) animatable.start();
}
if (tint != null && tint.isStateful())
{
setColorFilter(tint.getColorForState(getDrawableState(), 0));
}
}
代码示例来源:origin: com.albedinsky.android/ui-graphics-base
/**
*/
@Override
@SuppressLint("NewApi")
public Drawable getCurrent() {
if (mDrawable instanceof InsetDrawable && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
final Drawable innerDrawable = ((InsetDrawable) mDrawable).getDrawable();
return innerDrawable != null ? innerDrawable.getCurrent() : null;
}
return mDrawable.getCurrent();
}
代码示例来源:origin: com.albedinsky.android/ui-graphics
/**
*/
@Override
@SuppressLint("NewApi")
public Drawable getCurrent() {
if (mDrawable instanceof InsetDrawable && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
final Drawable innerDrawable = ((InsetDrawable) mDrawable).getDrawable();
return innerDrawable != null ? innerDrawable.getCurrent() : null;
}
return mDrawable.getCurrent();
}
代码示例来源:origin: com.albedinsky.android/ui
/**
*/
@Override
@SuppressLint("NewApi")
public Drawable getCurrent() {
if (mDrawable instanceof InsetDrawable && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
final Drawable innerDrawable = ((InsetDrawable) mDrawable).getDrawable();
return innerDrawable != null ? innerDrawable.getCurrent() : null;
}
return mDrawable.getCurrent();
}
代码示例来源:origin: XunMengWinter/Now
@Override
public void onResourceReady(Drawable resource, Transition<? super Drawable> transition) {
mSimpleDraweeView.setImageDrawable(resource);
mImageDrawable = resource.getCurrent();
}
});
代码示例来源:origin: stackoverflow.com
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
Drawable drawable = holder.getBackground();
if (drawable instanceof GradientDrawable) {
GradientDrawable gd = (GradientDrawable) drawable.getCurrent();
gd.setColor(Color.parseColor(colors[position]));
} else if (drawable instanceof RippleDrawable) {
RippleDrawable rd = (RippleDrawable) drawable;
int color = Color.parseColor(colors[position]);
rd.setColor(newColorStateList(color));
}
}
代码示例来源:origin: filippella/Dagger-Rx-Database-MVP
@Override
public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) {
mImageIcon.setImageDrawable(resource);
GlideBitmapDrawable drawable = (GlideBitmapDrawable) mImageIcon.getDrawable().getCurrent();
Bitmap bitmap = drawable.getBitmap();
}
}
代码示例来源:origin: bradand/XMouse
protected void startLongClickTransition(final View clickedChild) {
if (clickedChild != null && mItemTransitionDrawable == null) {
if (clickedChild.getBackground().getCurrent() instanceof TransitionDrawable) {
mItemTransitionDrawable = (TransitionDrawable) clickedChild.getBackground().getCurrent();
mItemTransitionDrawable.startTransition(ViewConfiguration.getLongPressTimeout());
}
}
}
内容来源于网络,如有侵权,请联系作者删除!