use of android.view.ContextThemeWrapper in project danci by ling0322.
the class ReciteFragment method onBackKey.
@Override
public boolean onBackKey() {
if (recite.isFinsihed() == true) {
System.exit(0);
}
Dialog dialog = new AlertDialog.Builder(new ContextThemeWrapper(getActivity(), R.style.AnneDialog)).setMessage("单词还没有背完, 确定要退出吗?").setPositiveButton("退出", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
System.exit(0);
}
}).setNegativeButton("取消", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
}
}).create();
dialog.show();
return true;
}
use of android.view.ContextThemeWrapper in project XobotOS by xamarin.
the class ActionBarImpl method getThemedContext.
public Context getThemedContext() {
if (mThemedContext == null) {
TypedValue outValue = new TypedValue();
Resources.Theme currentTheme = mContext.getTheme();
currentTheme.resolveAttribute(com.android.internal.R.attr.actionBarWidgetTheme, outValue, true);
final int targetThemeRes = outValue.resourceId;
if (targetThemeRes != 0 && mContext.getThemeResId() != targetThemeRes) {
mThemedContext = new ContextThemeWrapper(mContext, targetThemeRes);
} else {
mThemedContext = mContext;
}
}
return mThemedContext;
}
use of android.view.ContextThemeWrapper in project platform_frameworks_base by android.
the class WindowDecorActionBar method getThemedContext.
public Context getThemedContext() {
if (mThemedContext == null) {
TypedValue outValue = new TypedValue();
Resources.Theme currentTheme = mContext.getTheme();
currentTheme.resolveAttribute(com.android.internal.R.attr.actionBarWidgetTheme, outValue, true);
final int targetThemeRes = outValue.resourceId;
if (targetThemeRes != 0 && mContext.getThemeResId() != targetThemeRes) {
mThemedContext = new ContextThemeWrapper(mContext, targetThemeRes);
} else {
mThemedContext = mContext;
}
}
return mThemedContext;
}
use of android.view.ContextThemeWrapper in project platform_frameworks_base by android.
the class FloatingToolbar method applyDefaultTheme.
/**
* Returns a re-themed context with controlled look and feel for views.
*/
private static Context applyDefaultTheme(Context originalContext) {
TypedArray a = originalContext.obtainStyledAttributes(new int[] { R.attr.isLightTheme });
boolean isLightTheme = a.getBoolean(0, true);
int themeId = isLightTheme ? R.style.Theme_Material_Light : R.style.Theme_Material;
a.recycle();
return new ContextThemeWrapper(originalContext, themeId);
}
use of android.view.ContextThemeWrapper in project platform_frameworks_base by android.
the class ListMenuPresenter method initForMenu.
@Override
public void initForMenu(@NonNull Context context, @Nullable MenuBuilder menu) {
if (mThemeRes != 0) {
mContext = new ContextThemeWrapper(context, mThemeRes);
mInflater = LayoutInflater.from(mContext);
} else if (mContext != null) {
mContext = context;
if (mInflater == null) {
mInflater = LayoutInflater.from(mContext);
}
}
mMenu = menu;
if (mAdapter != null) {
mAdapter.notifyDataSetChanged();
}
}
Aggregations