Example usage for android.app ProgressDialog STYLE_SPINNER

List of usage examples for android.app ProgressDialog STYLE_SPINNER

Introduction

In this page you can find the example usage for android.app ProgressDialog STYLE_SPINNER.

Prototype

int STYLE_SPINNER

To view the source code for android.app ProgressDialog STYLE_SPINNER.

Click Source Link

Document

Creates a ProgressDialog with a circular, spinning progress bar.

Usage

From source file:postApp.ActivitiesView.MenuView.FragmentViews.PairingView.QrCodeView.java

/**
 * Loading method that shows a progressdialog
 *//* w  w  w.j  a va 2s.c o  m*/
public void Loading() {
    progress.setMessage("Pairing");
    progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progress.setIndeterminate(true);
    progress.setCancelable(false);
    progress.setCanceledOnTouchOutside(false);
    progress.show();
}

From source file:de.baumann.hhsmoodle.helper.helper_main.java

public static void onClose(final Activity activity) {
    PreferenceManager.setDefaultValues(activity, R.xml.user_settings, false);
    sharedPref = PreferenceManager.getDefaultSharedPreferences(activity);
    final ProgressDialog progressDialog;

    if (sharedPref.getBoolean("backup_aut", false)) {

        try {/* w w  w.  ja v  a 2 s . com*/
            helper_security.encryptBackup(activity, "/bookmarks_DB_v01.db");
        } catch (Exception e) {
            e.printStackTrace();
        }
        try {
            helper_security.encryptBackup(activity, "/courses_DB_v01.db");
        } catch (Exception e) {
            e.printStackTrace();
        }
        try {
            helper_security.encryptBackup(activity, "/notes_DB_v01.db");
        } catch (Exception e) {
            e.printStackTrace();
        }
        try {
            helper_security.encryptBackup(activity, "/random_DB_v01.db");
        } catch (Exception e) {
            e.printStackTrace();
        }
        try {
            helper_security.encryptBackup(activity, "/subject_DB_v01.db");
        } catch (Exception e) {
            e.printStackTrace();
        }
        try {
            helper_security.encryptBackup(activity, "/schedule_DB_v01.db");
        } catch (Exception e) {
            e.printStackTrace();
        }
        try {
            helper_security.encryptBackup(activity, "/todo_DB_v01.db");
        } catch (Exception e) {
            e.printStackTrace();
        }

        progressDialog = new ProgressDialog(activity);
        progressDialog.setMessage(activity.getString(R.string.app_close));
        progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        progressDialog.show();

        new Handler().postDelayed(new Runnable() {
            public void run() {
                sharedPref.edit().putString("loadURL", "").apply();
                helper_security.encryptDatabases(activity);
                if (progressDialog.isShowing()) {
                    progressDialog.cancel();
                }
                activity.finishAffinity();
            }
        }, 1500);

    } else {
        sharedPref.edit().putString("loadURL", "").apply();
        helper_security.encryptDatabases(activity);
        activity.finishAffinity();
    }
}

From source file:com.artur.softwareproject.BluetoothConnectionListAdapter.java

@Override
@NonNull//  w  w  w  .  j  a  v a 2s  .com
public View getView(final int position, View convertView, @NonNull ViewGroup parent) {
    ViewHolder mViewHolder;

    if (convertView == null) {
        mViewHolder = new ViewHolder();

        LayoutInflater ListInflater = LayoutInflater.from(getContext());

        convertView = ListInflater.inflate(R.layout.bluetooth_list_pattern, parent, false);

        mViewHolder.bluetoothConnectionName = (TextView) convertView
                .findViewById(R.id.bluetooth_connection_name);

        mViewHolder.bluetoothConnectionStatus = (TextView) convertView
                .findViewById(R.id.bluetooth_connection_status);

        convertView.setTag(mViewHolder);

        convertView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //What happens if you press on the list items at the bluetooth activity.
                Animation animation = new AlphaAnimation(0.3f, 1.0f);

                animation.setDuration(1000);

                v.startAnimation(animation);

                intent = new Intent(contextActivity, BluetoothService.class);
                intent.putExtra("device", bDevices.get(position));
                intent.putExtra("deviceList", bDevices);

                contextActivity.startService(intent);

                final ProgressDialog connectingDialog = new ProgressDialog(contextActivity);

                connectDialog = connectingDialog;

                connectingDialog.setMessage("Connecting...");
                connectingDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
                connectingDialog.setCancelable(false);
                connectingDialog.show();

                final ConnectionHandlerClass connectHandler = new ConnectionHandlerClass(bclaReference);

                connectThread = new Thread(new Runnable() {
                    @Override
                    public void run() {
                        int stop = 0;
                        int counter = 0;

                        //Timeout after 10 seconds.
                        while (stop == 0 && counter < 5) {
                            stop = getConnected();
                            counter++;
                            sleep(2000);
                        }

                        //Timeout occurred after 10s of waiting and stop is still 0.
                        if (stop == 0 && counter == 4) {
                            timeout = true;
                        }

                        connectHandler.sendEmptyMessage(0);
                    }
                });

                connectThread.start();
            }
        });
    } else {
        mViewHolder = (ViewHolder) convertView.getTag();
    }

    mViewHolder.bluetoothConnectionName.setText(bluetoothAddress.get(position));
    mViewHolder.bluetoothConnectionStatus.setText(bluetoothName.get(position));

    return convertView;
}

From source file:br.ufg.inf.es.fs.contpatri.mobile.webservice.Autenticar.java

@Override
protected void onPreExecute() {
    super.onPreExecute();
    dialog.setTitle("Autenticando...");
    dialog.setMessage("Realizando login com " + usuario.getLogin());
    dialog.setIndeterminate(true);//from w w w .  j a  v a 2 s.  co  m
    dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    dialog.setCancelable(false);
    dialog.show();
}

From source file:com.brq.wallet.activity.AddAccountActivity.java

private void createNewHdAccount() {
    final WalletManager wallet = _mbwManager.getWalletManager(false);
    // at this point, we have to have a master seed, since we created one on startup
    Preconditions.checkState(wallet.hasBip32MasterSeed());
    if (!wallet.canCreateAdditionalBip44Account()) {
        _toaster.toast(R.string.use_acc_first, false);
        return;/*w  w  w  . ja  v  a2  s . co m*/
    }
    _progress.setCancelable(false);
    _progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    _progress.setMessage(getString(R.string.hd_account_creation_started));
    _progress.show();
    new HdCreationAsyncTask(_mbwManager.getEventBus()).execute();
}

From source file:com.example.photoremark.MainActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == RESULT_CAPTURE_IMAGE && (resultCode == Activity.RESULT_OK)) {

        processDialog = new ProgressDialog(MainActivity.this);
        processDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        // processDialog.setTitle("");
        processDialog.setMessage("?...");
        // ProgressDialog ??? false ??
        processDialog.setIndeterminate(false);
        // ProgressDialog ???
        processDialog.setCancelable(false);
        processDialog.show();//from w w w.j a v a  2s  .c  o m
        watermarkphoto();
    }
}

From source file:com.fabernovel.alertevoirie.HomeActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    switch (id) {
    case DIALOG_PROGRESS:
        ProgressDialog pd = new ProgressDialog(this);
        pd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        pd.setIndeterminate(true);//ww w.j av  a 2  s  . c  om
        pd.setOnDismissListener(new OnDismissListener() {
            @Override
            public void onDismiss(DialogInterface dialog) {
                if (dialog_shown)
                    removeDialog(DIALOG_PROGRESS);
            }
        });
        pd.setOnCancelListener(new OnCancelListener() {
            @Override
            public void onCancel(DialogInterface dialog) {
                AVService.getInstance(HomeActivity.this).cancelTask();
                finish();
            }
        });
        pd.setMessage(getString(R.string.ui_message_loading));
        return pd;

    default:
        return super.onCreateDialog(id);
    }
}

From source file:edu.wpi.khufnagle.lighthousenavigator.PhotographsActivity.java

/**
 * Display the UI defined in activity_photographs.xml upon activity start.
 *///from   w w  w  .j a v a 2s  .co m
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.setContentView(R.layout.activity_photographs);

    /*
     * Add "up" button functionality in the left of application icon in
     * top-left corner, allowing user to return to "welcome" screen
     */
    final ActionBar ab = this.getSupportActionBar();
    ab.setDisplayHomeAsUpEnabled(true);
    ab.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

    /*
     * Create "navigation spinner" in activity action bar that allows user to
     * view a different content screen
     */
    final ArrayAdapter<CharSequence> navDropDownAdapter = ArrayAdapter.createFromResource(this,
            R.array.ab_content_activities_names, R.layout.ab_navigation_dropdown_item);
    ab.setListNavigationCallbacks(navDropDownAdapter, this);
    ab.setSelectedNavigationItem(ContentActivity.PHOTOGRAPHS.getABDropDownListIndex());

    // Retrieve name of lighthouse that user is viewing
    final Bundle extras = this.getIntent().getExtras();
    final String lighthouseNameSelected = extras.getString("lighthousename");

    // Lighthouse data guaranteed to exist ("Welcome" activity performs data
    // existence validation)
    final LighthouseDataParser lighthouseInformationParser = new LighthouseDataParser(
            this.getApplicationContext(), lighthouseNameSelected);
    lighthouseInformationParser.parseLighthouseData();
    this.currentLighthouse = lighthouseInformationParser.getLighthouse();

    /*
     * Complete Flickr downloading task only if a network connection exists
     * _and_ the cache is empty or contains information about a lighthouse
     * other than the "desired" one
     */
    this.userConnectedToInternet = this.networkConnectionExists();
    FlickrDownloadHandler downloadHandler = null;

    if (this.userConnectedToInternet) {
        if (!this.photoCacheExists()) {
            if (!PhotographsActivity.downloadingThreadStarted) {
                Log.d("LIGHTNAVDEBUG", "Creating dialog...");

                // Display dialog informing user about download progress
                final ProgressDialog flickrPhotoDownloadDialog = new ProgressDialog(this,
                        ProgressDialog.STYLE_SPINNER);
                flickrPhotoDownloadDialog.setTitle("Downloading Flickr photos");
                flickrPhotoDownloadDialog.setMessage("Downloading photographs from Flickr...");
                flickrPhotoDownloadDialog.setCancelable(true);

                flickrPhotoDownloadDialog.show();

                final HashSet<Photograph> flickrPhotos = new HashSet<Photograph>();

                /*
                 * Start background thread that will complete actual downloading
                 * process
                 */
                PhotographsActivity.downloadingThreadStarted = true;
                downloadHandler = new FlickrDownloadHandler(this, this.currentLighthouse, flickrPhotos,
                        flickrPhotoDownloadDialog);

                final FlickrPhotoDownloadThread downloadThread = new FlickrPhotoDownloadThread(
                        this.getApplicationContext(), this.currentLighthouse, downloadHandler,
                        PhotographsActivity.XML_DOWNLOAD_COMPLETE, PhotographsActivity.INTERRUPT);
                Log.d("LIGHTNAVDEBUG", "Flickr download XML thread started");
                downloadThread.start();

                /*
                 * Interrupt (stop) currently-running thread if user cancels
                 * downloading operation explicitly
                 */
                flickrPhotoDownloadDialog.setOnCancelListener(new OnCancelListener() {
                    @Override
                    public void onCancel(DialogInterface di) {
                        if (downloadThread.isAlive()) {
                            downloadThread.interrupt();
                        } else if (PhotographsActivity.this.parseOutputThread != null
                                && PhotographsActivity.this.parseOutputThread.isAlive()) {
                            PhotographsActivity.this.parseOutputThread.interrupt();
                        } else {
                            // Do nothing
                        }
                    }
                });
            }
        } else {

            final ArrayList<Photograph> lighthousePhotos = this.currentLighthouse.getAlbum()
                    .get(ActivityVisible.PHOTOGRAPHS);
            lighthousePhotos.clear();
            final File downloadCacheDir = new File(this.getFilesDir() + "/download-cache/");
            final File[] downloadCacheDirContents = downloadCacheDir.listFiles();
            for (int i = 0; i < downloadCacheDirContents.length; i++) {
                final String downloadCacheDirContentName = downloadCacheDirContents[i].getName();
                final String[] downloadCacheDirContentPieces = downloadCacheDirContentName.split("_");
                final Long photoID = Long.parseLong(downloadCacheDirContentPieces[2]);
                final String ownerName = downloadCacheDirContentPieces[3].replace("~", " ");
                final String creativeCommonsLicenseIDString = downloadCacheDirContentPieces[4].substring(0, 1);
                final int creativeCommonsLicenseID = Integer.parseInt(creativeCommonsLicenseIDString);
                final CreativeCommonsLicenseType licenseType = CreativeCommonsLicenseType
                        .convertToLicenseEnum(creativeCommonsLicenseID);
                lighthousePhotos.add(new Photograph(photoID, ownerName, licenseType,
                        "/download-cache/" + downloadCacheDirContentName));
            }
            this.currentLighthouse.getAlbum().put(ActivityVisible.PHOTOGRAPHS, lighthousePhotos);
        }
    }

    if (!this.userConnectedToInternet || this.userConnectedToInternet && this.photoCacheExists()
            || downloadHandler != null && downloadHandler.getFlickrOperationsComplete()) {
        // Display first photograph as "selected" photograph in top-left corner
        // by default
        final ArrayList<Photograph> photoSet = this.currentLighthouse.getAlbum()
                .get(ActivityVisible.PHOTOGRAPHS);
        final Photograph currentPhotoOnLeftSide = photoSet.get(0);

        final ImageView currentPhotoView = (ImageView) this.findViewById(R.id.iv_photographs_current_image);
        if (this.userConnectedToInternet) {
            currentPhotoView.setImageDrawable(Drawable.createFromPath(
                    PhotographsActivity.this.getFilesDir() + currentPhotoOnLeftSide.getInternalStorageLoc()));
        } else {
            currentPhotoView.setImageResource(currentPhotoOnLeftSide.getResID());
        }

        // Add credits for "default" main photograph
        final TextView owner = (TextView) this.findViewById(R.id.tv_photographs_photographer);
        final TextView licenseType = (TextView) this.findViewById(R.id.tv_photographs_license);
        owner.setText("Uploaded by: " + currentPhotoOnLeftSide.getOwner());
        licenseType.setText("License: " + currentPhotoOnLeftSide.getLicenseTypeAbbreviation());

        /*
         * Display Google Map as a SupportMapFragment (instead of MapFragment
         * for compatibility with Android 2.x)
         */
        /*
         * BIG thanks to http://www.truiton.com/2013/05/
         * android-supportmapfragment-example/ for getting this part of the app
         * working
         */
        final FragmentManager fm = this.getSupportFragmentManager();
        final Fragment mapFragment = fm.findFragmentById(R.id.frag_photographs_map);
        final SupportMapFragment smf = (SupportMapFragment) mapFragment;
        smf.getMap();
        final GoogleMap supportMap = smf.getMap();

        /*
         * Center map at lighthouse location, at a zoom level of 12 with no
         * tilt, facing due north
         */
        final LatLng lighthouseLocation = new LatLng(this.currentLighthouse.getCoordinates().getLatitude(),
                this.currentLighthouse.getCoordinates().getLongitude());
        final float zoomLevel = 12.0f;
        final float tiltAngle = 0.0f;
        final float bearing = 0.0f;
        final CameraPosition cameraPos = new CameraPosition(lighthouseLocation, zoomLevel, tiltAngle, bearing);
        supportMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPos));

        /*
         * Allows user to open a maps application (such as Google Maps) upon
         * selecting the map fragment
         */
        /*
         * Courtesy of:
         * http://stackoverflow.com/questions/6205827/how-to-open-standard
         * -google-map-application-from-my-application
         */
        supportMap.setOnMapClickListener(new OnMapClickListener() {

            @Override
            public void onMapClick(LatLng lighthouseCoordinates) {
                final String uri = String.format(Locale.US, "geo:%f,%f", lighthouseCoordinates.latitude,
                        lighthouseCoordinates.longitude);
                final Intent googleMapsIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
                PhotographsActivity.this.startActivity(googleMapsIntent);
            }
        });

        this.gv = (GridView) this.findViewById(R.id.gv_photographs_thumbnails);

        /*
         * Photographs in the "current lighthouse album" are from Flickr if the
         * album is empty or if the first (or _any_) of the elements in the
         * album do not have a "proper" static resource ID
         */
        this.photosFromFlickr = this.currentLighthouse.getAlbum().get(ActivityVisible.PHOTOGRAPHS).isEmpty()
                || this.currentLighthouse.getAlbum().get(ActivityVisible.PHOTOGRAPHS).iterator().next()
                        .getResID() == 0;

        final LighthouseImageAdapter thumbnailAdapter = new LighthouseImageAdapter(this,
                this.currentLighthouse.getAlbum().get(ActivityVisible.PHOTOGRAPHS), this.photosFromFlickr);

        this.gv.setAdapter(thumbnailAdapter);

        this.gv.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
                // Determine which photograph from the list was selected...
                final Photograph photoClicked = (Photograph) thumbnailAdapter.getItem(position);
                final int photoClickedResID = photoClicked.getResID();

                // ...and change the information in the top-left corner
                // accordingly
                if (PhotographsActivity.this.userConnectedToInternet) {
                    currentPhotoView.setImageDrawable(Drawable.createFromPath(
                            PhotographsActivity.this.getFilesDir() + photoClicked.getInternalStorageLoc()));
                } else {
                    currentPhotoView.setImageResource(photoClickedResID);
                }
                owner.setText("Uploaded by: " + photoClicked.getOwner());
                licenseType.setText("License: " + photoClicked.getLicenseTypeAbbreviation());
            }
        });
    }
}

From source file:org.alfresco.mobile.android.application.fragments.operations.OperationWaitingDialogFragment.java

public Dialog onCreateDialog(final Bundle savedInstanceState) {
    setRetainInstance(true);// w  w  w.ja  va  2  s  .  c  o  m
    if (getArguments() != null) {
        operationType = getArguments().getInt(PARAM_TYPEID);
        intentId = getArguments().getString(PARAM_INTENTID);
        iconId = getArguments().getInt(PARAM_ICONID);
        title = getArguments().getString(PARAM_TITLEID);
        message = getArguments().getString(PARAM_MESSAGEID);
        parent = getArguments().getParcelable(PARAM_NODEID);
        nbItems = getArguments().getInt(PARAM_SIZE);
    }

    ProgressDialog dialog = new ProgressDialog(getActivity());
    if (iconId == 0) {
        iconId = R.drawable.ic_alfresco_logo;
    }
    dialog.setIcon(iconId);
    dialog.setTitle(title);
    if (message == null) {
        message = getString(R.string.waiting_operations);
    }
    dialog.setMessage(message);
    boolean indeterminate = true;
    if (nbItems > 0) {
        dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
        dialog.setProgress(0);
        dialog.setMax(nbItems);
        indeterminate = false;
    } else {
        dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    }
    dialog.setIndeterminate(indeterminate);
    dialog.setCancelable(false);
    dialog.setButton(DialogInterface.BUTTON_NEGATIVE, getString(R.string.cancel),
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            });

    getActivity().getLoaderManager().restartLoader(this.hashCode(), null, this);

    return dialog;
}

From source file:com.kkbox.toolkit.dialog.KKDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    DialogInterface.OnClickListener positiveListener = new DialogInterface.OnClickListener() {
        @Override//from   ww w  . j  a v a 2  s .co  m
        public void onClick(DialogInterface dialog, int id) {
            if (!isDismissed) {
                if (listener != null) {
                    listener.onPositive();
                }
                onDialogFinishedByUser();
                isDismissed = true;
            }
        }
    };

    DialogInterface.OnClickListener neutralListener = new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int id) {
            if (!isDismissed) {
                if (listener != null) {
                    listener.onNeutral();
                }
                onDialogFinishedByUser();
                isDismissed = true;
            }
        }
    };

    DialogInterface.OnClickListener negativeListener = new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int id) {
            if (!isDismissed) {
                if (listener != null) {
                    listener.onNegative();
                }
                onDialogFinishedByUser();
                isDismissed = true;
            }
        }
    };

    switch (dialogType) {
    case Type.PROGRESSING_DIALOG:
        ProgressDialog progressDialog;
        if (theme != -1) {
            progressDialog = new ProgressDialog(getActivity(), theme);
        } else {
            progressDialog = new ProgressDialog(getActivity());
        }
        progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        progressDialog.setMessage(message);
        progressDialog.setIndeterminate(true);
        progressDialog.setCanceledOnTouchOutside(false);
        progressDialog.setCancelable(listener != null);
        return progressDialog;
    case Type.ALERT_DIALOG:
        AlertDialog.Builder builder;
        AlertDialog alertDialog;
        if (theme != -1) {
            builder = new AlertDialog.Builder(new ContextThemeWrapper(getActivity(), theme));
        } else {
            builder = new AlertDialog.Builder(getActivity());
        }
        builder.setMessage(message);
        builder.setTitle(title);
        builder.setPositiveButton(positiveButtonText, positiveListener);
        alertDialog = builder.create();
        alertDialog.setCanceledOnTouchOutside(isAlertDialogCanceledOnTouchOutside);
        return alertDialog;
    case Type.THREE_CHOICE_DIALOG:
        if (theme != -1) {
            builder = new AlertDialog.Builder(new ContextThemeWrapper(getActivity(), theme));
        } else {
            builder = new AlertDialog.Builder(getActivity());
        }
        builder.setMessage(message);
        builder.setTitle(title);
        builder.setPositiveButton(positiveButtonText, positiveListener);
        builder.setNeutralButton(neutralButtonText, neutralListener);
        builder.setNegativeButton(negativeButtonText, negativeListener);
        alertDialog = builder.create();
        alertDialog.setCanceledOnTouchOutside(isAlertDialogCanceledOnTouchOutside);
        return alertDialog;
    case Type.YES_OR_NO_DIALOG:
        if (theme != -1) {
            builder = new AlertDialog.Builder(new ContextThemeWrapper(getActivity(), theme));
        } else {
            builder = new AlertDialog.Builder(getActivity());
        }
        builder.setMessage(message);
        builder.setTitle(title);
        builder.setPositiveButton(positiveButtonText, positiveListener);
        builder.setNegativeButton(negativeButtonText, negativeListener);
        alertDialog = builder.create();
        alertDialog.setCanceledOnTouchOutside(isAlertDialogCanceledOnTouchOutside);
        return alertDialog;
    case Type.SELECT_DIALOG:
        if (theme != -1) {
            builder = new AlertDialog.Builder(new ContextThemeWrapper(getActivity(), theme));
        } else {
            builder = new AlertDialog.Builder(getActivity());
        }
        builder.setMessage(message);
        builder.setTitle(title);
        builder.setSingleChoiceItems(entries, selectedIndex, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                if (!isDismissed) {
                    if (listener != null) {
                        listener.onEvent(id);
                    }
                    dismiss();
                    onDialogFinishedByUser();
                    isDismissed = true;
                }
            }
        });
        builder.setNegativeButton(negativeButtonText, negativeListener);
        alertDialog = builder.create();
        alertDialog.setCanceledOnTouchOutside(isAlertDialogCanceledOnTouchOutside);
        return alertDialog;
    case Type.CUSTOMIZE_DIALOG:
        if (theme != -1) {
            builder = new AlertDialog.Builder(new ContextThemeWrapper(getActivity(), theme));
        } else {
            builder = new AlertDialog.Builder(getActivity());
        }
        if (customizeView != null && customizeView.getParent() != null) {
            ((ViewGroup) customizeView.getParent()).removeView(customizeView);
        }
        builder.setView(customizeView);

        if (!TextUtils.isEmpty(title)) {
            builder.setTitle(title);
        }
        if (!TextUtils.isEmpty(positiveButtonText)) {
            builder.setPositiveButton(positiveButtonText, positiveListener);
        }
        if (!TextUtils.isEmpty(neutralButtonText)) {
            builder.setNeutralButton(neutralButtonText, neutralListener);
        }
        if (!TextUtils.isEmpty(negativeButtonText)) {
            builder.setNegativeButton(negativeButtonText, negativeListener);
        }
        alertDialog = builder.create();
        alertDialog.setCanceledOnTouchOutside(isAlertDialogCanceledOnTouchOutside);
        return alertDialog;
    case Type.CUSTOMIZE_FULLSCREEN_DIALOG:
        Dialog dialog;
        if (theme != -1) {
            dialog = new Dialog(getActivity(), theme);
        } else {
            dialog = new Dialog(getActivity(), android.R.style.Theme_NoTitleBar);
        }
        if (customizeView != null && customizeView.getParent() != null) {
            ((ViewGroup) customizeView.getParent()).removeView(customizeView);
        }
        dialog.setContentView(customizeView);
        return dialog;
    }
    return null;
}