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.arantius.tivocommander.SeasonPass.java

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

    final ArrayList<String> subscriptionIds = new ArrayList<String>();
    final ArrayList<Integer> slots = new ArrayList<Integer>();
    int i = 0;//ww w. ja  va  2 s . com
    while (i < mSubscriptionData.size()) {
        if (mSubscriptionStatus.get(i) == SubscriptionStatus.MISSING) {
            String subscriptionId = mSubscriptionIds.get(i);
            subscriptionIds.add(subscriptionId);
            slots.add(i);
            mSubscriptionStatus.set(i, SubscriptionStatus.LOADING);
        }
        i++;
    }

    final ProgressDialog d = new ProgressDialog(this);
    final MindRpcResponseListener onAllPassesLoaded = new MindRpcResponseListener() {
        public void onResponse(MindRpcResponse response) {
            if (response != null) {
                mDetailCallback.onResponse(response);
            }
            d.dismiss();

            // Save the state before ordering.
            mSubscriptionIdsBeforeReorder.clear();
            mSubscriptionIdsBeforeReorder.addAll(mSubscriptionIds);
            // Flip the buttons.
            findViewById(R.id.reorder_enable).setVisibility(View.GONE);
            findViewById(R.id.reorder_apply).setVisibility(View.VISIBLE);
            // Show the drag handles.
            mInReorderMode = true;
            mListAdapter.notifyDataSetChanged();
        }
    };

    if (subscriptionIds.size() == 0) {
        // No subscriptions need loading? Proceed immediately.
        onAllPassesLoaded.onResponse(null);
    } else {
        // Otherwise, show dialog and start loading.
        d.setIndeterminate(true);
        d.setTitle("Preparing ...");
        d.setMessage("Loading all season pass data.");
        d.setCancelable(false);
        d.show();

        final SubscriptionSearch req = new SubscriptionSearch(subscriptionIds);
        mRequestSlotMap.put(req.getRpcId(), slots);
        MindRpc.addRequest(req, onAllPassesLoaded);
    }
}

From source file:im.afterclass.android.activity.RegisterActivity.java

/**
 * //from www.  j  a va  2 s. c o  m
 * @param view
 */
public void register(View view) {
    final String username = userNameEditText.getText().toString().trim();
    final String pwd = passwordEditText.getText().toString().trim();
    String confirm_pwd = confirmPwdEditText.getText().toString().trim();
    if (TextUtils.isEmpty(username)) {
        Toast.makeText(this, "????", Toast.LENGTH_SHORT).show();
        userNameEditText.requestFocus();
        return;
    } else if (TextUtils.isEmpty(pwd)) {
        Toast.makeText(this, "???", Toast.LENGTH_SHORT).show();
        passwordEditText.requestFocus();
        return;
    } else if (TextUtils.isEmpty(confirm_pwd)) {
        Toast.makeText(this, "???", Toast.LENGTH_SHORT).show();
        confirmPwdEditText.requestFocus();
        return;
    } else if (!pwd.equals(confirm_pwd)) {
        Toast.makeText(this, "????", Toast.LENGTH_SHORT).show();
        return;
    }

    if (!TextUtils.isEmpty(username) && !TextUtils.isEmpty(pwd)) {
        final ProgressDialog pd = new ProgressDialog(this);
        pd.setMessage("...");
        pd.show();
        new Thread(new Runnable() {
            public void run() {
                try {
                    //sdk
                    EMChatManager.getInstance().createAccountOnServer(username, pwd);
                    runOnUiThread(new Runnable() {
                        public void run() {
                            if (!RegisterActivity.this.isFinishing())
                                pd.dismiss();
                            //???
                            DemoApplication.getInstance().setUserName(username);
                            Toast.makeText(getApplicationContext(), "?", 0).show();
                            newRegister();
                            finish();
                        }
                    });
                } catch (final Exception e) {
                    runOnUiThread(new Runnable() {
                        public void run() {
                            if (!RegisterActivity.this.isFinishing())
                                pd.dismiss();
                            if (e != null && e.getMessage() != null) {
                                String errorMsg = e.getMessage();
                                if (errorMsg.indexOf("EMNetworkUnconnectedException") != -1) {
                                    Toast.makeText(getApplicationContext(), "?",
                                            0).show();
                                } else if (errorMsg.indexOf("conflict") != -1) {
                                    Toast.makeText(getApplicationContext(), "?", 0).show();
                                } else {
                                    Toast.makeText(getApplicationContext(), ": " + e.getMessage(),
                                            1).show();
                                }

                            } else {
                                Toast.makeText(getApplicationContext(), ": ", 1).show();

                            }
                        }
                    });
                }
            }
        }).start();

    }
}

From source file:com.easemob.chatuidemo.ui.setting.SettingsFragment.java

void logout() {
    final ProgressDialog pd = new ProgressDialog(getActivity());
    String st = getResources().getString(R.string.Are_logged_out);
    pd.setMessage(st);/*from w  ww.ja v a2 s.  c o  m*/
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    DemoHelper.getInstance().logout(true, 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:com.easemob.ChuangKeYuan.ui.SettingsFragment.java

void logout() {
    final ProgressDialog pd = new ProgressDialog(getActivity());
    String st = getResources().getString(R.string.Are_logged_out);
    pd.setMessage(st);/*w  ww  . j  av a 2s . c  om*/
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    MyHelper.getInstance().logout(true, 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:com.example.sujit.myapplication.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/*  ww  w. jav  a 2 s .  co m*/
        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());
        }
    });
    //Adding the request to request queue
    RequestQueue requestQueue = Volley.newRequestQueue(this);
    requestQueue.add(stringRequest);
}

From source file:com.gh4a.BaseActivity.java

protected void stopProgressDialog(ProgressDialog progressDialog) {
    if (progressDialog != null && progressDialog.isShowing()) {
        progressDialog.dismiss();
    }/*from   w  w w .ja  v  a 2 s .  co m*/
}

From source file:app.view.chat.ContactListFragment.java

/**
 * user???//  ww w  . jav  a 2s  .com
 */
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 (EaseMobException e) {
                e.printStackTrace();
                getActivity().runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        Toast.makeText(getActivity(), "???", Toast.LENGTH_SHORT).show();
                    }
                });
            }
        }
    }).start();

}

From source file:com.imalu.alyou.activity.SettingsFragment.java

void logout() {
    final ProgressDialog pd = new ProgressDialog(getActivity());
    pd.setMessage("..");
    pd.setCanceledOnTouchOutside(false);
    pd.show();//from   w  w  w  .java  2s  . c  om
    AlUApplication.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:nl.eduvpn.app.fragment.CustomProviderFragment.java

@OnClick(R.id.custom_provider_connect)
protected void onConnectClicked() {
    String prefix = getContext().getString(R.string.custom_provider_prefix);
    String postfix = _customProviderUrl.getText().toString();
    String url = prefix + postfix;
    if (getActivity() != null) {
        final Instance customProviderInstance = _createCustomProviderInstance(url, AuthorizationType.LOCAL);
        final ProgressDialog dialog = ProgressDialog.show(getContext(),
                getString(R.string.progress_dialog_title), getString(R.string.api_discovery_message), true);
        // Discover the API
        _apiService.getJSON(customProviderInstance.getSanitizedBaseURI() + API_DISCOVERY_POSTFIX, null,
                new APIService.Callback<JSONObject>() {
                    @Override/*  w  ww  .ja v  a  2s .c  o  m*/
                    public void onSuccess(JSONObject result) {
                        try {
                            DiscoveredAPI discoveredAPI = _serializerService.deserializeDiscoveredAPI(result);
                            dialog.dismiss();
                            _connectionService.initiateConnection(getActivity(), customProviderInstance,
                                    discoveredAPI);
                        } catch (SerializerService.UnknownFormatException ex) {
                            ErrorDialog.show(getContext(), R.string.error_dialog_title,
                                    getString(R.string.custom_api_discovery_error, ex.toString()));
                            Log.e(TAG, "Error while parsing discovered API", ex);
                            dialog.dismiss();
                        }
                    }

                    @Override
                    public void onError(String errorMessage) {
                        dialog.dismiss();
                        Log.e(TAG, "Error fetching discovered API: " + errorMessage);
                        ErrorDialog.show(getContext(), R.string.error_dialog_title,
                                getString(R.string.custom_api_discovery_error, errorMessage));
                    }
                });
    }
}

From source file:com.sakisds.icymonitor.activities.ConnectionActivity.java

/**
 * Connect to URL/*w  ww .  j  ava2s.  co  m*/
 *
 * @param url URL to connect.
 */
private void connect(final String url) {
    // Create client
    RequestParams params = new RequestParams("id", mSettings.getLong("device_id", -1));

    // Create a dialog
    final ProgressDialog progress = ProgressDialog.show(this, "", getResources().getString(R.string.connecting),
            false);

    final Context context = this;
    // Send request
    mClient.get(url + "/auth", params, new JsonHttpResponseHandler() {
        @Override
        public void onSuccess(JSONObject response) {
            progress.dismiss();
            try {
                String version = response.getString("Version");
                if (version.equals(ACCEPTED_SERVER_VERSION)) {
                    String auth = response.getString("Auth");
                    if (auth.equals("OK")) {
                        Intent intent = new Intent(getBaseContext(), MainViewActivity.class);
                        intent.putExtra(MainViewActivity.EXTRA_ADDRESS, url);
                        startActivity(intent);
                    } else {
                        showErrorDialog(R.string.error_could_not_connect_title, R.string.error_authentication);
                    }
                } else if (version.equals(UPDATE_SERVER_VERSION)) {
                    showErrorDialog(R.string.error_could_not_connect_title,
                            R.string.error_outdated_server_update);
                } else {
                    showErrorDialog(R.string.error_outdated_server, R.string.error_outdated_server_long);
                }
            } catch (JSONException e) {
                showErrorDialog(R.string.error_could_not_connect_title, R.string.error_invalid_response);
            }
        }

        @Override
        public void onFailure(Throwable e, JSONObject response) {
            progress.dismiss();
            showErrorDialog(R.string.error_could_not_connect_title, R.string.error_could_not_connect);
        }
    });
}