Skip to content

Instantly share code, notes, and snippets.

@jezinka
Created May 7, 2017 07:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jezinka/b0422eeba6047b762a595471bd6dc323 to your computer and use it in GitHub Desktop.
Save jezinka/b0422eeba6047b762a595471bd6dc323 to your computer and use it in GitHub Desktop.
private void toggleCheckboxesAndToolbar() {
int colorId = adapter.showCheckboxes ? R.color.colorPrimary : android.R.color.darker_gray;
myToolbar.setBackgroundColor(ContextCompat.getColor(this, colorId));
MenuItem deleteMenuButton = myToolbar.getMenu().findItem(R.id.delete_menu_button);
deleteMenuButton.setVisible(!deleteMenuButton.isVisible());
adapter.showCheckboxes = !adapter.showCheckboxes;
adapter.notifyDataSetChanged();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment