use of android.support.v7.app.AlertDialog in project AdMoney by ErnestoGonAr.
the class CategoriasIngreso method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_categorias_ingreso);
aceptar = (Button) findViewById(R.id.aceptarin);
agregar = (ImageButton) findViewById(R.id.agregar_ci);
bd = new BDHandlerAM(this);
bandera = false;
a = bd.spinneringresos();
RecyclerView rv = (RecyclerView) findViewById(R.id.recycler_ci);
try {
String[][] dataSet = bd.obtenerCategoriasi();
LinearLayoutManager ln = new LinearLayoutManager(this);
ln.setOrientation(LinearLayoutManager.VERTICAL);
CustomAdapter_CategoriasI adapter = new CustomAdapter_CategoriasI(dataSet);
rv.setLayoutManager(ln);
rv.setAdapter(adapter);
} catch (ArrayIndexOutOfBoundsException e) {
Toast toast = Toast.makeText(this, "No hay categorias de Ingresos", Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
toast.show();
return;
}
agregar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder mBuilder = new AlertDialog.Builder(CategoriasIngreso.this);
View mView = getLayoutInflater().inflate(R.layout.insertar_categoriase, null);
final EditText insertar = (EditText) mView.findViewById(R.id.insertb);
final Button iguardar = (Button) mView.findViewById(R.id.insertarguardar);
final Button icancelar = (Button) mView.findViewById(R.id.insertarcancelar);
mBuilder.setView(mView);
AlertDialog dialog = mBuilder.create();
dialog.show();
insertar.requestFocus();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(insertar, InputMethodManager.SHOW_IMPLICIT);
iguardar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
validartexto = insertar.getText().toString();
insertar();
if (bandera) {
bd.insertarCI(primeroMayuscula(insertar.getText().toString()), 7);
}
onBackPressed2();
}
});
icancelar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed2();
}
});
}
});
aceptar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
}
use of android.support.v7.app.AlertDialog in project Small by wequick.
the class UIUtils method alert.
public static void alert(Context context, String tips) {
AlertDialog dlg = new AlertDialog.Builder(context).setMessage("lib.utils: " + tips).setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
}).create();
dlg.show();
}
use of android.support.v7.app.AlertDialog in project wire-android by wireapp.
the class ConversationFragment method onSyncError.
@Override
public void onSyncError(final ErrorsList.ErrorDescription errorDescription) {
switch(errorDescription.getType()) {
case CANNOT_SEND_ASSET_FILE_NOT_FOUND:
ViewUtils.showAlertDialog(getActivity(), R.string.asset_upload_error__not_found__title, R.string.asset_upload_error__not_found__message, R.string.asset_upload_error__not_found__button, null, true);
errorDescription.dismiss();
break;
case CANNOT_SEND_ASSET_TOO_LARGE:
AlertDialog dialog = ViewUtils.showAlertDialog(getActivity(), R.string.asset_upload_error__file_too_large__title, R.string.asset_upload_error__file_too_large__message_default, R.string.asset_upload_error__file_too_large__button, null, true);
long maxAllowedSizeInBytes = AssetFactory.getMaxAllowedAssetSizeInBytes();
if (maxAllowedSizeInBytes > 0) {
String maxFileSize = Formatter.formatShortFileSize(getContext(), maxAllowedSizeInBytes);
dialog.setMessage(getString(R.string.asset_upload_error__file_too_large__message, maxFileSize));
}
errorDescription.dismiss();
((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new SelectedTooLargeFileEvent());
break;
case RECORDING_FAILURE:
ViewUtils.showAlertDialog(getActivity(), R.string.audio_message__recording__failure__title, R.string.audio_message__recording__failure__message, R.string.alert_dialog__confirmation, null, true);
errorDescription.dismiss();
break;
case CANNOT_SEND_MESSAGE_TO_UNVERIFIED_CONVERSATION:
onErrorCanNotSentMessageToUnverifiedConversation(errorDescription);
break;
}
}
use of android.support.v7.app.AlertDialog in project wire-android by wireapp.
the class ChangeEmailPreferenceDialogFragment method onStart.
@Override
public void onStart() {
super.onStart();
final AlertDialog dialog = (AlertDialog) getDialog();
if (dialog == null) {
return;
}
final Button positiveButton = dialog.getButton(Dialog.BUTTON_POSITIVE);
positiveButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (inputLayout == null) {
dismiss();
return;
}
handleInput();
}
});
}
use of android.support.v7.app.AlertDialog in project wire-android by wireapp.
the class ChangeEmailPreferenceDialogFragment method onCreateDialog.
@SuppressLint("InflateParams")
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final LayoutInflater inflater = LayoutInflater.from(getActivity());
final View view = inflater.inflate(R.layout.preference_dialog_change_email, null);
inputLayout = ViewUtils.getView(view, R.id.til__preferences__email);
final EditText editText = ViewUtils.getView(view, R.id.acet__preferences__email);
editText.requestFocus();
editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
handleInput();
return true;
} else {
return false;
}
}
});
final String existingEmail = getArguments().getString(ARG_EMAIL, "");
editText.setText(existingEmail);
editText.setSelection(editText.length());
final AlertDialog alertDialog = new AlertDialog.Builder(getActivity()).setTitle(R.string.pref__account_action__dialog__change_email__title).setView(view).setPositiveButton(android.R.string.ok, null).setNegativeButton(android.R.string.cancel, null).create();
alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
return alertDialog;
}
Aggregations