use of android.support.v7.view.ContextThemeWrapper in project MarkyMark-Android by M2Mobi.
the class ThemedContext method getWrapper.
/**
* Wraps a context with a ContextThemeWrapper with the MarkyMark theme
*
* @param pContext
* Context used by the wrapper
* @return Returns a ContextThemeWrapper with the MarkyMark theme
*/
private static ContextThemeWrapper getWrapper(Context pContext) {
final TypedArray array = pContext.getTheme().obtainStyledAttributes(new int[] { R.attr.MarkyMarkTheme });
final int id = array.getResourceId(0, R.style.MarkyMarkStyle);
array.recycle();
return new ContextThemeWrapper(pContext, id);
}
use of android.support.v7.view.ContextThemeWrapper in project FastHub by k0shk0sh.
the class BaseDialogFragment method onCreateView.
@SuppressLint("RestrictedApi")
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (fragmentLayout() != 0) {
final Context contextThemeWrapper = new ContextThemeWrapper(getContext(), getContext().getTheme());
LayoutInflater themeAwareInflater = inflater.cloneInContext(contextThemeWrapper);
View view = themeAwareInflater.inflate(fragmentLayout(), container, false);
unbinder = ButterKnife.bind(this, view);
return view;
}
return super.onCreateView(inflater, container, savedInstanceState);
}
use of android.support.v7.view.ContextThemeWrapper in project FastHub by k0shk0sh.
the class BaseFragment method onCreateView.
@SuppressLint("RestrictedApi")
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (fragmentLayout() != 0) {
final Context contextThemeWrapper = new ContextThemeWrapper(getContext(), getContext().getTheme());
LayoutInflater themeAwareInflater = inflater.cloneInContext(contextThemeWrapper);
View view = themeAwareInflater.inflate(fragmentLayout(), container, false);
unbinder = ButterKnife.bind(this, view);
return view;
}
return super.onCreateView(inflater, container, savedInstanceState);
}
use of android.support.v7.view.ContextThemeWrapper in project FastHub by k0shk0sh.
the class BaseMvpBottomSheetDialogFragment method onCreateView.
@SuppressLint("RestrictedApi")
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (fragmentLayout() != 0) {
final Context contextThemeWrapper = new ContextThemeWrapper(getContext(), getContext().getTheme());
LayoutInflater themeAwareInflater = inflater.cloneInContext(contextThemeWrapper);
View view = themeAwareInflater.inflate(fragmentLayout(), container, false);
unbinder = ButterKnife.bind(this, view);
return view;
}
return super.onCreateView(inflater, container, savedInstanceState);
}
use of android.support.v7.view.ContextThemeWrapper in project EssayJoke by qiyei2015.
the class SkinAppCompatViewInflater method themifyContext.
/**
* Allows us to emulate the {@code android:theme} attribute for devices before L.
*/
private static Context themifyContext(Context context, AttributeSet attrs, boolean useAndroidTheme, boolean useAppTheme) {
final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.View, 0, 0);
int themeId = 0;
if (useAndroidTheme) {
// First try reading android:theme if enabled
themeId = a.getResourceId(R.styleable.View_android_theme, 0);
}
if (useAppTheme && themeId == 0) {
// ...if that didn't work, try reading app:theme (for legacy reasons) if enabled
themeId = a.getResourceId(R.styleable.View_theme, 0);
if (themeId != 0) {
LogManager.i(LOG_TAG, "app:theme is now deprecated. " + "Please move to using android:theme instead.");
}
}
a.recycle();
if (themeId != 0 && (!(context instanceof ContextThemeWrapper) || ((ContextThemeWrapper) context).getThemeResId() != themeId)) {
// If the context isn't a ContextThemeWrapper, or it is but does not have
// the same theme as we need, wrap it in a new wrapper
context = new ContextThemeWrapper(context, themeId);
}
return context;
}
Aggregations