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.nxt.yn.app.ui.SettingsFragment.java

void logout() {
    final ProgressDialog pd = new ProgressDialog(getActivity());
    String st = getResources().getString(R.string.Are_logged_out);
    pd.setMessage(st);//  w  w w.  j av a2s  . co m
    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(), null));

                }
            });
        }

        @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.imalu.alyou.activity.FriendlistFragment.java

/**
 * ?/*from   w  w  w.j av  a 2  s . c om*/
 * 
 * @param toDeleteUser
 */
public void deleteContact(final HXUser 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());
    //               AlUApplication.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.easemob.chatui.activity.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 ava2 s . c  o  m
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    BeewayApplication.getInstance().logout(new EMCallBack() {

        @Override
        public void onSuccess() {
            getActivity().runOnUiThread(new Runnable() {
                public void run() {
                    pd.dismiss();
                    // ??
                    (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.easemob.chatuidemo.activity.SettingsFragment.java

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

        @Override
        public void onSuccess() {
            getActivity().runOnUiThread(new Runnable() {
                @Override
                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.imalu.alyou.activity.ContactlistFragment.java

/**
 * ?//from   w  w w. ja va2 s  .  c  o  m
 * 
 * @param toDeleteUser
 */
public void deleteContact(final HXUser 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());
    //               AlUApplication.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.youti.chat.activity.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 va 2 s.c o m
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    YoutiApplication.getInstance().logout(new EMCallBack() {

        @Override
        public void onSuccess() {
            getActivity().runOnUiThread(new Runnable() {
                public void run() {
                    pd.dismiss();
                    // ??
                    ((MyMessageActivity) 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.imalu.alyou.activity.FriendlistFragment.java

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

}

From source file:org.protocoder.appApi.ProtoScripts.java

public void shareProtoFileDialog(String folder, String name) {
    final ProgressDialog progress = new ProgressDialog(mProtocoder.a);
    progress.setTitle("Exporting .proto");
    progress.setMessage("Your project will be ready soon!");
    progress.setCancelable(true);/*from w ww.j av  a  2  s  .  c  om*/
    progress.setCanceledOnTouchOutside(false);
    progress.show();

    String zipFilePath = exportProto(folder, name);

    Intent shareIntent = new Intent();
    shareIntent.setAction(Intent.ACTION_SEND);
    shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(zipFilePath)));
    shareIntent.setType("application/zip");

    progress.dismiss();

    mProtocoder.a.startActivity(
            Intent.createChooser(shareIntent, mProtocoder.a.getResources().getText(R.string.share_proto_file)));
}

From source file:com.esri.arcgisruntime.sample.editandsyncfeatures.MainActivity.java

/**
 * Create a progress dialog to show sync state
 *///w w w  .ja  va 2s . c o  m
private void createProgressDialog(Job job) {

    ProgressDialog syncProgressDialog = new ProgressDialog(this);
    syncProgressDialog.setTitle("Sync Geodatabase Job");
    syncProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    syncProgressDialog.setCanceledOnTouchOutside(false);
    syncProgressDialog.show();

    job.addProgressChangedListener(() -> syncProgressDialog.setProgress(job.getProgress()));

    job.addJobDoneListener(syncProgressDialog::dismiss);
}

From source file:com.shengtao.chat.chatUI.activity.ContactlistFragment.java

/**
 * ?/*from w w  w.  ja  v  a  2 s . c o m*/
 *
 * @param toDeleteUser
 */
public void deleteContact(final User 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?
                UserDao dao = new UserDao(getActivity());
                dao.deleteContact(tobeDeleteUser.getUsername());
                UIApplication.getContext().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(), st2 + e.getMessage(), Toast.LENGTH_SHORT).show();
                    }
                });

            }

        }
    }).start();

}