Search in sources :

Example 16 with ContextThemeWrapper

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"));
}
Also used : ContextThemeWrapper(android.support.v7.view.ContextThemeWrapper) ColorMapper(org.openhab.habdroid.ui.OpenHABWidgetAdapter.ColorMapper) Test(org.junit.Test)

Example 17 with ContextThemeWrapper

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();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) ContextThemeWrapper(android.view.ContextThemeWrapper)

Example 18 with ContextThemeWrapper

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();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) ContextThemeWrapper(android.view.ContextThemeWrapper) DialogInterface(android.content.DialogInterface) NonNull(android.support.annotation.NonNull)

Example 19 with ContextThemeWrapper

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();
}
Also used : Context(android.content.Context) ContextThemeWrapper(android.view.ContextThemeWrapper) MenuInflater(android.view.MenuInflater) PopupMenu(android.support.v7.widget.PopupMenu)

Example 20 with ContextThemeWrapper

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();
}
Also used : Context(android.content.Context) ContextThemeWrapper(android.view.ContextThemeWrapper) LayoutInflater(android.view.LayoutInflater) AppCompatActivity(android.support.v7.app.AppCompatActivity) Validator(br.com.ilhasoft.support.validation.Validator) ActionBar(android.support.v7.app.ActionBar) Nullable(android.support.annotation.Nullable)

Aggregations

View (android.view.View)40 ContextThemeWrapper (android.support.v7.view.ContextThemeWrapper)38 ContextThemeWrapper (android.view.ContextThemeWrapper)31 Context (android.content.Context)25 DialogInterface (android.content.DialogInterface)24 TextView (android.widget.TextView)22 RecyclerView (android.support.v7.widget.RecyclerView)21 ImageView (android.widget.ImageView)21 AlertDialog (android.support.v7.app.AlertDialog)20 LayoutInflater (android.view.LayoutInflater)18 Intent (android.content.Intent)13 Nullable (android.support.annotation.Nullable)10 ColorPreferences (me.ccrama.redditslide.ColorPreferences)10 Drawable (android.graphics.drawable.Drawable)9 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)9 EditText (android.widget.EditText)8 Bundle (android.os.Bundle)7 ArrayList (java.util.ArrayList)7 SuppressLint (android.annotation.SuppressLint)6 Dialog (android.app.Dialog)6