Example usage for android.view MenuItem getTitleCondensed

List of usage examples for android.view MenuItem getTitleCondensed

Introduction

In this page you can find the example usage for android.view MenuItem getTitleCondensed.

Prototype

public CharSequence getTitleCondensed();

Source Link

Document

Retrieve the current condensed title of the item.

Usage

From source file:com.actionbarsherlock.internal.ActionBarSherlockNative.java

@Override
public boolean dispatchOptionsItemSelected(android.view.MenuItem item) {
    if (DEBUG)/*w ww .jav  a 2  s  .c  om*/
        Log.d(TAG, "[dispatchOptionsItemSelected] item: " + item.getTitleCondensed());

    final boolean result = callbackOptionsItemSelected(mMenu.findItem(item));
    if (DEBUG)
        Log.d(TAG, "[dispatchOptionsItemSelected] returning " + result);
    return result;
}

From source file:android.app.Activity.java

/**
 * Default implementation of//from  w  ww .  ja v a 2  s . co  m
 * {@link android.view.Window.Callback#onMenuItemSelected}
 * for activities.  This calls through to the new
 * {@link #onOptionsItemSelected} method for the
 * {@link android.view.Window#FEATURE_OPTIONS_PANEL}
 * panel, so that subclasses of
 * Activity don't need to deal with feature codes.
 */
public boolean onMenuItemSelected(int featureId, MenuItem item) {
    CharSequence titleCondensed = item.getTitleCondensed();

    switch (featureId) {
    case Window.FEATURE_OPTIONS_PANEL:
        // Put event logging here so it gets called even if subclass
        // doesn't call through to superclass's implmeentation of each
        // of these methods below
        if (titleCondensed != null) {
            EventLog.writeEvent(50000, 0, titleCondensed.toString());
        }
        if (onOptionsItemSelected(item)) {
            return true;
        }
        if (mFragments.dispatchOptionsItemSelected(item)) {
            return true;
        }
        if (item.getItemId() == android.R.id.home && mActionBar != null
                && (mActionBar.getDisplayOptions() & ActionBar.DISPLAY_HOME_AS_UP) != 0) {
            if (mParent == null) {
                return onNavigateUp();
            } else {
                return mParent.onNavigateUpFromChild(this);
            }
        }
        return false;

    case Window.FEATURE_CONTEXT_MENU:
        if (titleCondensed != null) {
            EventLog.writeEvent(50000, 1, titleCondensed.toString());
        }
        if (onContextItemSelected(item)) {
            return true;
        }
        return mFragments.dispatchContextItemSelected(item);

    default:
        return false;
    }
}