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();
}
});
}
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();
}
});
}
}
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();
}
}
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);
}
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;
}
}
Aggregations