Android Open Source - qrscanner Message Dialog Fragment






From Project

Back to project page qrscanner.

License

The source code is released under:

Apache License

If you think the Android project qrscanner listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.qloppy.qrscan.sample;
/*from w  ww . ja  v a  2s  .c  o m*/
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;

public class MessageDialogFragment extends DialogFragment {
    public interface MessageDialogListener {
        public void onDialogPositiveClick(DialogFragment dialog);
    }

    private String mTitle;
    private String mMessage;
    private MessageDialogListener mListener;

    public void onCreate(Bundle state) {
        super.onCreate(state);
        setRetainInstance(true);
    }

    public static MessageDialogFragment newInstance(String title, String message, MessageDialogListener listener) {
        MessageDialogFragment fragment = new MessageDialogFragment();
        fragment.mTitle = title;
        fragment.mMessage = message;
        fragment.mListener = listener;
        return fragment;
    }

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setMessage(mMessage)
                .setTitle(mTitle);

        builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                if(mListener != null) {
                    mListener.onDialogPositiveClick(MessageDialogFragment.this);
                }
            }
        });

        return builder.create();
    }
}




Java Source Code List

com.qloppy.qrscan.CameraPreview.java
com.qloppy.qrscan.CameraUtils.java
com.qloppy.qrscan.QRCodeScannerView.java
com.qloppy.qrscan.ViewFinderView.java
com.qloppy.qrscan.sample.MainActivity.java
com.qloppy.qrscan.sample.MessageDialogFragment.java
com.qloppy.qrscan.sample.SimpleScannerActivity.java
com.qloppy.qrscan.sample.SimpleScannerFragmentActivity.java