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;
}
java类android.graphics.drawable.Drawable.ConstantState的实例源码
AppCompatDrawableManager.java 文件源码
项目:boohee_v5.6
阅读 30
收藏 0
点赞 0
评论 0
DrawableUtils.java 文件源码
项目:boohee_v5.6
阅读 34
收藏 0
点赞 0
评论 0
private static boolean setContainerConstantStateV9(DrawableContainer drawable, ConstantState constantState) {
if (!sSetConstantStateMethodFetched) {
try {
sSetConstantStateMethod = DrawableContainer.class.getDeclaredMethod("setConstantState", new Class[]{DrawableContainerState.class});
sSetConstantStateMethod.setAccessible(true);
} catch (NoSuchMethodException e) {
Log.e(LOG_TAG, "Could not fetch setConstantState(). Oh well.");
}
sSetConstantStateMethodFetched = true;
}
if (sSetConstantStateMethod != null) {
try {
sSetConstantStateMethod.invoke(drawable, new Object[]{constantState});
return true;
} catch (Exception e2) {
Log.e(LOG_TAG, "Could not invoke setConstantState(). Oh well.");
}
}
return false;
}
DrawableUtils.java 文件源码
项目:boohee_v5.6
阅读 31
收藏 0
点赞 0
评论 0
private static boolean setContainerConstantStateV7(DrawableContainer drawable, ConstantState constantState) {
if (!sDrawableContainerStateFieldFetched) {
try {
sDrawableContainerStateField = DrawableContainer.class.getDeclaredField("mDrawableContainerStateField");
sDrawableContainerStateField.setAccessible(true);
} catch (NoSuchFieldException e) {
Log.e(LOG_TAG, "Could not fetch mDrawableContainerStateField. Oh well.");
}
sDrawableContainerStateFieldFetched = true;
}
if (sDrawableContainerStateField != null) {
try {
sDrawableContainerStateField.set(drawable, constantState);
return true;
} catch (Exception e2) {
Log.e(LOG_TAG, "Could not set mDrawableContainerStateField. Oh well.");
}
}
return false;
}
SkinCompatDrawableManager.java 文件源码
项目:Android-skin-support
阅读 31
收藏 0
点赞 0
评论 0
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;
}
SkinCompatDrawableManager.java 文件源码
项目:Android-skin-support
阅读 32
收藏 0
点赞 0
评论 0
private boolean addDrawableToCache(@NonNull final Context context, final long key,
@NonNull final Drawable drawable) {
final ConstantState cs = drawable.getConstantState();
if (cs != null) {
synchronized (mDrawableCacheLock) {
LongSparseArray<WeakReference<ConstantState>> cache = mDrawableCaches.get(context);
if (cache == null) {
cache = new LongSparseArray<>();
mDrawableCaches.put(context, cache);
}
cache.put(key, new WeakReference<ConstantState>(cs));
}
return true;
}
return false;
}
ao.java 文件源码
项目:solved-hacking-problem
阅读 22
收藏 0
点赞 0
评论 0
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;
}
}
ao.java 文件源码
项目:solved-hacking-problem
阅读 23
收藏 0
点赞 0
评论 0
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;
}
}
AppCompatDrawableManager.java 文件源码
项目:permissionsModule
阅读 33
收藏 0
点赞 0
评论 0
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;
}
AppCompatDrawableManager.java 文件源码
项目:permissionsModule
阅读 40
收藏 0
点赞 0
评论 0
private boolean addCachedDelegateDrawable(@NonNull final Context context, final long key,
@NonNull final Drawable drawable) {
final ConstantState cs = drawable.getConstantState();
if (cs != null) {
synchronized (mDelegateDrawableCacheLock) {
LongSparseArray<WeakReference<ConstantState>> cache
= mDelegateDrawableCaches.get(context);
if (cache == null) {
cache = new LongSparseArray<>();
mDelegateDrawableCaches.put(context, cache);
}
cache.put(key, new WeakReference<ConstantState>(cs));
}
return true;
}
return false;
}
NavigationMenuItemView.java 文件源码
项目:FMTech
阅读 24
收藏 0
点赞 0
评论 0
public void setIcon(Drawable paramDrawable)
{
Drawable.ConstantState localConstantState;
if (paramDrawable != null)
{
localConstantState = paramDrawable.getConstantState();
if (localConstantState != null) {
break label52;
}
}
for (;;)
{
paramDrawable = DrawableCompat.wrap(paramDrawable).mutate();
paramDrawable.setBounds(0, 0, this.mIconSize, this.mIconSize);
DrawableCompat.setTintList(paramDrawable, this.mIconTintList);
TextViewCompat.setCompoundDrawablesRelative$16207aff(this.mTextView, paramDrawable);
return;
label52:
paramDrawable = localConstantState.newDrawable();
}
}
PreferencesActivity.java 文件源码
项目:vlc_android_win
阅读 27
收藏 0
点赞 0
评论 0
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
super.onPreferenceTreeClick(preferenceScreen, preference);
if (preference instanceof PreferenceScreen)
setUpNestedScreen((PreferenceScreen) preference);
try {
if (preference!=null && preference instanceof PreferenceScreen) {
Dialog dialog = ((PreferenceScreen)preference).getDialog();
if (dialog!=null) {
Window window = dialog.getWindow();
if (window != null) {
ConstantState state = this.getWindow().getDecorView().findViewById(android.R.id.content).getBackground().getConstantState();
if (state != null)
window.getDecorView().setBackgroundDrawable(state.newDrawable());
}
}
}
} catch(Exception e){}
return false;
}
PreferencesActivity.java 文件源码
项目:vlc-android
阅读 30
收藏 0
点赞 0
评论 0
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
super.onPreferenceTreeClick(preferenceScreen, preference);
if (preference instanceof PreferenceScreen)
setUpNestedScreen((PreferenceScreen) preference);
try {
if (preference!=null && preference instanceof PreferenceScreen) {
Dialog dialog = ((PreferenceScreen)preference).getDialog();
if (dialog!=null) {
Window window = dialog.getWindow();
if (window != null) {
ConstantState state = this.getWindow().getDecorView().findViewById(android.R.id.content).getBackground().getConstantState();
if (state != null)
window.getDecorView().setBackgroundDrawable(state.newDrawable());
}
}
}
} catch(Exception e){}
return false;
}
DrawableResource.java 文件源码
项目:GitHub
阅读 24
收藏 0
点赞 0
评论 0
@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();
}
SuggestionsAdapter.java 文件源码
项目:boohee_v5.6
阅读 29
收藏 0
点赞 0
评论 0
public SuggestionsAdapter(Context context, SearchView searchView, SearchableInfo searchable, WeakHashMap<String, ConstantState> outsideDrawablesCache) {
super(context, searchView.getSuggestionRowLayout(), null, true);
this.mSearchView = searchView;
this.mSearchable = searchable;
this.mCommitIconResId = searchView.getSuggestionCommitIconResId();
this.mProviderContext = context;
this.mOutsideDrawablesCache = outsideDrawablesCache;
}
SuggestionsAdapter.java 文件源码
项目:boohee_v5.6
阅读 34
收藏 0
点赞 0
评论 0
private Drawable checkIconCache(String resourceUri) {
ConstantState cached = (ConstantState) this.mOutsideDrawablesCache.get(resourceUri);
if (cached == null) {
return null;
}
return cached.newDrawable();
}
SuggestionsAdapter.java 文件源码
项目:boohee_v5.6
阅读 40
收藏 0
点赞 0
评论 0
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;
}
AnimatedVectorDrawableCompat.java 文件源码
项目:boohee_v5.6
阅读 35
收藏 0
点赞 0
评论 0
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);
}
}
}
}
VectorDrawableCompat.java 文件源码
项目:boohee_v5.6
阅读 28
收藏 0
点赞 0
评论 0
public ConstantState getConstantState() {
if (this.mDelegateDrawable != null) {
return new VectorDrawableDelegateState(this.mDelegateDrawable.getConstantState());
}
this.mVectorState.mChangingConfigurations = getChangingConfigurations();
return this.mVectorState;
}
DrawableWrapperDonut.java 文件源码
项目:boohee_v5.6
阅读 32
收藏 0
点赞 0
评论 0
@Nullable
public ConstantState getConstantState() {
if (this.mState == null || !this.mState.canConstantState()) {
return null;
}
this.mState.mChangingConfigurations = getChangingConfigurations();
return this.mState;
}
NavigationMenuItemView.java 文件源码
项目:boohee_v5.6
阅读 21
收藏 0
点赞 0
评论 0
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);
}
SkinCompatDrawableManager.java 文件源码
项目:Android-skin-support
阅读 34
收藏 0
点赞 0
评论 0
public void onConfigurationChanged(@NonNull Context context) {
synchronized (mDrawableCacheLock) {
LongSparseArray<WeakReference<ConstantState>> cache = mDrawableCaches.get(context);
if (cache != null) {
// Crude, but we'll just clear the cache when the configuration changes
cache.clear();
}
}
}
da.java 文件源码
项目:solved-hacking-problem
阅读 30
收藏 0
点赞 0
评论 0
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;
}
}
bt.java 文件源码
项目:solved-hacking-problem
阅读 29
收藏 0
点赞 0
评论 0
public static boolean m2634b(Drawable drawable) {
if (drawable instanceof LayerDrawable) {
return VERSION.SDK_INT >= 16;
} else if (drawable instanceof InsetDrawable) {
return VERSION.SDK_INT >= 14;
} else {
if (drawable instanceof StateListDrawable) {
return VERSION.SDK_INT >= 8;
} else {
if (drawable instanceof GradientDrawable) {
return VERSION.SDK_INT >= 14;
} else {
if (!(drawable instanceof DrawableContainer)) {
return drawable instanceof C0063q ? m2634b(((C0063q) drawable).m469a()) : drawable instanceof C0244a ? m2634b(((C0244a) drawable).m1984a()) : drawable instanceof ScaleDrawable ? m2634b(((ScaleDrawable) drawable).getDrawable()) : true;
} else {
ConstantState constantState = drawable.getConstantState();
if (!(constantState instanceof DrawableContainerState)) {
return true;
}
for (Drawable b : ((DrawableContainerState) constantState).getChildren()) {
if (!m2634b(b)) {
return false;
}
}
return true;
}
}
}
}
}
ao.java 文件源码
项目:solved-hacking-problem
阅读 22
收藏 0
点赞 0
评论 0
private boolean m2504a(Context context, long j, Drawable drawable) {
ConstantState constantState = drawable.getConstantState();
if (constantState == null) {
return false;
}
synchronized (this.f1317m) {
C0113f c0113f = (C0113f) this.f1318n.get(context);
if (c0113f == null) {
c0113f = new C0113f();
this.f1318n.put(context, c0113f);
}
c0113f.m646b(j, new WeakReference(constantState));
}
return true;
}
C0064r.java 文件源码
项目:solved-hacking-problem
阅读 23
收藏 0
点赞 0
评论 0
public ConstantState getConstantState() {
if (this.f345b == null || !this.f345b.m488a()) {
return null;
}
this.f345b.f351a = getChangingConfigurations();
return this.f345b;
}
C0011l.java 文件源码
项目:solved-hacking-problem
阅读 26
收藏 0
点赞 0
评论 0
public ConstantState getConstantState() {
if (this.a != null) {
return new C0019t(this.a.getConstantState());
}
this.f22c.f76a = getChangingConfigurations();
return this.f22c;
}
C0004d.java 文件源码
项目:solved-hacking-problem
阅读 27
收藏 0
点赞 0
评论 0
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++;
}
}
}
}
da.java 文件源码
项目:solved-hacking-problem
阅读 33
收藏 0
点赞 0
评论 0
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;
}
}
bt.java 文件源码
项目:solved-hacking-problem
阅读 27
收藏 0
点赞 0
评论 0
public static boolean m2634b(Drawable drawable) {
if (drawable instanceof LayerDrawable) {
return VERSION.SDK_INT >= 16;
} else if (drawable instanceof InsetDrawable) {
return VERSION.SDK_INT >= 14;
} else {
if (drawable instanceof StateListDrawable) {
return VERSION.SDK_INT >= 8;
} else {
if (drawable instanceof GradientDrawable) {
return VERSION.SDK_INT >= 14;
} else {
if (!(drawable instanceof DrawableContainer)) {
return drawable instanceof C0063q ? m2634b(((C0063q) drawable).m469a()) : drawable instanceof C0244a ? m2634b(((C0244a) drawable).m1984a()) : drawable instanceof ScaleDrawable ? m2634b(((ScaleDrawable) drawable).getDrawable()) : true;
} else {
ConstantState constantState = drawable.getConstantState();
if (!(constantState instanceof DrawableContainerState)) {
return true;
}
for (Drawable b : ((DrawableContainerState) constantState).getChildren()) {
if (!m2634b(b)) {
return false;
}
}
return true;
}
}
}
}
}
ao.java 文件源码
项目:solved-hacking-problem
阅读 39
收藏 0
点赞 0
评论 0
private boolean m2504a(Context context, long j, Drawable drawable) {
ConstantState constantState = drawable.getConstantState();
if (constantState == null) {
return false;
}
synchronized (this.f1317m) {
C0113f c0113f = (C0113f) this.f1318n.get(context);
if (c0113f == null) {
c0113f = new C0113f();
this.f1318n.put(context, c0113f);
}
c0113f.m646b(j, new WeakReference(constantState));
}
return true;
}