Example usage for android.app ProgressDialog setCanceledOnTouchOutside

List of usage examples for android.app ProgressDialog setCanceledOnTouchOutside

Introduction

In this page you can find the example usage for android.app ProgressDialog setCanceledOnTouchOutside.

Prototype

public void setCanceledOnTouchOutside(boolean cancel) 

Source Link

Document

Sets whether this dialog is canceled when touched outside the window's bounds.

Usage

From source file:com.easemob.chatuidemo.activity.NewGroupActivity.java

public void setGroup(final String groupName, final String groupIntroduce, final String open,
        final String number, final String allow_invite) {
    final ProgressDialog pd = new ProgressDialog(this);
    pd.setMessage("");
    pd.setCanceledOnTouchOutside(false);
    pd.show();/*from   w w w .j a va2  s. c om*/
    Log.i("FriMsg", groupName + groupIntroduce + open + number + allow_invite);
    RequestQueue requestQueue = Volley.newRequestQueue(this);

    requestQueue.start();

    requestQueue.add(new AutoLoginRequest(this, Request.Method.POST, Model.PathLoad,
            new Response.Listener<JSONObject>() {
                @Override
                public void onResponse(JSONObject response) {
                    Log.i("FriMsg", response.toString());
                    try {
                        if (response.getString("status").equals("0")) {
                            Toast.makeText(NewGroupActivity.this, "?", 0).show();
                            NewGroupActivity.this.finish();
                        }

                    } catch (Exception e) {
                        Log.e("Activity_boshu_FriMsg", "?");
                    }
                    pd.dismiss();

                }
            }, new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError error) {
                    Log.i("FriMsg", error.getMessage());
                    pd.dismiss();

                }
            }) {
        @Override
        protected void setParams(Map<String, String> params) {
            params.put("sys", "msg");
            params.put("ctrl", "msger");
            params.put("action", "crt_group");
            params.put("group_name", groupName);
            params.put("introduce", groupIntroduce);
            params.put("maxusers", "5000");
            params.put("public", open);
            params.put("approval", "1");
            params.put("members", number);
            params.put("allow_invite", allow_invite);

        }
    });
}

From source file:im.afterclass.android.fragment.ContactlistFragment.java

/**
 * ?//from   w w  w  .ja v a 2 s. co m
 * @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());
                DemoApplication.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(), Toast.LENGTH_SHORT)
                                .show();
                    }
                });

            }

        }
    }).start();

}

From source file:com.softminds.matrixcalculator.OperationFragments.AdjointFragment.java

@Override
public void onListItemClick(ListView L, View V, int position, long id) {
    ProgressDialog progressDialog = new ProgressDialog(getContext());
    progressDialog.setMessage(getString(R.string.Calculating));
    progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    progressDialog.setIndeterminate(false);
    progressDialog.setCanceledOnTouchOutside(false);
    progressDialog.show();//from  w w  w.  java2s .c om
    RunToGetDeterminant(position, progressDialog);
}

From source file:com.ysls.imhere.fragment.ContactlistFragment.java

/**
 * ?/* w w  w . ja  v a 2 s. c  o m*/
 * 
 * @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.runye.express.chat.activity.ContactlistFragment.java

/**
 * ?//from  ww w . j  a  v a 2s.c o  m
 * 
 * @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() {
        @Override
        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() {
                    @Override
                    public void run() {
                        pd.dismiss();
                        adapter.remove(tobeDeleteUser);
                        adapter.notifyDataSetChanged();

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

            }

        }
    }).start();

}

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

void logout() {
    final ProgressDialog pd = new ProgressDialog(getActivity());
    pd.setMessage("..");
    pd.setCanceledOnTouchOutside(false);
    pd.show();// www.ja  va  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.aidigame.hisun.imengstar.huanxin.SettingsActivity.java

void logout() {
    final ProgressDialog pd = new ProgressDialog(this);
    pd.setMessage("..");
    pd.setCanceledOnTouchOutside(false);
    pd.show();/*from   www. j  a v a2  s.c  om*/
}

From source file:at.bitfire.davdroid.ui.setup.DetectConfigurationFragment.java

@NonNull
@Override//from   w  ww  . j a v a 2  s  .  c o m
public Dialog onCreateDialog(Bundle savedInstanceState) {
    ProgressDialog progress = new ProgressDialog(getActivity());
    progress.setTitle(R.string.login_configuration_detection);
    progress.setMessage(getString(R.string.login_querying_server));
    progress.setIndeterminate(true);
    progress.setCanceledOnTouchOutside(false);
    setCancelable(false);
    return progress;
}

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

/**
 * ?/*from w  w  w  .j  a  v  a2  s  .  c o  m*/
 * @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.xuejian.client.lxp.module.toolbox.im.ContactlistFragment.java

/**
 * user???//from w  w w  .  j  av  a2 s .  c o 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);
                if (isAdded())
                    getActivity().runOnUiThread(new Runnable() {
                        public void run() {
                            pd.dismiss();
                            //                     Toast.makeText(getActivity(), "????", Toast.LENGTH_SHORT).show();
                            ToastUtil.getInstance(getActivity()).showToast("?");
                        }
                    });
            } catch (EaseMobException e) {
                e.printStackTrace();
                if (isAdded())
                    getActivity().runOnUiThread(new Runnable() {
                        public void run() {
                            pd.dismiss();
                            //                     Toast.makeText(getActivity(), "???", Toast.LENGTH_SHORT).show();
                            ToastUtil.getInstance(getActivity()).showToast("~??");
                        }
                    });
            }
        }
    }).start();

}