@Override
  public boolean onOptionsItemSelected(final MenuItem item) {
    final int id = item.getItemId();
    if (id == R.id.menu_repeat_last) {
      replaceLog(getLastLog());
      return true;
    }

    final LogTemplate template = LogTemplateProvider.getTemplate(id);
    if (template != null) {
      insertIntoLog(template.getValue(getLogContext()), true);
      return true;
    }

    final Smiley smiley = GCSmiliesProvider.getSmiley(id);
    if (smiley != null) {
      insertIntoLog("[" + smiley.text + "]", true);
      return true;
    }

    return super.onOptionsItemSelected(item);
  }
 private void replaceLog(final String newText) {
   final EditText log = ButterKnife.findById(this, R.id.log);
   log.setText(StringUtils.EMPTY);
   insertIntoLog(newText, true);
 }