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.silentcircle.contacts.calllog.ClearCallLogDialog.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override//  w  w w .j  a  v  a2  s .c  o  m
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final ContentResolver resolver = getActivity().getContentResolver();
    final OnClickListener okListener = new OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            final ProgressDialog progressDialog = ProgressDialog.show(getActivity(),
                    getString(R.string.clearCallLogProgress_title), "", true, false);
            final AsyncTask<Void, Void, Void> task = new AsyncTask<Void, Void, Void>() {
                @Override
                protected Void doInBackground(Void... params) {
                    resolver.delete(ScCalls.CONTENT_URI, null, null);
                    return null;
                }

                @Override
                protected void onPostExecute(Void result) {
                    progressDialog.dismiss();
                }
            };
            // TODO: Once we have the API, we should configure this ProgressDialog
            // to only show up after a certain time (e.g. 150ms)
            progressDialog.show();
            task.execute();
        }
    };
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
        builder.setIconAttribute(android.R.attr.alertDialogIcon);

    return builder.setTitle(R.string.clearCallLogConfirmation_title)
            .setMessage(R.string.clearCallLogConfirmation).setNegativeButton(android.R.string.cancel, null)
            .setPositiveButton(android.R.string.ok, okListener).setCancelable(true).create();
}

From source file:com.arantius.tivocommander.SeasonPass.java

public void reorderApply(View unusedView) {
    Utils.log("SeasonPass::reorderApply() " + Boolean.toString(mInReorderMode));

    boolean noChange = true;
    ArrayList<String> subIds = new ArrayList<String>();
    for (int i = 0; i < mSubscriptionIds.size(); i++) {
        if (mSubscriptionIds.get(i) != mSubscriptionIdsBeforeReorder.get(i)) {
            noChange = false;/*from   ww  w  .  ja v  a 2  s .  com*/
        }
        subIds.add(mSubscriptionData.get(i).path("subscriptionId").asText());
    }

    final ProgressDialog d = new ProgressDialog(this);
    final MindRpcResponseListener onReorderComplete = new MindRpcResponseListener() {
        public void onResponse(MindRpcResponse response) {
            if (d.isShowing()) {
                d.dismiss();
            }

            // Flip the buttons.
            findViewById(R.id.reorder_enable).setVisibility(View.VISIBLE);
            findViewById(R.id.reorder_apply).setVisibility(View.GONE);
            // Turn off the drag handles.
            mInReorderMode = false;
            mListAdapter.notifyDataSetChanged();
        }
    };

    if (noChange) {
        // If there was no change, switch the UI back immediately.
        onReorderComplete.onResponse(null);
    } else {
        // Otherwise show a dialog while we do the RPC.
        d.setIndeterminate(true);
        d.setTitle("Saving ...");
        d.setMessage("Saving new season pass order.  " + "Patience please, this takes a while.");
        d.setCancelable(false);
        d.show();

        SubscriptionsReprioritize req = new SubscriptionsReprioritize(subIds);
        MindRpc.addRequest(req, onReorderComplete);
    }
}

From source file:com.mediatek.galleryfeature.stereo.segment.background.StereoBackgroundActivity.java

private void hideSavingProgress() {
    if (mSavingProgressDialog != null) {
        ProgressDialog progress = mSavingProgressDialog.get();
        if (progress != null) {
            progress.dismiss();
        }/* w ww . j  ava 2 s.  co m*/
    }
}

From source file:com.wenwen.chatuidemo.activity.SettingsFragment.java

void logout() {
    final ProgressDialog pd = new ProgressDialog(getActivity());
    pd.setMessage("..");
    pd.setCanceledOnTouchOutside(false);
    pd.show();/*from  w w w. j a  v  a  2 s. c  o  m*/
    DemoApplication.getInstance().logout(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) {

        }
    });
}

From source file:com.yozio.demo.implementations.twitter.TweetPhotoActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.photo);/*w ww  .j a  v  a2  s  .co m*/
    Button btnPhoto = (Button) findViewById(R.id.btnPhoto);
    btnPostPhoto = (Button) findViewById(R.id.btnPostPhoto);
    mImageView = (ImageView) findViewById(R.id.imgPhoto);

    btnPhoto.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
            startActivityForResult(takePictureIntent, 0);
        }
    });

    // This does the post to twitter
    btnPostPhoto.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            if (mImageBitmap != null) {

                final ProgressDialog progress = SafeProgressDialog.show(TweetPhotoActivity.this);

                // First create a Socialize share object so we get the correct URLs
                ShareOptions options = ShareUtils.getUserShareOptions(TweetPhotoActivity.this);
                ShareUtils.registerShare(TweetPhotoActivity.this, entity, options, new ShareAddListener() {

                    @Override
                    public void onError(SocializeException error) {
                        progress.dismiss();
                        handleError(TweetPhotoActivity.this, error);
                    }

                    @Override
                    public void onCreate(Share result) {
                        // Now post to Twitter.
                        try {
                            // Get the bytes for the image
                            byte[] image = TwitterUtils.getImageForPost(TweetPhotoActivity.this, mImageBitmap,
                                    CompressFormat.JPEG);

                            PhotoTweet tweet = new PhotoTweet();
                            tweet.setImageData(image);

                            String link = "http://www.trybluebug.com";
                            tweet.setText("Taken with BlueBug " + link);

                            TwitterUtils.tweetPhoto(TweetPhotoActivity.this, tweet,
                                    new SocialNetworkPostListener() {

                                        @Override
                                        public void onNetworkError(Activity context, SocialNetwork network,
                                                Exception error) {
                                            progress.dismiss();
                                            handleError(TweetPhotoActivity.this, error);
                                        }

                                        @Override
                                        public void onCancel() {
                                            progress.dismiss();
                                            DemoUtils.showToast(TweetPhotoActivity.this, "Cancelled");
                                        }

                                        @Override
                                        public void onAfterPost(Activity parent, SocialNetwork socialNetwork,
                                                JSONObject responseObject) {
                                            progress.dismiss();
                                            DemoUtils.showToast(parent, "Photo Shared!");
                                        }
                                    });

                        } catch (IOException e) {
                            handleError(TweetPhotoActivity.this, e);
                        }

                    }
                }, SocialNetwork.TWITTER);

            }
        }
    });
}

From source file:xj.property.fragment.SettingsFragment.java

void logout() {
    final ProgressDialog pd = new ProgressDialog(getActivity());
    pd.setMessage("..");
    pd.setCanceledOnTouchOutside(false);
    pd.show();//from  w  w  w  .ja v a2  s . c  om
    XjApplication.getInstance().logout(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) {

        }
    });
}

From source file:com.aidigame.hisun.imengstar.huanxin.SettingsFragment.java

void logout() {
    final ProgressDialog pd = new ProgressDialog(getActivity());
    pd.setMessage("..");
    pd.setCanceledOnTouchOutside(false);
    pd.show();/*  w ww. j  a v  a2s. c o m*/
    com.aidigame.hisun.imengstar.PetApplication.logout(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) {

        }
    });
}

From source file:com.yozio.demo.implementations.facebook.PostPhotoActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.photo);// www  .j a  va  2  s  . co  m
    Button btnPhoto = (Button) findViewById(R.id.btnPhoto);
    btnPostPhoto = (Button) findViewById(R.id.btnPostPhoto);
    mImageView = (ImageView) findViewById(R.id.imgPhoto);

    btnPhoto.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
            startActivityForResult(takePictureIntent, 0);
        }
    });

    // This does the post to facebook
    btnPostPhoto.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            if (mImageBitmap != null) {

                final ProgressDialog progress = SafeProgressDialog.show(PostPhotoActivity.this);

                // First create a Socialize share object so we get the correct URLs
                ShareOptions options = ShareUtils.getUserShareOptions(PostPhotoActivity.this);
                ShareUtils.registerShare(PostPhotoActivity.this, entity, options, new ShareAddListener() {

                    @Override
                    public void onError(SocializeException error) {
                        progress.dismiss();
                        handleError(PostPhotoActivity.this, error);
                    }

                    @Override
                    public void onCreate(Share result) {
                        // Now post to Facebook.
                        try {
                            // Get the bytes for the image
                            byte[] image = FacebookUtils.getImageForPost(PostPhotoActivity.this, mImageBitmap,
                                    CompressFormat.JPEG);

                            Map<String, Object> params = new HashMap<String, Object>();
                            String graphPath = "me/photos";

                            String link = "http://www.trybluebug.com";
                            String msg = "Taken with BlueBug " + link;

                            params.put("caption", msg);
                            params.put("photo", image);

                            FacebookUtils.post(PostPhotoActivity.this, graphPath, params,
                                    new SocialNetworkPostListener() {

                                        @Override
                                        public void onNetworkError(Activity context, SocialNetwork network,
                                                Exception error) {
                                            progress.dismiss();
                                            handleError(PostPhotoActivity.this, error);
                                        }

                                        @Override
                                        public void onCancel() {
                                            progress.dismiss();
                                            DemoUtils.showToast(PostPhotoActivity.this, "Cancelled");
                                        }

                                        @Override
                                        public void onAfterPost(Activity parent, SocialNetwork socialNetwork,
                                                JSONObject responseObject) {
                                            progress.dismiss();
                                            DemoUtils.showToast(parent, "Photo Shared!");
                                        }
                                    });

                        } catch (IOException e) {
                            handleError(PostPhotoActivity.this, e);
                        }

                    }
                }, SocialNetwork.FACEBOOK);

            }
        }
    });
}

From source file:com.safeness.im.activity.SettingsFragment.java

void logout() {
    final ProgressDialog pd = new ProgressDialog(getActivity());
    pd.setMessage("..");
    pd.setCanceledOnTouchOutside(false);
    pd.show();//from  w ww. j  a  v a  2 s .  c  o m
    PatientApplication.getInstance().logout(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) {

        }
    });
}

From source file:com.haseebelahi.usman.UserProfile.java

public void getUserDetails() {

    String url = "http://asfand.danglingpixels.com/taxi/app/get_user.php?user_id=" + logged_in;

    //showing dialog box
    final ProgressDialog progressDialog = new ProgressDialog(this.getActivity(), R.style.AppTheme_Dark_Dialog);
    progressDialog.setIndeterminate(true);
    progressDialog.setMessage("Updating...");
    progressDialog.show();/*from  w  ww .  ja  v  a 2s.  com*/

    // Request a string response
    StringRequest stringRequest = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() {
        @Override
        public void onResponse(String response) {

            // Result handling
            System.out.println(response);
            progressDialog.dismiss();

            try {
                JSONArray jsonArray = new JSONArray(response);
                JSONObject jsonObject = jsonArray.getJSONObject(0);
                name.setText("Name: " + jsonObject.getString("name"));
                username.setText("Username: " + jsonObject.getString("username"));
                email.setText("Email: " + jsonObject.getString("email"));
                cnic.setText("CNIC: " + jsonObject.getString("cnic"));

            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {

            // Error handling
            System.out.println("Something went wrong!");
            error.printStackTrace();
            progressDialog.dismiss();
            Toast.makeText(getContext(), "FAILED TO CONNECT", Toast.LENGTH_LONG).show();
        }
    });
    // Add the request to the queue
    int socketTimeout = 30000;//30 seconds - change to what you want
    RetryPolicy policy = new DefaultRetryPolicy(socketTimeout, DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
            DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
    stringRequest.setRetryPolicy(policy);
    Volley.newRequestQueue(this.getContext()).add(stringRequest);
}