Search in sources :

Example 16 with AlertDialog

use of android.support.v7.app.AlertDialog in project wire-android by wireapp.

the class AddEmailAndPasswordPreferenceDialogFragment 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 (emailInputLayout == 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 17 with AlertDialog

use of android.support.v7.app.AlertDialog in project HumaneApp by Ganesh1010.

the class DonationConfirmationActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_donation_confirmation);
    mainItemList = (LinearLayout) findViewById(R.id.mainItemNeedList);
    for (int i = 0; i < 2; i++) {
        ImageView mainItem = new ImageView(getApplicationContext());
        mainItem.setBackgroundResource(R.drawable.ic_cloth_black);
        mainItemList.addView(mainItem);
        LinearLayout.LayoutParams margins = new LinearLayout.LayoutParams(mainItem.getLayoutParams());
        margins.rightMargin = 20;
        margins.leftMargin = 20;
        mainItem.setLayoutParams(margins);
        mainItem.setMinimumHeight(100);
        mainItem.setMaxHeight(200);
        mainItem.setMinimumWidth(100);
        mainItem.setMaxWidth(200);
        mainItem.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                AlertDialog.Builder builder = new AlertDialog.Builder(DonationConfirmationActivity.this);
                builder.setTitle("Item Details");
                LayoutInflater inflater = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                View dialogView = inflater.inflate(R.layout.donation_confirmation_item_display, null);
                RecyclerView itemToDisplay = (RecyclerView) dialogView.findViewById(R.id.itemToDisplay);
                itemToDisplay.setAdapter(new DonationConfirmationItemDisplayAdapter());
                builder.setView(dialogView);
                itemToDisplay.setAdapter(new DonationConfirmationItemDisplayAdapter());
                builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {

                    public void onClick(DialogInterface dialog, int id) {
                        dialog.dismiss();
                    }
                });
                AlertDialog dialog = builder.create();
                dialog.show();
            }
        });
    }
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) RecyclerView(android.support.v7.widget.RecyclerView) ImageView(android.widget.ImageView) View(android.view.View) LayoutInflater(android.view.LayoutInflater) RecyclerView(android.support.v7.widget.RecyclerView) ImageView(android.widget.ImageView) LinearLayout(android.widget.LinearLayout)

Example 18 with AlertDialog

use of android.support.v7.app.AlertDialog in project HumaneApp by Ganesh1010.

the class ChooseLocationActivity method setCurrentLocation.

private void setCurrentLocation() {
    GPSTracker gpsTracker = new GPSTracker(ChooseLocationActivity.this);
    String cityName = gpsTracker.getLocality(ChooseLocationActivity.this);
    if (cityName != null) {
        HomeActivity.locationName = cityName;
        finish();
    } else {
        AlertDialog.Builder builder = new AlertDialog.Builder(ChooseLocationActivity.this);
        builder.setTitle("Alert !");
        builder.setMessage("Unable to fetch location details");
        builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                finish();
            }
        });
        AlertDialog alertDialog = builder.create();
        alertDialog.show();
    }
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface)

Example 19 with AlertDialog

use of android.support.v7.app.AlertDialog in project WordPress-Android by wordpress-mobile.

the class EditTextPreferenceWithValidation method showDialog.

@Override
protected void showDialog(Bundle state) {
    super.showDialog(state);
    final AlertDialog dialog = (AlertDialog) getDialog();
    Button positiveButton = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
    if (positiveButton != null) {
        positiveButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                String error = null;
                CharSequence text = getEditText().getText();
                if (mValidationType == ValidationType.EMAIL) {
                    error = validateEmail(text);
                } else if (!TextUtils.isEmpty(text) && mValidationType == ValidationType.URL) {
                    error = validateUrl(text);
                }
                if (error != null) {
                    getEditText().setError(error);
                } else {
                    callChangeListener(text);
                    dialog.dismiss();
                }
            }
        });
    }
    CharSequence summary = getSummary();
    if (TextUtils.isEmpty(summary)) {
        getEditText().setText("");
    } else {
        getEditText().setText(summary);
        getEditText().setSelection(0, summary.length());
    }
    // clear previous errors
    getEditText().setError(null);
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) Button(android.widget.Button) View(android.view.View)

Example 20 with AlertDialog

use of android.support.v7.app.AlertDialog in project Remindy by abicelis.

the class ListItemAttachmentViewHolder method onClick.

@Override
public void onClick(View view) {
    int id = view.getId();
    switch(id) {
        case R.id.list_item_attachment_list_item_more:
            CharSequence[] items = new CharSequence[] { mActivity.getResources().getString(R.string.dialog_list_item_attachment_options_copy), mActivity.getResources().getString(R.string.dialog_list_item_attachment_options_edit), mActivity.getResources().getString(R.string.dialog_list_item_attachment_options_delete) };
            AlertDialog dialog = new AlertDialog.Builder(mActivity).setItems(items, new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    switch(which) {
                        case 0:
                            ClipboardUtil.copyToClipboard(mActivity, mCurrent.getText());
                            break;
                        case 1:
                            handleListItemEdit(false);
                            break;
                        case 2:
                            mAdapter.deleteItem(mPosition);
                            if (mRealTimeDataPersistence)
                                mAdapter.triggerAttachmentDataUpdatedListener();
                            break;
                    }
                }
            }).create();
            dialog.show();
            break;
        case R.id.list_item_attachment_list_item_checkbox:
            mCurrent.setChecked(!mCurrent.isChecked());
            if (mRealTimeDataPersistence)
                mAdapter.triggerAttachmentDataUpdatedListener();
            break;
        case R.id.item_attachment_list_container:
            handleListItemEdit(true);
            break;
    }
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface)

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