Search in sources :

Example 11 with AlertDialog

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();
        }
    });
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) EditText(android.widget.EditText) InputMethodManager(android.view.inputmethod.InputMethodManager) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) Toast(android.widget.Toast) ImageButton(android.widget.ImageButton) Button(android.widget.Button) CustomAdapter_CategoriasI(layout.CustomAdapter_CategoriasI) RecyclerView(android.support.v7.widget.RecyclerView)

Example 12 with AlertDialog

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();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface)

Example 13 with AlertDialog

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;
    }
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) GlobalTrackingController(com.waz.zclient.tracking.GlobalTrackingController) SelectedTooLargeFileEvent(com.waz.zclient.core.controllers.tracking.events.filetransfer.SelectedTooLargeFileEvent)

Example 14 with AlertDialog

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();
        }
    });
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) Button(android.widget.Button) TextView(android.widget.TextView) View(android.view.View)

Example 15 with AlertDialog

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;
}
Also used : EditText(android.widget.EditText) KeyEvent(android.view.KeyEvent) AlertDialog(android.support.v7.app.AlertDialog) LayoutInflater(android.view.LayoutInflater) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View) SuppressLint(android.annotation.SuppressLint) SuppressLint(android.annotation.SuppressLint)

Aggregations

AlertDialog (android.support.v7.app.AlertDialog)413 DialogInterface (android.content.DialogInterface)275 View (android.view.View)219 TextView (android.widget.TextView)165 Intent (android.content.Intent)117 EditText (android.widget.EditText)87 ImageView (android.widget.ImageView)68 Button (android.widget.Button)67 LayoutInflater (android.view.LayoutInflater)59 RecyclerView (android.support.v7.widget.RecyclerView)54 NonNull (android.support.annotation.NonNull)53 AdapterView (android.widget.AdapterView)51 SuppressLint (android.annotation.SuppressLint)50 ArrayList (java.util.ArrayList)48 Bundle (android.os.Bundle)46 ListView (android.widget.ListView)42 Context (android.content.Context)35 SharedPreferences (android.content.SharedPreferences)35 Uri (android.net.Uri)32 LinearLayout (android.widget.LinearLayout)29