private void showLogoutTipDialog() { View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View view) { switch (view.getId()) { case R.id.dialog_base_with_button_cancel_btn: mDialog.dismiss(); break; case R.id.dialog_base_with_button_commit_btn: mDialog.dismiss(); PrefUtils.setBoolean(ProfileActivity.this, "login_flag", false); PrefUtils.setString(ProfileActivity.this, "loginUser", null); JMessageClient.logout(); activityManager.popAllActivity(); Intent intent6 = new Intent(ProfileActivity.this, ToLoginOrSingupActivity.class); startActivity(intent6); break; } } }; mDialog = DialogUtils.createCommonDialog(this, listener, "您确定退出当前账户吗?", "否", "是"); mDialog.show(); }
// 获取token private void getToken(final String imagePath) { loadingDialog = DialogUtils.creatLoadingDialog(this, "请稍后..."); loadingDialog.show(); RequestParams params = new RequestParams(GlobalContants.GET_TOKEN_URL); x.http() .post( params, new Callback.CommonCallback<String>() { @Override public void onSuccess(String result) { LogUtils.d("result_token", result); try { JSONObject object = new JSONObject(result); String token = object.getString("token"); if (!TextUtils.isEmpty(token)) { upLoadFile(token, imagePath); } } catch (JSONException e) { e.printStackTrace(); } } @Override public void onError(Throwable ex, boolean isOnCallback) { LogUtils.e("token_error", "获取token失败"); } @Override public void onCancelled(CancelledException cex) {} @Override public void onFinished() {} }); }
// 重发对话框 private void showResendDialog( final ViewHolder holder, final Animation sendingAnim, final Message msg) { View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View view) { switch (view.getId()) { case R.id.dialog_base_with_button_cancel_btn: mDialog.dismiss(); break; case R.id.dialog_base_with_button_commit_btn: mDialog.dismiss(); resendText(holder, sendingAnim, msg); break; } } }; mDialog = DialogUtils.createCommonDialog(context, listener, "是否重新发送?", "否", "是"); mDialog.show(); }