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.ame.armymax.SettingsActivity.java

private ProgressDialog getProgressDialog() {

    ProgressDialog progress = null;//from   w w w  .j a va  2 s  .  co  m

    if (progress == null) {
        ProgressDialog dialog = new ProgressDialog(this);
        dialog.setIndeterminate(true);
        dialog.setCancelable(true);
        dialog.setInverseBackgroundForced(false);
        dialog.setCanceledOnTouchOutside(true);
        progress = dialog;
    }
    return progress;
}

From source file:com.grass.caishi.cc.frag.FriendsListFragment.java

/**
 * ?/*from w  w w  . ja  va2 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(false).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.sxt.superqq.fragment.ContactlistFragment.java

/**
 * ?//from w  w w .  jav a  2s  . c  o m
 * 
 * @param toDeleteUser
 */
public void deleteContact(final UserBean tobeDeleteUser) {
    String st1 = getResources().getString(R.string.deleting);
    final String st2 = getResources().getString(R.string.Delete_failed);
    final ProgressDialog pd = new ProgressDialog(getActivity());
    pd.setMessage(st1);
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    new Thread(new Runnable() {
        public void run() {
            try {
                EMContactManager.getInstance().deleteContact(tobeDeleteUser.getUserName());
                // db?
                EMUserDao dao = new EMUserDao(getActivity());
                dao.deleteContact(tobeDeleteUser.getUserName());
                SuperQQApplication.getInstance().getContact_List().remove(tobeDeleteUser.getUserName());
                getActivity().runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        mAdapter.remove(tobeDeleteUser);

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

            }

        }
    }).start();

}

From source file:org.mythdroid.activities.MDActivity.java

@Override
public Dialog onCreateDialog(int id) {

    switch (id) {

    case FRONTEND_CHOOSER:
        final Dialog d = createFrontendDialog();
        d.setOnDismissListener(dismissListener);
        d.setOnCancelListener(cancelListener);
        return d;

    case DIALOG_LOAD:
        final ProgressDialog prog = new ProgressDialog(this);
        prog.setIndeterminate(true);//from w  ww.  j  av  a  2s  . c  o  m
        prog.setMessage(getResources().getText(R.string.loading));
        prog.setCanceledOnTouchOutside(false);
        prog.setOnCancelListener(new OnCancelListener() {
            @Override
            public void onCancel(DialogInterface arg0) {
                finish();
            }
        });
        return prog;

    }

    return null;

}

From source file:com.grass.caishi.cc.frag.FriendsListFragment.java

/**
 * user???/*from   w  ww  .  j  av a2  s  .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(), "????", 0).show();
                    }
                });
            } catch (EaseMobException e) {
                e.printStackTrace();
                getActivity().runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        Toast.makeText(getActivity(), "???", 0).show();
                    }
                });
            }
        }
    }).start();

}

From source file:com.sxt.superqq.fragment.SettingsFragment.java

void logout() {
    final ProgressDialog pd = new ProgressDialog(getActivity());
    String st = getResources().getString(R.string.Are_logged_out);
    pd.setMessage(st);// ww  w  .j a  v a 2 s .c  o  m
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    SuperQQApplication.getInstance().logout(new EMCallBack() {

        @Override
        public void onSuccess() {
            getActivity().runOnUiThread(new Runnable() {
                public void run() {
                    //????
                    ArrayList<UserBean> contactList = SuperQQApplication.getInstance().getContactList();
                    contactList.clear();
                    HashMap<Integer, ContactBean> contacts = SuperQQApplication.getInstance().getContacts();
                    contacts.clear();
                    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.sxit.dreamiya.fragment.SettingsFragment.java

void logout() {
    final ProgressDialog pd = new ProgressDialog(getActivity());
    String st = getResources().getString(R.string.Are_logged_out);
    pd.setMessage(st);/*from ww w.  j a va  2  s .c o  m*/
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    DemoApplication.getInstance().logout(new EMCallBack() {

        @Override
        public void onSuccess() {
            getActivity().runOnUiThread(new Runnable() {
                public void run() {
                    // ??
                    DBHelper dbh = new DBHelper(getActivity());
                    int db_res_int = dbh.clearAllUserInfo();

                    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.grass.caishi.cc.activity.main.FriendsListFragment.java

/**
 * ?/*from  w w  w .  j av a 2  s .  com*/
 * 
 * @param
 */
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(false).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.grass.caishi.cc.activity.main.FriendsListFragment.java

/**
 * user???/*from   w  w  w  .  jav  a 2s  . 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);
                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.dong.huang.imdemo.ui.SettingsFragment.java

void logout() {
    final ProgressDialog pd = new ProgressDialog(getActivity());
    String st = getResources().getString(R.string.Are_logged_out);
    pd.setMessage(st);//from www . j a  v 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(), 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();

                }
            });
        }
    });
}