Example usage for android.app Dialog setOnShowListener

List of usage examples for android.app Dialog setOnShowListener

Introduction

In this page you can find the example usage for android.app Dialog setOnShowListener.

Prototype

public void setOnShowListener(@Nullable OnShowListener listener) 

Source Link

Document

Sets a listener to be invoked when the dialog is shown.

Usage

From source file:Main.java

public static void onResume(Dialog dialog) {
    View decorView = dialog.getWindow().getDecorView();
    dialog.getWindow().setFlags(FLAG_NOT_FOCUSABLE, FLAG_NOT_FOCUSABLE);
    dialog.setOnShowListener(d -> dialog.getWindow().clearFlags(FLAG_NOT_FOCUSABLE));
    hideSystemUI(decorView);//from  w  w  w .ja va 2  s  . co  m
    decorView.setOnSystemUiVisibilityChangeListener(visibility -> {
        if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
            hideSystemUI(decorView);
        }
    });
}

From source file:br.com.bioscada.apps.biotracks.fragments.AbstractMyTracksDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final Dialog dialog = createDialog();
    dialog.setOnShowListener(new DialogInterface.OnShowListener() {

        @Override//from ww  w .  j  a v  a2  s .  com
        public void onShow(DialogInterface dialogInterface) {
            DialogUtils.setDialogTitleDivider(getActivity(), dialog);
        }
    });
    return dialog;
}

From source file:com.jaspersoft.android.jaspermobile.dialog.AboutDialogFragment.java

@NonNull
@Override// www. jav a  2s  .c  o  m
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setTitle(R.string.sa_show_about);
    String message = getString(R.string.sa_about_info, BuildConfig.VERSION_NAME);
    builder.setMessage(Html.fromHtml(message));
    builder.setNeutralButton(R.string.ok, null);

    Dialog dialog = builder.create();
    dialog.setCanceledOnTouchOutside(true);

    dialog.setOnShowListener(this);
    return dialog;
}

From source file:at.jclehner.rxdroid.DatePickerFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final Calendar cal;

    final Bundle args = getArguments();
    if (args == null || !args.containsKey(ARG_DATE))
        cal = DateTime.nowCalendar();/*from w  w  w  .  j a v  a 2 s .  co  m*/
    else
        cal = DateTime.calendarFromDate((Date) args.getSerializable(ARG_DATE));

    final int d = cal.get(Calendar.DAY_OF_MONTH);
    final int m = cal.get(Calendar.MONTH);
    final int y = cal.get(Calendar.YEAR);

    if (Version.SDK_IS_JELLYBEAN_OR_NEWER) {
        // Workaround for Android issue #34833
        final Dialog dialog = new DatePickerDialog(getActivity(), null, y, m, d);
        dialog.setOnShowListener(this);
        return dialog;
    } else
        return new DatePickerDialog(getActivity(), mListener, y, m, d);
}

From source file:com.ruesga.rview.fragments.RevealDialogFragment.java

@NonNull
@Override//from   w w w  .  ja v a  2s  . co  m
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public final Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
    buildDialog(builder, savedInstanceState);
    Dialog dialog = builder.create();
    if (AndroidHelper.isLollipopOrGreater()) {
        dialog.setOnShowListener(dialogInterface -> performEnterRevealTransition());
    }
    return dialog;
}

From source file:com.jaspersoft.android.jaspermobile.dialog.NumberDialogFragment.java

@NonNull
@Override/*www.  j  av  a  2 s  .co  m*/
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    LayoutInflater layoutInflater = LayoutInflater.from(getActivity());
    ViewGroup customView = (ViewGroup) layoutInflater.inflate(R.layout.page_dialog_layout,
            (ViewGroup) getActivity().getWindow().getDecorView(), false);
    numberEditText = (EditText) customView.findViewById(R.id.customNumber);
    numberEditText.setFilters(new InputFilter[] { new InputFilterMinMax(1, mMaxValue) });

    if (mInitValue != Integer.MIN_VALUE) {
        numberEditText.setText("");
        numberEditText.append(String.valueOf(mInitValue));
    }

    builder.setTitle(mTitleRes);
    builder.setView(customView);
    builder.setNegativeButton(R.string.cancel, null);
    builder.setPositiveButton(R.string.ok, null);

    Dialog pageDialog = builder.create();
    pageDialog.setOnShowListener(this);
    return pageDialog;
}

From source file:com.androzic.PreferencesHelpDialog.java

@SuppressLint("NewApi")
@Override//from  w w w .ja va  2s .c o m
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = super.onCreateDialog(savedInstanceState);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) {
        dialog.setOnShowListener(new DialogInterface.OnShowListener() {
            @Override
            public void onShow(DialogInterface dialog) {
                scrollToView(rootView, rootView.findViewById(sectionId));
            }
        });
    }
    return dialog;
}

From source file:at.jclehner.rxdroid.preferences.DrugNamePreference2.java

@Override
protected void onPrepareDialog(Dialog dialog) {
    dialog.setOnShowListener(new OnShowListener() {

        @Override// w ww .  jav a  2s .c o  m
        public void onShow(DialogInterface dialog) {
            mBtnPositive = ((AlertDialog) dialog).getButton(Dialog.BUTTON_POSITIVE);
        }
    });
}

From source file:com.ruesga.rview.fragments.SetAccountStatusDialogFragment.java

@Override
public void setupDialog(Dialog dialog, int style) {
    super.setupDialog(dialog, style);

    dialog.setOnShowListener(dialog1 -> {
        Button button = ((AlertDialog) dialog1).getButton(AlertDialog.BUTTON_POSITIVE);
        button.setOnClickListener(v -> performAccountStateChanged());
    });/* w w  w .ja  v  a 2  s.com*/
}

From source file:com.jaspersoft.android.jaspermobile.dialog.ProgressDialogFragment.java

@NonNull
@Override/*from  www . j  ava 2 s  . com*/
public Dialog onCreateDialog(Bundle savedInstanceState) {
    View customLayout = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_progress, null);

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    TextView message = (TextView) customLayout.findViewById(R.id.progressMessage);
    message.setText(getString(loadingMessage));
    builder.setView(customLayout);

    Dialog dialog = builder.create();
    dialog.setCanceledOnTouchOutside(false);

    dialog.setOnShowListener(new OnShowListener() {
        @Override
        public void onShow(DialogInterface dialog) {
            if (!isPreparing) {
                dialog.dismiss();
                return;
            }
            if (onShowListener != null) {
                onShowListener.onShow(dialog);
            }
            isPreparing = false;
        }
    });
    return dialog;
}