本文整理汇总了Java中android.graphics.drawable.Drawable.ConstantState.newDrawable方法的典型用法代码示例。如果您正苦于以下问题:Java ConstantState.newDrawable方法的具体用法?Java ConstantState.newDrawable怎么用?Java ConstantState.newDrawable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.graphics.drawable.Drawable.ConstantState
的用法示例。
在下文中一共展示了ConstantState.newDrawable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCachedDelegateDrawable
import android.graphics.drawable.Drawable.ConstantState; //导入方法依赖的package包/类
private Drawable getCachedDelegateDrawable(@NonNull Context context, long key) {
Drawable drawable = null;
synchronized (this.mDelegateDrawableCacheLock) {
LongSparseArray<WeakReference<ConstantState>> cache = (LongSparseArray) this.mDelegateDrawableCaches.get(context);
if (cache == null) {
} else {
WeakReference<ConstantState> wr = (WeakReference) cache.get(key);
if (wr != null) {
ConstantState entry = (ConstantState) wr.get();
if (entry != null) {
drawable = entry.newDrawable(context.getResources());
} else {
cache.delete(key);
}
}
}
}
return drawable;
}
示例2: getCachedDrawable
import android.graphics.drawable.Drawable.ConstantState; //导入方法依赖的package包/类
private Drawable getCachedDrawable(@NonNull final Context context, final long key) {
synchronized (mDrawableCacheLock) {
final LongSparseArray<WeakReference<ConstantState>> cache
= mDrawableCaches.get(context);
if (cache == null) {
return null;
}
final WeakReference<ConstantState> wr = cache.get(key);
if (wr != null) {
// We have the key, and the secret
ConstantState entry = wr.get();
if (entry != null) {
return entry.newDrawable(context.getResources());
} else {
// Our entry has been purged
cache.delete(key);
}
}
}
return null;
}
示例3: m2496a
import android.graphics.drawable.Drawable.ConstantState; //导入方法依赖的package包/类
private Drawable m2496a(Context context, long j) {
synchronized (this.f1317m) {
C0113f c0113f = (C0113f) this.f1318n.get(context);
if (c0113f == null) {
return null;
}
WeakReference weakReference = (WeakReference) c0113f.m641a(j);
if (weakReference != null) {
ConstantState constantState = (ConstantState) weakReference.get();
if (constantState != null) {
Drawable newDrawable = constantState.newDrawable(context.getResources());
return newDrawable;
}
c0113f.m645b(j);
}
return null;
}
}
示例4: getCachedDelegateDrawable
import android.graphics.drawable.Drawable.ConstantState; //导入方法依赖的package包/类
private Drawable getCachedDelegateDrawable(@NonNull final Context context, final long key) {
synchronized (mDelegateDrawableCacheLock) {
final LongSparseArray<WeakReference<ConstantState>> cache
= mDelegateDrawableCaches.get(context);
if (cache == null) {
return null;
}
final WeakReference<ConstantState> wr = cache.get(key);
if (wr != null) {
// We have the key, and the secret
ConstantState entry = wr.get();
if (entry != null) {
return entry.newDrawable(context.getResources());
} else {
// Our entry has been purged
cache.delete(key);
}
}
}
return null;
}
示例5: get
import android.graphics.drawable.Drawable.ConstantState; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public final T get() {
@Nullable ConstantState state = drawable.getConstantState();
if (state == null) {
return drawable;
}
// Drawables contain temporary state related to how they're being displayed
// (alpha, color filter etc), so return a new copy each time.
// If we ever return the original drawable, it's temporary state may be changed
// and subsequent copies may end up with that temporary state. See #276.
return (T) state.newDrawable();
}
示例6: checkIconCache
import android.graphics.drawable.Drawable.ConstantState; //导入方法依赖的package包/类
private Drawable checkIconCache(String resourceUri) {
ConstantState cached = (ConstantState) this.mOutsideDrawablesCache.get(resourceUri);
if (cached == null) {
return null;
}
return cached.newDrawable();
}
示例7: getActivityIconWithCache
import android.graphics.drawable.Drawable.ConstantState; //导入方法依赖的package包/类
private Drawable getActivityIconWithCache(ComponentName component) {
String componentIconKey = component.flattenToShortString();
if (this.mOutsideDrawablesCache.containsKey(componentIconKey)) {
ConstantState cached = (ConstantState) this.mOutsideDrawablesCache.get(componentIconKey);
if (cached == null) {
return null;
}
return cached.newDrawable(this.mProviderContext.getResources());
}
Drawable drawable = getActivityIcon(component);
this.mOutsideDrawablesCache.put(componentIconKey, drawable == null ? null : drawable.getConstantState());
return drawable;
}
示例8: AnimatedVectorDrawableCompatState
import android.graphics.drawable.Drawable.ConstantState; //导入方法依赖的package包/类
public AnimatedVectorDrawableCompatState(Context context, AnimatedVectorDrawableCompatState copy, Callback owner, Resources res) {
if (copy != null) {
this.mChangingConfigurations = copy.mChangingConfigurations;
if (copy.mVectorDrawable != null) {
ConstantState cs = copy.mVectorDrawable.getConstantState();
if (res != null) {
this.mVectorDrawable = (VectorDrawableCompat) cs.newDrawable(res);
} else {
this.mVectorDrawable = (VectorDrawableCompat) cs.newDrawable();
}
this.mVectorDrawable = (VectorDrawableCompat) this.mVectorDrawable.mutate();
this.mVectorDrawable.setCallback(owner);
this.mVectorDrawable.setBounds(copy.mVectorDrawable.getBounds());
this.mVectorDrawable.setAllowCaching(false);
}
if (copy.mAnimators != null) {
int numAnimators = copy.mAnimators.size();
this.mAnimators = new ArrayList(numAnimators);
this.mTargetNameMap = new ArrayMap(numAnimators);
for (int i = 0; i < numAnimators; i++) {
Animator anim = (Animator) copy.mAnimators.get(i);
Animator animClone = anim.clone();
String targetName = (String) copy.mTargetNameMap.get(anim);
animClone.setTarget(this.mVectorDrawable.getTargetByName(targetName));
this.mAnimators.add(animClone);
this.mTargetNameMap.put(animClone, targetName);
}
}
}
}
示例9: setIcon
import android.graphics.drawable.Drawable.ConstantState; //导入方法依赖的package包/类
public void setIcon(Drawable icon) {
if (icon != null) {
ConstantState state = icon.getConstantState();
if (state != null) {
icon = state.newDrawable();
}
icon = DrawableCompat.wrap(icon).mutate();
icon.setBounds(0, 0, this.mIconSize, this.mIconSize);
DrawableCompat.setTintList(icon, this.mIconTintList);
}
TextViewCompat.setCompoundDrawablesRelative(this.mTextView, icon, null, null, null);
}
示例10: m2677a
import android.graphics.drawable.Drawable.ConstantState; //导入方法依赖的package包/类
private Drawable m2677a(ComponentName componentName) {
Object obj = null;
String flattenToShortString = componentName.flattenToShortString();
if (this.f1488n.containsKey(flattenToShortString)) {
ConstantState constantState = (ConstantState) this.f1488n.get(flattenToShortString);
return constantState == null ? null : constantState.newDrawable(this.f1487m.getResources());
} else {
Drawable b = m2684b(componentName);
if (b != null) {
obj = b.getConstantState();
}
this.f1488n.put(flattenToShortString, obj);
return b;
}
}
示例11: C0004d
import android.graphics.drawable.Drawable.ConstantState; //导入方法依赖的package包/类
public C0004d(Context context, C0004d c0004d, Callback callback, Resources resources) {
int i = 0;
if (c0004d != null) {
this.f12a = c0004d.f12a;
if (c0004d.f13b != null) {
ConstantState constantState = c0004d.f13b.getConstantState();
if (resources != null) {
this.f13b = (C0011l) constantState.newDrawable(resources);
} else {
this.f13b = (C0011l) constantState.newDrawable();
}
this.f13b = (C0011l) this.f13b.mutate();
this.f13b.setCallback(callback);
this.f13b.setBounds(c0004d.f13b.getBounds());
this.f13b.m34a(false);
}
if (c0004d.f14c != null) {
int size = c0004d.f14c.size();
this.f14c = new ArrayList(size);
this.f15d = new C0107a(size);
while (i < size) {
Animator animator = (Animator) c0004d.f14c.get(i);
Animator clone = animator.clone();
String str = (String) c0004d.f15d.get(animator);
clone.setTarget(this.f13b.m33a(str));
this.f14c.add(clone);
this.f15d.put(clone, str);
i++;
}
}
}
}
示例12: newDrawableFromState
import android.graphics.drawable.Drawable.ConstantState; //导入方法依赖的package包/类
protected Drawable newDrawableFromState(ConstantState state, Resources res) {
return state.newDrawable(res);
}
示例13: newDrawableFromState
import android.graphics.drawable.Drawable.ConstantState; //导入方法依赖的package包/类
protected Drawable newDrawableFromState(@NonNull ConstantState state, @Nullable Resources res) {
return state.newDrawable();
}
示例14: m2686b
import android.graphics.drawable.Drawable.ConstantState; //导入方法依赖的package包/类
private Drawable m2686b(String str) {
ConstantState constantState = (ConstantState) this.f1488n.get(str);
return constantState == null ? null : constantState.newDrawable();
}
示例15: m477a
import android.graphics.drawable.Drawable.ConstantState; //导入方法依赖的package包/类
protected Drawable m477a(ConstantState constantState, Resources resources) {
return constantState.newDrawable();
}