List of usage examples for android.app ProgressDialog dismiss
@Override public void dismiss()
From source file:com.nxt.yn.app.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 . jav a 2 s .c om pd.setCanceledOnTouchOutside(false); pd.show(); 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(), null)); } }); } @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:com.mobicage.rogerthat.registration.AbstractRegistrationActivity.java
public void tryConnect(final ProgressDialog pd, final int attempt, final String statusMessage, final RegistrationInfo info) { T.UI();// w w w.j ava2 s. c o m final Pausable pausable = this; if (attempt > XMPP_MAX_NUM_ATTEMPTS) { pd.dismiss(); String message = getString(R.string.registration_error); UIUtils.showDialog(mActivity, null, message, getString(R.string.try_again), null, null, null); mWizard.reInit(); mWizard.goBackToPrevious(); return; } pd.setMessage(statusMessage + attempt); if (!pd.isShowing()) pd.show(); L.d("Registration attempt #" + attempt); final String xmppServiceName = info.mCredentials.getXmppServiceName(); final String xmppAccount = info.mCredentials.getXmppAccount(); final String xmppPassword = info.mCredentials.getPassword(); final ConfigurationProvider cp = mService.getConfigurationProvider(); Configuration cfg = cp.getConfiguration(RegistrationWizard2.CONFIGKEY); final String invitorCode = (cfg == null) ? null : cfg.get(INVITOR_CODE_CONFIGKEY, null); final String invitorSecret = (cfg == null) ? null : cfg.get(INVITOR_SECRET_CONFIGKEY, null); Runnable runnable = new SafeRunnable() { @Override public void safeRun() { T.REGISTRATION(); try { if (CloudConstants.USE_XMPP_KICK_CHANNEL) { final ConnectionConfiguration xmppConfig = new XMPPConfigurationFactory(cp, mService.getNetworkConnectivityManager(), null) .getSafeXmppConnectionConfiguration(xmppServiceName); final XMPPConnection xmppCon = new XMPPConnection(xmppConfig); xmppCon.setLogger(new Logger() { @Override public void log(String message) { L.d(message); } }); xmppCon.connect(); xmppCon.login(xmppAccount, xmppPassword); final Thread t2 = new Thread(new SafeRunnable() { @Override protected void safeRun() throws Exception { L.d("REG Before disconnect (on separate thread) - xmpp-" + xmppCon.hashCode()); xmppCon.disconnect(); L.d("REG After disconnect (on separate thread) - xmpp-" + xmppCon.hashCode()); } }); t2.setDaemon(true); t2.start(); } postFinishRegistration(info.mCredentials.getUsername(), info.mCredentials.getPassword(), invitorCode, invitorSecret); runOnUI(new SafeRunnable(pausable) { @Override protected void safeRun() throws Exception { T.UI(); mWizard.setCredentials(info.mCredentials); if (CloudConstants.USE_GCM_KICK_CHANNEL && !"".equals(mGCMRegistrationId)) { GoogleServicesUtils.saveGCMRegistrationId(mService, mGCMRegistrationId); } mService.setCredentials(mWizard.getCredentials()); mService.setRegisteredInConfig(true); final Intent launchServiceIntent = new Intent(mActivity, MainService.class); launchServiceIntent.putExtra(MainService.START_INTENT_JUST_REGISTERED, true); launchServiceIntent.putExtra(MainService.START_INTENT_MY_EMAIL, mWizard.getEmail()); mActivity.startService(launchServiceIntent); stopRegistrationService(); pd.dismiss(); mWizard.finish(); // finish } }); } catch (Exception e) { L.d("Exception while trying to end the registration process", e); runOnUI(new SafeRunnable(pausable) { @Override protected void safeRun() throws Exception { T.UI(); tryConnect(pd, attempt + 1, statusMessage, info); } }); } } }; if (attempt == 1) { runOnWorker(runnable); } else { runDelayedOnWorker(runnable, XMPP_CHECK_DELAY_MILLIS); } }
From source file:com.feytuo.chat.activity.ContactlistFragment.java
/** * user???//from w ww. j ava 2s . co m */ private void moveToBlacklist(final String username) { final ProgressDialog pd = new ProgressDialog(getActivity()); pd.setMessage("???..."); pd.setCanceledOnTouchOutside(false); pd.show(); new Thread(new Runnable() { public void run() { try { //??? EMContactManager.getInstance().addUserToBlackList(username, true); getActivity().runOnUiThread(new Runnable() { public void run() { pd.dismiss(); Toast.makeText(getActivity(), "????", Toast.LENGTH_SHORT).show(); } }); } catch (final EaseMobException e) { e.printStackTrace(); getActivity().runOnUiThread(new Runnable() { public void run() { pd.dismiss(); Log.i(TAG, "???" + e.getMessage()); Toast.makeText(getActivity(), "???", Toast.LENGTH_SHORT).show(); } }); } } }).start(); }
From source file:com.easemob.chatui.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 . jav a 2 s . com pd.setCanceledOnTouchOutside(false); pd.show(); BeewayApplication.getInstance().logout(new EMCallBack() { @Override public void onSuccess() { 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:com.m2dl.mini_projet.mini_projet_android.fragment.PhotoDialogFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.menu_photo_view, container, false); if (getArguments() != null) { mainActivity = ((MainActivity) getActivity()); myBitmap = getArguments().getParcelable(ARG_PHOTO); ImageView bitmapDialog = (ImageView) v.findViewById(R.id.imageView); bitmapDialog.setImageBitmap(myBitmap); coordLat = getArguments().getDouble(ARG_COORD_LAT); coordLong = getArguments().getDouble(ARG_COORD_LONG); imageFilePath = getArguments().getString(ARG_FILE_PATH); }//from ww w. jav a2 s .com getDialog().setTitle("Uploader votre photo"); etPseudo = (EditText) v.findViewById(R.id.editTextPseudo); etTags = (EditText) v.findViewById(R.id.editTextTags); Button buttonAnnuler = (Button) v.findViewById(R.id.buttonAnnuler); buttonAnnuler.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { getDialog().dismiss(); } }); Button buttonConfirmer = (Button) v.findViewById(R.id.buttonConfirmer); buttonConfirmer.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Date currentDate = new Date(System.currentTimeMillis()); Boolean authorConfirmed, tagsConfirmed; if (!etPseudo.getText().toString().isEmpty()) { authorConfirmed = true; } else { authorConfirmed = false; etPseudo.setError("Ce champs est obligatoire"); } if (!etTags.getText().toString().isEmpty()) { tagsConfirmed = true; } else { tagsConfirmed = false; etTags.setError("Veuillez rentrer au moins un tag"); } if (tagsConfirmed && authorConfirmed) { final Photo myPhoto = new Photo(etPseudo.getText().toString(), coordLat, coordLong, currentDate); String[] myTags = etTags.getText().toString().split(","); for (String tag : myTags) { Tag myTag = new Tag(tag.replaceAll("\\s", "")); myPhoto.putTag(myTag); } String tag = etTags.getText().toString().replaceAll("\\s", ""); final boolean[] uploaded = { false }; final Image p = factory(myPhoto, tag, myBitmap); final Callback<Image> callback = new Callback<Image>() { @Override public void success(Image photo, Response response) { myPhoto.setUrl(photo.url()); mainActivity.putInPhotoMarkers(myPhoto); uploaded[0] = true; getDialog().dismiss(); } @Override public void failure(RetrofitError error) { System.err.println("Could not post photo"); } }; final SimpleImageTag simpleImageTag = ServiceGenerator.createService(SimpleImageTag.class); AsyncTask<InputStream, Void, String> task = new AsyncTask<InputStream, Void, String>() { @Override protected String doInBackground(InputStream... params) { String id = CloudinaryHelper.upload(params[0]); p.setId(id); simpleImageTag.postImage(p, callback); return id; } }; try { task.execute(new FileInputStream(new File(imageFilePath))); } catch (FileNotFoundException e) { e.printStackTrace(); } final ProgressDialog progDialog = ProgressDialog.show(mainActivity, "Upload de l'image en cours...", "Veuillez patienter", true); new Thread() { public void run() { try { while (!uploaded[0]) ; } catch (Exception e) { Log.e(MainActivity.TAG, e.getMessage()); } progDialog.dismiss(); } }.start(); } } }); return v; }
From source file:com.youti.chat.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 . ja va2s. co m pd.setCanceledOnTouchOutside(false); pd.show(); YoutiApplication.getInstance().logout(new EMCallBack() { @Override public void onSuccess() { getActivity().runOnUiThread(new Runnable() { public void run() { pd.dismiss(); // ?? ((MyMessageActivity) 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:de.jerleo.samsung.knox.firewall.MainActivity.java
private void applyRules() { // Get context final Context context = this; // Show progress final ProgressDialog progress = new ProgressDialog(this); // Finish message final Toast completed = Toast.makeText(this, getString(R.string.firewall_rules_complete), Toast.LENGTH_SHORT);//from ww w. j av a 2 s .co m progress.setIndeterminate(true); progress.setProgress(0); progress.show(); // Handler to dismiss progress @SuppressLint("HandlerLeak") final Handler handler = new Handler() { @Override public void handleMessage(Message msg) { super.handleMessage(msg); progress.dismiss(); completed.show(); } }; // Apply firewall rules new Thread(new Runnable() { @Override public void run() { progress.setMessage(getString(R.string.firewall_rules_create)); Firewall.createRules(context); handler.sendMessage(handler.obtainMessage()); } }).start(); }
From source file:com.rastating.droidbeard.MainActivity.java
private void restartSickbeard(boolean prompt) { if (prompt) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Confirmation").setMessage("Are you sure you want to restart SickBeard?") .setCancelable(true).setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override//from www. j a v a 2 s. c o m public void onClick(DialogInterface dialogInterface, int i) { restartSickbeard(false); } }).setNegativeButton("No", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); } }).create().show(); } else { final ProgressDialog dialog = new ProgressDialog(this); dialog.setTitle("Restarting"); dialog.setMessage("Please wait..."); dialog.setCancelable(false); dialog.setIndeterminate(true); dialog.show(); RestartTask task = new RestartTask(this); task.addResponseListener(new ApiResponseListener<Boolean>() { @Override public void onApiRequestFinished(SickbeardAsyncTask sender, Boolean result) { dialog.dismiss(); } }); task.start(); } }
From source file:itstudio.instructor.fragment.ContactlistFragment.java
/** * user???/*from w ww .j a v a 2 s .c om*/ */ private void moveToBlacklist(final String username) { final ProgressDialog pd = new ProgressDialog(getActivity()); pd.setMessage("???..."); pd.setCanceledOnTouchOutside(false); pd.show(); new Thread(new Runnable() { public void run() { try { //??? EMContactManager.getInstance().addUserToBlackList(username, false); getActivity().runOnUiThread(new Runnable() { public void run() { pd.dismiss(); Toast.makeText(getActivity(), "????", 0).show(); refresh(); } }); } catch (EaseMobException e) { e.printStackTrace(); getActivity().runOnUiThread(new Runnable() { public void run() { pd.dismiss(); Toast.makeText(getActivity(), "???", 0).show(); } }); } } }).start(); }
From source file:ansteph.com.beecab.view.profile.DriverProfileView.java
private void getImageData() { final ProgressDialog loading = ProgressDialog.show(this, "Please wait ", "Fetching data...", false, false); String url = String.format(Config.RETRIEVE_USER_IMAGE_URL, taxiID); //Creating a json array request to get the json from our api JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(url, new Response.Listener<JSONArray>() { @Override//from w w w. ja v a2 s . c om public void onResponse(JSONArray response) { //Dismissing the progressdialog on response loading.dismiss(); //Displaying our grid loadImage(response); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { } }); //Creating a request queue RequestQueue requestQueue = Volley.newRequestQueue(getApplicationContext()); //Adding our request to the queue requestQueue.add(jsonArrayRequest); }