android.content.DialogInterface#OnDismissListener ( )源码实例Demo

下面列出了android.content.DialogInterface#OnDismissListener ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: memetastic   文件: ActivityUtils.java
public void showDialogWithHtmlTextView(@StringRes int resTitleId, String text, boolean isHtml, DialogInterface.OnDismissListener dismissedListener) {
    ScrollView scroll = new ScrollView(_context);
    AppCompatTextView textView = new AppCompatTextView(_context);
    int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16, _context.getResources().getDisplayMetrics());

    scroll.setPadding(padding, 0, padding, 0);
    scroll.addView(textView);
    textView.setMovementMethod(new LinkMovementMethod());
    textView.setText(isHtml ? new SpannableString(Html.fromHtml(text)) : text);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 17);

    AlertDialog.Builder dialog = new AlertDialog.Builder(_context)
            .setPositiveButton(android.R.string.ok, null).setOnDismissListener(dismissedListener)
            .setView(scroll);
    if (resTitleId != 0) {
        dialog.setTitle(resTitleId);
    }
    dialogFullWidth(dialog.show(), true, false);
}
 
源代码2 项目: SmartFlasher   文件: Dialog.java
public Dialog setOnDismissListener(DialogInterface.OnDismissListener onDismissListener) {
    mOnDismissListener = onDismissListener;
    setOnCancelListener(new DialogInterface.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialogInterface) {
            if (mOnDismissListener != null) {
                mOnDismissListener.onDismiss(dialogInterface);
            }
        }
    });
    return this;
}
 
源代码3 项目: permissionUtil   文件: PermissionActivity.java
private void showRationale(DialogInterface.OnDismissListener listener) {
    PermissionCallback callback = PermissionUtil.getCallback();
    String title = getCallbackTitle(callback);
    String message = getCallbackMessage(callback);
    AlertDialog dialog = new AlertDialog.Builder(this,R.style.Theme_AppCompat_Light_Dialog_MinWidth)
            .setTitle(title)
            .setMessage(message)
            .setPositiveButton(android.R.string.ok, null)
            .setOnDismissListener(listener)
            .create();
    dialog.show();
}
 
源代码4 项目: AndroidProject   文件: BaseDialog.java
/**
 * 设置一个销毁监听器
 *
 * @param listener       销毁监听器对象
 * @deprecated           请使用 {@link #addOnDismissListener(BaseDialog.OnDismissListener)}
 */
@Deprecated
@Override
public void setOnDismissListener(@Nullable DialogInterface.OnDismissListener listener) {
    if (listener == null) {
        return;
    }
    addOnDismissListener(new DismissListenerWrapper(listener));
}
 
源代码5 项目: SprintNBA   文件: DialogUtils.java
public static Dialog showTips(Context context, String title, String des, String btn, DialogInterface.OnDismissListener dismissListener) {
    AlertDialog.Builder builder = dialogBuilder(context, title, des);
    builder.setCancelable(true);
    builder.setPositiveButton(btn, null);
    Dialog dialog = builder.show();
    dialog.setCanceledOnTouchOutside(true);
    dialog.setOnDismissListener(dismissListener);
    return dialog;
}
 
源代码6 项目: AndroidBase   文件: ProgressDialogUtil.java
public static Dialog createProgressDialog(Context context, String title, String des,  DialogInterface.OnDismissListener dismissListener,boolean cancelable) {
    ProgressDialog builder = dialogBuilder(context, title, des);
    builder.setCancelable(cancelable);
    builder.setCanceledOnTouchOutside(true);
    builder.setOnDismissListener(dismissListener);
    return builder;
}
 
源代码7 项目: aptoide-client   文件: AptoideDialog.java
public static DialogFragment myAppInstall(String appName, DialogInterface.OnClickListener okListener, DialogInterface.OnDismissListener dismissListener) {

//        DialogFragment fragment = MyAppInstallDialog.newInstance(appName, okListener, dismissListener);
//
//        Bundle bundle = new Bundle();
//
//        bundle.putString("appName", appName);
//        fragment.setArguments(bundle);

        return MyAppInstallDialog.newInstance(appName, okListener, dismissListener);
    }
 
源代码8 项目: android-md-core   文件: DialogUtils.java
public static AlertDialog showInfoDialog(Context context, CharSequence message, DialogInterface.OnClickListener onClickListener,
    DialogInterface.OnDismissListener onDismissListener) {
  AlertDialog alertDialog = new AlertDialog.Builder(context)
      .setTitle("sample")
      .setMessage(message)
      .setPositiveButton(R.string.text_ok, onClickListener)
      .setOnDismissListener(onDismissListener)
      .create();
  alertDialog.show();
  return alertDialog;
}
 
源代码9 项目: KernelAdiutor   文件: ViewUtils.java
public static Dialog dialogBuilder(CharSequence message, DialogInterface.OnClickListener negativeListener,
                                   DialogInterface.OnClickListener positiveListener,
                                   DialogInterface.OnDismissListener dismissListener, Context context) {
    Dialog dialog = new Dialog(context).setMessage(message);
    if (negativeListener != null) {
        dialog.setNegativeButton(context.getString(R.string.cancel), negativeListener);
    }
    if (positiveListener != null) {
        dialog.setPositiveButton(context.getString(R.string.ok), positiveListener);
    }
    if (dismissListener != null) {
        dialog.setOnDismissListener(dismissListener);
    }
    return dialog;
}
 
源代码10 项目: aptoide-client   文件: MyAppInstallDialog.java
public static MyAppInstallDialog newInstance(String appName, DialogInterface.OnClickListener okListener, DialogInterface.OnDismissListener dismissListener) {
    MyAppInstallDialog dialog = new MyAppInstallDialog();
    dialog.appName = appName;
    dialog.okListener = okListener;
    dialog.dismissListener = dismissListener;
    return dialog;
}
 
源代码11 项目: MeiBaseModule   文件: MeiCompatDialogDelegate.java
public void setOnDismissListener(DialogInterface.OnDismissListener onDismissListener) {
    mOnDismissListener = onDismissListener;
}
 
源代码12 项目: talkback   文件: BaseDialog.java
/** Returns and shows the dialog with ok/cancel button. */
public AlertDialog showDialog() {
  // Only show one dialog at a time.
  if (dialog != null && dialog.isShowing()) {
    return dialog;
  }

  final DialogInterface.OnClickListener onClickListener =
      (dialog, buttonClicked) -> clickDialogInternal(buttonClicked);
  final DialogInterface.OnDismissListener onDismissListener = dialog -> dismissDialogInternal();

  AlertDialog.Builder dialogBuilder =
      new AlertDialog.Builder(context)
          .setTitle(dialogTitleResId)
          .setNegativeButton(android.R.string.cancel, onClickListener)
          .setPositiveButton(android.R.string.ok, onClickListener)
          .setOnDismissListener(onDismissListener)
          .setCancelable(true);

  String message = getMessageString();
  if (!TextUtils.isEmpty(message)) {
    dialogBuilder.setMessage(message);
  }
  View customizedView = getCustomizedView();
  if (customizedView != null) {
    dialogBuilder.setView(customizedView);
  }

  dialog = dialogBuilder.create();
  if (isSoftInputMode) {
    dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
  }
  if (context instanceof TalkBackService) {
    DialogUtils.setWindowTypeToDialog(dialog.getWindow());
  } else {
    LogUtils.v(
        TAG,
        "Create BaseDialog from context not instance of TalkBackService, class:"
            + context.getClass());
  }
  dialog.show();

  registerServiceDialog();
  return dialog;
}
 
源代码13 项目: KlyphMessenger   文件: ChangeLogDialog.java
public ChangeLogDialog setOnDismissListener(final DialogInterface.OnDismissListener onDismissListener) {
    mOnDismissListener = onDismissListener;
    return this;
}
 
源代码14 项目: SprintNBA   文件: DialogUtils.java
public static Dialog showTips(Context context, int title, int des, int btn, DialogInterface.OnDismissListener dismissListener) {
    return showTips(context, context.getString(title), context.getString(des), context.getString(btn), dismissListener);
}
 
源代码15 项目: Android-Next   文件: AlertDialogFragment.java
public Builder setOnDismissListener(DialogInterface.OnDismissListener onDismissListener) {
    mParams.mOnDismissListener = onDismissListener;
    return this;
}
 
源代码16 项目: date_picker_converter   文件: TimePickerDialog.java
@SuppressWarnings("unused")
public void setOnDismissListener(DialogInterface.OnDismissListener onDismissListener) {
    mOnDismissListener = onDismissListener;
}
 
源代码17 项目: AndroidBase   文件: ProgressDialogUtil.java
public static Dialog createProgressDialog(Context context, int title, int des, int btn, DialogInterface.OnDismissListener dismissListener,boolean cancelable) {
    return createProgressDialog(context, context.getString(title), context.getString(des),  dismissListener,cancelable);
}
 
源代码18 项目: AssistantBySDK   文件: DatePickerDialog.java
@SuppressWarnings("unused")
public void setOnDismissListener(DialogInterface.OnDismissListener onDismissListener) {
    mOnDismissListener = onDismissListener;
}
 
源代码19 项目: AlarmOn   文件: TimePickerDialog.java
@SuppressWarnings("unused")
public void setOnDismissListener(DialogInterface.OnDismissListener onDismissListener) {
    mOnDismissListener = onDismissListener;
}
 
/**
 * Sets the listener, which should be notified, when the dialog, which is created by the
 * builder, is dismissed for any reason.
 *
 * @param listener
 *         The listener, which should be set, as an instance of the type {@link
 *         DialogInterface.OnDismissListener}, or null, if no listener should be set
 * @return The builder, the method has been called upon, as an instance of the generic type
 * BuilderType
 */
public final BuilderType setOnDismissListener(
        @Nullable final DialogInterface.OnDismissListener listener) {
    getProduct().setOnDismissListener(listener);
    return self();
}