android.support.v7.app.AlertDialog.setOnShowListener()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(10.6k)|赞(0)|评价(0)|浏览(97)

本文整理了Java中android.support.v7.app.AlertDialog.setOnShowListener()方法的一些代码示例,展示了AlertDialog.setOnShowListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AlertDialog.setOnShowListener()方法的具体详情如下:
包路径:android.support.v7.app.AlertDialog
类名称:AlertDialog
方法名:setOnShowListener

AlertDialog.setOnShowListener介绍

暂无

代码示例

代码示例来源:origin: seven332/EhViewer

@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
 View view = getActivity().getLayoutInflater().inflate(R.layout.dialog_hosts, null, false);
 host = view.findViewById(R.id.host);
 ip = view.findViewById(R.id.ip);
 Bundle arguments = getArguments();
 if (savedInstanceState == null && arguments != null) {
  host.setText(arguments.getString(KEY_HOST));
  ip.setText(arguments.getString(KEY_IP));
 }
 AlertDialog.Builder builder = new AlertDialog.Builder(getContext()).setView(view);
 onCreateDialogBuilder(builder);
 AlertDialog dialog = builder.create();
 dialog.setOnShowListener(d -> onCreateDialog((AlertDialog) d));
 return dialog;
}

代码示例来源:origin: TeamNewPipe/NewPipe

alertDialog.setOnShowListener(dialog -> {
  setDialogButtonsState(alertDialog, radioGroup.getCheckedRadioButtonId() != -1);
});

代码示例来源:origin: JZ-Darkal/AndroidHttpCapture

alertDialog.setOnShowListener(new DialogInterface.OnShowListener() {
  @Override
  public void onShow(DialogInterface d) {

代码示例来源:origin: Hu12037102/ImageCompress

.setNegativeButton("取消", null)
    .setCancelable(false).create();
mForbidDialog.setOnShowListener(new DialogInterface.OnShowListener() {
  @Override
  public void onShow(DialogInterface dialog) {

代码示例来源:origin: sytolk/TaxiAndroidOpen

private void buildAlertDebug() {
  final android.support.v7.app.AlertDialog.Builder builder = new android.support.v7.app.AlertDialog.Builder(this);
  builder.setMessage(R.string.send_log_title)
      .setCancelable(true)
      .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
        public void onClick(@SuppressWarnings("unused") final DialogInterface dialog, @SuppressWarnings("unused") final int id) {
          RestClient.getInstance().clearCache();
          ACRA.getErrorReporter().handleSilentException(new Exception("Client Report"));
        }
      })
      .setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
        public void onClick(final DialogInterface dialog, @SuppressWarnings("unused") final int id) {
          dialog.dismiss();
        }
      });
  final android.support.v7.app.AlertDialog alert = builder.create();
  alert.setOnShowListener(new DialogInterface.OnShowListener() {
    @Override
    public void onShow(DialogInterface dialog) {
      Button btnPositive = alert.getButton(Dialog.BUTTON_POSITIVE);
      btnPositive.setTextSize(TypedValue.COMPLEX_UNIT_SP, 35);
      Button btnNegative = alert.getButton(Dialog.BUTTON_NEGATIVE);
      btnNegative.setTextSize(TypedValue.COMPLEX_UNIT_SP, 35);
    }
  });
  alert.show();
  TextView textView = (TextView) alert.findViewById(android.R.id.message);
  textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 35);
}

代码示例来源:origin: Hu12037102/MediaSelector

.setNegativeButton("取消", null)
    .setCancelable(false).create();
mForbidDialog.setOnShowListener(new DialogInterface.OnShowListener() {
  @Override
  public void onShow(DialogInterface dialog) {

代码示例来源:origin: NordicSemiconductor/Android-nRF-Beacon

@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
  final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()).setTitle(R.string.update_dialog_adv_interval_title).setNegativeButton(R.string.cancel, null)
      .setPositiveButton(R.string.ok, null);
  final View view = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_dialog_adv_interval, null);
  mAdvIntervalView = (EditText) view.findViewById(R.id.adv_interval);
  // Fill the field with the current value
  final Bundle args = getArguments();
  final int currentInterval = args.getInt(ADV_INTERVAL);
  mAdvIntervalView.setText(String.valueOf(currentInterval));
  builder.setView(view);
  // The OK button must validate the entered value. We have to overwrite the default button listener.
  final AlertDialog dialog = builder.create();
  dialog.setOnShowListener(new DialogInterface.OnShowListener() {
    @Override
    public void onShow(final DialogInterface d) {
      final Button ok = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
      ok.setOnClickListener(ModifyAdvIntervalFragment.this);
    }
  });
  return dialog;
}

代码示例来源:origin: NordicSemiconductor/Android-nRF-Beacon

@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
  final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()).setTitle(R.string.update_dialog_major_minor_title).setNegativeButton(R.string.cancel, null)
      .setPositiveButton(R.string.ok, null);
  final View view = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_dialog_major_minor, null);
  mMajorView = (EditText) view.findViewById(R.id.major);
  mMinorView = (EditText) view.findViewById(R.id.minor);
  // Fill the fields with the current values
  final Bundle args = getArguments();
  final int major = args.getInt(MAJOR);
  final int minor = args.getInt(MINOR);
  mMajorView.setText(String.valueOf(major));
  mMinorView.setText(String.valueOf(minor));
  builder.setView(view);
  // The OK button must validate the entered value. We have to overwrite the default button listener.
  final AlertDialog dialog = builder.create();
  dialog.setOnShowListener(new DialogInterface.OnShowListener() {
    @Override
    public void onShow(final DialogInterface d) {
      final Button ok = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
      ok.setOnClickListener(ModifyMajorMinorFragment.this);
    }
  });
  return dialog;
}

代码示例来源:origin: NordicSemiconductor/Android-nRF-Beacon

@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
  final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()).setTitle(R.string.update_dialog_rssi_title).setNegativeButton(R.string.cancel, null)
      .setPositiveButton(R.string.ok, null);
  final View view = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_dialog_rssi, null);
  mRssiView = (EditText) view.findViewById(R.id.rssi);
  // Fill the field with the current value
  final Bundle args = getArguments();
  final int currentRssi = args.getInt(RSSI);
  mRssiView.setText(String.valueOf(currentRssi));
  builder.setView(view);
  // The OK button must validate the entered value. We have to overwrite the default button listener.
  final AlertDialog dialog = builder.create();
  dialog.setOnShowListener(new DialogInterface.OnShowListener() {
    @Override
    public void onShow(final DialogInterface d) {
      final Button ok = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
      ok.setOnClickListener(ModifyRssiFragment.this);
    }
  });
  return dialog;
}

代码示例来源:origin: alexive/visual-goodies

/**
 * Shows the dialog.
 * @param listener What to do when the dialog is accepted.
 */
public TextInputDialog show(TextListener listener){
  this.listener = listener;
  watcher = new Watcher();
  mDialogView.getEditText().addTextChangedListener(watcher);
  this.dialog = mDialog.create();
  this.dialog.setOnShowListener(new DialogInterface.OnShowListener() {
    @Override
    public void onShow(DialogInterface dialog) {
      //Just to update the positive's button visibility in case the dev want's
      //just non blank-space input.
      watcher.onTextChanged(mDialogView.getEditText().getText().toString(), 0, 0, 0);
    }
  });
  this.dialog.show();
  return this;
}

代码示例来源:origin: Hu12037102/MediaSelector

.setNegativeButton("取消", null)
    .setCancelable(false).create();
mForbidDialog.setOnShowListener(new DialogInterface.OnShowListener() {
  @Override
  public void onShow(DialogInterface dialog) {

代码示例来源:origin: sytolk/TaxiAndroidOpen

alert.setOnShowListener(new DialogInterface.OnShowListener() {
  @Override
  public void onShow(DialogInterface dialog) {

代码示例来源:origin: NordicSemiconductor/Android-nRF-Beacon

@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
  final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()).setTitle(R.string.update_dialog_manufacturer_id_title).setNegativeButton(R.string.cancel, null)
      .setNeutralButton(R.string.action_default, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(final DialogInterface dialog, final int which) {
          final UpdateFragment parentFragment = (UpdateFragment) getParentFragment();
          parentFragment.writeNewManufacturerId(NORDIC_SEMICONDUCTOR_COMPANY_IDENTIFIER);
        }
      }).setPositiveButton(R.string.ok, null);
  final View view = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_dialog_manufacturer_id, null);
  mManufacturerIdView = (EditText) view.findViewById(R.id.manufacturer_id);
  // Fill the field with the current value
  final Bundle args = getArguments();
  final int currentId = args.getInt(MANUFACTURER_ID);
  mManufacturerIdView.setText(String.valueOf(currentId));
  builder.setView(view);
  // The OK button must validate the entered value. We have to overwrite the default button listener.
  final AlertDialog dialog = builder.create();
  dialog.setOnShowListener(new DialogInterface.OnShowListener() {
    @Override
    public void onShow(final DialogInterface d) {
      final Button ok = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
      ok.setOnClickListener(ModifyManufacturerIdFragment.this);
    }
  });
  return dialog;
}

代码示例来源:origin: NordicSemiconductor/Android-nRF-Beacon

dialog.setOnShowListener(new DialogInterface.OnShowListener() {
  @Override
  public void onShow(final DialogInterface d) {

代码示例来源:origin: domsu/compass

private void initializeDialog(AlertDialog dialog) {
  dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
  dialog.setOnShowListener(d -> {
    Button b = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
    b.setOnClickListener(view -> {
      if (validateCoordinates()) {
        passResult();
        dismiss();
      }
    });
  });
}

代码示例来源:origin: lopspower/SaveInsta

.create();
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
  @Override
  public void onShow(DialogInterface arg0) {

代码示例来源:origin: Calsign/APDE

dialog.setOnShowListener(new DialogInterface.OnShowListener() {
  @Override
  public void onShow(final DialogInterface dialog) {

代码示例来源:origin: casific/murmur

alertdialog.setOnShowListener(new DialogInterface.OnShowListener() {
  @Override
  public void onShow(DialogInterface dialog) {

代码示例来源:origin: jclehner/rxdroid

public DoseDialog(Context context)
{
  super(context);
  View view = getLayoutInflater().inflate(R.layout.dose_dialog, null);
  view.findViewById(R.id.dose_container).setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v)
    {
      setState(STATE_DOSE_EDIT);
    }
  });
  mDoseText = (TextView) view.findViewById(R.id.dose_text);
  mHintText = (TextView) view.findViewById(R.id.dose_hint);
  mDoseInput = (FractionInput) view.findViewById(R.id.dose_edit);
  mInsufficientSupplyText = (TextView) view.findViewById(R.id.text_insufficient_supplies);
  setView(view);
  setButton(BUTTON_NEGATIVE, getString(android.R.string.cancel), mLocalOnClickListener);
  // The actual listener for this button is added in mLocalOnShowListener!
  setButton(BUTTON_POSITIVE, getString(android.R.string.ok), (OnClickListener) null);
  super.setOnShowListener(mLocalOnShowListener);
  Database.registerEventListener(this);
  // Without this, the setMessage() calls in updateMessage() would be ignored; same
  // goes for title and icon, but we don't set one for now.
  setMessage("");
}

代码示例来源:origin: GrenderG/Color-O-Matic

ad.setOnShowListener(new DialogInterface.OnShowListener() {
  @Override
  public void onShow(DialogInterface dialog) {

相关文章