use of android.content.DialogInterface.OnShowListener in project packages_apps_Contacts by AOKP.
the class GroupNameDialogFragment method onCreateDialog.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
final LayoutInflater layoutInflater = LayoutInflater.from(builder.getContext());
final View view = layoutInflater.inflate(R.layout.group_name_dialog, null);
final EditText editText = (EditText) view.findViewById(R.id.group_label);
initializeGroupLabelEditText(editText);
builder.setTitle(getTitleResourceId());
builder.setView(view);
editText.requestFocus();
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int whichButton) {
onCompleted(editText.getText().toString().trim());
}
});
builder.setNegativeButton(android.R.string.cancel, null);
final AlertDialog dialog = builder.create();
dialog.setOnShowListener(new OnShowListener() {
@Override
public void onShow(DialogInterface dialogInterface) {
updateOkButtonState(dialog, editText);
}
});
editText.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void afterTextChanged(Editable s) {
updateOkButtonState(dialog, editText);
}
});
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
return dialog;
}
use of android.content.DialogInterface.OnShowListener in project Android-DialogFragments by wada811.
the class AbstractDialogFragment method setOnShowListener.
protected void setOnShowListener(Dialog dialog) {
useOnShowListener = true;
dialog.setOnShowListener(new OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
bindShowListener();
}
});
}
Aggregations