项目:Aequorea
文件:RichText.java
/**
* 判断Activity是否已经结束
*
* @param context context
* @return true:已结束
*/
private static boolean activityIsAlive(Context context) {
if (context == null) {
return false;
}
if (context instanceof TintContextWrapper) {
context = ((TintContextWrapper) context).getBaseContext();
}
if (context instanceof Activity) {
if (((Activity) context).isFinishing()) {
return false;
} else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && ((Activity) context).isDestroyed()) {
return false;
}
}
}
return true;
}
项目:Aequorea
文件:AbstractImageLoader.java
private boolean activityIsAlive() {
TextView textView = textViewWeakReference.get();
if (textView == null) {
return false;
}
Context context = textView.getContext();
if (context == null) {
return false;
}
if (context instanceof TintContextWrapper) {
context = ((TintContextWrapper) context).getBaseContext();
}
if (context instanceof Activity) {
if (((Activity) context).isFinishing()) {
return false;
} else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && ((Activity) context).isDestroyed()) {
return false;
}
}
}
return true;
}
项目:android-gto-support
文件:PicassoUtils.java
@NonNull
@SuppressLint("RestrictedApi")
public Picasso.Builder injectVectorAwareContext(@NonNull final Context context,@NonNull final Picasso.Builder builder) {
// XXX: forcibly inject a TintContextWrapper context to support loading Support VectorDrawables
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
try {
final Field f = Picasso.Builder.class.getDeclaredField("context");
f.setAccessible(true);
f.set(builder,TintContextWrapper.wrap(context.getApplicationContext()));
} catch (final Exception e) {
Crashlytics.logException(e);
}
}
return builder;
}
项目:RichText
文件:ImageTarget.java
/**
* 判断Activity是否已经结束
*
* @return true:已结束
*/
boolean activityIsAlive() {
TextView textView = textViewWeakReference.get();
if (textView == null) {
return false;
}
Context context = textView.getContext();
if (context == null) {
return false;
}
if (context instanceof TintContextWrapper) {
context = ((TintContextWrapper) context).getBaseContext();
}
if (context instanceof Activity) {
if (((Activity) context).isFinishing()) {
return false;
} else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && ((Activity) context).isDestroyed()) {
return false;
}
}
}
return true;
}
项目:Android-RobotoTextView
文件:RobotoCompatInflater.java
final View createView(View parent,final String name,@NonNull Context context,@NonNull AttributeSet attrs,boolean inheritContext,boolean readAppTheme,boolean wrapContext) {
if (inheritContext && parent != null) {
context = parent.getContext();
}
if (readAppTheme) {
context = themifyContext(context,attrs,true);
}
if (wrapContext) {
context = TintContextWrapper.wrap(context);
}
View view = createViewFromTag(context,name,attrs);
if (view != null) {
checkOnClickListener(view,attrs);
}
return view;
}
项目:Android-skin-support
文件:SkinCompatViewInflater.java
public final View createView(View parent,boolean readAndroidTheme,boolean wrapContext) {
final Context originalContext = context;
// We can emulate Lollipop's android:theme attribute propagating down the view hierarchy
// by using the parent's context
if (inheritContext && parent != null) {
context = parent.getContext();
}
if (readAndroidTheme || readAppTheme) {
// We then apply the theme on the context,if specified
context = themifyContext(context,readAndroidTheme,readAppTheme);
}
if (wrapContext) {
context = TintContextWrapper.wrap(context);
}
View view = createViewFromHackInflater(context,attrs);
// We need to 'inject' our tint aware Views in place of the standard framework versions
if (view == null) {
view = createViewFromFV(context,attrs);
}
if (view == null) {
view = createViewFromV7(context,attrs);
}
if (view == null) {
view = createViewFromInflater(context,attrs);
}
if (view == null) {
view = createViewFromTag(context,attrs);
}
if (view != null) {
// If we have created a view,check it's android:onClick
checkOnClickListener(view,attrs);
}
return view;
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。