@Override public void onClick(View v) { if (isUpdate) { isUpdate = false; final MyRemDialog dialog = new MyRemDialog(HomePageActivity.this, R.style.dialog); dialog.setTitle(R.string.user_basic_dialog_save_rem_title); dialog.setMessage(R.string.user_basic_dialog_to_save_message); dialog.setPosBtnText(R.string.user_basic_dialog_save_rem_btn_save); dialog.setNegBtnText(R.string.user_basic_dialog_save_rem_btn_cancel); dialog.setPosBtnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { isUpdate = false; btnRight.setImageResource(R.drawable.edit_btn_selector); afterToUpdateUserInfo(); } }); dialog.setNegBtnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); } else { finish(); } }
private void chanceMyFvaDialog(final ProductRec rec, final int pos) { final MyRemDialog chanceMyFvaDialog = new MyRemDialog(TagReviewListActivity.this, R.style.dialog); chanceMyFvaDialog.setHeaderVisility(View.GONE); chanceMyFvaDialog.setMessage(R.string.chance_rem); chanceMyFvaDialog.setPosBtnText(R.string.chance_btn_pos); chanceMyFvaDialog.setNegBtnText(R.string.chance_btn_neg); chanceMyFvaDialog.show(); chanceMyFvaDialog.setPosBtnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { readyToChanceFav(rec.getId(), pos); chanceMyFvaDialog.dismiss(); } }); chanceMyFvaDialog.setCancelClickListener( new OnClickListener() { @Override public void onClick(View v) { chanceMyFvaDialog.dismiss(); } }); }
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { // TODO Auto-generated method stub if (keyCode == KeyEvent.KEYCODE_BACK && isUpdate) { final MyRemDialog dialog = new MyRemDialog(HomePageActivity.this, R.style.dialog); dialog.setTitle(R.string.user_basic_dialog_save_rem_title); dialog.setMessage(R.string.user_basic_dialog_to_save_message); dialog.setPosBtnText(R.string.user_basic_dialog_save_rem_btn_save); dialog.setNegBtnText(R.string.user_basic_dialog_save_rem_btn_cancel); dialog.setPosBtnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { isUpdate = false; btnRight.setImageResource(R.drawable.edit_btn_selector); afterToUpdateUserInfo(); } }); dialog.setNegBtnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); } // else { // HomePageActivity.this.finish(); // } return super.onKeyDown(keyCode, event); }