@Override
        public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
          if (item.getItemId() == R.id.action_delete) {
            mAdapter.delete();
            mActionMode.finish();

            Snackbar.make(
                    mRecyclerView,
                    getString(R.string.message_deleted, mAdapter.totalItemChecked()),
                    Snackbar.LENGTH_LONG)
                .setAction(
                    R.string.message_undo,
                    new View.OnClickListener() {
                      @Override
                      public void onClick(View v) {
                        mAdapter.undoDelete();
                      }
                    })
                .setActionTextColor(ContextCompat.getColor(MainActivity.this, R.color.colorPrimary))
                .show();
          }

          return false;
        }
 private void updateTitleBar() {
   int total = mAdapter.totalItemChecked();
   String selected = getResources().getQuantityString(R.plurals.total_selected, total, total);
   mActionMode.setTitle(selected);
 }