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:cn.xcom.helper.activity.AuthorizedActivity.java

private void uploadImg(File f) {
    //        http://bang.xiaocool.net/index.php?g=apps&m=index&a=uploadimg
    dialog.setMessage("");
    dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    dialog.show();/*from w ww  .j a v a  2s.c o m*/
    RequestParams params = new RequestParams();
    try {
        params.put("upfile", f);
    } catch (FileNotFoundException e) {

    }
    LogUtils.e(TAG, "--statusCode->" + params.toString());
    HelperAsyncHttpClient.post(NetConstant.NET_UPLOAD_IMG, params, new JsonHttpResponseHandler() {
        @Override
        public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
            super.onSuccess(statusCode, headers, response);
            LogUtils.e(TAG, "--statusCode->" + statusCode + "==>" + response.toString());
            if (response != null) {
                try {
                    String state = response.getString("status");
                    if (state.equals("success")) {
                        LogUtils.e(TAG, "--flag->" + flag);
                        if (flag == 1) {
                            userInfo.setUserHandIDCard(response.getString("data"));
                            imageLoader.displayImage(NetConstant.NET_DISPLAY_IMG + userInfo.getUserHandIDCard(),
                                    iv_handheld_ID_card, options);
                        } else if (flag == 2) {
                            userInfo.setUserIDCard(response.getString("data"));
                            imageLoader.displayImage(NetConstant.NET_DISPLAY_IMG + userInfo.getUserIDCard(),
                                    iv_ID_card, options);
                        } else if (flag == 3) {
                            userInfo.setUserDrivingLicense(response.getString("data"));
                            imageLoader.displayImage(
                                    NetConstant.NET_DISPLAY_IMG + userInfo.getUserDrivingLicense(),
                                    iv_driving_license, options);
                        }
                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
            dialog.dismiss();
        }

        @Override
        public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {
            super.onFailure(statusCode, headers, responseString, throwable);
            LogUtils.e(TAG, "--statusCode->" + statusCode + "==>" + responseString);
            dialog.dismiss();
        }
    });

}

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

@Override
protected Dialog onCreateDialog(int id) {
    switch (id) {
    case DIALOG_PROGRESS:
        mPd = new ProgressDialog(this);
        mPd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        mPd.setIndeterminate(true);/* w  w  w  .  j a  v  a 2s .  co  m*/
        mPd.setOnDismissListener(new OnDismissListener() {
            @Override
            public void onDismiss(DialogInterface dialog) {
                removeDialog(DIALOG_PROGRESS);
            }
        });
        mPd.setOnCancelListener(new OnCancelListener() {
            @Override
            public void onCancel(DialogInterface dialog) {
                AVService.getInstance(MyIncidentsActivity.this).cancelTask();
                finish();
            }
        });
        mPd.setMessage(getString(R.string.ui_message_loading));
        return mPd;

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

From source file:com.hkm.listviewhkm.base.DialogIntent.java

private void prepare_progress_bar() {
    progressBar = new ProgressDialog(mFragmentActivity);
    progressBar.setIndeterminate(true);//www .j  av a 2s . c om
    progressBar.setCancelable(false);
    progressBar.setProgressStyle(ProgressDialog.STYLE_SPINNER);
}

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

private void stopRecording() {
    final Context context = this;

    AsyncTask<Void, Void, Void> task = new AsyncTask<Void, Void, Void>() {
        @Override//from   w  w w. ja  v a  2s  . com
        protected void onPreExecute() {
            pd = new ProgressDialog(context);
            pd.setTitle("Processing...");
            pd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
            pd.setMessage("Please wait.");
            pd.setCancelable(false);
            pd.setIndeterminate(true);
            pd.show();
        }

        @Override
        protected Void doInBackground(Void... params) {
            modelConstructed = rService.create3dModel();

            return null;
        }

        @Override
        protected void onPostExecute(Void result) {
            if (pd != null) {
                pd.dismiss();
            }

            if (rBound) {
                unbindService(mConnection);
                rBound = false;
            }

            MenuItem item = mainMenu.findItem(R.id.record_data);

            item.setIcon(R.drawable.ic_action_save);

            Animation a = AnimationUtils.loadAnimation(context, R.anim.textupslide);
            TextView tv = (TextView) findViewById(R.id.recordClock);
            tv.startAnimation(a);

            recordClock.setVisibility(View.GONE);

            recording = false;

            if (modelConstructed) {
                Toast.makeText(getApplicationContext(), "Recording stopped.\n3D model created.",
                        Toast.LENGTH_LONG).show();
            } else {
                Toast.makeText(getApplicationContext(), "Recording stopped.\n3D model creation failed.",
                        Toast.LENGTH_LONG).show();
            }
        }
    };

    task.execute((Void[]) null);

}

From source file:net.gerosyab.dailylog.activity.MainActivity.java

private void exportCategory(final long id) {

    //?? ? ?? csv  
    //? ?? ?? //from  w  w w . ja v  a2s .c  om
    // ? ?  ? ? 
    Category category = categories.get((int) id);

    ProgressDialog progressDialog = new ProgressDialog(MainActivity.this);
    progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progressDialog.setTitle("Exporting data [" + category.getName() + "]");
    progressDialog.show();

    String filename = category.getName() + "" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date())
            + ".data";
    FileOutputStream outputStream = null;
    File resultFilePath = null;
    File resultFile = null;
    CSVWriter cw = null;

    try {
        resultFile = new File(context.getCacheDir(), filename);

        outputStream = new FileOutputStream(resultFile.getAbsolutePath());
        //            cw = new CSVWriter(new OutputStreamWriter(outputStream, "UTF-8"),'\t', '"');
        cw = new CSVWriter(new OutputStreamWriter(outputStream, "UTF-8"), ',', '"');

        // Export Data
        String[] metaDataStr = { "Version:" + AppDatabase.VERSION, "Name:" + category.getName(),
                "Unit:" + category.getUnit(), "Type:" + category.getRecordType(),
                "DefaultValue:" + category.getDefaultValue(),
                "Columns:date(yyyy-MM-dd 24HH:mm:ss)/value(boolean|numeric|string)" };
        cw.writeNext(metaDataStr);

        List<Record> records = category.getRecordsOrderByDateAscending(realm);
        for (Record record : records) {
            String value = null;
            if (category.getRecordType() == StaticData.RECORD_TYPE_BOOLEAN) {
                value = "true";
            } else if (category.getRecordType() == StaticData.RECORD_TYPE_NUMBER) {
                value = "" + record.getNumber();
            } else if (category.getRecordType() == StaticData.RECORD_TYPE_MEMO) {
                value = record.getString();
            }
            String[] s = { record.getDateString(StaticData.fmtForBackup), value };
            cw.writeNext(s);
        }

        cw.close();
        outputStream.close();

        progressDialog.dismiss();

        Uri fileUri = FileProvider.getUriForFile(context, "net.gerosyab.dailylog.fileprovider", resultFile);

        Intent shareIntent = new Intent();
        shareIntent.setAction(Intent.ACTION_SEND);
        shareIntent.putExtra(Intent.EXTRA_STREAM, fileUri);
        shareIntent.setType("text/plain");

        startActivity(Intent.createChooser(shareIntent, getResources().getText(R.string.send_to)));

    } catch (UnsupportedEncodingException e) {
        Log.e("DailyLog", e.getMessage());
        e.printStackTrace();
    } catch (IllegalArgumentException e) {
        Log.e("DailyLog", e.getMessage());
        e.printStackTrace();
    } catch (Exception e) {
        Log.e("DailyLog", e.getMessage());
        e.printStackTrace();
    } finally {
        progressDialog.dismiss();
    }
}

From source file:com.zsxj.pda.ui.client.LoginActivity.java

private void initData() {

    mWdtLogin = WDTLogin.getinstance();//ww w  .j a v  a 2 s.com

    // Init progress dialog
    mProgressDialog = new ProgressDialog(this);
    mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    mProgressDialog.setTitle(R.string.please_wait);
    mProgressDialog.setMessage(getString(R.string.login) + "...");
    mProgressDialog.setCancelable(false);

    readLoginInfo();

    if (checkInputStatus() == INPUT_OK && mAutoLoginCheck.isChecked()) {
        autoLoginPrepare();
    } else {
        //         mSellerNickEdit.setText("duoduoyun");
        //         mUserNameEdit.setText("admin");
        //         mPasswordEdit.setText("ddy!@#$%^");
        //         mSellerNickEdit.setText("demo");
        //         mUserNameEdit.setText("ws");
        //         mPasswordEdit.setText("123");
        //         mSellerNickEdit.setText("xiaobaxi");
        //         mUserNameEdit.setText("admin");
        //         mPasswordEdit.setText("xiaobaxi");
        //         mSellerNickEdit.setText("duoduotest");
        //         mUserNameEdit.setText("admin");
        //         mPasswordEdit.setText("123456");
        //         mSellerNickEdit.setText("haoxu");
        //         mUserNameEdit.setText("admin");
        //         mPasswordEdit.setText("172c3a");
        //         mSellerNickEdit.setText("yinpai");
        //         mUserNameEdit.setText("pda");
        //         mPasswordEdit.setText("1234");
        //         mSellerNickEdit.setText("qiqu");
        //         mUserNameEdit.setText("");
        //         mPasswordEdit.setText("123456");
        //         mSellerNickEdit.setText("joyvio");
        //         mUserNameEdit.setText("");
        //         mPasswordEdit.setText("666666");
        mSellerNickEdit.setText("jiulong");
        mUserNameEdit.setText("admin");
        mPasswordEdit.setText("wenwen0023");
    }
}

From source file:org.thialfihar.android.apg.ui.CertifyKeyActivity.java

/**
 * kicks off the actual signing process on a background thread
 *//* www  . ja v  a  2  s  .  c  o m*/
private void startSigning() {

    // Bail out if there is not at least one user id selected
    ArrayList<String> userIds = mUserIdsAdapter.getSelectedUserIds();
    if (userIds.isEmpty()) {
        Toast.makeText(CertifyKeyActivity.this, "No User IDs to sign selected!", Toast.LENGTH_SHORT).show();
        return;
    }

    // Send all information needed to service to sign key in other thread
    Intent intent = new Intent(this, ApgIntentService.class);

    intent.setAction(ApgIntentService.ACTION_CERTIFY_KEYRING);

    // fill values for this action
    Bundle data = new Bundle();

    data.putLong(ApgIntentService.CERTIFY_KEY_MASTER_KEY_ID, mMasterKeyId);
    data.putLong(ApgIntentService.CERTIFY_KEY_PUB_KEY_ID, mPubKeyId);
    data.putLong(ApgIntentService.CERTIFY_KEY_PUB_KEY_ID, mPubKeyId);
    data.putStringArrayList(ApgIntentService.CERTIFY_KEY_UIDS, userIds);

    intent.putExtra(ApgIntentService.EXTRA_DATA, data);

    // Message is received after signing is done in ApgService
    ApgIntentServiceHandler saveHandler = new ApgIntentServiceHandler(this,
            getString(R.string.progress_signing), ProgressDialog.STYLE_SPINNER) {
        public void handleMessage(Message message) {
            // handle messages by standard ApgHandler first
            super.handleMessage(message);

            if (message.arg1 == ApgIntentServiceHandler.MESSAGE_OKAY) {

                Toast.makeText(CertifyKeyActivity.this, R.string.key_sign_success, Toast.LENGTH_SHORT).show();

                // check if we need to send the key to the server or not
                if (mUploadKeyCheckbox.isChecked()) {
                    // upload the newly signed key to the keyserver
                    uploadKey();
                } else {
                    setResult(RESULT_OK);
                    finish();
                }
            }
        }
    };

    // Create a new Messenger for the communication back
    Messenger messenger = new Messenger(saveHandler);
    intent.putExtra(ApgIntentService.EXTRA_MESSENGER, messenger);

    // show progress dialog
    saveHandler.showProgressDialog(this);

    // start service with intent
    startService(intent);
}

From source file:com.saulcintero.moveon.fragments.History.java

private void importRoute(int activity, int type, String date, String time, String[] files,
        boolean deleteOnFinish) {
    importTask = null;//from   ww  w  .java 2 s.  c o  m

    DialogInterface.OnCancelListener dialogCancelled = new DialogInterface.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialog) {
            UIFunctionUtils.showMessage(mContext, true, getString(R.string.import_canceled));

            importTask = null;
        }
    };

    pd = new ProgressDialog(act);
    pd.setTitle(R.string.dialog_import_importing);
    pd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    pd.setCancelable(false);
    pd.setOnCancelListener(dialogCancelled);
    pd.setMessage(getString(R.string.dialog_import_text));
    importTask = new ImportPracticesTask(pd, act, mContext, type, date, time, activity, files, deleteOnFinish);
    importTask.execute();
}

From source file:jp.co.tweetmap.MainActivity.java

/**
 * Shows progress dialog./*from  www  .  j  ava 2  s .co m*/
 */
private void showDialog() {
    mProgressDialog = new ProgressDialog(this);
    mProgressDialog.setMessage(getResources().getString(R.string.twitter_info_loading_msg));
    mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    mProgressDialog.show();
}

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

public void refresh_data() {
    if (NOFM) {//from   w ww  .  j  a v  a  2s  . c o  m
        if (nozip) {
            //Reverse geocoder to zipcode
            getZipFromLocation(location, this);
            //Call api to retrieve Farmers Market from the UDSA site 
            usdaurl = usdaurl + zipcode;
            nozip = false;
        }
    } else {
        usdaurl = usdaurl_sav;
    }
    //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();
    gplaceurl = gplaceurl_sav;
    placeurl_save = gplaceurl;
    if (NOVR) {
        gplaceurl = gplaceurl + queryvegan;
    }

    if (NOOR) {
        gplaceurl = placeurl_save;
        gplaceurl = gplaceurl + queryvegetarian;
    }

    if (NOFS) {
        gplaceurl = placeurl_save;
        gplaceurl = gplaceurl + queryfarms;
    }

    if ((NOVR) && (NOOR)) {
        gplaceurl = placeurl_save;
        gplaceurl = gplaceurl + queryvegan + "&" + queryvegetarian;
    }

    if ((NOVR) && (NOFS)) {
        gplaceurl = placeurl_save;
        gplaceurl = gplaceurl + queryvegan + "&" + queryfarms;
    }

    if ((NOOR) && (NOFS)) {
        gplaceurl = placeurl_save;
        gplaceurl = gplaceurl + queryvegetarian + "&" + queryfarms;
    }

    if ((NOVR) && (NOOR) && (NOFS)) {
        gplaceurl = placeurl_save;
        gplaceurl = gplaceurl + queryvegan + "&" + queryvegetarian + "&" + queryfarms;
    }
    {
        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);

    }

    map.setInfoWindowAdapter(new CustomToast(this, null));
    // map.setOnInfoWindowClickListener((OnInfoWindowClickListener) 
    map.setMyLocationEnabled(true);
    CameraUpdate zoom = CameraUpdateFactory.zoomTo(12);
    map.animateCamera(zoom);

}