项目: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,/* 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,@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,/* 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);
}
}
项目:Android-RobotoTextView
文件:RobotoInflater.java
@Override
public View onCreateView(View parent,String name,Context context,AttributeSet attrs) {
try {
View view = mAppCompatDelegate.createView(parent,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,VectorEnabledTintResources.shouldBeUsed());
}
if (view instanceof TextView) {
RobotoTypefaces.setUpTypeface((TextView) view,attrs);
}
return view;
} catch (Exception e) {
//if some thing went wrong
return null;
}
}
项目:SkinSprite
文件:SkinnableActivity.java
@Override
public View onCreateView(View parent,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,/* 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,AttributeSet attrs) {
final boolean isPre21 = Build.VERSION.SDK_INT < 21;
return createView(parent,false,VectorEnabledTintResources.shouldBeUsed());
}
项目:ThemeDemo
文件:LayoutInflaterFactory2.java
@Override
public View onCreateView(String name,AttributeSet attrs) {
final boolean isPre21 = Build.VERSION.SDK_INT < 21;
return createView(null,VectorEnabledTintResources.shouldBeUsed());
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。