@Override public void onClick(final View view) { switch (view.getId()) { case R.id.btn_right: mDialog.dismiss(); break; case R.id.btn_left: mPreferences.delete(PreferenceConstants.AUTORIZATION_TOKEN); Constants.setAuthTOken(""); Constants.setCustServiceObj(null); Constants.setMyCheckServerData(null); Constants.setCCServiceObj(null); Moneymart.getInstance().myChecksList = new ArrayList<ChecksObject>(); Moneymart.getInstance().myCheckUploadQueue = new LinkedHashMap<String, MyChecksDataObject>(); Moneymart.getInstance().failedChecksList = new TreeMap<String, ChecksObject>(); Intent intent = new Intent(this, LoginActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); finish(); break; default: break; } }
@OnClick(R.id.tv_logout) public void logout() { // mPreferences.clearAllPrefs(); if (Moneymart.getInstance().myCheckUploadQueue.size() > 0) { showAlertDialog( "", getResources().getString(R.string.error_logout_upload_in_progress), this, 0, getResources().getString(R.string.lbl_menu_logout), getResources().getString(R.string.btn_cancel), null); } else if (Moneymart.getInstance().failedChecksList.size() > 0) { showAlertDialog( "", getResources().getString(R.string.error_logout_failed_check_exists), this, 0, getResources().getString(R.string.lbl_menu_logout), getResources().getString(R.string.btn_cancel), null); } else { showAlertDialog( "", getResources().getString(R.string.lbl_logout_confirm_msg), this, 0, getResources().getString(R.string.lbl_menu_logout), getResources().getString(R.string.btn_cancel), null); } }