本文整理汇总了Java中android.graphics.drawable.Drawable.ConstantState类的典型用法代码示例。如果您正苦于以下问题:Java ConstantState类的具体用法?Java ConstantState怎么用?Java ConstantState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConstantState类属于android.graphics.drawable.Drawable包,在下文中一共展示了ConstantState类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:20,代码来源:AppCompatDrawableManager.java
示例2: setContainerConstantStateV9
import android.graphics.drawable.Drawable.ConstantState; //导入依赖的package包/类
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;
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:21,代码来源:DrawableUtils.java
示例3: setContainerConstantStateV7
import android.graphics.drawable.Drawable.ConstantState; //导入依赖的package包/类
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;
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:21,代码来源:DrawableUtils.java
示例4: 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;
}
开发者ID:ximsfei,项目名称:Android-skin-support,代码行数:23,代码来源:SkinCompatDrawableManager.java
示例5: addDrawableToCache
import android.graphics.drawable.Drawable.ConstantState; //导入依赖的package包/类
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;
}
开发者ID:ximsfei,项目名称:Android-skin-support,代码行数:17,代码来源:SkinCompatDrawableManager.java
示例6: 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;
}
}
开发者ID:Qwaz,项目名称:solved-hacking-problem,代码行数:19,代码来源:ao.java
示例7: 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;
}
开发者ID:GigigoGreenLabs,项目名称:permissionsModule,代码行数:23,代码来源:AppCompatDrawableManager.java
示例8: addCachedDelegateDrawable
import android.graphics.drawable.Drawable.ConstantState; //导入依赖的package包/类
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;
}
开发者ID:GigigoGreenLabs,项目名称:permissionsModule,代码行数:18,代码来源:AppCompatDrawableManager.java
示例9: setIcon
import android.graphics.drawable.Drawable.ConstantState; //导入依赖的package包/类
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();
}
}
开发者ID:ChiangC,项目名称:FMTech,代码行数:22,代码来源:NavigationMenuItemView.java
示例10: onPreferenceTreeClick
import android.graphics.drawable.Drawable.ConstantState; //导入依赖的package包/类
@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;
}
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:21,代码来源:PreferencesActivity.java
示例11: 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();
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:DrawableResource.java
示例12: SuggestionsAdapter
import android.graphics.drawable.Drawable.ConstantState; //导入依赖的package包/类
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;
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:9,代码来源:SuggestionsAdapter.java
示例13: 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();
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:8,代码来源:SuggestionsAdapter.java
示例14: 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;
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:14,代码来源:SuggestionsAdapter.java
示例15: 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);
}
}
}
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:31,代码来源:AnimatedVectorDrawableCompat.java
示例16: getConstantState
import android.graphics.drawable.Drawable.ConstantState; //导入依赖的package包/类
public ConstantState getConstantState() {
if (this.mDelegateDrawable != null) {
return new VectorDrawableDelegateState(this.mDelegateDrawable.getConstantState());
}
this.mVectorState.mChangingConfigurations = getChangingConfigurations();
return this.mVectorState;
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:8,代码来源:VectorDrawableCompat.java
示例17: getConstantState
import android.graphics.drawable.Drawable.ConstantState; //导入依赖的package包/类
@Nullable
public ConstantState getConstantState() {
if (this.mState == null || !this.mState.canConstantState()) {
return null;
}
this.mState.mChangingConfigurations = getChangingConfigurations();
return this.mState;
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:9,代码来源:DrawableWrapperDonut.java
示例18: 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);
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:13,代码来源:NavigationMenuItemView.java
示例19: onConfigurationChanged
import android.graphics.drawable.Drawable.ConstantState; //导入依赖的package包/类
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();
}
}
}
开发者ID:ximsfei,项目名称:Android-skin-support,代码行数:10,代码来源:SkinCompatDrawableManager.java
示例20: 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;
}
}
开发者ID:Qwaz,项目名称:solved-hacking-problem,代码行数:16,代码来源:da.java
注:本文中的android.graphics.drawable.Drawable.ConstantState类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论