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.linroid.pushapp.ui.bind.BindActivity.java

@OnClick(R.id.btn_bind)
public void onBindBtnClicked(Button btn) {
    final ProgressDialog dialog = new ProgressDialog(this, R.style.Theme_AppCompat_Light_Dialog);
    dialog.setIndeterminate(true);/* ww w . java  2  s.  c o  m*/
    dialog.setMessage(getString(R.string.msg_dialog_bind));
    dialog.setCancelable(false);
    dialog.show();
    authApi.bindDevice(bindToken, queryAndBuildDeviceInfo(), new Callback<Account>() {
        @Override
        @DebugLog
        public void success(Account authInfo, Response response) {
            Device device = authInfo.getDevice();
            User user = authInfo.getUser();
            String token = authInfo.getToken();
            account.setDevice(device);
            account.setUser(user);
            account.setToken(token);
            account.saveToFile();

            dialog.dismiss();
            redirectToHome();
        }

        @Override
        @DebugLog
        public void failure(RetrofitError error) {
            Snackbar.make(switcher, error.getMessage(), Snackbar.LENGTH_SHORT).show();
            dialog.dismiss();
        }
    });
}

From source file:com.example.sujit.customerapp.Get_Taxi.java

private void getDirection() {
    //Getting the URL
    String url = makeURL(currentLatitude, currentLongitude, destnLatitude, destnLongitude);

    //Showing a dialog till we get the route
    final ProgressDialog loading = ProgressDialog.show(this, "Getting Route", "Please wait...", false, false);

    //Creating a string request
    StringRequest stringRequest = new StringRequest(url, new Response.Listener<String>() {
        @Override/*from   ww  w .  ja v  a2s .c  om*/
        public void onResponse(String response) {
            loading.dismiss();
            //Calling the method drawPath to draw the path
            drawPath(response);
        }
    }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            loading.dismiss();
            Log.d("Direction APi error", error.toString());
        }
    });
    MySingleton.getInstance(getApplicationContext()).addToRequestQueue(stringRequest);
}

From source file:cn.ucai.wechat.ui.SettingsActivity.java

void logout() {
    final ProgressDialog pd = new ProgressDialog(SettingsActivity.this);
    String st = getResources().getString(R.string.Are_logged_out);
    pd.setMessage(st);/* w  w  w .  java 2 s.c o m*/
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    WeChatHelper.getInstance().logout(false, new EMCallBack() {

        @Override
        public void onSuccess() {
            runOnUiThread(new Runnable() {
                public void run() {
                    pd.dismiss();
                    finish();
                    // show login screen
                    MFGT.gotoLoginActivity(SettingsActivity.this);

                }
            });
        }

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

        }

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

                @Override
                public void run() {
                    // TODO Auto-generated method stub
                    pd.dismiss();
                    Toast.makeText(SettingsActivity.this, "unbind devicetokens failed", Toast.LENGTH_SHORT)
                            .show();
                }
            });
        }
    });
}

From source file:com.easemob.ui.ContactlistFragment.java

/**
 * ?//from w w  w  .ja v a  2s  .  c om
 * @param toDeleteUser
 */
public void deleteContact(final User tobeDeleteUser) {
    final ProgressDialog pd = new ProgressDialog(getActivity());
    pd.setMessage("...");
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    new Thread(new Runnable() {
        public void run() {
            try {
                EMContactManager.getInstance().deleteContact(tobeDeleteUser.getUsername());
                //db?
                UserDao dao = new UserDao(getActivity());
                dao.deleteContact(tobeDeleteUser.getUsername());
                MyApplication.getInstance().getContactList().remove(tobeDeleteUser.getUsername());
                getActivity().runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        adapter.remove(tobeDeleteUser);
                        adapter.notifyDataSetChanged();

                    }
                });
            } catch (final Exception e) {
                getActivity().runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        Toast.makeText(getActivity(), ": " + e.getMessage(), 1).show();
                    }
                });

            }

        }
    }).start();

}

From source file:com.kncwallet.wallet.ui.SendingAddressesFragment.java

private void handleReloadContacts() {
    final Context context = activity;
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    String phoneNumber = activity.getWalletApplication().GetPhoneNumber();

    final ProgressDialog progressDialog = new ProgressDialog(context);
    progressDialog.setTitle(R.string.contacts_lookup_refresh_title);
    progressDialog.setMessage(getString(R.string.contacts_lookup_refresh_message));
    progressDialog.setCancelable(false);
    progressDialog.show();//from   w w w  . j  a va 2 s.  c  o  m

    KnCDialog.fixDialogDivider(progressDialog);

    new ContactsDownloader(context, prefs, phoneNumber, new ContactsDownloader.ContactsDownloaderListener() {
        @Override
        public void onSuccess(int newContacts) {
            progressDialog.dismiss();
            if (newContacts > 0) {
                Toast.makeText(context, getString(R.string.contacts_lookup_contacts_added, "" + newContacts),
                        Toast.LENGTH_SHORT).show();
            } else {
                Toast.makeText(context, R.string.contacts_lookup_success, Toast.LENGTH_SHORT).show();
            }
        }

        @Override
        public void onError(String message) {
            progressDialog.dismiss();
            Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
        }
    }).doContactsLookup();
}

From source file:com.givon.anhao.activity.ContactlistFragment.java

/**
 * ?/* ww w. j  a v a2 s  .  c  o  m*/
 * 
 * @param toDeleteUser
 */
public void deleteContact(final UserBean tobeDeleteUser) {
    final ProgressDialog pd = new ProgressDialog(getActivity());
    pd.setMessage("...");
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    new Thread(new Runnable() {
        public void run() {
            try {
                EMContactManager.getInstance().deleteContact(tobeDeleteUser.getUsername());
                // db?
                UserDao dao = new UserDao(getActivity());
                dao.deleteContact(tobeDeleteUser.getUsername());
                AnhaoApplication.getInstance().getContactList().remove(tobeDeleteUser.getUsername());
                getActivity().runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        adapter.remove(tobeDeleteUser);
                        adapter.notifyDataSetChanged();

                    }
                });
            } catch (final Exception e) {
                getActivity().runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        Toast.makeText(getActivity(), ": " + e.getMessage(), 1).show();
                    }
                });

            }

        }
    }).start();

}

From source file:eu.dirtyharry.androidopsiadmin.Main.java

public void getOpsiClientsTask() {
    final ProgressDialog dialog = ProgressDialog.show(Main.this, getString(R.string.gen_title_pleasewait),
            getString(R.string.pd_getclients), true);
    final Handler handler = new Handler() {
        public void handleMessage(Message msg) {
            dialog.dismiss();
            if (GlobalVar.getInstance().getError().equals("null")) {
                if (doit.equals("true")) {

                    Intent i = new Intent(Main.this, ShowOpsiClientsListView.class);
                    Bundle b = new Bundle();
                    b.putStringArrayList("allclients", allclients);
                    b.putStringArrayList("clientdescriptions", clientdescription);
                    b.putStringArrayList("clientmacs", clientmac);
                    b.putStringArrayList("clientnotes", clientnotes);
                    b.putStringArrayList("clientips", clientip);
                    b.putStringArrayList("clientinventorys", clientinventory);
                    b.putStringArrayList("clientlastseens", clientlastseen);
                    i.putExtras(b);/*from   w  w  w  .  j ava  2  s  .  c  o  m*/
                    startActivityForResult(i, GET_OPSI_CLIENT_REQUEST);

                } else if (doit.equals("serverdown")) {
                    Toast.makeText(Main.this, String.format(getString(R.string.to_servernotrechable), serverip),
                            Toast.LENGTH_LONG).show();
                }
            } else {
                new Functions().msgBox(Main.this, getString(R.string.gen_title_error),
                        GlobalVar.getInstance().getError(), false);
                // GlobalVar.getInstance().setError("null");
            }

        }
    };

    checkUpdate = new Thread() {
        public void run() {
            Looper.prepare();
            if (Networking.isServerUp(serverip, serverport, serverusername, serverpasswd)) {
                getOpsiClients("rpc", serverip, serverport, "host_getHashes", serverusername, serverpasswd);
                doit = "true";
            } else {
                doit = "serverdown";
                //
            }

            handler.sendEmptyMessage(0);

        }
    };
    checkUpdate.start();
    // RTM ????
    // checkUpdate.interrupt();
}

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

private void initAuto() {
        Intent intent = getIntent();/* w  w  w .  j a  va  2 s.  c  o m*/
        String TAG = intent.getStringExtra("TAG");
        String CAT = intent.getStringExtra("CAT");

        _checkAllCase(false);
        if (TAG != null)
            _checkTagCase(TAG.split(","));
        if (CAT != null)
            _checkCatCase(CAT.split(","));
        if (TAG == null && CAT == null)
            _checkAllCase(true);
        final Handler h = new Handler() {
            public void handleMessage(Message msg) {
                if (msg.what == 0x1234)
                    onClick(mRun);
            }
        };

        final ProgressDialog dialog = new ProgressDialog(this).show(this, "Starting Benchmark", "Please wait...",
                true, false);
        new Thread() {
            public void run() {
                SystemClock.sleep(1000);
                dialog.dismiss();
                Message m = new Message();
                m.what = 0x1234;
                h.sendMessage(m);
            }
        }.start();
        mTouchable = true;
    }

From source file:com.sven.im.ui.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  . ja  v  a2 s  .  com
    pd.setCanceledOnTouchOutside(false);
    pd.show();

    BmobUser.logOut(getActivity());

    Tencent mTencent = Tencent.createInstance("1105318381", App.getInstance().getContext());
    mTencent.logout(getActivity());

    DemoHelper.getInstance().logout(false, new EMCallBack() {

        @Override
        public void onSuccess() {
            getActivity().runOnUiThread(new Runnable() {
                public void run() {
                    pd.dismiss();
                    // ??
                    ((MainActivity) getActivity()).finish();
                    startActivity(new Intent(getActivity(), LoginActivity.class));
                }
            });
        }

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

        }

        @Override
        public void onError(int code, String message) {
            getActivity().runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    // TODO Auto-generated method stub
                    pd.dismiss();
                    Toast.makeText(getActivity(), "unbind devicetokens failed", Toast.LENGTH_SHORT).show();

                }
            });
        }
    });
}

From source file:eu.dirtyharry.androidopsiadmin.Main.java

public void getOPSIDepotConfig(final String depot) {
    final ProgressDialog dialog = ProgressDialog.show(Main.this, getString(R.string.gen_title_pleasewait),
            String.format(getString(R.string.pd_getdepotconfigfor), depot), true);
    final Handler handler = new Handler() {
        public void handleMessage(Message msg) {
            dialog.dismiss();
            if (GlobalVar.getInstance().getError().equals("null")) {
                Intent i = new Intent(Main.this, ShowOpsiHostParamsListView.class);
                Bundle b = new Bundle();
                b.putString("hostparams", opsiresult.toString());
                b.putString("pc", choosendepot);
                b.putString("opsitype", "OpsiConfigserver");
                i.putExtras(b);/*from ww  w . j a va2s.c  om*/
                startActivityForResult(i, SHOW_OPSI_DEPOT_REQUEST);
            } else {
                new Functions().msgBox(Main.this, getString(R.string.gen_title_error),
                        GlobalVar.getInstance().getError(), false);
            }

        }
    };
    Thread checkUpdate = new Thread() {
        public void run() {
            Looper.prepare();
            JSONArray JSONparams = new JSONArray();
            JSONparams.put(depot);
            opsiresult = new JSONObject();
            opsiresult = eu.dirtyharry.androidopsiadmin.Networking.opsiGetJSONObject("rpc", serverip,
                    serverport, "getDepot_hash", JSONparams, serverusername, serverpasswd);
            handler.sendEmptyMessage(0);
        }
    };
    checkUpdate.start();
}