List of usage examples for android.app ProgressDialog setCanceledOnTouchOutside
public void setCanceledOnTouchOutside(boolean cancel)
From source file:cn.xcom.helper.chat.ui.SettingsFragment.java
void logout() { final ProgressDialog pd = new ProgressDialog(getActivity()); String st = getResources().getString(R.string.Are_logged_out); pd.setMessage(st);/*www. j a va2 s .c o 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(); // show login screen ((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.gikoo5.hyphenate.ui.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. j a v a2 s . co m*/ pd.setCanceledOnTouchOutside(false); pd.show(); EMHelper.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(); } }); } }); }
From source file:com.imalu.alyou.activity.LoginActivity.java
/** * // w w w . java2s. c o m * * @param view */ public void login(View view) { if (!CommonUtils.isNetWorkConnected(this)) { Toast.makeText(this, R.string.network_isnot_available, Toast.LENGTH_SHORT).show(); return; } final String username = usernameEditText.getText().toString(); final String password = passwordEditText.getText().toString(); //AlUApplication.currentUserNick = usernameEditText.getText().toString(); if (!TextUtils.isEmpty(username) && !TextUtils.isEmpty(password)) { progressShow = true; final ProgressDialog pd = new ProgressDialog(LoginActivity.this); pd.setCanceledOnTouchOutside(false); pd.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { progressShow = false; } }); pd.setMessage("..."); pd.show(); LoginRequest loginReq = new LoginRequest(); loginReq.setUsername(username); loginReq.setPassword(password); NetManager.execute(NetManager.LOGIN_REQUEST_OPERATION, loginReq, new JsonHttpResponseHandler() { @Override public void onSuccess(int statusCode, Header[] headers, JSONObject response) { try { pd.dismiss(); Log.e("login_check", " response:" + response.toString()); UserInfo userInfo = new UserInfo(); userInfo.setJsonObject(response); AlUApplication.getMyInfo().setPhoneNum(username); AlUApplication.getMyInfo().setPassword(password); AlUApplication.getMyInfo().setHxname(userInfo.getHXName()); AlUApplication.getMyInfo().setId(userInfo.getID()); AlUApplication.getMyInfo().setUsername(userInfo.getUserName()); AlUApplication.getMyInfo().setKey(userInfo.getKey()); AlUApplication.getMyInfo().setJifen(userInfo.getJifen()); AlUApplication.getMyInfo().setAge(userInfo.getAge()); AlUApplication.getMyInfo().setLocus(userInfo.getLocus()); AlUApplication.getMyInfo().setRealname(userInfo.getRealName()); AlUApplication.getMyInfo().setSex(userInfo.getSex()); AlUApplication.getMyInfo().setSocietykey(userInfo.getSocietyKey()); AlUApplication.getMyInfo().setJiarugonghuikey(userInfo.getJiaruGonghuiKey()); AlUApplication.getMyInfo().setSocietyName(userInfo.getSocietyName()); PersonalInfoResponse personal = new PersonalInfoResponse(); personal.setJsonObject(response); AlUApplication.getUserfans().setId(personal.getId()); AlUApplication.getUserfans().setJifen(personal.getJifen()); AlUApplication.getUserfans().setUserName(personal.getUserName()); AlUApplication.getUserfans().setSocietyName(personal.getSocietyName()); // ????? AlUApplication.getInstance().setUserName(username); AlUApplication.getInstance().setPassword(password); User user = new User(); user.setId((long) userInfo.getID()); user.setUsername(username); user.setPassword(password); user.setChatuser(userInfo.getHXName()); saveUserToDB(user); /* runOnUiThread(new Runnable() { public void run() { pd.setMessage("..."); } }); */ EMChatManager.getInstance().login(userInfo.getHXName(), userInfo.getHXPwd(), new EMCallBack() { @Override public void onSuccess() { EMChatManager.getInstance().loadAllConversations(); } @Override public void onProgress(int progress, String status) { // TODO Auto-generated method stub } @Override public void onError(int code, String message) { // TODO Auto-generated method stub } }); // ** ?logout?? // ** manually load all local groups and // conversations in case we are auto login //EMGroupManager.getInstance().loadAllGroups(); // demo??????username?? /*List<String> usernames = EMContactManager.getInstance().getContactUserNames(); EMLog.d("roster", "contacts size: " + usernames.size()); for (String username : usernames) { User user = new User(); user.setUsername(username); setUserHearder(username, user); userlist.put(username, user); }*/ /*Map<String, User> userlist = new HashMap<String, User>(); // user"" User newFriends = new User(); newFriends.setUsername(Constant.NEW_FRIENDS_USERNAME); newFriends.setNick(""); newFriends.setHeader(""); userlist.put(Constant.NEW_FRIENDS_USERNAME, newFriends); // "?" User groupUser = new User(); groupUser.setUsername(Constant.GROUP_USERNAME); groupUser.setNick("?"); groupUser.setHeader(""); userlist.put(Constant.GROUP_USERNAME, groupUser);*/ // //AlUApplication.getInstance().setContactList(userlist); // db //UserDao dao = new UserDao(LoginActivity.this); //List<User> users = new ArrayList<User>(userlist.values()); //dao.saveContactList(users); // ??(??groupidgroupname????members),sdkdb //EMGroupManager.getInstance().getGroupsFromServer();*/ } catch (Exception e) { e.printStackTrace(); } //?nickname ios?nick //boolean updatenick = EMChatManager.getInstance().updateCurrentUserNick(AlUApplication.currentUserNick); //if (!updatenick) { // EMLog.e("LoginActivity", "update current user nick fail"); //} //if (!LoginActivity.this.isFinishing()) //pd.dismiss(); // ? startActivity(new Intent(LoginActivity.this, MainActivity.class)); finish(); } @Override public void onFailure(int statusCode, Header[] headers, final String responseString, Throwable throwable) { if (!progressShow) { return; } pd.dismiss(); runOnUiThread(new Runnable() { public void run() { //pd.dismiss(); //Toast.makeText(getApplicationContext(), ": " + responseString, 0).show(); } }); } }); } }
From source file:cn.ucai.chatuidemo.activity.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 a v a 2 s . c o m*/ pd.setCanceledOnTouchOutside(false); pd.show(); DemoHXSDKHelper.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.eason.marker.emchat.chatuidemo.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(); DemoHXSDKHelper.getInstance().logout(true, new EMCallBack() { @Override public void onSuccess() { getActivity().runOnUiThread(new Runnable() { public void run() { pd.dismiss(); // ?? ((EMChatMainActivity) getActivity()).finish(); startActivity(new Intent(getActivity(), EMChatLoginActivity.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.qixin.activity.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 va2 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() { 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.lykj.weixun.ui.chat.ui.ContactListFragment.java
/** * delete contact/*w w w. ja va 2 s . c o m*/ * * @param */ public void deleteContact(final EaseUser 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 { EMClient.getInstance().contactManager().deleteContact(tobeDeleteUser.getUsername()); // remove user from memory and database UserDao dao = new UserDao(getActivity()); dao.deleteContact(tobeDeleteUser.getUsername()); DemoHelper.getInstance().getContactList().remove(tobeDeleteUser.getUsername()); getActivity().runOnUiThread(new Runnable() { public void run() { pd.dismiss(); contactList.remove(tobeDeleteUser); contactListLayout.refresh(); } }); } catch (final Exception e) { getActivity().runOnUiThread(new Runnable() { public void run() { pd.dismiss(); Toast.makeText(getActivity(), st2 + e.getMessage(), Toast.LENGTH_LONG).show(); } }); } } }).start(); }
From source file:cn.ucai.superwechat.ui.SettingsActivity.java
void logout() { final ProgressDialog pd = new ProgressDialog(this); String st = getResources().getString(R.string.Are_logged_out); pd.setMessage(st);/*w w w . j av a2s .c o m*/ pd.setCanceledOnTouchOutside(false); pd.show(); SuperWeChatHelper.getInstance().logout(false, new EMCallBack() { @Override public void onSuccess() { runOnUiThread(new Runnable() { public void run() { pd.dismiss(); // show login screen // ExitAppUtils.getInstance().exit(); finish(); startActivity(new Intent(SettingsActivity.this, LoginActivity.class) .setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK)); } }); } @Override public void onProgress(int progress, String status) { } @Override public void onError(int code, String message) { runOnUiThread(new Runnable() { @Override public void run() { // TODO Auto-generated method stub pd.dismiss(); Toast.makeText(SettingsActivity.this, "unbind devicetokens failed", Toast.LENGTH_SHORT) .show(); } }); } }); }
From source file:com.liangxun.yuejiula.huanxin.chat.activity.GroupsActivity.java
public void addToGroup(final EMGroup group) { String st1 = getResources().getString(R.string.Is_sending_a_request); final String st2 = getResources().getString(R.string.Request_to_join); final String st3 = getResources().getString(R.string.send_the_request_is); final String st4 = getResources().getString(R.string.Join_the_group_chat); final String st5 = getResources().getString(R.string.Failed_to_join_the_group_chat); final ProgressDialog pd = new ProgressDialog(this); // getResources().getString(R.string) pd.setMessage(st1);// w ww . j a va 2 s . c om pd.setCanceledOnTouchOutside(false); pd.show(); new Thread(new Runnable() { public void run() { try { //membersOnly??join if (group.isMembersOnly()) { EMGroupManager.getInstance().applyJoinToGroup(group.getGroupId(), st2); } else { EMGroupManager.getInstance().joinGroup(group.getGroupId()); } runOnUiThread(new Runnable() { public void run() { pd.dismiss(); if (group.isMembersOnly()) Toast.makeText(GroupsActivity.this, st3, Toast.LENGTH_SHORT).show(); else Toast.makeText(GroupsActivity.this, st4, Toast.LENGTH_SHORT).show(); } }); } catch (final EaseMobException e) { e.printStackTrace(); runOnUiThread(new Runnable() { public void run() { pd.dismiss(); Toast.makeText(GroupsActivity.this, st5 + e.getMessage(), Toast.LENGTH_SHORT).show(); } }); } } }).start(); }
From source file:com.easemob.chatuidemo.adapter.NewFriendsMsgAdapter.java
/** * ???/* w w w.jav a 2 s.c o m*/ * * @param button * @param username */ public void acceptInvitation(final Button button, final InviteMessage msg) { final ProgressDialog pd = new ProgressDialog(context); String str1 = context.getResources().getString(R.string.Are_agree_with); final String str2 = context.getResources().getString(R.string.Has_agreed_to); final String str3 = context.getResources().getString(R.string.Agree_with_failure); pd.setMessage(str1); pd.setCanceledOnTouchOutside(false); pd.show(); RequestQueue requestQueue = Volley.newRequestQueue(context); requestQueue.start(); requestQueue.add(new AutoLoginRequest(context, Request.Method.POST, Model.PathLoad, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { pd.dismiss(); button.setText(str2); msg.setStatus(InviteMesageStatus.AGREED); // db ContentValues values = new ContentValues(); values.put(InviteMessgeDao.COLUMN_NAME_STATUS, msg.getStatus().ordinal()); messgeDao.updateMessage(msg.getId(), values); button.setBackgroundDrawable(null); button.setEnabled(false); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Toast.makeText(context, str3 + error.getMessage(), 1).show(); } }) { @Override protected void setParams(Map<String, String> params) { if (msg.getGroupId() == null) {//??? params.put("sys", "msg"); params.put("ctrl", "msger"); params.put("action", "add_friend"); params.put("friend_name", msg.getFrom()); } else //?? { params.put("sys", "msg"); params.put("ctrl", "msger"); params.put("action", "agree_group"); params.put("stranger", msg.getFrom()); params.put("group_sn", msg.getGroupId()); } } }); }