Skip to content

Instantly share code, notes, and snippets.

@YoungjaeKim
Created May 12, 2013 15:27
Show Gist options
  • Save YoungjaeKim/5563918 to your computer and use it in GitHub Desktop.
Save YoungjaeKim/5563918 to your computer and use it in GitHub Desktop.
ActionMode on ActionBarSherlock. A kind of context menu.
private final class ActionModeForReply implements ActionMode.Callback {
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
//Used to put dark icons on light action bar
menu.add(R.string.send_now)
.setIcon(R.drawable.ic_menu_send_now)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_WITH_TEXT | MenuItem.SHOW_AS_ACTION_ALWAYS);
return true;
}
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
return false;
}
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
//Toast.makeText(ActionModes.this, "Got click: " + item, Toast.LENGTH_SHORT).show();
mode.finish();
return true;
}
// 글작성 취소시.
@Override
public void onDestroyActionMode(ActionMode mode) {
new AlertDialog.Builder(QuestionViewActivity.this)
.setMessage(getString(R.string.dialogConfirmFinishApp))
.setCancelable(false)
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// 확인버튼 클릭 시 처리.
_linearLayoutBottomMenuBar.setVisibility(View.VISIBLE);
_linearLayoutAnswerPanel.setVisibility(View.GONE);
_isReplyMode = false;
}
})
.setNegativeButton(R.string.cancel, null)
.show();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment