Java 类android.support.v7.widget.TintContextWrapper 实例源码

项目: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, final String name, @NonNull Context context,
                             @NonNull AttributeSet attrs, boolean inheritContext,
                             boolean readAndroidTheme, boolean readAppTheme, 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, attrs, readAndroidTheme, readAppTheme);
    }
    if (wrapContext) {
        context = TintContextWrapper.wrap(context);
    }

    View view = createViewFromHackInflater(context, name, attrs);

    // We need to 'inject' our tint aware Views in place of the standard framework versions
    if (view == null) {
        view = createViewFromFV(context, name, attrs);
    }

    if (view == null) {
        view = createViewFromV7(context, name, attrs);
    }

    if (view == null) {
        view = createViewFromInflater(context, name, attrs);
    }

    if (view == null) {
        view = createViewFromTag(context, name, attrs);
    }

    if (view != null) {
        // If we have created a view, check it's android:onClick
        checkOnClickListener(view, attrs);
    }

    return view;
}