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:edu.cmu.cylab.starslinger.view.SaveActivity.java

private Dialog xshowProgress(Activity act, Bundle args) {
    String msg = args.getString(extra.RESID_MSG);
    MyLog.i(TAG, msg);/*w  ww.j  a v  a2s .  c  o  m*/

    if (mDlgProg != null) {
        mDlgProg = null;
        mProgressMsg = null;
    }
    mDlgProg = new ProgressDialog(act);
    mDlgProg.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    mDlgProg.setMessage(msg);
    mProgressMsg = msg;
    mDlgProg.setCancelable(true);
    mDlgProg.setIndeterminate(true);
    mDlgProg.setProgress(0);
    mDlgProg.setCanceledOnTouchOutside(false);
    mDlgProg.setOnDismissListener(new DialogInterface.OnDismissListener() {

        @Override
        public void onDismiss(DialogInterface dialog) {
            finish();
        }
    });
    mDlgProg.setOnCancelListener(new DialogInterface.OnCancelListener() {

        @Override
        public void onCancel(DialogInterface dialog) {
            finish();
        }
    });

    return mDlgProg;
}

From source file:com.einzig.ipst2.activities.MainActivity.java

/**
 * Wrapper function for parseEmailWork./*from w  ww. jav  a 2s .  c  o  m*/
 * <p>
 * Builds the progress dialog for, then calls parseEmailWork
 * </p>
 *
 * @see MainActivity#parseEmailWork(Account, ProgressDialog)
 */
private void parseEmail() {
    if (Looper.myLooper() == Looper.getMainLooper()) {
        Logger.d("IS MAIN THREAD?!");
    }
    final Account account = getAccount();
    if (account != null) {
        final ProgressDialog dialog = new ProgressDialog(this, ThemeHelper.getDialogTheme(this));
        dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        dialog.setIndeterminate(true);
        dialog.setTitle(getString(R.string.searching_email));
        dialog.setCanceledOnTouchOutside(false);
        dialog.setCancelable(false);
        dialog.show();
        new Thread() {
            public void run() {
                parseEmailWork(account, dialog);
            }
        }.start();
        //getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
        //getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    }
}

From source file:study.tdcc.act.MainCalendar.java

/**
 * ?(??)//  ww  w  .  j a v  a  2 s .  c o m
 */
public void makeCalDateCell() {
    Log.d("DEBUG", "MainCalendar makeCalDateCell Start");
    //??
    pdObj = new ProgressDialog(MainCalendar.this);
    pdObj.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    pdObj.setMessage(getString(R.string.scload_msg));
    //?????
    pdObj.setCancelable(false);
    //?
    pdObj.show();
    //????
    Thread thread = new Thread(runLoadAllDay);
    //?
    thread.start();
    Log.d("DEBUG", "MainCalendar makeCalDateCell End");
}

From source file:com.realtek.simpleconfig.SCTest.java

/**  */
@SuppressWarnings("deprecation")
public void DiscoverDevPopUp(final int milliSeconds) {
    discovDialog.setTitle("Wi-Fi: " + SCLib.getConnectedWifiSSID());
    discovDialog.setMessage("    ?......");
    discovDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    discovDialog.setCancelable(false);/*from  w ww  .j ava  2 s. c o m*/
    discovDialog.setButton("Cancel", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            DiscovEnable = false;
            dialog.cancel();
        }
    });
    discovDialog.show();

    new Thread(new Runnable() {
        public void run() {
            Process.setThreadPriority(Process.THREAD_PRIORITY_DEFAULT);
            byte[] DiscovCmdBuf = SCCtlOps.rtk_sc_gen_discover_packet(SCLib.rtk_sc_get_default_pin());
            long startTime = System.currentTimeMillis();
            long endTime = System.currentTimeMillis();
            while (DiscovEnable && (endTime - startTime) < milliSeconds) {
                SCLib.rtk_sc_send_discover_packet(DiscovCmdBuf, "255.255.255.255");
                endTime = System.currentTimeMillis();
            }
            Log.i(TAG, "Discover Time Elapsed: " + (endTime - startTime) + "ms");

            // Update Status
            Message msg = Message.obtain();
            msg.obj = null;
            msg.what = ~SCCtlOps.Flag.DiscoverACK; //timeout
            SCLib.TreadMsgHandler.sendMessage(msg);
        }
    }).start();
}

From source file:de.bahnhoefe.deutschlands.bahnhofsfotos.DetailsActivity.java

private void uploadPhoto() {
    final ProgressDialog progress = new ProgressDialog(DetailsActivity.this);
    progress.setMessage(getResources().getString(R.string.send));
    progress.setTitle(getResources().getString(R.string.app_name));
    progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progress.show();/*from www  .  j ava  2 s. c o m*/

    final File mediaFile = getStoredMediaFile();
    RequestBody file = RequestBody
            .create(MediaType.parse(URLConnection.guessContentTypeFromName(mediaFile.getName())), mediaFile);
    rsapi.photoUpload(email, token, bahnhof.getId(), countryCode.toLowerCase(), file)
            .enqueue(new Callback<Void>() {
                @Override
                public void onResponse(Call<Void> call, Response<Void> response) {
                    progress.dismiss();
                    switch (response.code()) {
                    case 202:
                        new SimpleDialogs().confirm(DetailsActivity.this, R.string.upload_completed);
                        break;
                    case 400:
                        new SimpleDialogs().confirm(DetailsActivity.this, R.string.upload_bad_request);
                        break;
                    case 401:
                        new SimpleDialogs().confirm(DetailsActivity.this, R.string.upload_token_invalid);
                        break;
                    case 409:
                        new SimpleDialogs().confirm(DetailsActivity.this, R.string.upload_conflict);
                        break;
                    case 413:
                        new SimpleDialogs().confirm(DetailsActivity.this, R.string.upload_too_big);
                        break;
                    default:
                        new SimpleDialogs().confirm(DetailsActivity.this,
                                String.format(getText(R.string.upload_failed).toString(), response.code()));
                    }
                }

                @Override
                public void onFailure(Call<Void> call, Throwable t) {
                    Log.e(TAG, "Error uploading photo", t);
                    progress.dismiss();
                    new SimpleDialogs().confirm(DetailsActivity.this,
                            String.format(getText(R.string.upload_failed).toString(), t.getMessage()));
                }
            });
}

From source file:com.mobicage.rogerthat.registration.RegistrationActivity2.java

private void registerWithAccessToken(final String accessToken) {
    final String timestamp = "" + mWiz.getTimestamp();
    final String deviceId = mWiz.getDeviceId();
    final String registrationId = mWiz.getRegistrationId();
    final String installId = mWiz.getInstallationId();
    // Make call to Rogerthat webfarm
    final ProgressDialog progressDialog = new ProgressDialog(RegistrationActivity2.this);
    progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progressDialog//from w  ww .  j a va  2 s  .c o m
            .setMessage(getString(R.string.registration_activating_account, getString(R.string.app_name)));
    progressDialog.setCancelable(false);
    progressDialog.show();
    final SafeRunnable showErrorDialog = new SafeRunnable() {
        @Override
        protected void safeRun() throws Exception {
            T.UI();
            progressDialog.dismiss();
            AlertDialog.Builder builder = new AlertDialog.Builder(RegistrationActivity2.this);
            builder.setMessage(R.string.registration_facebook_error);
            builder.setPositiveButton(R.string.rogerthat, null);
            AlertDialog dialog = builder.create();
            dialog.show();
        }
    };

    mWorkerHandler.post(new SafeRunnable() {
        @Override
        protected void safeRun() throws Exception {
            T.REGISTRATION();
            String version = "1";
            String signature = Security.sha256(version + " " + installId + " " + timestamp + " " + deviceId
                    + " " + registrationId + " " + accessToken + CloudConstants.REGISTRATION_MAIN_SIGNATURE);

            HttpPost httppost = new HttpPost(CloudConstants.REGISTRATION_FACEBOOK_URL);
            try {
                List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(8);
                nameValuePairs.add(new BasicNameValuePair("version", version));
                nameValuePairs.add(new BasicNameValuePair("registration_time", timestamp));
                nameValuePairs.add(new BasicNameValuePair("device_id", deviceId));
                nameValuePairs.add(new BasicNameValuePair("registration_id", registrationId));
                nameValuePairs.add(new BasicNameValuePair("signature", signature));
                nameValuePairs.add(new BasicNameValuePair("install_id", installId));
                nameValuePairs.add(new BasicNameValuePair("access_token", accessToken));
                nameValuePairs.add(new BasicNameValuePair("language", Locale.getDefault().getLanguage()));
                nameValuePairs.add(new BasicNameValuePair("country", Locale.getDefault().getCountry()));
                nameValuePairs.add(new BasicNameValuePair("app_id", CloudConstants.APP_ID));
                nameValuePairs.add(
                        new BasicNameValuePair("use_xmpp_kick", CloudConstants.USE_XMPP_KICK_CHANNEL + ""));
                nameValuePairs.add(new BasicNameValuePair("GCM_registration_id", mGCMRegistrationId));

                httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

                // Execute HTTP Post Request
                HttpResponse response = mHttpClient.execute(httppost);

                int statusCode = response.getStatusLine().getStatusCode();
                HttpEntity entity = response.getEntity();

                if (entity == null) {
                    mUIHandler.post(showErrorDialog);
                    return;
                }

                @SuppressWarnings("unchecked")
                final Map<String, Object> responseMap = (Map<String, Object>) JSONValue
                        .parse(new InputStreamReader(entity.getContent()));

                if (statusCode != 200 || responseMap == null) {
                    if (statusCode == 500 && responseMap != null) {
                        final String errorMessage = (String) responseMap.get("error");
                        if (errorMessage != null) {
                            mUIHandler.post(new SafeRunnable() {
                                @Override
                                protected void safeRun() throws Exception {
                                    T.UI();
                                    progressDialog.dismiss();
                                    AlertDialog.Builder builder = new AlertDialog.Builder(
                                            RegistrationActivity2.this);
                                    builder.setMessage(errorMessage);
                                    builder.setPositiveButton(R.string.rogerthat, null);
                                    AlertDialog dialog = builder.create();
                                    dialog.show();
                                }
                            });
                            return;
                        }
                    }
                    mUIHandler.post(showErrorDialog);
                    return;
                }
                JSONObject account = (JSONObject) responseMap.get("account");
                final String email = (String) responseMap.get("email");
                mAgeAndGenderSet = (Boolean) responseMap.get("age_and_gender_set");
                final RegistrationInfo info = new RegistrationInfo(email,
                        new Credentials((String) account.get("account"), (String) account.get("password")));
                mUIHandler.post(new SafeRunnable() {
                    @Override
                    protected void safeRun() throws Exception {
                        T.UI();
                        mWiz.setEmail(email);
                        mWiz.save();
                        hideNotification();
                        tryConnect(progressDialog, 1, getString(R.string.registration_establish_connection,
                                email, getString(R.string.app_name)) + " ", info);
                    }
                });

            } catch (Exception e) {
                L.d(e);
                mUIHandler.post(showErrorDialog);
            }
        }
    });
}

From source file:com.realtek.simpleconfig.SCTest.java

/** Profile */
@SuppressWarnings("deprecation")
public void DelProfProgressPopUp() {
    DelProfFirstShow = true;/* ww w.j a v  a  2 s. c o m*/

    delProfDialog.setTitle(CurrentControlDev);
    delProfDialog.setMessage("    Removing......");
    delProfDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    delProfDialog.setCancelable(false);
    delProfDialog.setButton("Cancel", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
        }
    });
    delProfDialog.show();
}

From source file:net.evecom.android.web.Web0Activity.java

private void showProgressDialog() {
    if (mDialog == null) {
        mDialog = new ProgressDialog(mContext);
        mDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);// 
        mDialog.setMessage(" ...");
        mDialog.setIndeterminate(false);// 
        mDialog.setCancelable(true);// 
        mDialog.setCanceledOnTouchOutside(false);
        mDialog.setOnDismissListener(new OnDismissListener() {

            @Override/*from ww  w  . j  a v  a 2s  .c om*/
            public void onDismiss(DialogInterface dialog) {
                // TODO Auto-generated method stub
                mDialog = null;
            }
        });
        mDialog.show();

    }
}

From source file:com.jbsoft.farmtotable.FarmToTableActivity.java

@Override
public void onLocationChanged(Location arg0) {
    if (NOFM) {/*  w  w w .  jav a 2 s  .co m*/
        //Reverse geocoder to zipcode
        getZipFromLocation(arg0, this);

        //start progress box going
        progress.setMessage("Getting Farmers Markets and Other Organic Options in your area:)");
        progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        progress.setIndeterminate(true);
        progress.show();

        //Call api to retrieve Farmers Market from the UDSA site 
        usdaurl = usdaurl + zipcode;
    }

    if (NOVR) {
        gplaceurl = gplaceurl + queryvegan + queryorganic;
    } else if (NOOR) {
        gplaceurl = gplaceurl + queryvegetarian + queryorganic;
    } else if ((NOVR) && (NOOR)) {
        gplaceurl = gplaceurl + queryvegan + queryvegetarian + queryorganic;
    }
    if (NOFS) {
        gplaceurl = gplaceurl + "+" + queryfarms;
        {
            MarkerOptions markerOptions = new MarkerOptions();
        }
        //The Google Places API Text Search Service 
        gplaceurl = gplaceurl + "&location=" + latitude + "," + longitude
                + "&radius=10&key=AIzaSyA_fzl-7ZkF4EINWhuQ0bcXp3zkdAXZc5o";
        //Call Asynch process Api 

        new restAPICall().execute(usdaurl, gplaceurl);
    }

}

From source file:chinanurse.cn.nurse.Fragment_Nurse_job.EmployResumeDetailsfragment.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.rela_yaoqingmianshi:
        if (user.getUserid() == null || user.getUserid().length() <= 0) {
            Intent intent = new Intent(getActivity(), LoginActivity.class);
            startActivity(intent);// ww w  .  ja v a 2s . c  om
        } else {
            if (user.getUsertype() != null && user.getUsertype().length() > 0) {
                if ("1".equals(user.getUsertype())) {
                    Toast.makeText(getActivity(), "??", Toast.LENGTH_SHORT)
                            .show();
                } else if ("2".equals(user.getUsertype())) {
                    if (HttpConnect.isConnnected(getActivity())) {
                        dialogpgd.setMessage("???..");
                        dialogpgd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
                        dialogpgd.show();
                        new StudyRequest(getActivity(), handler).getMyPublishJobList(user.getUserid(),
                                GETMYPUBLISHJOB);
                        //                              new StudyRequest(mcontext, handler).getMyPublishJobList(userid, INDERVIEW);
                        //userid  companyid?   jobid??
                    } else {
                        Toast.makeText(getActivity(), R.string.net_erroy, Toast.LENGTH_SHORT).show();
                    }
                }
            }
        }
        break;
    case R.id.employ_tv_contact_gone:
        if (user.getUserid() != null && user.getUserid().length() > 0) {
            if ("1".equals(user.getUsertype())) {
                Toast.makeText(getActivity(), "???",
                        Toast.LENGTH_SHORT).show();
            } else {
                if (HttpConnect.isConnnected(getActivity())) {
                    dialogpgd.setMessage("...");
                    dialogpgd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
                    dialogpgd.show();
                    new StudyRequest(getActivity(), handler).getCompanyCertify(user.getUserid(),
                            GETCOMANYCERTIFY);
                } else {
                    Toast.makeText(getActivity(), R.string.net_erroy, Toast.LENGTH_SHORT).show();
                }
            }
        } else {
            Intent intent = new Intent(getActivity(), LoginActivity.class);
            startActivity(intent);
        }

        break;
    case R.id.tv_sendjianli_back:
        activity = (MainActivity) getActivity();
        activity.switchFragmentAddHide(FragmentTag.TAG_NURSE);
        //                try{
        //                    cf = (EmployFragment) getActivity()
        //                            .getSupportFragmentManager()
        //                            .findFragmentByTag(FragmentTag.TAG_NURSE.getTag())
        //                            .getChildFragmentManager()
        //                            .findFragmentByTag(FragmentTag.TAG_EMPLOY.getTag());
        //                    cf.switchFragmentone(FragmentTag.TAG_TALENT);
        //                    cf.visible_gone();
        //                } catch (Exception e) {
        //                    e.printStackTrace();
        //                }
        break;
    }
}