Search in sources :

Example 1 with ContextThemeWrapper

use of android.support.v7.view.ContextThemeWrapper in project android_frameworks_base by ResurrectionRemix.

the class NekoLand method showNameDialog.

private void showNameDialog(final Cat cat) {
    final Context context = new ContextThemeWrapper(this, android.R.style.Theme_Material_Light_Dialog_NoActionBar);
    // TODO: Move to XML, add correct margins.
    View view = LayoutInflater.from(context).inflate(R.layout.edit_text, null);
    final EditText text = (EditText) view.findViewById(android.R.id.edit);
    text.setText(cat.getName());
    text.setSelection(cat.getName().length());
    final int size = context.getResources().getDimensionPixelSize(android.R.dimen.app_icon_size);
    Drawable catIcon = cat.createIcon(this, size, size).loadDrawable(this);
    new AlertDialog.Builder(context).setTitle(" ").setIcon(catIcon).setView(view).setPositiveButton(android.R.string.ok, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            cat.logRename(context);
            cat.setName(text.getText().toString().trim());
            mPrefs.addCat(cat);
        }
    }).show();
}
Also used : Context(android.content.Context) EditText(android.widget.EditText) AlertDialog(android.app.AlertDialog) ContextThemeWrapper(android.view.ContextThemeWrapper) DialogInterface(android.content.DialogInterface) Drawable(android.graphics.drawable.Drawable) OnClickListener(android.content.DialogInterface.OnClickListener) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView)

Example 2 with ContextThemeWrapper

use of android.support.v7.view.ContextThemeWrapper in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class DashboardAdapter method showRemoveOption.

private void showRemoveOption(View v, final Tile suggestion) {
    PopupMenu popup = new PopupMenu(new ContextThemeWrapper(mContext, R.style.Theme_AppCompat_DayNight), v);
    popup.getMenu().add(R.string.suggestion_remove).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {

        @Override
        public boolean onMenuItemClick(MenuItem item) {
            MetricsLogger.action(mContext, MetricsEvent.ACTION_SETTINGS_DISMISS_SUGGESTION, DashboardAdapter.getSuggestionIdentifier(mContext, suggestion));
            disableSuggestion(suggestion);
            mSuggestions.remove(suggestion);
            recountItems();
            return true;
        }
    });
    popup.show();
}
Also used : ContextThemeWrapper(android.view.ContextThemeWrapper) MenuItem(android.view.MenuItem) PopupMenu(android.support.v7.widget.PopupMenu)

Example 3 with ContextThemeWrapper

use of android.support.v7.view.ContextThemeWrapper in project android_frameworks_base by AOSPA.

the class NekoLand method showNameDialog.

private void showNameDialog(final Cat cat) {
    final Context context = new ContextThemeWrapper(this, android.R.style.Theme_Material_Light_Dialog_NoActionBar);
    // TODO: Move to XML, add correct margins.
    View view = LayoutInflater.from(context).inflate(R.layout.edit_text, null);
    final EditText text = (EditText) view.findViewById(android.R.id.edit);
    text.setText(cat.getName());
    text.setSelection(cat.getName().length());
    final int size = context.getResources().getDimensionPixelSize(android.R.dimen.app_icon_size);
    Drawable catIcon = cat.createIcon(this, size, size).loadDrawable(this);
    new AlertDialog.Builder(context).setTitle(" ").setIcon(catIcon).setView(view).setPositiveButton(android.R.string.ok, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            cat.logRename(context);
            cat.setName(text.getText().toString().trim());
            mPrefs.addCat(cat);
        }
    }).show();
}
Also used : Context(android.content.Context) EditText(android.widget.EditText) AlertDialog(android.app.AlertDialog) ContextThemeWrapper(android.view.ContextThemeWrapper) DialogInterface(android.content.DialogInterface) Drawable(android.graphics.drawable.Drawable) OnClickListener(android.content.DialogInterface.OnClickListener) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView)

Example 4 with ContextThemeWrapper

use of android.support.v7.view.ContextThemeWrapper in project wire-android by wireapp.

the class EphemeralLayout method onFinishInflate.

@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    ContextThemeWrapper cw = new ContextThemeWrapper(getContext(), com.waz.zclient.ui.R.style.NumberPickerText);
    numberPicker = new NumberPicker(cw);
    numberPicker.setMinValue(0);
    final EphemeralExpiration[] ephemeralExpirationsValues = getAvailableEphemeralExpirations();
    numberPicker.setMaxValue(ephemeralExpirationsValues.length - 1);
    String[] values = new String[ephemeralExpirationsValues.length];
    for (int i = 0; i < values.length; i++) {
        values[i] = getDisplayName(ephemeralExpirationsValues[i]);
    }
    numberPicker.setDisplayedValues(values);
    numberPicker.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (callback != null) {
                callback.onEphemeralExpirationSelected(ephemeralExpirationsValues[numberPicker.getValue()], true);
            }
        }
    });
    numberPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() {

        @Override
        public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
            if (callback != null) {
                callback.onEphemeralExpirationSelected(ephemeralExpirationsValues[numberPicker.getValue()], false);
            }
        }
    });
    try {
        //NoSuchFieldException
        Field f = numberPicker.getClass().getDeclaredField("mSelectionDivider");
        f.setAccessible(true);
        f.set(numberPicker, getResources().getDrawable(com.waz.zclient.ui.R.drawable.number_picker_divider));
    } catch (Throwable t) {
        Timber.e(t, "Something went wrong");
    }
    addView(numberPicker);
}
Also used : NumberPicker(android.widget.NumberPicker) EphemeralExpiration(com.waz.api.EphemeralExpiration) View(android.view.View) Field(java.lang.reflect.Field) ContextThemeWrapper(android.support.v7.view.ContextThemeWrapper)

Example 5 with ContextThemeWrapper

use of android.support.v7.view.ContextThemeWrapper in project platform_frameworks_base by android.

the class NekoLand method showNameDialog.

private void showNameDialog(final Cat cat) {
    final Context context = new ContextThemeWrapper(this, android.R.style.Theme_Material_Light_Dialog_NoActionBar);
    // TODO: Move to XML, add correct margins.
    View view = LayoutInflater.from(context).inflate(R.layout.edit_text, null);
    final EditText text = (EditText) view.findViewById(android.R.id.edit);
    text.setText(cat.getName());
    text.setSelection(cat.getName().length());
    final int size = context.getResources().getDimensionPixelSize(android.R.dimen.app_icon_size);
    Drawable catIcon = cat.createIcon(this, size, size).loadDrawable(this);
    new AlertDialog.Builder(context).setTitle(" ").setIcon(catIcon).setView(view).setPositiveButton(android.R.string.ok, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            cat.logRename(context);
            cat.setName(text.getText().toString().trim());
            mPrefs.addCat(cat);
        }
    }).show();
}
Also used : Context(android.content.Context) EditText(android.widget.EditText) AlertDialog(android.app.AlertDialog) ContextThemeWrapper(android.view.ContextThemeWrapper) DialogInterface(android.content.DialogInterface) Drawable(android.graphics.drawable.Drawable) OnClickListener(android.content.DialogInterface.OnClickListener) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView)

Aggregations

View (android.view.View)41 ContextThemeWrapper (android.support.v7.view.ContextThemeWrapper)38 ContextThemeWrapper (android.view.ContextThemeWrapper)35 DialogInterface (android.content.DialogInterface)26 Context (android.content.Context)25 AlertDialog (android.support.v7.app.AlertDialog)24 TextView (android.widget.TextView)23 RecyclerView (android.support.v7.widget.RecyclerView)21 ImageView (android.widget.ImageView)21 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)9 Bundle (android.os.Bundle)7 NonNull (android.support.annotation.NonNull)7 ArrayList (java.util.ArrayList)7 SuppressLint (android.annotation.SuppressLint)6