Example usage for android.app ProgressDialog dismiss

List of usage examples for android.app ProgressDialog dismiss

Introduction

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

Prototype

@Override
public void dismiss() 

Source Link

Document

Dismiss this dialog, removing it from the screen.

Usage

From source file:com.android.gallery3d.filtershow.FilterShowActivity.java

private void hideSavingProgress() {
    if (mSavingProgressDialog != null) {
        ProgressDialog progress = mSavingProgressDialog.get();
        if (progress != null)
            progress.dismiss();
    }//from   ww w .j  a  v a  2s  . c  o  m
}

From source file:com.zhenlaidian.ui.InputCarNumberActivity.java

public void createOrderForPos() throws UnsupportedEncodingException {
    if (System.currentTimeMillis() - currentM > 1000) {
        SharedPreferences pfs = this.getSharedPreferences("autologin", Context.MODE_PRIVATE);
        uid = pfs.getString("account", "");
        final String carnumber = URLEncoder.encode(getStringFromPreference("carnumber"), "utf-8");
        String url = BaseActivity.baseurl + "collectorrequest.do?action=posincome&token=" + BaseActivity.token
                + "&carnumber=" + URLEncoder.encode(carnumber, "utf-8") + "&bid="
                + getStringFromPreference("bowei") + "&berthid="
                + SharedPreferencesUtils.getIntance(this).getberthid() + "&workid="
                + SharedPreferencesUtils.getIntance(this).getworkid() + "&prepay=0&ismonthuser=" + ismonthuser
                + "&berthorderid=" + getStringFromPreference("berthorderid") + "&orderid="
                + getStringFromPreference("preorderid") + "&car_type=" + cartypecode;
        MyLog.w("InCarDialogActivity", "??URL--->" + url);
        final ProgressDialog dialog = ProgressDialog.show(this, "??", "????...",
                true, true);/*from w  w w . j a va2s .c o m*/
        dialog.setCanceledOnTouchOutside(false);
        AQuery aQuery = new AQuery(this);
        aQuery.ajax(url, String.class, new AjaxCallback<String>() {

            @Override
            public void callback(String url, String object, AjaxStatus status) {
                if (status.getCode() == 200 && object != null) {
                    dialog.dismiss();
                    MyLog.i("InCarDialogActivity", "??--->" + object);
                    Gson gson = new Gson();
                    InCarDialogInfo info = gson.fromJson(object, InCarDialogInfo.class);
                    infos = info;
                    if (info != null) {
                        MyLog.d("InCarDialogActivity", info.toString());
                        if ("1".equals(info.getResult())) {
                            //?????
                            putStringToPreference("berthorderid", "");
                            putBooleanToPreference("next", false);
                            voice = new VoiceSynthesizerUtil(context);
                            voice.playText("??");
                            bt_ok.setOnClickListener(null);
                            //                                if (CommontUtils.checkList(files)) {
                            //                                    for (int i = 0; i < files.size(); i++) {
                            //                                        String SDState = Environment.getExternalStorageState();
                            //                                        if (SDState.equals(Environment.MEDIA_MOUNTED)) {
                            //                                            File dir = new File(Environment.getExternalStorageDirectory() + "/TingCheBao");
                            //                                            if (!dir.exists()) {
                            //                                                dir.mkdirs();
                            //                                            }
                            //                                            files.get(i).renameTo(new File(dir.getAbsolutePath(), info.getOrderid() + "in" + i + ".jpeg"));
                            //                                            CameraBitmapUtil.upload(context, i, info.getOrderid(), 0);
                            //                                        }
                            //                                    }
                            //                                }
                            if (CommontUtils.checkList(listPath)) {
                                for (int i = 0; i < listPath.size(); i++) {
                                    String SDState = Environment.getExternalStorageState();
                                    if (SDState.equals(Environment.MEDIA_MOUNTED)) {
                                        File dir = new File(
                                                Environment.getExternalStorageDirectory() + "/TingCheBao");
                                        if (!dir.exists()) {
                                            dir.mkdirs();
                                        }
                                        (new File(listPath.get(i))).renameTo(new File(dir.getAbsolutePath(),
                                                info.getOrderid() + "in" + i + ".jpeg"));
                                        CameraBitmapUtil.upload(context, i, info.getOrderid(), 0);
                                    }
                                }
                            }
                            if (PullMsgService.CanPrint) {
                                //                                if (mService.getState() != BluetoothService.STATE_CONNECTED) {
                                //                                    conn2bluetooth2();
                                //                                } else {
                                prient(uid, info);
                                //                                }
                            } else {
                                FinishAction();
                            }

                            //                            if (parkPositionListener != null && !SharedPreferencesUtils.getIntance(InCarDialogActivity.this).getSelectParkPosition()) {
                            //                                parkPositionListener.doSelectParkPosition(tv_add_carnumber.getText().toString(), info.getOrderid());
                            //                            }
                            //                            InCarDialogActivity.this.finish();
                        } else {
                            Toast.makeText(context, info.getErrmsg(), Toast.LENGTH_SHORT).show();
                        }
                    }
                } else {
                    dialog.dismiss();
                    switch (status.getCode()) {
                    case -101:
                        Toast.makeText(context, "?--????",
                                Toast.LENGTH_SHORT).show();
                        break;
                    case 500:
                        Toast.makeText(context, "??--????",
                                Toast.LENGTH_SHORT).show();
                        break;
                    }
                }
            }
        });
        currentM = System.currentTimeMillis();
    }
}

From source file:com.marcopolci.paperwalletvalidator.MainActivity.java

@Override
public void OnScanResult(final String result) {
    final ScanFragment scanfragment = (ScanFragment) getFragmentManager().findFragmentById(R.id.fragmentScan);
    if (PATTERN_BITCOIN_ADDRESS.matcher(result).matches()) {
        textAddress.setText(result);/*from  w  w  w. j a v  a  2 s  .  co m*/
        ecKey = null;
        textKey.setText(null);
        try {
            addr = new Address(null, result);
        } catch (AddressFormatException e) {
            e.printStackTrace();
            //TODO segnalare indirizzo non leggibile
        }
        scanfragment.resumeScan(RESUME_SCAN_DELAY);
    } else if (PATTERN_BIP38_PRIVATE_KEY.matcher(result).matches()) {
        textKey.setText(result);
        //scanfragment.pauseScan();
        //dismissCamera();
        createPassphraseDialog(new PassphraseListener() {
            @Override
            public void onPassphrase(final String passphrase) {
                final ProgressDialog progress = ProgressDialog.show(MainActivity.this,
                        getString(R.string.bip38_progress_title),
                        getString(R.string.bip38_progress_description), true);
                new AsyncTask<Void, Void, Void>() {
                    @Override
                    protected Void doInBackground(Void... params) {
                        try {
                            //TODO manca supporto per testnet
                            final BIP38PrivateKey bip38Key = new BIP38PrivateKey(MainNetParams.get(), result);
                            ecKey = bip38Key.decrypt(passphrase);
                            //ValidateData();
                        } catch (BIP38PrivateKey.BadPassphraseException e) {
                            //TODO segnalare password sbagliata
                        } catch (AddressFormatException e) {
                            //TODO segnalare chiave non leggibile
                        }
                        return null;
                    }

                    @Override
                    protected void onPostExecute(Void r) {
                        progress.dismiss();
                        ValidateData();
                        scanfragment.resumeScan(RESUME_SCAN_DELAY);
                        //restartCamera();
                    }
                }.execute();
            }
        }, new DialogInterface.OnCancelListener() {
            @Override
            public void onCancel(DialogInterface dialog) {
                scanfragment.resumeScan(RESUME_SCAN_DELAY);
            }
        }).show(getFragmentManager(), "Passphrase");
    } else if (PATTERN_DUMPED_PRIVATE_KEY_UNCOMPRESSED_MAINNET.matcher(result).matches()
            || PATTERN_DUMPED_PRIVATE_KEY_COMPRESSED_MAINNET.matcher(result).matches()
            || PATTERN_DUMPED_PRIVATE_KEY_UNCOMPRESSED_TESTNET.matcher(result).matches()
            || PATTERN_DUMPED_PRIVATE_KEY_COMPRESSED_TESTNET.matcher(result).matches()) {
        textKey.setText(result);
        try {
            ecKey = (new DumpedPrivateKey(null, result)).getKey();
            ValidateData();
        } catch (AddressFormatException e) {
            //TODO segnalare chiave non leggibile
            e.printStackTrace();
        }
        scanfragment.resumeScan(RESUME_SCAN_DELAY);
    }
}

From source file:com.jakebasile.android.linkshrink.ShortenUrl.java

private void shortenWithBitly(final String longUrl, SharedPreferences prefs) {
    final String username = prefs.getString("bitlyUsername", null);
    final String key = prefs.getString("bitlyKey", null);
    if (username == null || key == null) {
        Toast.makeText(getApplicationContext(), R.string.badbitlyconfig, Toast.LENGTH_LONG).show();
        _shortUrl = null;//from w  w  w  .  j  a  va 2 s .  c  o  m
        finish();
    } else {
        String display = String.format(getResources().getString(R.string.shortening_message), BITLY);
        final ProgressDialog pd = ProgressDialog.show(ShortenUrl.this,
                getResources().getString(R.string.shortening_title), display, true);
        new Thread() {
            @Override
            public void run() {
                try {
                    String requestUrl = String.format(BITLY_URL, longUrl, username.toLowerCase(), key);
                    ByteArrayOutputStream stream = new ByteArrayOutputStream();
                    HttpClient httpClient = new DefaultHttpClient();
                    HttpGet request = new HttpGet(new URI(requestUrl));
                    HttpResponse response = httpClient.execute(request);
                    if (response.getStatusLine().getStatusCode() == 200) {
                        response.getEntity().writeTo(stream);
                        _shortUrl = new String(stream.toByteArray()).trim();
                    } else {
                        _shortUrl = null;
                    }
                    _handler.sendEmptyMessage(0);
                } catch (IOException ex) {
                    _handler.sendEmptyMessage(1);
                } catch (URISyntaxException ex) {
                    _handler.sendEmptyMessage(2);
                } finally {
                    pd.dismiss();
                }
            }
        }.start();
    }
}

From source file:com.microsoft.onedrive.apiexplorer.ItemFragment.java

/**
 * Copies an item onto the current destination in the copy preferences
 * @param item The item to copy/*from ww w.j a  va  2  s.  c o  m*/
 */
private void copy(final Item item) {
    final BaseApplication app = (BaseApplication) getActivity().getApplication();
    final IOneDriveClient oneDriveClient = app.getOneDriveClient();
    final ItemReference parentReference = new ItemReference();
    parentReference.id = getCopyPrefs().getString(COPY_DESTINATION_PREF_KEY, null);

    final ProgressDialog dialog = new ProgressDialog(getActivity(), ProgressDialog.STYLE_HORIZONTAL);
    dialog.setTitle("Copying item");
    dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    dialog.setMessage("Waiting for copy to complete");

    final IProgressCallback<Item> progressCallback = new IProgressCallback<Item>() {
        @Override
        public void progress(final long current, final long max) {
            dialog.setMax((int) current);
            dialog.setMax((int) max);
        }

        @Override
        public void success(final Item item) {
            dialog.dismiss();
            final String string = getString(R.string.copy_success_message, item.name,
                    item.parentReference.path);
            Toast.makeText(getActivity(), string, Toast.LENGTH_LONG).show();
        }

        @Override
        public void failure(final ClientException error) {
            dialog.dismiss();
            new AlertDialog.Builder(getActivity()).setTitle(R.string.error_title).setMessage(error.getMessage())
                    .setNegativeButton(R.string.close, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(final DialogInterface dialog, final int which) {
                            dialog.dismiss();
                        }
                    }).create().show();
        }
    };

    final DefaultCallback<AsyncMonitor<Item>> callback = new DefaultCallback<AsyncMonitor<Item>>(
            getActivity()) {
        @Override
        public void success(final AsyncMonitor<Item> itemAsyncMonitor) {
            final int millisBetweenPoll = 1000;
            itemAsyncMonitor.pollForResult(millisBetweenPoll, progressCallback);
        }
    };
    oneDriveClient.getDrive().getItems(item.id).getCopy(item.name, parentReference).buildRequest()
            .create(callback);
    dialog.show();
}

From source file:com.example.parkhere.provider.AddSeekerRoleFragment.java

public void createSeekerProfileProcess(SeekerPayment seekerPayment, BillingAddress billingAddress,
        Vehicle vehicle) {// w  w w.  j a va  2 s  .c  om
    final ProgressDialog progressDialog = new ProgressDialog(rootView.getContext(),
            R.style.AppTheme_Dark_Dialog);
    progressDialog.setIndeterminate(true);
    progressDialog.setMessage("Adding Seeker Role...");
    progressDialog.show();

    Retrofit retrofit = new Retrofit.Builder().baseUrl(Constants.BASE_URL)
            .addConverterFactory(GsonConverterFactory.create()).build();

    RequestInterface requestInterface = retrofit.create(RequestInterface.class);

    ServerRequest request = new ServerRequest();
    request.setOperation(Constants.ADD_SEEKER_ROLE_OPERATION);
    request.setUser(user);
    request.setSeekerPayment(seekerPayment);
    request.setBillingAddress(billingAddress);
    request.setVehicle(vehicle);
    Call<ServerResponse> response = requestInterface.operation(request);

    response.enqueue(new Callback<ServerResponse>() {
        @Override
        public void onResponse(Call<ServerResponse> call, retrofit2.Response<ServerResponse> response) {
            ServerResponse resp = response.body();

            if (resp.getResult().equals(Constants.SUCCESS)) {
                goToSeekerUserhomeScreen();
            }

            progressDialog.dismiss();
            Snackbar.make(create_sprof_scrollview, resp.getMessage(), Snackbar.LENGTH_LONG).show();
        }

        @Override
        public void onFailure(Call<ServerResponse> call, Throwable t) {
            progressDialog.dismiss();
            Snackbar.make(create_sprof_scrollview, t.getLocalizedMessage(), Snackbar.LENGTH_LONG).show();
        }
    });
}

From source file:dong.lan.tuyi.activity.SettingsFragment.java

void logout() {
    final ProgressDialog pd = new ProgressDialog(getActivity());
    String st = getResources().getString(R.string.Are_logged_out);
    pd.setMessage(st);/*from w w  w  .j a v  a  2s.c  om*/
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    TuApplication.getInstance().logout(new EMCallBack() {

        @Override
        public void onSuccess() {
            MyUmengCommunityLogin.getInstance().logout(getActivity(), new LoginListener() {
                @Override
                public void onStart() {
                    System.out.print("? start");
                }

                @Override
                public void onComplete(int i, CommUser commUser) {
                    System.out.print("?");
                    CommonUtils.logout();
                    CommConfig.getConfig().loginedUser = new CommUser();
                    Pushable var3 = PushSDKManager.getInstance().getCurrentSDK();
                    var3.disable();
                }
            });
            getActivity().runOnUiThread(new Runnable() {
                public void run() {
                    pd.dismiss();
                    // ??
                    getActivity().finish();
                    startActivity(new Intent(getActivity(), LoginActivity.class));

                }
            });
        }

        @Override
        public void onProgress(int progress, String status) {

        }

        @Override
        public void onError(int code, String message) {

        }
    });
}

From source file:au.com.wallaceit.reddinator.ViewAllSubredditsActivity.java

private void search(final String query) {
    //System.out.println("Searching: " + query);
    if (dlpopulartask != null) {
        dlpopulartask.cancel(true);/*from w  ww. j a v  a  2  s .  c o m*/
    }
    // use a thread for searching
    final ProgressDialog sdialog = ProgressDialog.show(ViewAllSubredditsActivity.this, "", ("Searching..."),
            true);
    Thread t = new Thread() {
        public void run() {
            // get all popular subreddits
            try {
                srjson = global.mRedditData.getSubredditSearch(query);
            } catch (RedditData.RedditApiException e) {
                e.printStackTrace();
            }
            // put into arraylist
            sreddits = new ArrayList<>();
            int i = 0;
            while (i < srjson.length()) {
                try {
                    sreddits.add(srjson.getJSONObject(i).getJSONObject("data").getString("display_name"));
                } catch (JSONException e) {
                    e.printStackTrace();
                }
                i++;
            }
            //System.out.println("search complete");
            runOnUiThread(new Runnable() {
                public void run() {
                    setListAdaptor();
                    if (sreddits.size() == 0) {
                        // set no result text in no items view
                        emptyview.setText("No subreddits found");
                    }
                    sdialog.dismiss();
                }
            });

        }
    };
    t.start();
}

From source file:com.guldencoin.androidwallet.nlg.ui.SendCoinsFragment.java

private void requestPaymentRequest(final String paymentRequestUrl) {
    final String host = Uri.parse(paymentRequestUrl).getHost();
    final ProgressDialog progressDialog = ProgressDialog.show(activity, null,
            getString(R.string.send_coins_fragment_request_payment_request_progress, host), true, true, null);

    new RequestPaymentRequestTask.HttpRequestTask(backgroundHandler,
            new RequestPaymentRequestTask.ResultCallback() {
                @Override/*from ww  w .  j ava2 s. c o m*/
                public void onPaymentIntent(final PaymentIntent paymentIntent) {
                    progressDialog.dismiss();

                    if (SendCoinsFragment.this.paymentIntent.isSecurityExtendedBy(paymentIntent)) {
                        updateStateFrom(paymentIntent);
                    } else {
                        final DialogBuilder dialog = DialogBuilder.warn(activity,
                                R.string.send_coins_fragment_request_payment_request_failed_title);
                        dialog.setMessage(getString(
                                R.string.send_coins_fragment_request_payment_request_wrong_signature));
                        dialog.singleDismissButton(null);
                        dialog.show();
                    }
                }

                @Override
                public void onFail(final int messageResId, final Object... messageArgs) {
                    progressDialog.dismiss();

                    final DialogBuilder dialog = DialogBuilder.warn(activity,
                            R.string.send_coins_fragment_request_payment_request_failed_title);
                    dialog.setMessage(getString(messageResId, messageArgs));
                    dialog.setPositiveButton(R.string.button_retry, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(final DialogInterface dialog, final int which) {
                            requestPaymentRequest(paymentRequestUrl);
                        }
                    });
                    dialog.setNegativeButton(R.string.button_dismiss, null);
                    dialog.show();
                }
            }).requestPaymentRequest(paymentRequestUrl);
}

From source file:org.zeroxlab.benchmark.Benchmark.java

public void runCase(LinkedList<Case> list) {
    Case pointer = null;//from  w  w  w  . j  a v a  2  s. c  o  m
    boolean finish = true;
    for (int i = 0; i < list.size(); i++) {
        pointer = list.get(i);
        if (!pointer.isFinish()) {
            finish = false;
            break;
        }
    }

    if (finish) {
        //            mBannerInfo.setText("Benchmarking complete.\nClick Show to upload.\nUploaded results:\nhttp://0xbenchmark.appspot.com");
        String result = getResult();
        writeResult(mOutputFile, result);

        final ProgressDialog dialogGetXml = ProgressDialog.show(this, "Generating XML Report", "Please wait...",
                true, false);

        new Thread() {
            public void run() {
                mJSONResult = getJSONResult();
                mXMLResult = getXMLResult();
                Log.d(TAG, "XML: " + mXMLResult);
                writeResult(mOutputXMLFile, mXMLResult);
                Log.d(TAG, "JSON: " + mJSONResult);
                writeResult(mOutputJSONFile, mJSONResult);
                mShow.setClickable(true);
                onClick(mShow);
                mTouchable = true;
                dialogGetXml.dismiss();
            }
        }.start();
    } else {
        Intent intent = pointer.generateIntent();
        if (intent != null) {
            startActivityForResult(intent, 0);
        }
    }
}