@Override protected Builder build(Builder builder) { // TODO Auto-generated method stub String titleBuilder = getTitle(); if (!TextUtils.isEmpty(titleBuilder)) { builder.setTitle(titleBuilder); } String contentBuilder = getContent(); if (!TextUtils.isEmpty(contentBuilder)) { builder.setcontent(contentBuilder); } builder.setLeftOnclicklistener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub if (isDebug) { Log.v(TAG, "进入点击事件left.onLeftCilcklinstener();"); } for (LeftBnClickLintener left : getLeftListener()) { left.onLeftCilcklinstener(); if (isDebug) { Log.v(TAG, "left.onLeftCilcklinstener();"); } } } }); builder.setRightOnclicklistener( new OnClickListener() { @Override public void onClick(View v) { for (RightBnClickLintener right : getRightListener()) { right.onRightCilcklinstener(); if (isDebug) { Log.v(TAG, "right.onRightCilcklinstener();"); } } } }); return builder; }
public static Builder create(OleDeliverRequestContract contract) { if (contract == null) { throw new IllegalArgumentException("contract was null"); } Builder builder = create(); if (contract.getTitle() != null) { builder.setTitle(contract.getTitle()); } if (contract.getAuthor() != null) { builder.setAuthor(contract.getAuthor()); } if (contract.getCallNumber() != null) { builder.setCallNumber(contract.getCallNumber()); } if (contract.getCopyNumber() != null) { builder.setCopyNumber(contract.getCopyNumber()); } if (contract.getItemStatus() != null) { builder.setItemStatus(contract.getItemStatus()); } if (contract.getItemType() != null) { builder.setItemType(contract.getItemType()); } if (contract.getShelvingLocation() != null) { builder.setShelvingLocation(contract.getShelvingLocation()); } if (contract.getVolumeNumber() != null) { builder.setVolumeNumber(contract.getVolumeNumber()); } if (contract.getItemId() != null) { builder.setItemId(contract.getItemId()); } if (contract.getRequestId() != null) { builder.setRequestId(contract.getRequestId()); } if (contract.getRequestId() != null) { builder.setRequestId(contract.getRequestId()); } if (contract.getBorrowerQueuePosition() != null) { builder.setBorrowerQueuePosition(contract.getBorrowerQueuePosition()); } if (contract.getCreateDate() != null) { builder.setCreateDate(contract.getCreateDate()); } if (contract.getOleDeliverRequestType() != null) { builder.setOleDeliverRequestType( OleDeliverRequestTypeDefinition.Builder.create(contract.getOleDeliverRequestType())); } builder.setId(contract.getId()); return builder; }
/** Children can extend this to add more things to base builder. */ @Override protected Builder build(Builder builder) { final String title = getTitle(); if (!TextUtils.isEmpty(title)) { builder.setTitle(title); } final String message = getMessage(); if (!TextUtils.isEmpty(message)) { builder.setMessage(message); } final String positiveButtonText = getPositiveButtonText(); if (!TextUtils.isEmpty(positiveButtonText)) { builder.setPositiveButton( positiveButtonText, new View.OnClickListener() { @Override public void onClick(View view) { ISimpleDialogListener listener = getDialogListener(); if (listener != null) { listener.onPositiveButtonClicked(mRequestCode); } dismiss(); } }); } final String negativeButtonText = getNegativeButtonText(); if (!TextUtils.isEmpty(negativeButtonText)) { builder.setNegativeButton( negativeButtonText, new View.OnClickListener() { @Override public void onClick(View view) { ISimpleDialogListener listener = getDialogListener(); if (listener != null) { listener.onNegativeButtonClicked(mRequestCode); } dismiss(); } }); } return builder; }
@Override protected Builder build(Builder builder) { /* set dialog title */ String title = String.format("About %s", getString(R.string.app_name)); builder.setTitle(title); /* set dialog main message */ final TextView message = new TextView(getActivity()); SpannableString aboutText = new SpannableString(getString(R.string.about_text)); String versionString = String.format("Version: %s", getAppVersion()); message.setText(versionString + "\n\n" + aboutText); message.setTextSize(16); Linkify.addLinks(message, Linkify.ALL); int padding = (int) getActivity().getResources().getDimension(R.dimen.dialog_message_padding); builder.setView(message, padding, padding, padding, padding); /* set buttons (only add the "go pro" button to free version) */ if (mPackageInfo != null && !mPackageInfo.packageName.contains("glimmrpro")) { builder.setNegativeButton( getString(R.string.pro_donate), new View.OnClickListener() { @Override public void onClick(View view) { Uri uri = Uri.parse(Constants.PRO_MARKET_LINK); Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent); dismiss(); } }); } builder.setPositiveButton( getString(android.R.string.ok), new View.OnClickListener() { @Override public void onClick(View view) { dismiss(); } }); return builder; }
private void build() { final WorkoutsActivity activity = (WorkoutsActivity) context; Builder builder = new Builder(context); builder.setTitle(R.string.delete_workout); builder.setMessage( Html.fromHtml( getContext().getString(R.string.really_delete_workout) + ": <b>" + name + "</b>")); builder .setPositiveButton( R.string.delete, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { activity.removeWorkout(position); } }) .setNegativeButton( R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) {} }); builder.create().show(); }