Java Code Examples for com.actionbarsherlock.view.MenuItem#expandActionView()

The following examples show how to use com.actionbarsherlock.view.MenuItem#expandActionView() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ActionBarView.java    From CSipSimple with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onRestoreInstanceState(Parcelable p) {
    SavedState state = (SavedState) p;

    super.onRestoreInstanceState(state.getSuperState());

    if (state.expandedMenuItemId != 0 &&
            mExpandedMenuPresenter != null && mOptionsMenu != null) {
        final MenuItem item = mOptionsMenu.findItem(state.expandedMenuItemId);
        if (item != null) {
            item.expandActionView();
        }
    }

    if (state.isOverflowOpen) {
        postShowOverflowMenu();
    }
}
 
Example 2
Source File: ActionBarView.java    From android-apps with MIT License 6 votes vote down vote up
@Override
public void onRestoreInstanceState(Parcelable p) {
    SavedState state = (SavedState) p;

    super.onRestoreInstanceState(state.getSuperState());

    if (state.expandedMenuItemId != 0 &&
            mExpandedMenuPresenter != null && mOptionsMenu != null) {
        final MenuItem item = mOptionsMenu.findItem(state.expandedMenuItemId);
        if (item != null) {
            item.expandActionView();
        }
    }

    if (state.isOverflowOpen) {
        postShowOverflowMenu();
    }
}
 
Example 3
Source File: ActionBarView.java    From zen4android with MIT License 6 votes vote down vote up
@Override
public void onRestoreInstanceState(Parcelable p) {
    SavedState state = (SavedState) p;

    super.onRestoreInstanceState(state.getSuperState());

    if (state.expandedMenuItemId != 0 &&
            mExpandedMenuPresenter != null && mOptionsMenu != null) {
        final MenuItem item = mOptionsMenu.findItem(state.expandedMenuItemId);
        if (item != null) {
            item.expandActionView();
        }
    }

    if (state.isOverflowOpen) {
        postShowOverflowMenu();
    }
}
 
Example 4
Source File: ActionBarView.java    From zhangshangwuda with Apache License 2.0 6 votes vote down vote up
@Override
public void onRestoreInstanceState(Parcelable p) {
    SavedState state = (SavedState) p;

    super.onRestoreInstanceState(state.getSuperState());

    if (state.expandedMenuItemId != 0 &&
            mExpandedMenuPresenter != null && mOptionsMenu != null) {
        final MenuItem item = mOptionsMenu.findItem(state.expandedMenuItemId);
        if (item != null) {
            item.expandActionView();
        }
    }

    if (state.isOverflowOpen) {
        postShowOverflowMenu();
    }
}
 
Example 5
Source File: ActionBarView.java    From Libraries-for-Android-Developers with MIT License 6 votes vote down vote up
@Override
public void onRestoreInstanceState(Parcelable p) {
    SavedState state = (SavedState) p;

    super.onRestoreInstanceState(state.getSuperState());

    if (state.expandedMenuItemId != 0 &&
            mExpandedMenuPresenter != null && mOptionsMenu != null) {
        final MenuItem item = mOptionsMenu.findItem(state.expandedMenuItemId);
        if (item != null) {
            item.expandActionView();
        }
    }

    if (state.isOverflowOpen) {
        postShowOverflowMenu();
    }
}
 
Example 6
Source File: MenuBuilder.java    From CSipSimple with GNU General Public License v3.0 5 votes vote down vote up
public void restoreActionViewStates(Bundle states) {
    if (states == null) {
        return;
    }

    SparseArray<Parcelable> viewStates = states.getSparseParcelableArray(
            getActionViewStatesKey());

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB && viewStates == null) {
        //Fixes Issue #652 with sdk <= 2.3.6
        return;
    }

    final int itemCount = size();
    for (int i = 0; i < itemCount; i++) {
        final MenuItem item = getItem(i);
        final View v = item.getActionView();
        if (v != null && v.getId() != View.NO_ID) {
            v.restoreHierarchyState(viewStates);
        }
        if (item.hasSubMenu()) {
            final SubMenuBuilder subMenu = (SubMenuBuilder) item.getSubMenu();
            subMenu.restoreActionViewStates(states);
        }
    }

    final int expandedId = states.getInt(EXPANDED_ACTION_VIEW_ID);
    if (expandedId > 0) {
        MenuItem itemToExpand = findItem(expandedId);
        if (itemToExpand != null) {
            itemToExpand.expandActionView();
        }
    }
}
 
Example 7
Source File: MenuBuilder.java    From android-apps with MIT License 5 votes vote down vote up
public void restoreActionViewStates(Bundle states) {
    if (states == null) {
        return;
    }

    SparseArray<Parcelable> viewStates = states.getSparseParcelableArray(
            getActionViewStatesKey());

    final int itemCount = size();
    for (int i = 0; i < itemCount; i++) {
        final MenuItem item = getItem(i);
        final View v = item.getActionView();
        if (v != null && v.getId() != View.NO_ID) {
            v.restoreHierarchyState(viewStates);
        }
        if (item.hasSubMenu()) {
            final SubMenuBuilder subMenu = (SubMenuBuilder) item.getSubMenu();
            subMenu.restoreActionViewStates(states);
        }
    }

    final int expandedId = states.getInt(EXPANDED_ACTION_VIEW_ID);
    if (expandedId > 0) {
        MenuItem itemToExpand = findItem(expandedId);
        if (itemToExpand != null) {
            itemToExpand.expandActionView();
        }
    }
}
 
Example 8
Source File: MenuBuilder.java    From zen4android with MIT License 5 votes vote down vote up
public void restoreActionViewStates(Bundle states) {
    if (states == null) {
        return;
    }

    SparseArray<Parcelable> viewStates = states.getSparseParcelableArray(
            getActionViewStatesKey());

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB && viewStates == null) {
        //Fixes Issue #652 with sdk <= 2.3.6
        return;
    }

    final int itemCount = size();
    for (int i = 0; i < itemCount; i++) {
        final MenuItem item = getItem(i);
        final View v = item.getActionView();
        if (v != null && v.getId() != View.NO_ID) {
            v.restoreHierarchyState(viewStates);
        }
        if (item.hasSubMenu()) {
            final SubMenuBuilder subMenu = (SubMenuBuilder) item.getSubMenu();
            subMenu.restoreActionViewStates(states);
        }
    }

    final int expandedId = states.getInt(EXPANDED_ACTION_VIEW_ID);
    if (expandedId > 0) {
        MenuItem itemToExpand = findItem(expandedId);
        if (itemToExpand != null) {
            itemToExpand.expandActionView();
        }
    }
}
 
Example 9
Source File: MenuBuilder.java    From zhangshangwuda with Apache License 2.0 5 votes vote down vote up
public void restoreActionViewStates(Bundle states) {
    if (states == null) {
        return;
    }

    SparseArray<Parcelable> viewStates = states.getSparseParcelableArray(
            getActionViewStatesKey());

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB && viewStates == null) {
        //Fixes Issue #652 with sdk <= 2.3.6
        return;
    }

    final int itemCount = size();
    for (int i = 0; i < itemCount; i++) {
        final MenuItem item = getItem(i);
        final View v = item.getActionView();
        if (v != null && v.getId() != View.NO_ID) {
            v.restoreHierarchyState(viewStates);
        }
        if (item.hasSubMenu()) {
            final SubMenuBuilder subMenu = (SubMenuBuilder) item.getSubMenu();
            subMenu.restoreActionViewStates(states);
        }
    }

    final int expandedId = states.getInt(EXPANDED_ACTION_VIEW_ID);
    if (expandedId > 0) {
        MenuItem itemToExpand = findItem(expandedId);
        if (itemToExpand != null) {
            itemToExpand.expandActionView();
        }
    }
}
 
Example 10
Source File: MenuBuilder.java    From Libraries-for-Android-Developers with MIT License 5 votes vote down vote up
public void restoreActionViewStates(Bundle states) {
    if (states == null) {
        return;
    }

    SparseArray<Parcelable> viewStates = states.getSparseParcelableArray(
            getActionViewStatesKey());

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB && viewStates == null) {
        //Fixes Issue #652 with sdk <= 2.3.6
        return;
    }

    final int itemCount = size();
    for (int i = 0; i < itemCount; i++) {
        final MenuItem item = getItem(i);
        final View v = item.getActionView();
        if (v != null && v.getId() != View.NO_ID) {
            v.restoreHierarchyState(viewStates);
        }
        if (item.hasSubMenu()) {
            final SubMenuBuilder subMenu = (SubMenuBuilder) item.getSubMenu();
            subMenu.restoreActionViewStates(states);
        }
    }

    final int expandedId = states.getInt(EXPANDED_ACTION_VIEW_ID);
    if (expandedId > 0) {
        MenuItem itemToExpand = findItem(expandedId);
        if (itemToExpand != null) {
            itemToExpand.expandActionView();
        }
    }
}