use of org.qii.weiciyuan.ui.preference.filter.AbstractFilterFragment in project weiciyuan by qii.
the class AddFilterDialog method onCreateDialog.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
final EditText et = new EditText(getActivity());
builder.setView(et).setTitle(getString(R.string.input_filter_word)).setPositiveButton(getString(R.string.add), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String word = et.getText().toString().trim();
if (!TextUtils.isEmpty(word)) {
AbstractFilterFragment filterFragment = (AbstractFilterFragment) getTargetFragment();
filterFragment.addFilter(word);
}
}
}).setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
AlertDialog dialog = builder.create();
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
return dialog;
}
use of org.qii.weiciyuan.ui.preference.filter.AbstractFilterFragment in project weiciyuan by qii.
the class ModifyFilterDialog method onCreateDialog.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final String word = getArguments().getString("word");
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
final EditText et = new EditText(getActivity());
et.setText(word);
et.setSelection(et.getText().toString().length());
builder.setView(et).setTitle(getString(R.string.modify_filter_word)).setPositiveButton(getString(R.string.modify), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String newValue = et.getText().toString().trim();
if (!TextUtils.isEmpty(word)) {
AbstractFilterFragment filterFragment = (AbstractFilterFragment) getTargetFragment();
filterFragment.modifyFilter(word, newValue);
}
}
}).setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
AlertDialog dialog = builder.create();
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
return dialog;
}
Aggregations