Java Code Examples for android.view.MenuItem.setTitleCondensed()

The following are Jave code examples for showing how to use setTitleCondensed() of the android.view.MenuItem class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: chromium-for-android-56-debug-video   File: AppMenuPropertiesDelegate.java   View Source Code Vote up 5 votes
/**
 * Updates the bookmark item's visibility.
 *
 * @param bookmarkMenuItem {@link MenuItem} for adding/editing the bookmark.
 * @param currentTab        Current tab being displayed.
 */
protected void updateBookmarkMenuItem(MenuItem bookmarkMenuItem, Tab currentTab) {
    bookmarkMenuItem.setEnabled(mBookmarkBridge.isEditBookmarksEnabled());
    if (currentTab.getBookmarkId() != Tab.INVALID_BOOKMARK_ID) {
        bookmarkMenuItem.setIcon(R.drawable.btn_star_filled);
        bookmarkMenuItem.setChecked(true);
        bookmarkMenuItem.setTitleCondensed(mActivity.getString(R.string.edit_bookmark));
    } else {
        bookmarkMenuItem.setIcon(R.drawable.btn_star);
        bookmarkMenuItem.setChecked(false);
        bookmarkMenuItem.setTitleCondensed(null);
    }
}
 
Example 2
Project: buildAPKsApps   File: Seismo.java   View Source Code Vote up 4 votes
@Override
public boolean onOptionsItemSelected(MenuItem item) {
  super.onOptionsItemSelected(item);

  switch (item.getItemId()) {
  case R.id.Filter:
    if (item.getTitleCondensed().equals("Filter")) {
      seismo_view_.filter();
      item.setTitle("Unfilter noise");
      item.setTitleCondensed("Unfilter");
    } else {
      seismo_view_.unfilter();
      item.setTitle("Filter noise");
      item.setTitleCondensed("Filter");
    }
    return true;
  case R.id.Pause:
    if (item.getTitleCondensed().equals("Pause")) {
      seismo_view_.pause();
      item.setTitle("Resume measurement");
      item.setTitleCondensed("Resume");
    } else {
      seismo_view_.resume();
      item.setTitle("Pause measurement");
      item.setTitleCondensed("Pause");
    }
    return true;
  case R.id.x:
    seismo_view_.x();
    return true;
  case R.id.y:
    seismo_view_.y();
    return true;
  case R.id.z:
    seismo_view_.z();
    return true;
  case R.id.Save:
    seismo_view_.save();
    return true;
  case R.id.Export:
    startActivity(new Intent(this, Export.class));
    return true;
  case R.id.Help:
    startActivity(new Intent(this, Help.class));
    return true;
  }

  return false;
}