android.support.v7.widget.TintContextWrapper Java Examples

The following examples show how to use android.support.v7.widget.TintContextWrapper. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ImageTarget.java    From RichText with MIT License 6 votes vote down vote up
/**
 * 判断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;
}
 
Example #2
Source File: RobotoCompatInflater.java    From Android-RobotoTextView with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #3
Source File: SkinCompatViewInflater.java    From Android-skin-support with MIT License 4 votes vote down vote up
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;
}