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

项目:AndroidSkinAnimator    文件:SkinCompatDelegate.java   
public View createView(View parent, final String name, @NonNull Context context,
                       @NonNull AttributeSet attrs) {
    final boolean isPre21 = Build.VERSION.SDK_INT < 21;

    if (mSkinCompatViewInflater == null) {
        mSkinCompatViewInflater = new SkinCompatViewInflater();
    }

    // We only want the View to inherit its context if we're running pre-v21
    final boolean inheritContext = isPre21 && shouldInheritContext((ViewParent) parent);

    return mSkinCompatViewInflater.createView(parent, name, context, attrs, inheritContext,
            isPre21, /* Only read android:theme pre-L (L+ handles this anyway) */
            true, /* Read read app:theme as a fallback at all times for legacy reasons */
            VectorEnabledTintResources.shouldBeUsed() /* Only tint wrap the context if enabled */
    );
}
项目:Android-skin-support    文件:SkinCompatDelegate.java   
public View createView(View parent, final String name, @NonNull Context context,
                       @NonNull AttributeSet attrs) {
    final boolean isPre21 = Build.VERSION.SDK_INT < 21;

    if (mSkinCompatViewInflater == null) {
        mSkinCompatViewInflater = new SkinCompatViewInflater();
    }

    // We only want the View to inherit its context if we're running pre-v21
    final boolean inheritContext = isPre21 && shouldInheritContext((ViewParent) parent);

    return mSkinCompatViewInflater.createView(parent, name, context, attrs, inheritContext,
            isPre21, /* Only read android:theme pre-L (L+ handles this anyway) */
            true, /* Read read app:theme as a fallback at all times for legacy reasons */
            VectorEnabledTintResources.shouldBeUsed() /* Only tint wrap the context if enabled */
    );
}
项目:ReadMark    文件:BaseSkinActivity.java   
public View createView(View parent, final String name, @NonNull Context context,
                       @NonNull AttributeSet attrs) {
    final boolean isPre21 = Build.VERSION.SDK_INT < 21;

    if (mAppCompatViewInflater == null) {
        mAppCompatViewInflater = new SkinAppCompatViewInflater();
    }

    // We only want the View to inherit its context if we're running pre-v21
    final boolean inheritContext = isPre21 && shouldInheritContext((ViewParent) parent);

    return mAppCompatViewInflater.createView(parent, name, context, attrs, inheritContext,
            isPre21, /* Only read android:theme pre-L (L+ handles this anyway) */
            true, /* Read read app:theme as a fallback at all times for legacy reasons */
            VectorEnabledTintResources.shouldBeUsed() /* Only tint wrap the context if enabled */
    );
}
项目:S1-Next    文件:ResourceUtil.java   
/**
 * Sets the scaling factor for fonts displayed on the display.
 *
 * @param scale the scaling factor.
 */
public static void setScaledDensity(Context context, float scale) {
    Resources resources = context.getApplicationContext().getResources();
    DisplayMetrics displayMetrics = resources.getDisplayMetrics();
    Resources sysResources = Resources.getSystem();

    displayMetrics.scaledDensity = sysResources.getDisplayMetrics().scaledDensity * scale;

    //if use vector drawable, and SDK <= 20, use this to compat
    if (VectorEnabledTintResources.shouldBeUsed()) {
        Configuration config = resources.getConfiguration();
        config.fontScale = sysResources.getConfiguration().fontScale * scale;
        //noinspection deprecation
        resources.updateConfiguration(config, displayMetrics);
    }
}
项目:ReadMark    文件:BaseSkinActivity.java   
public View createView(View parent, final String name, @NonNull Context context,
                       @NonNull AttributeSet attrs) {
    final boolean isPre21 = Build.VERSION.SDK_INT < 21;

    if (mAppCompatViewInflater == null) {
        mAppCompatViewInflater = new SkinAppCompatViewInflater();
    }

    // We only want the View to inherit its context if we're running pre-v21
    final boolean inheritContext = isPre21 && shouldInheritContext((ViewParent) parent);

    return mAppCompatViewInflater.createView(parent, name, context, attrs, inheritContext,
            isPre21, /* Only read android:theme pre-L (L+ handles this anyway) */
            true, /* Read read app:theme as a fallback at all times for legacy reasons */
            VectorEnabledTintResources.shouldBeUsed() /* Only tint wrap the context if enabled */
    );
}
项目:Android-RobotoTextView    文件:RobotoInflater.java   
@Override
public View onCreateView(View parent, String name, Context context, AttributeSet attrs) {
    try {
        View view = mAppCompatDelegate.createView(parent, name, context, attrs);
        if (view == null) {
            final boolean isPre21 = Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP;
            final boolean inheritContext = isPre21 && shouldInheritContext((ViewParent) parent);
            view = mCompatInflater.createView(parent, name, context, attrs, inheritContext, isPre21, VectorEnabledTintResources.shouldBeUsed());
        }

        if (view instanceof TextView) {
            RobotoTypefaces.setUpTypeface((TextView) view, context, attrs);
        }
        return view;
    } catch (Exception e) {
        //if some thing went wrong
        return null;
    }
}
项目:SkinSprite    文件:SkinnableActivity.java   
@Override
public View onCreateView(View parent, String name, Context context, AttributeSet attrs) {
    if (mSkinnableViewInflater == null) {
        mSkinnableViewInflater = new SkinnableViewInflater();
    }
    final boolean isPre21 = Build.VERSION.SDK_INT < 21;
    final boolean inheritContext = isPre21 && shouldInheritContext((ViewParent) parent);
    return mSkinnableViewInflater.createView(parent, name, context, attrs, inheritContext,
            isPre21, /* Only read android:theme pre-L (L+ handles this anyway) */
            true, /* Read read app:theme as a fallback at all times for legacy reasons */
            VectorEnabledTintResources.shouldBeUsed() /* Only tint wrap the context if enabled */
    );
}
项目:ThemeDemo    文件:LayoutInflaterFactory2.java   
public View onCreateView(View parent, String name, Context context, AttributeSet attrs) {
    final boolean isPre21 = Build.VERSION.SDK_INT < 21;
    return createView(parent, name, context, attrs, false, false, isPre21, VectorEnabledTintResources.shouldBeUsed());
}
项目:ThemeDemo    文件:LayoutInflaterFactory2.java   
@Override
public View onCreateView(String name, Context context, AttributeSet attrs) {
    final boolean isPre21 = Build.VERSION.SDK_INT < 21;
    return createView(null, name, context, attrs, false, false, isPre21, VectorEnabledTintResources.shouldBeUsed());
}