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.techscl.ichat.activity.ChatActivity.java

/**
 * ???/*from   w w w  . ja va2  s.c om*/
 *
 * @param username
 */
private void addUserToBlacklist(final String username) {
    final ProgressDialog pd = new ProgressDialog(this);
    pd.setMessage(getString(R.string.Is_moved_into_blacklist));
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    new Thread(new Runnable() {
        public void run() {
            try {
                EMContactManager.getInstance().addUserToBlackList(username, false);
                runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        To.show(getString(R.string.Move_into_blacklist_success));
                    }
                });
            } catch (EaseMobException e) {
                e.printStackTrace();
                runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        To.show(getString(R.string.Move_into_blacklist_failure));
                    }
                });
            }
        }
    }).start();
}

From source file:cmu.cconfs.instantMessage.activities.ChatActivity.java

/**
 * ???//  w w  w . jav  a2s. co  m
 *
 * @param username
 */
private void addUserToBlacklist(final String username) {
    final ProgressDialog pd = new ProgressDialog(this);
    pd.setMessage(getString(R.string.Is_moved_into_blacklist));
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    new Thread(new Runnable() {
        public void run() {
            try {
                EMContactManager.getInstance().addUserToBlackList(username, false);
                runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        Toast.makeText(getApplicationContext(), R.string.Move_into_blacklist_success, 0).show();
                    }
                });
            } catch (EaseMobException e) {
                e.printStackTrace();
                runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        Toast.makeText(getApplicationContext(), R.string.Move_into_blacklist_failure, 0).show();
                    }
                });
            }
        }
    }).start();
}

From source file:com.example.fertilizercrm.easemob.chatuidemo.activity.ChatActivity.java

protected void onChatRoomViewCreation() {
    findViewById(R.id.container_to_group).setVisibility(View.GONE);

    final ProgressDialog pd = ProgressDialog.show(this, "", "Joining......");
    EMChatManager.getInstance().joinChatRoom(toChatUsername, new EMValueCallBack<EMChatRoom>() {

        @Override// www.ja  va  2  s .  co m
        public void onSuccess(EMChatRoom value) {
            // TODO Auto-generated method stub
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    pd.dismiss();
                    room = EMChatManager.getInstance().getChatRoom(toChatUsername);
                    if (room != null) {
                        tv_name.setText(room.getName());
                    } else {
                        tv_name.setText(toChatUsername);
                    }
                    EMLog.d(TAG, "join room success : " + room.getName());

                    onConversationInit();

                    onListViewCreation();
                }
            });
        }

        @Override
        public void onError(final int error, String errorMsg) {
            // TODO Auto-generated method stub
            EMLog.d(TAG, "join room failure : " + error);
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    pd.dismiss();
                }
            });
            finish();
        }
    });
}

From source file:cn.hbm.superwechat.activity.ChatActivity.java

/**
 * ???//from   w w w.  j a  v a  2s.  c om
 *
 * @param username
 */
private void addUserToBlacklist(final String username) {
    final ProgressDialog pd = new ProgressDialog(this);
    pd.setMessage(getString(R.string.Is_moved_into_blacklist));
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    new Thread(new Runnable() {
        public void run() {
            try {
                EMContactManager.getInstance().addUserToBlackList(username, false);
                runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        Toast.makeText(getApplicationContext(), R.string.Move_into_blacklist_success,
                                Toast.LENGTH_SHORT).show();
                    }
                });
            } catch (EaseMobException e) {
                e.printStackTrace();
                runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        Toast.makeText(getApplicationContext(), R.string.Move_into_blacklist_failure,
                                Toast.LENGTH_SHORT).show();
                    }
                });
            }
        }
    }).start();
}

From source file:com.efithealth.app.activity.ChatActivity.java

protected void onChatRoomViewCreation() {

    final ProgressDialog pd = ProgressDialog.show(this, "", "Joining......");
    EMChatManager.getInstance().joinChatRoom(toChatUsername, new EMValueCallBack<EMChatRoom>() {

        @Override/*  w w w  . ja va 2s .  c om*/
        public void onSuccess(EMChatRoom value) {
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    pd.dismiss();
                    room = EMChatManager.getInstance().getChatRoom(toChatUsername);
                    if (room != null) {
                        ((TextView) findViewById(R.id.name)).setText(room.getName());
                    } else {
                        ((TextView) findViewById(R.id.name)).setText(toChatUsername);
                    }
                    EMLog.d(TAG, "join room success : " + room.getName());

                    onConversationInit();

                    onListViewCreation();
                }
            });
        }

        @Override
        public void onError(final int error, String errorMsg) {
            EMLog.d(TAG, "join room failure : " + error);
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    pd.dismiss();
                }
            });
            finish();
        }
    });
}

From source file:cn.ucai.chatuidemo.activity.ChatActivity.java

/**
 * ???//from w  w w . ja va 2 s.co  m
 * 
 * @param username
 */
private void addUserToBlacklist(final String username) {
    final ProgressDialog pd = new ProgressDialog(this);
    pd.setMessage(getString(R.string.Is_moved_into_blacklist));
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    new Thread(new Runnable() {
        public void run() {
            try {
                EMContactManager.getInstance().addUserToBlackList(username, false);
                runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        Toast.makeText(getApplicationContext(), R.string.Move_into_blacklist_success,
                                Toast.LENGTH_LONG).show();
                    }
                });
            } catch (EaseMobException e) {
                e.printStackTrace();
                runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        Toast.makeText(getApplicationContext(), R.string.Move_into_blacklist_failure,
                                Toast.LENGTH_LONG).show();
                    }
                });
            }
        }
    }).start();
}

From source file:cn.gen.superwechat.activity.ChatActivity.java

/**
 * ???//from   ww  w.ja v a  2 s.c  o  m
 * 
 * @param username
 */
private void addUserToBlacklist(final String username) {
    final ProgressDialog pd = new ProgressDialog(this);
    pd.setMessage(getString(cn.gen.superwechat.R.string.Is_moved_into_blacklist));
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    new Thread(new Runnable() {
        public void run() {
            try {
                EMContactManager.getInstance().addUserToBlackList(username, false);
                runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        Toast.makeText(getApplicationContext(),
                                cn.gen.superwechat.R.string.Move_into_blacklist_success, Toast.LENGTH_SHORT)
                                .show();
                    }
                });
            } catch (EaseMobException e) {
                e.printStackTrace();
                runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        Toast.makeText(getApplicationContext(),
                                cn.gen.superwechat.R.string.Move_into_blacklist_failure, Toast.LENGTH_SHORT)
                                .show();
                    }
                });
            }
        }
    }).start();
}

From source file:com.eason.marker.emchat.chatuidemo.activity.ChatActivity.java

/**
 * ???/*from   www .  j  a  va  2s.c  o  m*/
 * 
 * @param username
 */
private void addUserToBlacklist(final String username) {
    final ProgressDialog pd = new ProgressDialog(this);
    pd.setMessage(getString(R.string.Is_moved_into_blacklist));
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    new Thread(new Runnable() {
        public void run() {
            try {
                EMContactManager.getInstance().addUserToBlackList(username, false);
                runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        GreenToast
                                .makeText(getApplicationContext(),
                                        getResources().getString(R.string.Move_into_blacklist_success), 0)
                                .show();
                    }
                });
            } catch (EaseMobException e) {
                e.printStackTrace();
                runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        GreenToast
                                .makeText(getApplicationContext(),
                                        getResources().getString(R.string.Move_into_blacklist_failure), 0)
                                .show();
                    }
                });
            }
        }
    }).start();
}

From source file:com.hzx.luoyechat.activity.ChatActivity.java

protected void onChatRoomViewCreation() {
    findViewById(R.id.container_to_group).setVisibility(View.GONE);

    final ProgressDialog pd = ProgressDialog.show(this, "", "Joining......");
    EMChatManager.getInstance().joinChatRoom(toChatUsername, new EMValueCallBack<EMChatRoom>() {

        @Override//w w w .j a v  a 2s  . c o m
        public void onSuccess(EMChatRoom value) {
            // TODO Auto-generated method stub
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    pd.dismiss();
                    room = EMChatManager.getInstance().getChatRoom(toChatUsername);

                    setmyTitle(room != null ? room.getNick() : toChatUsername);

                    EMLog.d(TAG, "join room success : " + room.getName());

                    onConversationInit();

                    onListViewCreation();
                }
            });
        }

        @Override
        public void onError(final int error, String errorMsg) {
            // TODO Auto-generated method stub
            EMLog.d(TAG, "join room failure : " + error);
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    pd.dismiss();
                }
            });
            finish();
        }
    });
}

From source file:com.mobicage.rogerthat.registration.RegistrationActivity2.java

private void registerWithAccessToken(final String accessToken) {
    final String timestamp = "" + mWiz.getTimestamp();
    final String deviceId = mWiz.getDeviceId();
    final String registrationId = mWiz.getRegistrationId();
    final String installId = mWiz.getInstallationId();
    // Make call to Rogerthat webfarm
    final ProgressDialog progressDialog = new ProgressDialog(RegistrationActivity2.this);
    progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progressDialog/*from  w w w  .  j  a v  a  2 s  .co  m*/
            .setMessage(getString(R.string.registration_activating_account, getString(R.string.app_name)));
    progressDialog.setCancelable(false);
    progressDialog.show();
    final SafeRunnable showErrorDialog = new SafeRunnable() {
        @Override
        protected void safeRun() throws Exception {
            T.UI();
            progressDialog.dismiss();
            AlertDialog.Builder builder = new AlertDialog.Builder(RegistrationActivity2.this);
            builder.setMessage(R.string.registration_facebook_error);
            builder.setPositiveButton(R.string.rogerthat, null);
            AlertDialog dialog = builder.create();
            dialog.show();
        }
    };

    mWorkerHandler.post(new SafeRunnable() {
        @Override
        protected void safeRun() throws Exception {
            T.REGISTRATION();
            String version = "1";
            String signature = Security.sha256(version + " " + installId + " " + timestamp + " " + deviceId
                    + " " + registrationId + " " + accessToken + CloudConstants.REGISTRATION_MAIN_SIGNATURE);

            HttpPost httppost = new HttpPost(CloudConstants.REGISTRATION_FACEBOOK_URL);
            try {
                List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(8);
                nameValuePairs.add(new BasicNameValuePair("version", version));
                nameValuePairs.add(new BasicNameValuePair("registration_time", timestamp));
                nameValuePairs.add(new BasicNameValuePair("device_id", deviceId));
                nameValuePairs.add(new BasicNameValuePair("registration_id", registrationId));
                nameValuePairs.add(new BasicNameValuePair("signature", signature));
                nameValuePairs.add(new BasicNameValuePair("install_id", installId));
                nameValuePairs.add(new BasicNameValuePair("access_token", accessToken));
                nameValuePairs.add(new BasicNameValuePair("language", Locale.getDefault().getLanguage()));
                nameValuePairs.add(new BasicNameValuePair("country", Locale.getDefault().getCountry()));
                nameValuePairs.add(new BasicNameValuePair("app_id", CloudConstants.APP_ID));
                nameValuePairs.add(
                        new BasicNameValuePair("use_xmpp_kick", CloudConstants.USE_XMPP_KICK_CHANNEL + ""));
                nameValuePairs.add(new BasicNameValuePair("GCM_registration_id", mGCMRegistrationId));

                httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

                // Execute HTTP Post Request
                HttpResponse response = mHttpClient.execute(httppost);

                int statusCode = response.getStatusLine().getStatusCode();
                HttpEntity entity = response.getEntity();

                if (entity == null) {
                    mUIHandler.post(showErrorDialog);
                    return;
                }

                @SuppressWarnings("unchecked")
                final Map<String, Object> responseMap = (Map<String, Object>) JSONValue
                        .parse(new InputStreamReader(entity.getContent()));

                if (statusCode != 200 || responseMap == null) {
                    if (statusCode == 500 && responseMap != null) {
                        final String errorMessage = (String) responseMap.get("error");
                        if (errorMessage != null) {
                            mUIHandler.post(new SafeRunnable() {
                                @Override
                                protected void safeRun() throws Exception {
                                    T.UI();
                                    progressDialog.dismiss();
                                    AlertDialog.Builder builder = new AlertDialog.Builder(
                                            RegistrationActivity2.this);
                                    builder.setMessage(errorMessage);
                                    builder.setPositiveButton(R.string.rogerthat, null);
                                    AlertDialog dialog = builder.create();
                                    dialog.show();
                                }
                            });
                            return;
                        }
                    }
                    mUIHandler.post(showErrorDialog);
                    return;
                }
                JSONObject account = (JSONObject) responseMap.get("account");
                final String email = (String) responseMap.get("email");
                mAgeAndGenderSet = (Boolean) responseMap.get("age_and_gender_set");
                final RegistrationInfo info = new RegistrationInfo(email,
                        new Credentials((String) account.get("account"), (String) account.get("password")));
                mUIHandler.post(new SafeRunnable() {
                    @Override
                    protected void safeRun() throws Exception {
                        T.UI();
                        mWiz.setEmail(email);
                        mWiz.save();
                        hideNotification();
                        tryConnect(progressDialog, 1, getString(R.string.registration_establish_connection,
                                email, getString(R.string.app_name)) + " ", info);
                    }
                });

            } catch (Exception e) {
                L.d(e);
                mUIHandler.post(showErrorDialog);
            }
        }
    });
}