Java Examples for android.view.ContextThemeWrapper
The following java examples will help you to understand the usage of android.view.ContextThemeWrapper. These source code samples are taken from different open source projects.
Example 1
| Project: calendar-widget-master File: EventWidgetService.java View source code |
@Override
public RemoteViewsFactory onGetViewFactory(Intent intent) {
int widgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, 0);
Context appContext = getApplicationContext();
int currentThemeId = themeNameToResId(InstanceSettings.fromId(appContext, widgetId).getEntryTheme());
ContextThemeWrapper context = new ContextThemeWrapper(appContext, currentThemeId);
return new EventRemoteViewsFactory(context, widgetId);
}Example 2
| Project: JwZhangJie-master File: wifi_not_connect.java View source code |
public static AlertDialog.Builder createwificonnectDialog(Context context) {
final AlertDialog.Builder connectDialogwifi = new AlertDialog.Builder(new ContextThemeWrapper(context, R.layout.share_dialog));
connectDialogwifi.setTitle(R.string.share_net_error_title);
connectDialogwifi.setMessage(R.string.share_net_error_content);
connectDialogwifi.setCancelable(false);
connectDialogwifi.setPositiveButton(R.string.share_net_error_done, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
return connectDialogwifi;
}Example 3
| Project: ytdownloader-master File: PopUps.java View source code |
public static void showPopUp(String title, String message, String type, Context context) {
AlertDialog.Builder helpBuilder = new AlertDialog.Builder(new ContextThemeWrapper(context, R.style.BoxTheme));
helpBuilder.setTitle(title);
helpBuilder.setMessage(message);
if (type == "alert") {
icon = android.R.drawable.ic_dialog_alert;
} else if (type == "info") {
icon = android.R.drawable.ic_dialog_info;
}
helpBuilder.setIcon(icon);
helpBuilder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// Do nothing but close the dialog
}
});
AlertDialog helpDialog = helpBuilder.create();
helpDialog.show();
}Example 4
| Project: AndroidTreeView-master File: TreeNodeWrapperView.java View source code |
private void init() {
setOrientation(LinearLayout.VERTICAL);
nodeContainer = new RelativeLayout(getContext());
nodeContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
nodeContainer.setId(R.id.node_header);
ContextThemeWrapper newContext = new ContextThemeWrapper(getContext(), containerStyle);
nodeItemsContainer = new LinearLayout(newContext, null, containerStyle);
nodeItemsContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
nodeItemsContainer.setId(R.id.node_items);
nodeItemsContainer.setOrientation(LinearLayout.VERTICAL);
nodeItemsContainer.setVisibility(View.GONE);
addView(nodeContainer);
addView(nodeItemsContainer);
}Example 5
| Project: CodeBag-master File: TreeNodeWrapperView.java View source code |
private void init() {
setOrientation(LinearLayout.VERTICAL);
nodeContainer = new RelativeLayout(getContext());
nodeContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
nodeContainer.setId(R.id.node_header);
ContextThemeWrapper newContext = new ContextThemeWrapper(getContext(), containerStyle);
nodeItemsContainer = new LinearLayout(newContext, null, containerStyle);
nodeItemsContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
nodeItemsContainer.setId(R.id.node_items);
nodeItemsContainer.setOrientation(LinearLayout.VERTICAL);
nodeItemsContainer.setVisibility(View.GONE);
addView(nodeContainer);
addView(nodeItemsContainer);
}Example 6
| Project: f-droid-master File: StartSwapFragment.java View source code |
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
LayoutInflater themedInflater = (LayoutInflater) new ContextThemeWrapper(inflater.getContext(), R.style.SwapTheme_StartSwap).getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = themedInflater.inflate(R.layout.swap_blank, container, false);
view.findViewById(R.id.button_start_swap).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
manager.nextStep();
}
});
return view;
}Example 7
| Project: goloader-master File: PopUps.java View source code |
public static void showPopUp(String title, String message, String type, Context context) {
AlertDialog.Builder helpBuilder = new AlertDialog.Builder(new ContextThemeWrapper(context, R.style.BoxTheme));
helpBuilder.setTitle(title);
helpBuilder.setMessage(message);
if (type == "alert") {
icon = android.R.drawable.ic_dialog_alert;
} else if (type == "info") {
icon = android.R.drawable.ic_dialog_info;
}
helpBuilder.setIcon(icon);
helpBuilder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// Do nothing but close the dialog
}
});
AlertDialog helpDialog = helpBuilder.create();
if (!((Activity) context).isFinishing()) {
helpDialog.show();
}
}Example 8
| Project: LazyTag-master File: TagAdapter.java View source code |
// create a new ImageView for each item referenced by the Adapter
public View getView(int position, View convertView, ViewGroup parent) {
Button button;
if (convertView == null) {
// if it's not recycled, initialize some attributes
button = new Button(new ContextThemeWrapper(mContext, android.R.style.Widget_Material_Button_Borderless_Colored), null, android.R.style.Widget_Material_Button_Borderless_Colored);
// imageView.setMaxWidth(parent.getWidth() / 2 - 40);
// imageView.setMaxHeight(parent.getHeight() / 3 - 40);
button.setLayoutParams(new GridView.LayoutParams(150, 100));
button.setPadding(5, 5, 5, 5);
} else {
button = (Button) convertView;
}
button.setText("Test");
return button;
}Example 9
| Project: meetup-client-master File: InviteContactActivity.java View source code |
public final Dialog onCreateDialog(Bundle bundle) {
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(new ContextThemeWrapper(getActivity(), R.style.Theme_EmeraldSea));
builder.setTitle(R.string.add_to_circle_email_picker_title);
builder.setAdapter(new ArrayAdapter(getActivity(), 0x1090012, getArguments().getStringArray("emails")), this);
builder.setNegativeButton(0x1040000, this);
builder.setCancelable(true);
return builder.create();
}Example 10
| Project: shuttle-master File: MediaRouteButtonHoloDark.java View source code |
private static Context getThemedContext(Context context) {
if (ThemeUtils.getThemeType(context) == ThemeUtils.ThemeType.TYPE_LIGHT) {
context = new ContextThemeWrapper(context, R.style.Theme_AppCompat_Light);
return new ContextThemeWrapper(context, R.style.Theme_MediaRouter);
}
context = new ContextThemeWrapper(context, R.style.Theme_AppCompat);
return new ContextThemeWrapper(context, R.style.Theme_MediaRouter);
}Example 11
| Project: TreeView_in_Android-master File: TreeNodeWrapperView.java View source code |
private void init() {
setOrientation(LinearLayout.VERTICAL);
nodeContainer = new RelativeLayout(getContext());
nodeContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
nodeContainer.setId(R.id.node_header);
ContextThemeWrapper newContext = new ContextThemeWrapper(getContext(), containerStyle);
nodeItemsContainer = new LinearLayout(newContext);
nodeItemsContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
nodeItemsContainer.setId(R.id.node_items);
nodeItemsContainer.setOrientation(LinearLayout.VERTICAL);
nodeItemsContainer.setVisibility(View.GONE);
addView(nodeContainer);
addView(nodeItemsContainer);
}Example 12
| Project: Ummo-master File: TreeNodeWrapperView.java View source code |
private void init() {
setOrientation(LinearLayout.VERTICAL);
nodeContainer = new RelativeLayout(getContext());
nodeContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
nodeContainer.setId(R.id.node_header);
ContextThemeWrapper newContext = new ContextThemeWrapper(getContext(), containerStyle);
nodeItemsContainer = new LinearLayout(newContext, null, containerStyle);
nodeItemsContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
nodeItemsContainer.setId(R.id.node_items);
nodeItemsContainer.setOrientation(LinearLayout.VERTICAL);
nodeItemsContainer.setVisibility(View.GONE);
addView(nodeContainer);
addView(nodeItemsContainer);
}Example 13
| Project: UpdatePlugin-master File: SafeDialogOper.java View source code |
private static Activity getActivity(Dialog dialog) {
Activity bindAct = null;
Context context = dialog.getContext();
do {
if (context instanceof Activity) {
bindAct = (Activity) context;
break;
} else if (context instanceof ContextThemeWrapper) {
context = ((ContextThemeWrapper) context).getBaseContext();
} else {
break;
}
} while (true);
return bindAct;
}Example 14
| Project: Android-Templates-And-Utilities-master File: TimePickerDialogFragment.java View source code |
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Calendar calendar = Calendar.getInstance();
if (mTime != -1L) {
calendar.setTimeInMillis(mTime);
}
ContextThemeWrapper context = new ContextThemeWrapper(getActivity(), getTheme(true));
FixedTimePickerDialog dialog = new FixedTimePickerDialog(calendar, context, this);
return dialog;
}Example 15
| Project: cumulus-master File: JsonListingPanelActivity.java View source code |
private void showEditDialog(final JsonListing listing) {
new AlertDialog.Builder(new ContextThemeWrapper(this, R.style.CompatTheme)).setTitle(R.string.link_to_m3u).setMessage(listing.getUrl()).setNegativeButton(R.string.delete, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
try {
Log.d(TAG, "Try deleting " + listing.toString());
ChannelDatabase.getInstance(JsonListingPanelActivity.this).delete(listing);
new Handler(Looper.getMainLooper()) {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
refreshUi();
}
}.sendEmptyMessageDelayed(0, 50);
} catch (JSONException e) {
e.printStackTrace();
}
}
}).setPositiveButton(R.string.cancel, null).show();
}Example 16
| Project: CumulusTV-master File: JsonListingPanelActivity.java View source code |
private void showEditDialog(final JsonListing listing) {
new AlertDialog.Builder(new ContextThemeWrapper(this, R.style.CompatTheme)).setTitle(R.string.link_to_m3u).setMessage(listing.getUrl()).setNegativeButton(R.string.delete, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
try {
Log.d(TAG, "Try deleting " + listing.toString());
ChannelDatabase.getInstance(JsonListingPanelActivity.this).delete(listing);
new Handler(Looper.getMainLooper()) {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
refreshUi();
}
}.sendEmptyMessageDelayed(0, 50);
} catch (JSONException e) {
e.printStackTrace();
}
}
}).setPositiveButton(R.string.cancel, null).show();
}Example 17
| Project: cwac-mediarouter-master File: MediaRouterThemeHelper.java View source code |
public static Context createThemedContext(Context context, boolean forceDark) {
boolean isLightTheme = isLightTheme(context);
/*
if (isLightTheme && forceDark) {
context = new ContextThemeWrapper(context, R.style.Theme_AppCompat);
isLightTheme = false;
}
*/
return new ContextThemeWrapper(context, isLightTheme ? R.style.Theme_MediaRouter_Light : R.style.Theme_MediaRouter);
}Example 18
| Project: download-ia-master File: PopUps.java View source code |
public static void showPopUp(String title, String message, String type, Activity activity) {
AlertDialog.Builder helpBuilder = new AlertDialog.Builder(new ContextThemeWrapper(activity, R.style.BoxTheme));
helpBuilder.setTitle(title);
helpBuilder.setMessage(message);
if (type == "alert") {
icon = android.R.drawable.ic_dialog_alert;
} else if (type == "info") {
icon = android.R.drawable.ic_dialog_info;
}
helpBuilder.setIcon(icon);
helpBuilder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// close the dialog
}
});
AlertDialog helpDialog = helpBuilder.create();
if (!activity.isFinishing()) {
helpDialog.show();
} else {
Utils.logger("w", "PopUp not showed", "PopUps");
}
}Example 19
| Project: FishDiary-master File: BaseStyleDialog.java View source code |
/**
* InfoDialog in this context means Dialog with Pos/Neg button
*
* @param msg
* message passed in
* @param callback
* defining operation when button clicked
* @param cancelable
* whether the dialog is cancelable
*/
public static void buildInfoDialog(Context context, String msg, final ICallBack callback, boolean cancelable) {
AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(context, android.R.style.Theme_NoTitleBar));
builder.setMessage(msg);
builder.setNegativeButton(R.string.button_cancel, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
callback.negButtonClicked();
}
});
builder.setPositiveButton(R.string.button_ok, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
callback.posButtonClicked();
}
});
builder.setOnCancelListener(new OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
callback.negButtonClicked();
}
});
builder.setCancelable(cancelable);
builder.show();
}Example 20
| Project: hover-master File: DemoHoverMenuActivity.java View source code |
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.d(TAG, "onCreate()");
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_hover_menu);
try {
final ContextThemeWrapper contextThemeWrapper = new ContextThemeWrapper(this, R.style.AppTheme);
DemoHoverMenuAdapter adapter = new DemoHoverMenuFactory().createDemoMenuFromCode(contextThemeWrapper, Bus.getInstance());
// DemoHoverMenuAdapter adapter = new DemoHoverMenuFactory().createDemoMenuFromFile(contextThemeWrapper);
mHoverMenuView = (ViewHoverMenu) findViewById(R.id.hovermenu);
mHoverMenuView.setAdapter(adapter);
} catch (IOException e) {
Log.e(TAG, "Failed to create demo menu from file.");
e.printStackTrace();
}
}Example 21
| Project: iCreate2012-Team-CM-master File: AboutApplicationDialogFragment.java View source code |
// {{{ methods
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Get the version.
String version = MainApplication.getVersionString();
// Determine the context theme.
final Context context = new ContextThemeWrapper(getActivity(), R.style.Theme_Sherlock_Light_Dialog);
// Inflate the view and set the contents.
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.about_application_dialog_fragment, null);
TextView textview = (TextView) view.findViewById(R.id.about_application_dialog_fragment_text);
textview.setText(Html.fromHtml(getString(R.string.about_application_text, version)));
textview.setLinksClickable(true);
textview.setMovementMethod(LinkMovementMethod.getInstance());
// Create the dialog.
return new AlertDialog.Builder(context).setIcon(R.drawable.ic_launcher).setTitle(getString(R.string.about_app_name, getString(R.string.app_name))).setView(view).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
}).create();
}Example 22
| Project: mediarouter-abs-master File: MediaRouterThemeHelper.java View source code |
public static Context createThemedContext(Context context, boolean forceDark) {
boolean isLightTheme = isLightTheme(context);
if (isLightTheme && forceDark) {
context = new ContextThemeWrapper(context, R.style.Theme_Sherlock);
isLightTheme = false;
}
return new ContextThemeWrapper(context, isLightTheme ? R.style.Theme_MediaRouter_Light : R.style.Theme_MediaRouter);
}Example 23
| Project: xpress-master File: PromptDialogFragment.java View source code |
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Log.i(TAG, "onCreateDialog");
String title = "";
if (getArguments() != null) {
title = getArguments().getString(TITLE);
}
ContextThemeWrapper context = new ContextThemeWrapper(getActivity(), android.R.style.Theme_Dialog);
return new AlertDialog.Builder(context).setTitle(title).setPositiveButton(R.string.confirm, mListener).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
dismiss();
}
}).create();
}Example 24
| Project: ytdownloader-2-master File: PopUps.java View source code |
public static void showPopUp(String title, String message, String type, Context context) {
AlertDialog.Builder helpBuilder = new AlertDialog.Builder(new ContextThemeWrapper(context, R.style.BoxTheme));
helpBuilder.setTitle(title);
helpBuilder.setMessage(message);
if (type == "alert") {
icon = android.R.drawable.ic_dialog_alert;
} else if (type == "info") {
icon = android.R.drawable.ic_dialog_info;
}
helpBuilder.setIcon(icon);
helpBuilder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// Do nothing but close the dialog
}
});
AlertDialog helpDialog = helpBuilder.create();
if (!((Activity) context).isFinishing()) {
helpDialog.show();
} else {
Utils.logger("w", "PopUp not showed", "PopUps");
}
}Example 25
| Project: ajaxAquery-master File: DialogUtils.java View source code |
/**
* Checks if a dialog is open.
*
* @return true if dialog is open
*/
private boolean isDialogOpen() {
final Activity activity = activityUtils.getCurrentActivity(false);
final View view = viewFetcher.getRecentDecorView(viewFetcher.getWindowDecorViews());
Context viewContext = null;
if (view != null) {
viewContext = view.getContext();
}
if (viewContext instanceof ContextThemeWrapper) {
ContextThemeWrapper ctw = (ContextThemeWrapper) viewContext;
viewContext = ctw.getBaseContext();
}
Context activityContext = activity;
Context activityBaseContext = activity.getBaseContext();
return (activityContext.equals(viewContext) || activityBaseContext.equals(viewContext)) && (view != activity.getWindow().getDecorView());
}Example 26
| Project: AndroidChromium-master File: AboutChromePreferences.java View source code |
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getActivity().setTitle(R.string.prefs_about_chrome);
addPreferencesFromResource(R.xml.about_chrome_preferences);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
ChromeBasePreference deprecationWarning = new ChromeBasePreference(new ContextThemeWrapper(getActivity(), R.style.DeprecationWarningPreferenceTheme));
deprecationWarning.setOrder(-1);
deprecationWarning.setTitle(R.string.deprecation_warning);
deprecationWarning.setIcon(R.drawable.exclamation_triangle);
getPreferenceScreen().addPreference(deprecationWarning);
}
PrefServiceBridge prefServiceBridge = PrefServiceBridge.getInstance();
AboutVersionStrings versionStrings = prefServiceBridge.getAboutVersionStrings();
Preference p = findPreference(PREF_APPLICATION_VERSION);
p.setSummary(getApplicationVersion(getActivity(), versionStrings.getApplicationVersion()));
p = findPreference(PREF_OS_VERSION);
p.setSummary(versionStrings.getOSVersion());
p = findPreference(PREF_LEGAL_INFORMATION);
int currentYear = Calendar.getInstance().get(Calendar.YEAR);
p.setSummary(getString(R.string.legal_information_summary, currentYear));
}Example 27
| Project: AndroidStatus-master File: DialogOverridePwm.java View source code |
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// TODO improve getting current theme
final int themeId = R.style.AlertDialogStyle;
final ContextThemeWrapper themeWrapper = new ContextThemeWrapper(getActivity(), themeId);
LayoutInflater inflater = getActivity().getLayoutInflater().cloneInContext(themeWrapper);
AlertDialog.Builder builder = new AlertDialog.Builder(themeWrapper, themeId);
View root = inflater.inflate(R.layout.dlg_override_pwm, null);
findViews(root);
Bundle args = getArguments();
if (args != null) {
pwmChannel = args.getInt(CHANNEL_KEY);
currentValue = args.getShort(VALUE_KEY);
tvTitle.setText(args.getString(MESSAGE_KEY));
}
seek.setProgress(currentValue);
updateProgressText();
builder.setTitle(R.string.titleOverride).setView(root).setPositiveButton(R.string.buttonUpdate, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
updateOverride(currentValue);
}
}).setNegativeButton(R.string.buttonCancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dismiss();
}
}).setNeutralButton(R.string.buttonClear, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
updateOverride(Globals.OVERRIDE_DISABLE);
}
});
return builder.create();
}Example 28
| Project: fdroidclient-master File: UninstallDialogActivity.java View source code |
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final Intent intent = getIntent();
final Apk apk = intent.getParcelableExtra(Installer.EXTRA_APK);
PackageManager pm = getPackageManager();
ApplicationInfo appInfo;
try {
//noinspection WrongConstant (lint is actually wrong here!)
appInfo = pm.getApplicationInfo(apk.packageName, PackageManager.GET_UNINSTALLED_PACKAGES);
} catch (PackageManager.NameNotFoundException e) {
throw new RuntimeException("Failed to get ApplicationInfo for uninstalling");
}
final boolean isSystem = (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0;
final boolean isUpdate = (appInfo.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0;
if (isSystem && !isUpdate) {
// Cannot remove system apps unless we're uninstalling updates
throw new RuntimeException("Cannot remove system apps unless we're uninstalling updates");
}
int messageId;
if (isUpdate) {
messageId = R.string.uninstall_update_confirm;
} else {
messageId = R.string.uninstall_confirm;
}
// hack to get theme applied (which is not automatically applied due to activity's Theme.NoDisplay
ContextThemeWrapper theme = new ContextThemeWrapper(this, FDroidApp.getCurThemeResId());
final AlertDialog.Builder builder = new AlertDialog.Builder(theme);
builder.setTitle(appInfo.loadLabel(pm));
builder.setIcon(appInfo.loadIcon(pm));
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent data = new Intent();
data.putExtra(Installer.EXTRA_APK, apk);
setResult(Activity.RESULT_OK, intent);
finish();
}
});
builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
setResult(Activity.RESULT_CANCELED);
finish();
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
setResult(Activity.RESULT_CANCELED);
finish();
}
});
builder.setMessage(messageId);
builder.create().show();
}Example 29
| Project: hintcase-master File: DimenUtils.java View source code |
public static Point getRealScreenSize(Context context) {
Point size = new Point();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = windowManager.getDefaultDisplay();
display.getRealSize(size);
} else {
View decorView = null;
if (context instanceof Activity) {
decorView = ((Activity) context).getWindow().getDecorView();
} else if (context instanceof ContextThemeWrapper) {
Context baseContext = ((ContextThemeWrapper) context).getBaseContext();
if (baseContext instanceof Activity) {
decorView = ((Activity) baseContext).getWindow().getDecorView();
}
}
if (decorView != null) {
size.x = decorView.getWidth();
size.y = decorView.getHeight();
}
}
return size;
}Example 30
| Project: itsnat_droid-master File: ClassDescView_widget_Spinner.java View source code |
private View createSpinnerObject(int idStyle, String spinnerMode, Context ctx) {
int mode;
if (spinnerMode != null) {
if ("dialog".equals(spinnerMode))
mode = Spinner.MODE_DIALOG;
else if ("dropdown".equals(spinnerMode))
mode = Spinner.MODE_DROPDOWN;
else
throw new ItsNatDroidException("Unrecognized value name " + spinnerMode + " for attribute");
} else
// MODE_THEME = -1 es decir se delega en el atributo spinnerMode y si no está definido (que es el caso de layouts dinámico) en lo que diga el theme que suele ser dropdown
mode = -1;
View view;
if (idStyle != 0) {
// La aplicación de un style de todas formas hace alguna cosa rara, si se puede, evitar usar style en un Spinner
if (mode != -1)
view = new Spinner(new ContextThemeWrapper(ctx, idStyle), (AttributeSet) null, 0, /*idStyle */
mode);
else
view = new Spinner(new ContextThemeWrapper(ctx, idStyle), (AttributeSet) null, 0);
} else {
// Es importante llamar a estos constructores y no pasar un idStyle con 0 pues Spinner define un style por defecto en el constructor que es "mandatory" si no especificamos uno explÃcitamente
if (mode != -1)
view = new Spinner(ctx, mode);
else
// El constructor de un sólo param también vale
view = new Spinner(ctx, (AttributeSet) null);
}
return view;
}Example 31
| Project: liferay-screens-master File: ReviewFragment.java View source code |
@Override
public void onDDLFormRecordAdded(Record record) {
SessionContext.createBasicSession(getString(R.string.default_user), getString(R.string.default_password));
goToCategory();
AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(getContext(), R.style.AlertDialogCustom)).setTitle(R.string.sorry_for_the_experience).setMessage(R.string.we_will_get_in_contact).setPositiveButton("Ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
builder.create().show();
}Example 32
| Project: open-keychain-master File: InstallDialogFragmentHelper.java View source code |
public static AlertDialog getInstallDialogFromArgs(Bundle args, final Activity activity, final int messengerMiddleButtonClicked, final int messengerDialogDimissed) {
final Messenger messenger = args.getParcelable(ARG_MESSENGER);
final int title = args.getInt(ARG_TITLE);
final int message = args.getInt(ARG_MESSAGE);
final int middleButton = args.getInt(ARG_MIDDLE_BUTTON);
final String installPath = args.getString(ARG_INSTALL_PATH);
final boolean useMiddleButton = args.getBoolean(ARG_USE_MIDDLE_BUTTON);
ContextThemeWrapper theme = ThemeChanger.getDialogThemeWrapper(activity);
CustomAlertDialogBuilder builder = new CustomAlertDialogBuilder(theme);
builder.setTitle(title).setMessage(message);
builder.setNegativeButton(R.string.orbot_install_dialog_cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Message msg = Message.obtain();
msg.what = messengerDialogDimissed;
try {
messenger.send(msg);
} catch (RemoteException e) {
Log.w(Constants.TAG, "Exception sending message, Is handler present?", e);
} catch (NullPointerException e) {
Log.w(Constants.TAG, "Messenger is null!", e);
}
}
});
builder.setPositiveButton(R.string.orbot_install_dialog_install, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Uri uri = Uri.parse(installPath);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
activity.startActivity(intent);
Message msg = Message.obtain();
msg.what = messengerDialogDimissed;
try {
messenger.send(msg);
} catch (RemoteException e) {
Log.w(Constants.TAG, "Exception sending message, Is handler present?", e);
} catch (NullPointerException e) {
Log.w(Constants.TAG, "Messenger is null!", e);
}
}
});
if (useMiddleButton) {
builder.setNeutralButton(middleButton, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Message msg = Message.obtain();
msg.what = messengerMiddleButtonClicked;
try {
messenger.send(msg);
} catch (RemoteException e) {
Log.w(Constants.TAG, "Exception sending message, Is handler present?", e);
} catch (NullPointerException e) {
Log.w(Constants.TAG, "Messenger is null!", e);
}
}
});
}
return builder.show();
}Example 33
| Project: sbt-android-master File: TelescopeAppContainer.java View source code |
@Override
public void onCapture(File file) {
dialog.dismiss();
Context toastContext = new ContextThemeWrapper(activity, android.R.style.Theme_DeviceDefault_Dialog);
LayoutInflater toastInflater = LayoutInflater.from(toastContext);
Toast toast = Toast.makeText(toastContext, "", Toast.LENGTH_SHORT);
View toastView = toastInflater.inflate(R.layout.telescope_tutorial_toast, null);
toast.setView(toastView);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
}Example 34
| Project: Tacere-master File: TutorialCrashReporterFragment.java View source code |
@Override
public void onClick(View v) {
AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(getActivity(), android.R.style.Theme_DeviceDefault_Dialog));
builder.setTitle(R.string.tutorial_crash_report_sample_title).setPositiveButton(R.string.close, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//nothing to do
}
});
WebView webView = new WebView(getActivity());
webView.loadUrl("file:///android_asset/sample_bug_report.html");
builder.setView(webView);
builder.show();
}Example 35
| Project: u2020-master File: TelescopeViewContainer.java View source code |
@Override
public void onCapture(File file) {
dialog.dismiss();
Context toastContext = new ContextThemeWrapper(activity, android.R.style.Theme_DeviceDefault_Dialog);
LayoutInflater toastInflater = LayoutInflater.from(toastContext);
Toast toast = Toast.makeText(toastContext, "", Toast.LENGTH_SHORT);
View toastView = toastInflater.inflate(R.layout.telescope_tutorial_toast, null);
toast.setView(toastView);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
}Example 36
| Project: u2020-mvp-master File: DebugViewContainer.java View source code |
@Override
public ViewGroup forActivity(final Activity activity) {
activity.setContentView(R.layout.debug_activity_frame);
final ViewHolder viewHolder = new ViewHolder();
ButterKnife.bind(viewHolder, activity);
final Context drawerContext = new ContextThemeWrapper(activity, R.style.Theme_U2020_Debug);
final DebugView debugView = new DebugView(drawerContext);
viewHolder.debugDrawer.addView(debugView);
// Set up the contextual actions to watch views coming in and out of the content area.
ContextualDebugActions contextualActions = debugView.getContextualDebugActions();
contextualActions.setActionClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
viewHolder.drawerLayout.closeDrawers();
}
});
viewHolder.content.setOnHierarchyChangeListener(HierarchyTreeChangeListener.wrap(contextualActions));
viewHolder.drawerLayout.setDrawerShadow(R.drawable.debug_drawer_shadow, GravityCompat.END);
viewHolder.drawerLayout.setDrawerListener(new DrawerLayout.SimpleDrawerListener() {
@Override
public void onDrawerOpened(View drawerView) {
debugView.onDrawerOpened();
}
});
// If you have not seen the debug drawer before, show it with a message
if (!seenDebugDrawer.get()) {
viewHolder.drawerLayout.postDelayed(() -> {
viewHolder.drawerLayout.openDrawer(GravityCompat.END);
Toast.makeText(drawerContext, R.string.debug_drawer_welcome, Toast.LENGTH_LONG).show();
}, 1000);
seenDebugDrawer.set(true);
}
final CompositeSubscription subscriptions = new CompositeSubscription();
setupMadge(viewHolder, subscriptions);
setupScalpel(viewHolder, subscriptions);
final Application app = activity.getApplication();
app.registerActivityLifecycleCallbacks(new ActivityHierarchyServer.Empty() {
@Override
public void onActivityDestroyed(Activity lifecycleActivity) {
if (lifecycleActivity == activity) {
subscriptions.unsubscribe();
app.unregisterActivityLifecycleCallbacks(this);
}
}
});
riseAndShine(activity);
return viewHolder.content;
}Example 37
| Project: android_Browser-master File: AutologinBar.java View source code |
public void updateAutoLogin(Tab tab, boolean animate) {
DeviceAccountLogin login = tab.getDeviceAccountLogin();
if (login != null) {
mAutoLoginHandler = login;
ContextThemeWrapper wrapper = new ContextThemeWrapper(mContext, android.R.style.Theme_Holo_Light);
mAccountsAdapter = new ArrayAdapter<String>(wrapper, android.R.layout.simple_spinner_item, login.getAccountNames());
mAccountsAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mAutoLoginAccount.setAdapter(mAccountsAdapter);
mAutoLoginAccount.setSelection(0);
mAutoLoginAccount.setEnabled(true);
mAutoLoginLogin.setEnabled(true);
mAutoLoginProgress.setVisibility(View.INVISIBLE);
mAutoLoginError.setVisibility(View.GONE);
switch(login.getState()) {
case DeviceAccountLogin.PROCESSING:
mAutoLoginAccount.setEnabled(false);
mAutoLoginLogin.setEnabled(false);
mAutoLoginProgress.setVisibility(View.VISIBLE);
break;
case DeviceAccountLogin.FAILED:
mAutoLoginProgress.setVisibility(View.INVISIBLE);
mAutoLoginError.setVisibility(View.VISIBLE);
break;
case DeviceAccountLogin.INITIAL:
break;
default:
throw new IllegalStateException();
}
showAutoLogin(animate);
} else {
hideAutoLogin(animate);
}
}Example 38
| Project: android_packages_apps-master File: AutologinBar.java View source code |
public void updateAutoLogin(Tab tab, boolean animate) {
DeviceAccountLogin login = tab.getDeviceAccountLogin();
if (login != null) {
mAutoLoginHandler = login;
ContextThemeWrapper wrapper = new ContextThemeWrapper(mContext, android.R.style.Theme_Holo_Light);
mAccountsAdapter = new ArrayAdapter<String>(wrapper, android.R.layout.simple_spinner_item, login.getAccountNames());
mAccountsAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mAutoLoginAccount.setAdapter(mAccountsAdapter);
mAutoLoginAccount.setSelection(0);
mAutoLoginAccount.setEnabled(true);
mAutoLoginLogin.setEnabled(true);
mAutoLoginProgress.setVisibility(View.INVISIBLE);
mAutoLoginError.setVisibility(View.GONE);
switch(login.getState()) {
case DeviceAccountLogin.PROCESSING:
mAutoLoginAccount.setEnabled(false);
mAutoLoginLogin.setEnabled(false);
mAutoLoginProgress.setVisibility(View.VISIBLE);
break;
case DeviceAccountLogin.FAILED:
mAutoLoginProgress.setVisibility(View.INVISIBLE);
mAutoLoginError.setVisibility(View.VISIBLE);
break;
case DeviceAccountLogin.INITIAL:
break;
default:
throw new IllegalStateException();
}
showAutoLogin(animate);
} else {
hideAutoLogin(animate);
}
}Example 39
| Project: browser.apk-master File: AutologinBar.java View source code |
public void updateAutoLogin(Tab tab, boolean animate) {
DeviceAccountLogin login = tab.getDeviceAccountLogin();
if (login != null) {
mAutoLoginHandler = login;
ContextThemeWrapper wrapper = new ContextThemeWrapper(mContext, android.R.style.Theme_Holo_Light);
mAccountsAdapter = new ArrayAdapter<String>(wrapper, android.R.layout.simple_spinner_item, login.getAccountNames());
mAccountsAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mAutoLoginAccount.setAdapter(mAccountsAdapter);
mAutoLoginAccount.setSelection(0);
mAutoLoginAccount.setEnabled(true);
mAutoLoginLogin.setEnabled(true);
mAutoLoginProgress.setVisibility(View.INVISIBLE);
mAutoLoginError.setVisibility(View.GONE);
switch(login.getState()) {
case DeviceAccountLogin.PROCESSING:
mAutoLoginAccount.setEnabled(false);
mAutoLoginLogin.setEnabled(false);
mAutoLoginProgress.setVisibility(View.VISIBLE);
break;
case DeviceAccountLogin.FAILED:
mAutoLoginProgress.setVisibility(View.INVISIBLE);
mAutoLoginError.setVisibility(View.VISIBLE);
break;
case DeviceAccountLogin.INITIAL:
break;
default:
throw new IllegalStateException();
}
showAutoLogin(animate);
} else {
hideAutoLogin(animate);
}
}Example 40
| Project: dashclock-master File: HelpUtils.java View source code |
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Get app version
PackageManager pm = getActivity().getPackageManager();
String packageName = getActivity().getPackageName();
String versionName;
try {
PackageInfo info = pm.getPackageInfo(packageName, 0);
versionName = info.versionName;
} catch (PackageManager.NameNotFoundException e) {
versionName = VERSION_UNAVAILABLE;
}
// Build the about body view and append the link to see OSS licenses
Context themedContext = new ContextThemeWrapper(getActivity(), R.style.Theme_Dialog);
LayoutInflater layoutInflater = LayoutInflater.from(themedContext);
View rootView = layoutInflater.inflate(R.layout.dialog_about, null);
TextView nameAndVersionView = (TextView) rootView.findViewById(R.id.app_name_and_version);
nameAndVersionView.setText(Html.fromHtml(getString(R.string.app_name_and_version, versionName)));
TextView aboutBodyView = (TextView) rootView.findViewById(R.id.about_body);
aboutBodyView.setText(Html.fromHtml(getString(R.string.about_body)));
aboutBodyView.setMovementMethod(new LinkMovementMethod());
return new AlertDialog.Builder(getActivity(), R.style.Theme_Dialog).setView(rootView).setPositiveButton(R.string.close, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
dialog.dismiss();
}
}).create();
}Example 41
| Project: Douya-master File: TintHelper.java View source code |
public static void onPanelMenuCreated(int featureId, Menu menu, AppCompatActivity activity) {
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
Context context = activity.getSupportActionBar().getThemedContext();
ColorStateList menuTintList = ViewUtils.getColorStateListFromAttrRes(R.attr.colorControlNormal, context);
int popupThemeResId = ViewUtils.getResIdFromAttrRes(R.attr.popupTheme, 0, context);
ColorStateList subMenuTintList;
if (popupThemeResId != 0) {
Context popupContext = new ContextThemeWrapper(context, popupThemeResId);
subMenuTintList = ViewUtils.getColorStateListFromAttrRes(R.attr.colorControlNormal, popupContext);
} else {
subMenuTintList = menuTintList;
}
tintMenuItemIcon(menu, menuTintList, subMenuTintList);
}
}Example 42
| Project: Expense-Tracker-App-master File: DialogManager.java View source code |
private AlertDialog createAlertDialog(Activity activity, String title, View dialogLayout, String message, String confirmText, String negativeText, final DialogInterface.OnClickListener listener) {
ContextThemeWrapper ctw = new ContextThemeWrapper(activity, R.style.DialogTheme);
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(ctw);
dialogBuilder.setTitle(title);
if (dialogLayout != null)
dialogBuilder.setView(dialogLayout);
if (message != null)
dialogBuilder.setMessage(message);
dialogBuilder.setCancelable(false);
dialogBuilder.setPositiveButton(confirmText, listener);
dialogBuilder.setNegativeButton(negativeText, listener);
AlertDialog alertDialog = dialogBuilder.create();
alertDialog.show();
return alertDialog;
}Example 43
| Project: FastLayout-master File: DefaultAttributesConverter.java View source code |
@Override
public LayoutAttribute onConvertLayoutAttribute(String attributeStartValue, String attributeValue, String attributeName, boolean isString) {
switch(attributeName) {
case "style":
return new LayoutAttribute(LayoutAttribute.Type.LAYOUT_CONSTRUCTOR_3, attributeValue);
case "android:theme":
return new LayoutAttribute(LayoutAttribute.Type.LAYOUT_CONSTRUCTOR_1, "new android.view.ContextThemeWrapper(" + "getContext(), " + attributeValue + ")");
case "android:layout_gravity":
return new LayoutAttribute(LayoutAttribute.Type.PARAM, attribute(attributeName.replace("android:layout_", ""), attributeValue));
case "android:background":
if (String.valueOf(attributeStartValue).startsWith("R.drawable.") || String.valueOf(attributeStartValue).startsWith("android.R.drawable.")) {
return new LayoutAttribute(setter("BackgroundResource", attributeStartValue, false));
}
break;
//Todo : textView attribute
case "android:textSize":
if (attributeStartValue.endsWith("sp")) {
return new LayoutAttribute(setter("TextSize", "TypedValue.COMPLEX_UNIT_SP," + attributeStartValue.replace("sp", ""), false));
} else if (attributeStartValue.endsWith("dip") || attributeStartValue.endsWith("dp")) {
return new LayoutAttribute(setter("TextSize", "TypedValue.COMPLEX_UNIT_DIP," + attributeStartValue.replace("dip", "").replace("dp", ""), false));
}
//Todo : viewgroup attribute
case "android:animateLayoutChanges":
if (Boolean.valueOf(attributeValue)) {
return new LayoutAttribute(setter("LayoutTransition", "new android.animation.LayoutTransition()", false));
} else {
return new LayoutAttribute(setter("LayoutTransition", "LayoutUtils.getDisabledLayoutTransition()", false));
}
case "android:transformPivotX":
return new LayoutAttribute(setter("PivotX", attributeValue, false));
case "android:transformPivotY":
return new LayoutAttribute(setter("PivotY", attributeValue, false));
}
//Todo : list with all
if (attributeName.startsWith("android:nextFocus")) {
return new LayoutAttribute(setter(attributeToName(attributeName) + "Id", attributeStartValue, false));
}
return null;
}Example 44
| Project: GWSHolmesWatson-master File: PreferenceInit.java View source code |
@Override
public int resolveThemeForContext(Context context, int invalidTheme) {
int theme, mod = 0;
TypedValue outValue = new TypedValue();
context.obtainStyledAttributes(new int[] { R.attr.preferenceTheme }).getValue(0, outValue);
switch(outValue.type) {
case TypedValue.TYPE_REFERENCE:
if (new ContextThemeWrapper(context, theme = outValue.resourceId).obtainStyledAttributes(new int[] { R.attr.holoTheme }).getInt(0, 0) == 4) {
return theme;
}
break;
case TypedValue.TYPE_INT_DEC:
case TypedValue.TYPE_INT_HEX:
mod = outValue.resourceId;
break;
}
theme = THEME_FLAG;
if (context instanceof Activity) {
if (mod == 0 || mod == ThemeManager.getDefaultTheme()) {
mod = ThemeManager.getThemeType(context);
if (mod == PreferenceInit.THEME_FLAG) {
theme = mod;
mod = 0;
} else if (mod == ThemeManager.INVALID) {
mod = ThemeManager.getDefaultTheme() & ThemeManager.COLOR_SCHEME_MASK;
if (mod == 0) {
mod = ThemeManager.DARK;
}
}
}
if (mod > 0) {
theme |= mod & ThemeManager.COLOR_SCHEME_MASK;
}
} else {
theme |= ThemeManager.getDefaultTheme() & ThemeManager.COLOR_SCHEME_MASK;
}
theme = ThemeManager.getThemeResource(theme, false);
if (theme == ThemeManager.getDefaultTheme() || theme == 0) {
theme = sThemes.getDarkTheme();
}
return theme;
}Example 45
| Project: Hancel-master File: PreferenceInit.java View source code |
@Override
public int resolveThemeForContext(Context context, int invalidTheme) {
int theme, mod = 0;
TypedValue outValue = new TypedValue();
TypedArray a;
(a = context.obtainStyledAttributes(new int[] { R.attr.preferenceTheme })).getValue(0, outValue);
a.recycle();
switch(outValue.type) {
case TypedValue.TYPE_REFERENCE:
if (new ContextThemeWrapper(context, theme = outValue.resourceId).obtainStyledAttributes(new int[] { R.attr.holoTheme }).getInt(0, 0) == 4) {
return theme;
}
break;
case TypedValue.TYPE_INT_DEC:
case TypedValue.TYPE_INT_HEX:
mod = outValue.resourceId;
break;
}
theme = THEME_FLAG;
if (context instanceof Activity) {
if (mod == 0 || mod == ThemeManager.getDefaultTheme()) {
mod = ThemeManager.getThemeType(context);
if (mod == PreferenceInit.THEME_FLAG) {
theme = mod;
mod = 0;
} else if (mod == ThemeManager.INVALID) {
mod = ThemeManager.getDefaultTheme() & ThemeManager.COLOR_SCHEME_MASK;
if (mod == 0) {
mod = ThemeManager.DARK;
}
}
}
if (mod > 0) {
theme |= mod & ThemeManager.COLOR_SCHEME_MASK;
}
} else {
theme |= ThemeManager.getDefaultTheme() & ThemeManager.COLOR_SCHEME_MASK;
}
theme = ThemeManager.getThemeResource(theme, false);
if (theme == ThemeManager.getDefaultTheme() || theme == 0) {
theme = sThemes.getDarkTheme();
}
return theme;
}Example 46
| Project: lyrics-master File: MaterialSuggestionsSearchView.java View source code |
public void refreshSuggestions() {
Editable text;
if (getContext() instanceof Activity)
text = ((EditText) ((Activity) getContext()).findViewById(R.id.searchTextView)).getText();
else if (getContext() instanceof ContextThemeWrapper)
text = ((EditText) ((Activity) ((ContextThemeWrapper) getContext()).getBaseContext()).findViewById(R.id.searchTextView)).getText();
else if (getContext() instanceof android.support.v7.view.ContextThemeWrapper)
text = ((EditText) ((Activity) ((android.support.v7.view.ContextThemeWrapper) getContext()).getBaseContext()).findViewById(R.id.searchTextView)).getText();
else
return;
setQuery(text, false);
}Example 47
| Project: MusesClient-master File: UpToUserDialogFragment.java View source code |
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
DebugFileLog.write(TAG + "| onCreateDialog");
LayoutInflater inflater = getActivity().getLayoutInflater();
View layout = inflater.inflate(R.layout.dialog_uptouser, null);
dialogHeader = (TextView) layout.findViewById(R.id.dialog_uptouser_title);
dialogBody = (TextView) layout.findViewById(R.id.dialog_uptouser_body);
proceedButton = (Button) layout.findViewById(R.id.dialog_uptouser_button_proceed);
cancelButton = (Button) layout.findViewById(R.id.dialog_uptouser_button_cancel);
dialogHeader.setText(title);
if (body == null || body.isEmpty()) {
// if there is no message that we can show to the user, just dismiss the dialog
Log.d(TAG, "no message found for the dialog");
dismiss();
onDestroy();
}
try {
splitBody = body.split("\\n");
} catch (NullPointerException e) {
Log.d(TAG, "cannot split string, therefore make the details text the same as the title");
splitBody = new String[2];
splitBody[0] = body;
splitBody[1] = body;
}
dialogBody.setText(splitBody[0]);
proceedButton.setOnClickListener(this);
cancelButton.setOnClickListener(this);
ContextThemeWrapper context = new ContextThemeWrapper(getActivity(), android.R.style.Theme_Holo_Light_Dialog_NoActionBar);
return new AlertDialog.Builder(context).setView(layout).create();
}Example 48
| Project: open-android-v3-master File: CardPaymentFragment.java View source code |
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
// create ContextThemeWrapper from the original Activity Context with the custom theme
final Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), R.style.PagerIndicatorDefaultNewWithDivider);
// clone the inflater using the ContextThemeWrapper
LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper);
// Inflate the layout for this fragment
View rootView = localInflater.inflate(R.layout.fragment_card_payment, container, false);
FragmentStatePagerAdapter adapter = new SavePayAdapter(getChildFragmentManager());
ViewPager pager = (ViewPager) rootView.findViewById(R.id.pager);
pager.setOffscreenPageLimit(4);
pager.setAdapter(adapter);
TabPageIndicator indicator = (TabPageIndicator) rootView.findViewById(R.id.indicator);
indicator.setViewPager(pager);
return rootView;
}Example 49
| Project: p2pkit-quickstart-android-master File: ColorPickerFragment.java View source code |
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.color_picker_fragment, null);
int oldColor = getArguments().getInt(COLOR_KEY);
mPicker = (ColorPicker) view.findViewById(R.id.picker);
mPicker.setShowOldCenterColor(false);
mPicker.setColor(oldColor);
AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(getActivity(), R.style.P2PKitAlertDialog));
builder.setView(view);
builder.setTitle(R.string.choose_color);
builder.setPositiveButton(R.string.set, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
mListener.onColorPicked(mPicker.getColor());
}
});
builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dismiss();
}
});
return builder.create();
}Example 50
| Project: packages_apps_settings-master File: CreateShortcut.java View source code |
private Bitmap createIcon(int resource) {
Context context = new ContextThemeWrapper(this, android.R.style.Theme_Material);
View view = LayoutInflater.from(context).inflate(R.layout.shortcut_badge, null);
((ImageView) view.findViewById(android.R.id.icon)).setImageResource(resource);
int spec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
view.measure(spec, spec);
Bitmap bitmap = Bitmap.createBitmap(view.getMeasuredWidth(), view.getMeasuredHeight(), Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
view.draw(canvas);
return bitmap;
}Example 51
| Project: pcs-master File: ContactPostStaff.java View source code |
/**
* Creates a Dialog for the user to choose Dialer app or SMS app
* @param v the view clicked
* @param numberToContact contact number corresponding to the view
*/
private void createDialog(View v, final String numberToContact) {
DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int optionSelected) {
contactStaff(optionSelected, numberToContact);
}
};
AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(v.getContext(), R.style.pcsaAlertDialogStyle));
builder.setMessage("Contact Via").setPositiveButton("Voice Call", dialogClickListener).setNegativeButton("Send Message", dialogClickListener).show();
}Example 52
| Project: penn-mobile-android-master File: MainActivityTest.java View source code |
@Override
protected void setUp() throws Exception {
super.setUp();
ContextThemeWrapper context = new ContextThemeWrapper(getInstrumentation().getTargetContext(), R.style.AppTheme);
setActivityContext(context);
Intent intent = new Intent(getInstrumentation().getTargetContext(), MainActivity.class);
startActivity(intent, null, null);
activity = getActivity();
mLabs = MainActivity.getLabsInstance();
}Example 53
| Project: platform_frameworks_support-master File: CardPresenter.java View source code |
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent) {
Log.d(TAG, "onCreateViewHolder");
Context context = parent.getContext();
if (mCardThemeResId != 0) {
if (mContextThemeWrapper == null) {
mContextThemeWrapper = new ContextThemeWrapper(context, mCardThemeResId);
}
context = mContextThemeWrapper;
}
ImageCardView v = new ImageCardView(context);
v.setFocusable(true);
v.setFocusableInTouchMode(true);
// aspect ratio.
if (sRand.nextBoolean()) {
v.setMainImageAdjustViewBounds(false);
v.setMainImageDimensions(getRowHeight(parent.getContext()), getRowHeight(parent.getContext()));
} else {
v.setMainImageAdjustViewBounds(true);
v.setMainImageDimensions(LayoutParams.WRAP_CONTENT, getRowHeight(parent.getContext()));
}
return new ViewHolder(v);
}Example 54
| Project: platform_packages_apps_browser-master File: AutologinBar.java View source code |
public void updateAutoLogin(Tab tab, boolean animate) {
DeviceAccountLogin login = tab.getDeviceAccountLogin();
if (login != null) {
mAutoLoginHandler = login;
ContextThemeWrapper wrapper = new ContextThemeWrapper(mContext, android.R.style.Theme_Holo_Light);
mAccountsAdapter = new ArrayAdapter<String>(wrapper, android.R.layout.simple_spinner_item, login.getAccountNames());
mAccountsAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mAutoLoginAccount.setAdapter(mAccountsAdapter);
mAutoLoginAccount.setSelection(0);
mAutoLoginAccount.setEnabled(true);
mAutoLoginLogin.setEnabled(true);
mAutoLoginProgress.setVisibility(View.INVISIBLE);
mAutoLoginError.setVisibility(View.GONE);
switch(login.getState()) {
case DeviceAccountLogin.PROCESSING:
mAutoLoginAccount.setEnabled(false);
mAutoLoginLogin.setEnabled(false);
mAutoLoginProgress.setVisibility(View.VISIBLE);
break;
case DeviceAccountLogin.FAILED:
mAutoLoginProgress.setVisibility(View.INVISIBLE);
mAutoLoginError.setVisibility(View.VISIBLE);
break;
case DeviceAccountLogin.INITIAL:
break;
default:
throw new IllegalStateException();
}
showAutoLogin(animate);
} else {
hideAutoLogin(animate);
}
}Example 55
| Project: platform_packages_apps_settings-master File: CreateShortcut.java View source code |
private Bitmap createIcon(int resource) {
Context context = new ContextThemeWrapper(this, android.R.style.Theme_Material);
View view = LayoutInflater.from(context).inflate(R.layout.shortcut_badge, null);
((ImageView) view.findViewById(android.R.id.icon)).setImageResource(resource);
int spec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
view.measure(spec, spec);
Bitmap bitmap = Bitmap.createBitmap(view.getMeasuredWidth(), view.getMeasuredHeight(), Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
view.draw(canvas);
return bitmap;
}Example 56
| Project: QuickLyric-master File: MaterialSuggestionsSearchView.java View source code |
public void refreshSuggestions() {
Editable text;
if (getContext() instanceof Activity)
text = ((EditText) ((Activity) getContext()).findViewById(R.id.searchTextView)).getText();
else if (getContext() instanceof ContextThemeWrapper)
text = ((EditText) ((Activity) ((ContextThemeWrapper) getContext()).getBaseContext()).findViewById(R.id.searchTextView)).getText();
else if (getContext() instanceof android.support.v7.view.ContextThemeWrapper)
text = ((EditText) ((Activity) ((android.support.v7.view.ContextThemeWrapper) getContext()).getBaseContext()).findViewById(R.id.searchTextView)).getText();
else
return;
setQuery(text, false);
}Example 57
| Project: SlideDateTimePicker-master File: TimeFragment.java View source code |
/**
* Create and return the user interface view for this fragment.
*/
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
int theme = getArguments().getInt("theme");
int initialHour = getArguments().getInt("hour");
int initialMinute = getArguments().getInt("minute");
boolean isClientSpecified24HourTime = getArguments().getBoolean("isClientSpecified24HourTime");
boolean is24HourTime = getArguments().getBoolean("is24HourTime");
// Unless we inflate using a cloned inflater with a Holo theme,
// on Lollipop devices the TimePicker will be the new-style
// radial TimePicker, which is not what we want. So we will
// clone the inflater that we're given but with our specified
// theme, then inflate the layout with this new inflater.
Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), theme == SlideDateTimePicker.HOLO_DARK ? android.R.style.Theme_Holo : android.R.style.Theme_Holo_Light);
LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper);
View v = localInflater.inflate(R.layout.fragment_time, container, false);
mTimePicker = (TimePicker) v.findViewById(R.id.timePicker);
// block keyboard popping up on touch
mTimePicker.setDescendantFocusability(DatePicker.FOCUS_BLOCK_DESCENDANTS);
mTimePicker.setOnTimeChangedListener(new TimePicker.OnTimeChangedListener() {
@Override
public void onTimeChanged(TimePicker view, int hourOfDay, int minute) {
mCallback.onTimeChanged(hourOfDay, minute);
}
});
// the TimePicker.
if (isClientSpecified24HourTime) {
mTimePicker.setIs24HourView(is24HourTime);
} else {
// If the client does not specify a 24-hour time format, use the
// device default.
mTimePicker.setIs24HourView(DateFormat.is24HourFormat(getTargetFragment().getActivity()));
}
mTimePicker.setCurrentHour(initialHour);
mTimePicker.setCurrentMinute(initialMinute);
// the user toggles the AM/PM button. Only applies to 4.0.0 and 4.0.3.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH && Build.VERSION.SDK_INT <= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
fixTimePickerBug18982();
}
return v;
}Example 58
| Project: TflTravelAlerts-master File: PreferenceInit.java View source code |
@Override
public int resolveThemeForContext(Context context, int invalidTheme) {
int theme, mod = 0;
TypedValue outValue = new TypedValue();
TypedArray a;
(a = context.obtainStyledAttributes(new int[] { R.attr.preferenceTheme })).getValue(0, outValue);
a.recycle();
switch(outValue.type) {
case TypedValue.TYPE_REFERENCE:
if (new ContextThemeWrapper(context, theme = outValue.resourceId).obtainStyledAttributes(new int[] { R.attr.holoTheme }).getInt(0, 0) == 4) {
return theme;
}
break;
case TypedValue.TYPE_INT_DEC:
case TypedValue.TYPE_INT_HEX:
mod = outValue.resourceId;
break;
}
theme = THEME_FLAG;
if (context instanceof Activity) {
if (mod == 0 || mod == ThemeManager.getDefaultTheme()) {
mod = ThemeManager.getThemeType(context);
if (mod == PreferenceInit.THEME_FLAG) {
theme = mod;
mod = 0;
} else if (mod == ThemeManager.INVALID) {
mod = ThemeManager.getDefaultTheme() & ThemeManager.COLOR_SCHEME_MASK;
if (mod == 0) {
mod = ThemeManager.DARK;
}
}
}
if (mod > 0) {
theme |= mod & ThemeManager.COLOR_SCHEME_MASK;
}
} else {
theme |= ThemeManager.getDefaultTheme() & ThemeManager.COLOR_SCHEME_MASK;
}
theme = ThemeManager.getThemeResource(theme, false);
if (theme == ThemeManager.getDefaultTheme() || theme == 0) {
theme = sThemes.getDarkTheme();
}
return theme;
}Example 59
| Project: XBrowser-master File: AutologinBar.java View source code |
public void updateAutoLogin(Tab tab, boolean animate) {
DeviceAccountLogin login = tab.getDeviceAccountLogin();
if (login != null) {
mAutoLoginHandler = login;
ContextThemeWrapper wrapper = new ContextThemeWrapper(mContext, android.R.style.Theme_Holo_Light);
mAccountsAdapter = new ArrayAdapter<String>(wrapper, android.R.layout.simple_spinner_item, login.getAccountNames());
mAccountsAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mAutoLoginAccount.setAdapter(mAccountsAdapter);
mAutoLoginAccount.setSelection(0);
mAutoLoginAccount.setEnabled(true);
mAutoLoginLogin.setEnabled(true);
mAutoLoginProgress.setVisibility(View.INVISIBLE);
mAutoLoginError.setVisibility(View.GONE);
switch(login.getState()) {
case DeviceAccountLogin.PROCESSING:
mAutoLoginAccount.setEnabled(false);
mAutoLoginLogin.setEnabled(false);
mAutoLoginProgress.setVisibility(View.VISIBLE);
break;
case DeviceAccountLogin.FAILED:
mAutoLoginProgress.setVisibility(View.INVISIBLE);
mAutoLoginError.setVisibility(View.VISIBLE);
break;
case DeviceAccountLogin.INITIAL:
break;
default:
throw new IllegalStateException();
}
showAutoLogin(animate);
} else {
hideAutoLogin(animate);
}
}Example 60
| Project: MagicaSakura-master File: TintManager.java View source code |
public static com.bilibili.magicasakura.utils.TintManager get(Context context) {
if (context == null)
return null;
if (context instanceof ContextThemeWrapper) {
context = ((ContextThemeWrapper) context).getBaseContext();
}
if (context instanceof android.view.ContextThemeWrapper) {
context = ((android.view.ContextThemeWrapper) context).getBaseContext();
}
com.bilibili.magicasakura.utils.TintManager tm = INSTANCE_CACHE.get(context);
if (tm == null) {
tm = new com.bilibili.magicasakura.utils.TintManager(context);
INSTANCE_CACHE.put(context, tm);
printLog("[get TintManager] create new TintManager.");
}
return tm;
}Example 61
| Project: remusic-master File: TintManager.java View source code |
public static TintManager get(Context context) {
if (context == null)
return null;
if (context instanceof ContextThemeWrapper) {
context = ((ContextThemeWrapper) context).getBaseContext();
}
if (context instanceof android.view.ContextThemeWrapper) {
context = ((android.view.ContextThemeWrapper) context).getBaseContext();
}
TintManager tm = INSTANCE_CACHE.get(context);
if (tm == null) {
tm = new TintManager(context);
INSTANCE_CACHE.put(context, tm);
printLog("[get TintManager] create new TintManager.");
}
return tm;
}Example 62
| Project: AcDisplay-master File: AboutDialog.java View source code |
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
ContextThemeWrapper context = getActivity();
assert context != null;
String year = Build.TIME_STAMP.substring(Build.TIME_STAMP.lastIndexOf(' ') + 1);
if (year.charAt(0) != '2')
Log.w(TAG, "The build year is corrupted! Check build script.");
String credits = getString(R.string.about_dialog_credits);
@SuppressLint("StringFormatMatches") String src = ResUtils.getString(getResources(), R.string.about_dialog_message, credits, year);
CharSequence message = Html.fromHtml(src);
MaterialDialog md = new MaterialDialog.Builder(context).iconRes(R.drawable.ic_information_outline_white_24dp).title(getVersionName(context)).content(message).negativeText(R.string.close).build();
md.getTitleView().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
switch(mTitleClickNumber++) {
case EASTER_EGGS_CLICK_NUMBER:
/*
Intent intent = new Intent(getActivity(), MainActivity.class)
.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(intent);
*/
// Reset click counter.
mTitleClickNumber = 0;
break;
default:
mTimeStampToast.show(Build.TIME_STAMP, Toast.LENGTH_LONG);
}
}
});
return md;
}Example 63
| Project: Android-Wallet-2-App-master File: RequestForgotPasswordDialog.java View source code |
@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
final FragmentActivity activity = (FragmentActivity) getActivity();
final WalletApplication application = (WalletApplication) activity.getApplication();
final LayoutInflater inflater = LayoutInflater.from(activity);
final Builder dialog = new AlertDialog.Builder(new ContextThemeWrapper(activity, R.style.Theme_Dialog));
dialog.setTitle(R.string.main_password_title);
final View view = inflater.inflate(R.layout.forgot_password_dialog, null);
dialog.setView(view);
final TextView passwordField = (TextView) view.findViewById(R.id.password_field);
final TextView titleTextView = (TextView) view.findViewById(R.id.title_text_view);
titleTextView.setText(R.string.main_password_text);
final Button continueButton = (Button) view.findViewById(R.id.password_continue);
final Button cancelButton = (Button) view.findViewById(R.id.cancel);
continueButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
try {
if (passwordField.getText().toString().trim() == null || passwordField.getText().toString().trim().length() < 1) {
callback.onFail();
}
String localWallet = application.readLocalWallet();
if (!application.decryptLocalWallet(localWallet, passwordField.getText().toString().trim())) {
callback.onFail();
return;
}
String password = passwordField.getText().toString().trim();
application.checkIfWalletHasUpdatedAndFetchTransactions(password, new SuccessCallback() {
@Override
public void onSuccess() {
dismiss();
callback.onSuccess();
}
@Override
public void onFail() {
dismiss();
callback.onFail();
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
});
cancelButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
dismiss();
}
});
Dialog d = dialog.create();
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
lp.dimAmount = 0;
lp.width = WindowManager.LayoutParams.FILL_PARENT;
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
// lp.gravity = Gravity.BOTTOM;
d.show();
d.getWindow().setAttributes(lp);
d.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
return d;
}Example 64
| Project: AndroidMaterialDesignToolbar-master_modified-master File: NightOwl.java View source code |
public static void owlBeforeCreate(Activity activity) {
Window window = activity.getWindow();
LayoutInflater layoutInflater = window.getLayoutInflater();
// replace the inflater in window
LayoutInflater injectLayoutInflater1 = Factory4InjectedInflater.newInstance(layoutInflater, activity);
injectLayoutInflater(injectLayoutInflater1, activity.getWindow(), activity.getWindow().getClass(), WINDOW_INFLATER);
// replace the inflater in current ContextThemeWrapper
LayoutInflater injectLayoutInflater2 = injectLayoutInflater1.cloneInContext(activity);
injectLayoutInflater(injectLayoutInflater2, activity, ContextThemeWrapper.class, THEME_INFLATER);
// insert owlViewContext into root view.
View v = activity.getWindow().getDecorView();
OwlViewContext owlObservable = new OwlViewContext();
insertViewContext(v, owlObservable);
}Example 65
| Project: AndroidRivers-master File: ListMenuPresenter.java View source code |
@Override
public void initForMenu(Context context, 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();
}
}Example 66
| Project: android_packages_inputmethods_LatinIME-master File: KeyboardLayoutSetTestsBase.java View source code |
@Override
protected void setUp() throws Exception {
super.setUp();
final Context context = getContext();
final Resources res = context.getResources();
RichInputMethodManager.init(context);
mRichImm = RichInputMethodManager.getInstance();
// Save and reset additional subtypes preference.
mSavedAdditionalSubtypes = mRichImm.getAdditionalSubtypes();
final InputMethodSubtype[] predefinedAdditionalSubtypes = AdditionalSubtypeUtils.createAdditionalSubtypesArray(AdditionalSubtypeUtils.createPrefSubtypes(res.getStringArray(R.array.predefined_subtypes)));
mRichImm.setAdditionalInputMethodSubtypes(predefinedAdditionalSubtypes);
final KeyboardTheme keyboardTheme = KeyboardTheme.searchKeyboardThemeById(getKeyboardThemeForTests(), KeyboardTheme.KEYBOARD_THEMES);
setContext(new ContextThemeWrapper(getContext(), keyboardTheme.mStyleId));
KeyboardLayoutSet.onKeyboardThemeChanged();
mScreenMetrics = Settings.readScreenMetrics(res);
final InputMethodInfo imi = mRichImm.getInputMethodInfoOfThisIme();
final int subtypeCount = imi.getSubtypeCount();
for (int index = 0; index < subtypeCount; index++) {
mAllSubtypesList.add(imi.getSubtypeAt(index));
}
}Example 67
| Project: AutoClick-master File: DialogUtils.java View source code |
/**
* Checks that the specified DecorView and the Activity DecorView are not equal.
*
* @param activity the activity which DecorView is to be compared
* @param decorView the DecorView to compare
* @return true if not equal
*/
private boolean isDialog(Activity activity, View decorView) {
if (decorView == null || !decorView.isShown() || activity == null) {
return false;
}
Context viewContext = null;
if (decorView != null) {
viewContext = decorView.getContext();
}
if (viewContext instanceof ContextThemeWrapper) {
ContextThemeWrapper ctw = (ContextThemeWrapper) viewContext;
viewContext = ctw.getBaseContext();
}
Context activityContext = activity;
Context activityBaseContext = activity.getBaseContext();
return (activityContext.equals(viewContext) || activityBaseContext.equals(viewContext)) && (decorView != activity.getWindow().getDecorView());
}Example 68
| Project: Coding-Android-master File: DatePickerFragment.java View source code |
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
String dateString = getArguments().getString(PARAM_DATA);
if (dateString.isEmpty()) {
dateString = new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTimeInMillis());
}
boolean maxToday = getArguments().getBoolean(PARAM_MAX_TODYA, false);
String[] date = dateString.split("-");
int year = Integer.valueOf(date[0]);
int month = Integer.valueOf(date[1]) - 1;
int day = Integer.valueOf(date[2]);
Context context = getActivity();
if (isBrokenSamsungDevice()) {
context = new ContextThemeWrapper(getActivity(), android.R.style.Theme_Holo_Light_Dialog);
}
final DatePickerDialog datePickerDialog = new DatePickerDialog(context, this, year, month, day);
if (maxToday) {
datePickerDialog.getDatePicker().setMaxDate(Calendar.getInstance().getTimeInMillis());
}
if (getArguments().getBoolean("clear", false)) {
datePickerDialog.setButton(DialogInterface.BUTTON_NEUTRAL, "清除", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
mDateSet.dateSetResult("", true);
dialog.cancel();
}
});
}
datePickerDialog.setButton(DialogInterface.BUTTON_NEGATIVE, "�消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
datePickerDialog.setButton(DialogInterface.BUTTON_POSITIVE, "确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
DatePicker datePicker = datePickerDialog.getDatePicker();
dateSet(datePicker.getYear(), datePicker.getMonth(), datePicker.getDayOfMonth());
dialog.cancel();
}
});
LinearLayout layoutParent = (LinearLayout) datePickerDialog.getDatePicker().getChildAt(0);
LinearLayout layout = (LinearLayout) layoutParent.getChildAt(0);
for (int i = 0; i < layout.getChildCount(); i++) {
View v = layout.getChildAt(i);
if (v instanceof NumberPicker) {
setNumberPicker((NumberPicker) v);
}
}
return datePickerDialog;
}Example 69
| Project: commcare-master File: SelectInstallModeFragment.java View source code |
private void showLocalAppDialog() {
ContextThemeWrapper wrapper = new ContextThemeWrapper(getContext(), R.style.DialogBaseTheme);
final PaneledChoiceDialog chooseApp = new PaneledChoiceDialog(wrapper, Localization.get("install.choose.local.app"));
DialogChoiceItem[] items = new DialogChoiceItem[mLocalApps.size()];
int count = 0;
for (final MicroNode.AppManifest app : mLocalApps) {
DialogChoiceItem item = new DialogChoiceItem(app.getName(), -1, new View.OnClickListener() {
@Override
public void onClick(View v) {
Activity currentActivity = getActivity();
if (currentActivity instanceof CommCareSetupActivity) {
((CommCareSetupActivity) currentActivity).onURLChosen(app.getLocalUrl());
}
((CommCareActivity) getActivity()).dismissAlertDialog();
}
});
items[count] = item;
count++;
}
chooseApp.setChoiceItems(items);
((CommCareActivity) getActivity()).showAlertDialog(chooseApp);
}Example 70
| Project: Contacts_Eclair_Mod-master File: AccountSelectionUtil.java View source code |
public static Dialog getSelectAccountDialog(Context context, int resId, DialogInterface.OnCancelListener onCancelListener) {
final Sources sources = Sources.getInstance(context);
final List<Account> writableAccountList = sources.getAccounts(true);
// Assume accountList.size() > 1
// Wrap our context to inflate list items using correct theme
final Context dialogContext = new ContextThemeWrapper(context, android.R.style.Theme_Light);
final LayoutInflater dialogInflater = (LayoutInflater) dialogContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final ArrayAdapter<Account> accountAdapter = new ArrayAdapter<Account>(context, android.R.layout.simple_list_item_2, writableAccountList) {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = dialogInflater.inflate(android.R.layout.simple_list_item_2, parent, false);
}
// TODO: show icon along with title
final TextView text1 = (TextView) convertView.findViewById(android.R.id.text1);
final TextView text2 = (TextView) convertView.findViewById(android.R.id.text2);
final Account account = this.getItem(position);
final ContactsSource source = sources.getInflatedSource(account.type, ContactsSource.LEVEL_SUMMARY);
final Context context = getContext();
text1.setText(account.name);
text2.setText(source.getDisplayLabel(context));
return convertView;
}
};
AccountSelectedListener accountSelectedListener = new AccountSelectedListener(context, writableAccountList, resId);
return new AlertDialog.Builder(context).setTitle(R.string.dialog_new_contact_account).setSingleChoiceItems(accountAdapter, 0, accountSelectedListener).setOnCancelListener(accountSelectedListener).create();
}Example 71
| Project: cwac-presentation-master File: PresentationService.java View source code |
private Context createPresoContext(Display display) {
Context displayContext = createDisplayContext(display);
final WindowManager wm = (WindowManager) displayContext.getSystemService(WINDOW_SERVICE);
return (new ContextThemeWrapper(displayContext, getThemeId()) {
@Override
public Object getSystemService(String name) {
if (Context.WINDOW_SERVICE.equals(name)) {
return (wm);
}
return (super.getSystemService(name));
}
});
}Example 72
| Project: Easy-Notification-master File: AboutDialog.java View source code |
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
ContextThemeWrapper context = getActivity();
assert context != null;
String year = Build.TIME_STAMP.substring(Build.TIME_STAMP.lastIndexOf(' ') + 1);
if (year.charAt(0) != '2')
Log.w(TAG, "The build year is corrupted! Check build script.");
CharSequence credits = getString(R.string.about_dialog_credits);
CharSequence message = Html.fromHtml(ResUtils.getString(getResources(), R.string.about_dialog_message, credits, year));
MaterialDialog md = new MaterialDialog.Builder(context).iconRes(R.drawable.ic_action_about_white).title(getVersionName(context)).content(message).negativeText(R.string.close).build();
md.getTitleView().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
switch(mTitleClickNumber++) {
case EASTER_EGGS_CLICK_NUMBER:
/*
Intent intent = new Intent(getActivity(), MainActivity.class)
.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(intent);
*/
// Reset click counter.
mTitleClickNumber = 0;
break;
default:
mTimeStampToast.show(Build.TIME_STAMP, Toast.LENGTH_LONG);
}
}
});
return md;
}Example 73
| Project: enviroCar-app-master File: DialogUtil.java View source code |
public static void createTitleMessageInfoDialog(String title, Spanned message, boolean doNotShowAgainField, DialogCallback callback, Context activity) {
if (!doNotShowAgainField) {
createTitleMessageInfoDialog(title, message, callback, activity);
return;
}
DoNotShowAgainAlertDialog dialog = new DoNotShowAgainAlertDialog(new ContextThemeWrapper(activity, R.style.EnviroCarAlertDialog));
dialog.setMessage(message);
dialog.setTitle(title);
dialog.setCallback(callback);
dialog.show();
}Example 74
| Project: firetweet-master File: QuickMenuFragment.java View source code |
private Context getThemedContext() {
if (mThemedContext != null)
return mThemedContext;
final Context context = getActivity();
final int currentThemeResource = ThemeUtils.getThemeResource(context);
final int themeResource = ThemeUtils.getDrawerThemeResource(currentThemeResource);
return mThemedContext = new ContextThemeWrapper(context, themeResource);
}Example 75
| Project: gdgdevfesthunt-master File: TriviaQuestionActivity.java View source code |
@Override
public boolean onTouch(View v, MotionEvent event) {
final Clue clue = Hunt.getHunt(getResources(), getApplicationContext()).getLastCompletedClue();
// Wait if we're waiting for toast pop.
if (hasAnswered) {
return true;
}
AnswerTextView tv = (AnswerTextView) v;
// Deal with flipping colors on and off
tv.onTouch(tv, event);
// Don't do anything on down besides flip color.
if (event.getAction() != MotionEvent.ACTION_UP) {
return true;
}
final Hunt hunt = Hunt.getHunt(getResources(), getApplicationContext());
hunt.setQuestionState(Hunt.QUESTION_STATE_NONE);
hunt.save(getResources(), getApplicationContext());
DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
};
ContextThemeWrapper ctw = new ContextThemeWrapper(this, R.style.AppTheme);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
boolean isUnderPar = hunt.getSecondsLeft() > 0;
hasAnswered = true;
keepAnimating = false;
if (tv.answerNum == clue.question.correctAnswer) {
builder.setMessage(clue.question.rightMessage).setPositiveButton("OK", dialogClickListener).setCancelable(false).show();
hunt.achievementManager.storeIncrement(AchievementManager.ID_5_TRIVIA_CORRECTLY);
if (isUnderPar) {
hunt.achievementManager.storeIncrement(AchievementManager.ID_TEACHERS_PET);
hunt.achievementManager.onQuestionAnswered(getApiClient(), isUnderPar, this);
}
hunt.save(getResources(), getApplicationContext());
} else {
/*AlertDialog.Builder alertadd = new AlertDialog.Builder(
this);
LayoutInflater factory = LayoutInflater.from(this);
final View view = factory.inflate(R.layout.wronganswer, null);
ImageView nononoImage = (ImageView) view.findViewById(R.id.nonono);
nononoImage.setVisibility(View.VISIBLE);
nononoAnimation.start();
alertadd.setView(view);
alertadd.setMessage(clue.question.wrongMessage);
alertadd.setPositiveButton("OK", dialogClickListener).setCancelable(false).show();
*/
builder.setMessage(clue.question.wrongMessage).setPositiveButton("OK", dialogClickListener).setCancelable(false).show();
}
return true;
}Example 76
| Project: kanshu-android-master File: PracticeExerciseFragment.java View source code |
private void showStatsPopup() {
AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(getActivity(), R.style.Base_Theme_AppCompat_Light_Dialog));
String message = "Correct:" + ((100.0 * mNOfCorrectAnswers) / mNExercises) + "%\nWrong: " + ((100.0 * mNOfWrongAnswers) / mNExercises) + "%";
builder.setMessage(message).setTitle(R.string.exercise_complete).setPositiveButton("Done", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
AlertDialog dialog = builder.create();
dialog.show();
}Example 77
| Project: katbag-master File: ListMenuPresenter.java View source code |
@Override
public void initForMenu(Context context, 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();
}
}Example 78
| Project: kouchat-android-master File: TopicDialogTest.java View source code |
@Test
public void dialogThemeShouldBeSet() {
final ContextThemeWrapper context = (ContextThemeWrapper) dialog.getContext();
final ContextThemeWrapper baseContext = (ContextThemeWrapper) context.getBaseContext();
final ShadowContextThemeWrapper shadowBaseContext = (ShadowContextThemeWrapper) Robolectric.shadowOf(baseContext);
final int themeResId = shadowBaseContext.callGetThemeResId();
assertEquals(R.style.Theme_Default_Dialog, themeResId);
}Example 79
| Project: little-bear-dictionary-master File: ListMenuPresenter.java View source code |
@Override
public void initForMenu(Context context, 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();
}
}Example 80
| Project: myHealthHub-master File: GraphViewStyle.java View source code |
/** * tries to get the theme's font color and use it for labels * @param context must be instance of ContextThemeWrapper */ public void useTextColorFromTheme(Context context) { if (context instanceof ContextThemeWrapper) { TypedArray array = ((ContextThemeWrapper) context).getTheme().obtainStyledAttributes(new int[] { android.R.attr.textColorPrimary }); int color = array.getColor(0, getVerticalLabelsColor()); array.recycle(); setVerticalLabelsColor(color); setHorizontalLabelsColor(color); } }
Example 81
| Project: NHentai-android-master File: SettingsAppearance.java View source code |
private void showCardCountCustomDialog() {
ContextThemeWrapper wrapper = new ContextThemeWrapper(getActivity().getApplicationContext(), R.style.Theme_NHBooks_Light);
View view = LayoutInflater.from(wrapper).inflate(R.layout.dialog_set_card_count, (ViewGroup) getView());
final AppCompatTextView numberText = (AppCompatTextView) view.findViewById(R.id.number_text);
final AppCompatSeekBar seekBar = (AppCompatSeekBar) view.findViewById(R.id.seekbar);
int cardCount = mSets.getInt(Settings.KEY_CARDS_COUNT, 2);
if (cardCount < 2) {
cardCount = 2;
}
numberText.setText(String.valueOf(cardCount));
seekBar.setKeyProgressIncrement(1);
seekBar.setMax(8);
seekBar.setProgress(cardCount - 2);
seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
numberText.setText(String.valueOf(i + 2));
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
new AlertDialog.Builder(getActivity()).setView(view).setTitle(R.string.set_title_cards_count).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
}).setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
mSets.putInt(Settings.KEY_CARDS_COUNT, seekBar.getProgress() + 2);
mCardCountPref.setSummary(getString(R.string.set_title_cards_count_summary, String.valueOf(seekBar.getProgress() + 2)));
showRestartTips();
}
}).show();
}Example 82
| Project: NightOwl-master File: NightOwl.java View source code |
public static void owlBeforeCreate(Activity activity) {
Window window = activity.getWindow();
LayoutInflater layoutInflater = window.getLayoutInflater();
// replace the inflater in window
LayoutInflater injectLayoutInflater1 = Factory4InjectedInflater.newInstance(layoutInflater, activity);
injectLayoutInflater(injectLayoutInflater1, activity.getWindow(), activity.getWindow().getClass(), WINDOW_INFLATER);
// replace the inflater in current ContextThemeWrapper
LayoutInflater injectLayoutInflater2 = injectLayoutInflater1.cloneInContext(activity);
injectLayoutInflater(injectLayoutInflater2, activity, ContextThemeWrapper.class, THEME_INFLATER);
// insert owlViewContext into root view.
View v = activity.getWindow().getDecorView();
OwlViewContext owlObservable = new OwlViewContext();
insertViewContext(v, owlObservable);
}Example 83
| Project: packages_inputmethods_latinime-master File: KeyboardLayoutSetTestsBase.java View source code |
@Override
protected void setUp() throws Exception {
super.setUp();
final Context context = getContext();
final Resources res = context.getResources();
RichInputMethodManager.init(context);
mRichImm = RichInputMethodManager.getInstance();
// Save and reset additional subtypes preference.
mSavedAdditionalSubtypes = mRichImm.getAdditionalSubtypes();
final InputMethodSubtype[] predefinedAdditionalSubtypes = AdditionalSubtypeUtils.createAdditionalSubtypesArray(AdditionalSubtypeUtils.createPrefSubtypes(res.getStringArray(R.array.predefined_subtypes)));
mRichImm.setAdditionalInputMethodSubtypes(predefinedAdditionalSubtypes);
final KeyboardTheme keyboardTheme = KeyboardTheme.searchKeyboardThemeById(getKeyboardThemeForTests(), KeyboardTheme.KEYBOARD_THEMES);
setContext(new ContextThemeWrapper(getContext(), keyboardTheme.mStyleId));
KeyboardLayoutSet.onKeyboardThemeChanged();
mScreenMetrics = Settings.readScreenMetrics(res);
final InputMethodInfo imi = mRichImm.getInputMethodInfoOfThisIme();
final int subtypeCount = imi.getSubtypeCount();
for (int index = 0; index < subtypeCount; index++) {
mAllSubtypesList.add(imi.getSubtypeAt(index));
}
}Example 84
| Project: PreLollipopTransition-master File: TransitionAnimation.java View source code |
public static MoveData startAnimation(final View toView, Bundle transitionBundle, Bundle savedInstanceState, final int duration, final TimeInterpolator interpolator, final Animator.AnimatorListener listener) {
Context context = toView.getContext();
if (context instanceof ContextThemeWrapper) {
context = ((ContextThemeWrapper) context).getBaseContext();
}
final TransitionData transitionData = new TransitionData(context, transitionBundle);
if (transitionData.imageFilePath != null) {
setImageToView(toView, transitionData.imageFilePath);
}
final MoveData moveData = new MoveData();
moveData.toView = toView;
moveData.duration = duration;
if (savedInstanceState == null) {
ViewTreeObserver observer = toView.getViewTreeObserver();
observer.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
toView.getViewTreeObserver().removeOnPreDrawListener(this);
int[] screenLocation = new int[2];
toView.getLocationOnScreen(screenLocation);
moveData.leftDelta = transitionData.thumbnailLeft - screenLocation[0];
moveData.topDelta = transitionData.thumbnailTop - screenLocation[1];
moveData.widthScale = (float) transitionData.thumbnailWidth / toView.getWidth();
moveData.heightScale = (float) transitionData.thumbnailHeight / toView.getHeight();
runEnterAnimation(moveData, interpolator, listener);
return true;
}
});
}
return moveData;
}Example 85
| Project: robotium-master File: DialogUtils.java View source code |
/**
* Checks that the specified DecorView and the Activity DecorView are not equal.
*
* @param activity the activity which DecorView is to be compared
* @param decorView the DecorView to compare
* @return true if not equal
*/
private boolean isDialog(Activity activity, View decorView) {
if (decorView == null || !decorView.isShown() || activity == null) {
return false;
}
Context viewContext = null;
if (decorView != null) {
viewContext = decorView.getContext();
}
if (viewContext instanceof ContextThemeWrapper) {
ContextThemeWrapper ctw = (ContextThemeWrapper) viewContext;
viewContext = ctw.getBaseContext();
}
Context activityContext = activity;
Context activityBaseContext = activity.getBaseContext();
return (activityContext.equals(viewContext) || activityBaseContext.equals(viewContext)) && (decorView != activity.getWindow().getDecorView());
}Example 86
| Project: serenity-android-master File: GridVideoOnItemLongClickListener.java View source code |
protected void performSubtitleSelection() {
dialog.dismiss();
AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(context, android.R.style.Theme_Holo_Dialog));
builder.setTitle("Subtitle Selection");
ListView modeList = new ListView(context);
modeList.setSelector(R.drawable.menu_item_selector);
List<Subtitle> options = info.getAvailableSubtitles();
ArrayAdapter<Subtitle> modeAdapter = new ArrayAdapter<Subtitle>(context, R.layout.simple_list_item, R.id.list_item_text, options);
modeList.setAdapter(modeAdapter);
modeList.setOnItemClickListener(new SubTitleSelection());
builder.setView(modeList);
subtitleDialog = builder.create();
subtitleDialog.show();
}Example 87
| Project: SlideDayTimePicker-master File: TimeFragment.java View source code |
/**
* Create and return the user interface view for this fragment.
*/
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
int theme = getArguments().getInt("theme");
int initialHour = getArguments().getInt("hour");
int initialMinute = getArguments().getInt("minute");
boolean isClientSpecified24HourTime = getArguments().getBoolean("isClientSpecified24HourTime");
boolean is24HourTime = getArguments().getBoolean("is24HourTime");
// Unless we inflate using a cloned inflater with a Holo theme,
// on Lollipop devices the TimePicker will be the new-style
// radial TimePicker, which is not what we want. So we will
// clone the inflater that we're given but with our specified
// theme, then inflate the layout with this new inflater.
Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), theme == SlideDayTimePicker.HOLO_DARK ? android.R.style.Theme_Holo : android.R.style.Theme_Holo_Light);
LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper);
View v = localInflater.inflate(R.layout.fragment_time, container, false);
mTimePicker = (TimePicker) v.findViewById(R.id.timePicker);
// block keyboard popping up on touch
mTimePicker.setDescendantFocusability(DatePicker.FOCUS_BLOCK_DESCENDANTS);
mTimePicker.setOnTimeChangedListener(new TimePicker.OnTimeChangedListener() {
@Override
public void onTimeChanged(TimePicker view, int hourOfDay, int minute) {
mCallback.onTimeChanged(hourOfDay, minute);
}
});
// the TimePicker.
if (isClientSpecified24HourTime) {
mTimePicker.setIs24HourView(is24HourTime);
} else {
// If the client does not specify a 24-hour time format, use the
// device default.
mTimePicker.setIs24HourView(DateFormat.is24HourFormat(getTargetFragment().getActivity()));
}
mTimePicker.setCurrentHour(initialHour);
mTimePicker.setCurrentMinute(initialMinute);
// the user toggles the AM/PM button. Only applies to 4.0.0 and 4.0.3.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH && Build.VERSION.SDK_INT <= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
fixTimePickerBug18982();
}
return v;
}Example 88
| Project: v2droid-master File: ListMenuPresenter.java View source code |
@Override
public void initForMenu(Context context, 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();
}
}Example 89
| Project: WhatsHare-master File: PatchedDialogFragment.java View source code |
/**
* Returns a builder that will create a dialog that can only be canceled by
* clicking OK or by pressing back.
*
* <p>
* Whenever the dialog is dismissed, {@link Activity#finish()} is called on
* the argument <tt>activity</tt>.
*
* <p>
* The builder has already the correct theme set (for making it look ok even
* on wonderful Android pre-v11), so {@link Builder#getContext()} can be
* used to inflate layouts with.
*
* @param activity
* the caller activity
* @return a builder to be used to create a dialog with
*/
protected Builder getNoUiBuilder(final FragmentActivity activity) {
context = new ContextThemeWrapper(activity, R.style.DialogTheme);
// @formatter:off
return new AlertDialog.Builder(context).setCancelable(false).setOnKeyListener(new DialogInterface.OnKeyListener() {
@Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP && !event.isCanceled()) {
dialog.cancel();
activity.finish();
return true;
}
return false;
}
}).setPositiveButton(android.R.string.ok, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
activity.finish();
}
});
// @formatter:on
}Example 90
| Project: 2Degrees-Toolbox-master File: ActionBarSherlockNative.java View source code |
@Override
protected Context getThemedContext() {
Context context = mActivity;
TypedValue outValue = new TypedValue();
mActivity.getTheme().resolveAttribute(android.R.attr.actionBarWidgetTheme, outValue, true);
if (outValue.resourceId != 0) {
//We are unable to test if this is the same as our current theme
//so we just wrap it and hope that if the attribute was specified
//then the user is intentionally specifying an alternate theme.
context = new ContextThemeWrapper(context, outValue.resourceId);
}
return context;
}Example 91
| Project: 51daifan-android-master File: ActionBarSherlockNative.java View source code |
@Override
protected Context getThemedContext() {
Context context = mActivity;
TypedValue outValue = new TypedValue();
mActivity.getTheme().resolveAttribute(android.R.attr.actionBarWidgetTheme, outValue, true);
if (outValue.resourceId != 0) {
//We are unable to test if this is the same as our current theme
//so we just wrap it and hope that if the attribute was specified
//then the user is intentionally specifying an alternate theme.
context = new ContextThemeWrapper(context, outValue.resourceId);
}
return context;
}Example 92
| Project: actionbar-sherlock-viewpager-master File: ActionBarSherlockNative.java View source code |
@Override
protected Context getThemedContext() {
Context context = mActivity;
TypedValue outValue = new TypedValue();
mActivity.getTheme().resolveAttribute(android.R.attr.actionBarWidgetTheme, outValue, true);
if (outValue.resourceId != 0) {
//We are unable to test if this is the same as our current theme
//so we just wrap it and hope that if the attribute was specified
//then the user is intentionally specifying an alternate theme.
context = new ContextThemeWrapper(context, outValue.resourceId);
}
return context;
}Example 93
| Project: ActionBarShareLock-master File: ActionBarSherlockNative.java View source code |
@Override
protected Context getThemedContext() {
Context context = mActivity;
TypedValue outValue = new TypedValue();
mActivity.getTheme().resolveAttribute(android.R.attr.actionBarWidgetTheme, outValue, true);
if (outValue.resourceId != 0) {
//We are unable to test if this is the same as our current theme
//so we just wrap it and hope that if the attribute was specified
//then the user is intentionally specifying an alternate theme.
context = new ContextThemeWrapper(context, outValue.resourceId);
}
return context;
}Example 94
| Project: ActionBarSherlock-master File: ActionBarSherlockNative.java View source code |
@Override
protected Context getThemedContext() {
Context context = mActivity;
TypedValue outValue = new TypedValue();
mActivity.getTheme().resolveAttribute(android.R.attr.actionBarWidgetTheme, outValue, true);
if (outValue.resourceId != 0) {
//We are unable to test if this is the same as our current theme
//so we just wrap it and hope that if the attribute was specified
//then the user is intentionally specifying an alternate theme.
context = new ContextThemeWrapper(context, outValue.resourceId);
}
return context;
}Example 95
| Project: ActionBarSherlockDrawerToggle-master File: ActionBarSherlockNative.java View source code |
@Override
protected Context getThemedContext() {
Context context = mActivity;
TypedValue outValue = new TypedValue();
mActivity.getTheme().resolveAttribute(android.R.attr.actionBarWidgetTheme, outValue, true);
if (outValue.resourceId != 0) {
//We are unable to test if this is the same as our current theme
//so we just wrap it and hope that if the attribute was specified
//then the user is intentionally specifying an alternate theme.
context = new ContextThemeWrapper(context, outValue.resourceId);
}
return context;
}Example 96
| Project: Aimp-Control-master File: ActionBarSherlockNative.java View source code |
@Override
protected Context getThemedContext() {
Context context = mActivity;
TypedValue outValue = new TypedValue();
mActivity.getTheme().resolveAttribute(android.R.attr.actionBarWidgetTheme, outValue, true);
if (outValue.resourceId != 0) {
//We are unable to test if this is the same as our current theme
//so we just wrap it and hope that if the attribute was specified
//then the user is intentionally specifying an alternate theme.
context = new ContextThemeWrapper(context, outValue.resourceId);
}
return context;
}Example 97
| Project: amaretto-android-master File: ActionBarSherlockNative.java View source code |
@Override
protected Context getThemedContext() {
Context context = mActivity;
TypedValue outValue = new TypedValue();
mActivity.getTheme().resolveAttribute(android.R.attr.actionBarWidgetTheme, outValue, true);
if (outValue.resourceId != 0) {
//We are unable to test if this is the same as our current theme
//so we just wrap it and hope that if the attribute was specified
//then the user is intentionally specifying an alternate theme.
context = new ContextThemeWrapper(context, outValue.resourceId);
}
return context;
}Example 98
| Project: AnarchyTalk-master File: ActionBarSherlockNative.java View source code |
@Override
protected Context getThemedContext() {
Context context = mActivity;
TypedValue outValue = new TypedValue();
mActivity.getTheme().resolveAttribute(android.R.attr.actionBarWidgetTheme, outValue, true);
if (outValue.resourceId != 0) {
//We are unable to test if this is the same as our current theme
//so we just wrap it and hope that if the attribute was specified
//then the user is intentionally specifying an alternate theme.
context = new ContextThemeWrapper(context, outValue.resourceId);
}
return context;
}Example 99
| Project: android-1-master File: ActionBarSherlockNative.java View source code |
@Override
protected Context getThemedContext() {
Context context = mActivity;
TypedValue outValue = new TypedValue();
mActivity.getTheme().resolveAttribute(android.R.attr.actionBarWidgetTheme, outValue, true);
if (outValue.resourceId != 0) {
//We are unable to test if this is the same as our current theme
//so we just wrap it and hope that if the attribute was specified
//then the user is intentionally specifying an alternate theme.
context = new ContextThemeWrapper(context, outValue.resourceId);
}
return context;
}Example 100
| Project: android-15-master File: ListMenuPresenter.java View source code |
@Override
public void initForMenu(Context context, 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;
}Example 101
| Project: android-arrow-drawable-sample-master File: ListMenuPresenter.java View source code |
@Override
public void initForMenu(Context context, 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();
}
}