use of android.support.v7.view.ContextThemeWrapper in project openhab-android by openhab.
the class WidgetAdapterTest method testColorMappingBrightTheme.
@Test
public void testColorMappingBrightTheme() {
ColorMapper colorMapper = new ColorMapper(new ContextThemeWrapper(context, R.style.HABDroid_Basic_ui));
assertEquals("Map #ffffff", Integer.valueOf(0xffffffff), colorMapper.mapColor("#ffffff"));
assertEquals("Must return \"null\" for invalid colors", null, colorMapper.mapColor("#fffzzz"));
assertEquals("Map white => #000000 in bright themes", Integer.valueOf(0xff000000), colorMapper.mapColor("white"));
assertEquals("Map red => #ff0000 in bright themes", Integer.valueOf(0xffff0000), colorMapper.mapColor("red"));
assertEquals("Map yellow => #fdd835 in bright themes", Integer.valueOf(0xfffdd835), colorMapper.mapColor("yellow"));
}
use of android.support.v7.view.ContextThemeWrapper in project WordPress-Login-Flow-Android by wordpress-mobile.
the class GoogleFragment method showErrorDialog.
protected void showErrorDialog(String message) {
AlertDialog dialog = new AlertDialog.Builder(new ContextThemeWrapper(getActivity(), R.style.LoginTheme)).setMessage(message).setPositiveButton(R.string.login_error_button, null).create();
dialog.show();
}
use of android.support.v7.view.ContextThemeWrapper in project WordPress-Login-Flow-Android by wordpress-mobile.
the class LoginSiteAddressHelpDialogFragment method onCreateDialog.
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder alert = new AlertDialog.Builder(new ContextThemeWrapper(getActivity(), R.style.LoginTheme));
alert.setTitle(R.string.login_site_address_help_title);
// noinspection InflateParams
alert.setView(getActivity().getLayoutInflater().inflate(R.layout.login_alert_site_address_help, null));
alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
dialog.dismiss();
}
});
alert.setNeutralButton(R.string.login_site_address_more_help, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
mLoginListener.helpFindingSiteAddress(mAccountStore.getAccount().getUserName(), mSiteStore);
}
});
if (savedInstanceState == null) {
mAnalyticsListener.trackUrlHelpScreenViewed();
}
return alert.create();
}
use of android.support.v7.view.ContextThemeWrapper in project samourai-wallet-android by Samourai-Wallet.
the class LandingActivity method showPopup.
/**
* Shows overflow menu manually
*
* @param v
*/
public void showPopup(View v) {
Context wrapper = new ContextThemeWrapper(this, R.style.popMenuStyle);
PopupMenu popup = new PopupMenu(wrapper, v, Gravity.LEFT);
MenuInflater inflater = popup.getMenuInflater();
inflater.inflate(R.menu.landing_activity_menu, popup.getMenu());
popup.setOnMenuItemClickListener(this);
popup.show();
}
use of android.support.v7.view.ContextThemeWrapper in project open-event-orga-app by fossasia.
the class CreateCopyrightFragment method onCreateView.
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), R.style.AppTheme);
LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper);
binding = DataBindingUtil.inflate(localInflater, R.layout.copyright_create_layout, container, false);
validator = new Validator(binding.form);
AppCompatActivity activity = ((AppCompatActivity) getActivity());
activity.setSupportActionBar(binding.toolbar);
ActionBar actionBar = activity.getSupportActionBar();
if (actionBar != null) {
actionBar.setHomeButtonEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
}
setHasOptionsMenu(true);
binding.submit.setOnClickListener(view -> {
if (validator.validate())
getPresenter().createCopyright();
});
return binding.getRoot();
}
Aggregations