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();
}
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();
}
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();
}
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);
}
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();
}
Aggregations