com.actionbarsherlock.view.CollapsibleActionView Java Examples

The following examples show how to use com.actionbarsherlock.view.CollapsibleActionView. 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 boolean expandItemActionView(MenuBuilder menu, MenuItemImpl item) {
    mExpandedActionView = item.getActionView();
    mExpandedHomeLayout.setIcon(mIcon.getConstantState().newDrawable(/* TODO getResources() */));
    mCurrentExpandedItem = item;
    if (mExpandedActionView.getParent() != ActionBarView.this) {
        addView(mExpandedActionView);
    }
    if (mExpandedHomeLayout.getParent() != ActionBarView.this) {
        addView(mExpandedHomeLayout);
    }
    mHomeLayout.setVisibility(GONE);
    if (mTitleLayout != null) mTitleLayout.setVisibility(GONE);
    if (mTabScrollView != null) mTabScrollView.setVisibility(GONE);
    if (mSpinner != null) mSpinner.setVisibility(GONE);
    if (mCustomNavView != null) mCustomNavView.setVisibility(GONE);
    requestLayout();
    item.setActionViewExpanded(true);

    if (mExpandedActionView instanceof CollapsibleActionView) {
        ((CollapsibleActionView) mExpandedActionView).onActionViewExpanded();
    }

    return true;
}
 
Example #2
Source File: ActionBarView.java    From android-apps with MIT License 6 votes vote down vote up
@Override
public boolean expandItemActionView(MenuBuilder menu, MenuItemImpl item) {
    mExpandedActionView = item.getActionView();
    mExpandedHomeLayout.setIcon(mIcon.getConstantState().newDrawable(/* TODO getResources() */));
    mCurrentExpandedItem = item;
    if (mExpandedActionView.getParent() != ActionBarView.this) {
        addView(mExpandedActionView);
    }
    if (mExpandedHomeLayout.getParent() != ActionBarView.this) {
        addView(mExpandedHomeLayout);
    }
    mHomeLayout.setVisibility(GONE);
    if (mTitleLayout != null) mTitleLayout.setVisibility(GONE);
    if (mTabScrollView != null) mTabScrollView.setVisibility(GONE);
    if (mSpinner != null) mSpinner.setVisibility(GONE);
    if (mCustomNavView != null) mCustomNavView.setVisibility(GONE);
    requestLayout();
    item.setActionViewExpanded(true);

    if (mExpandedActionView instanceof CollapsibleActionView) {
        ((CollapsibleActionView) mExpandedActionView).onActionViewExpanded();
    }

    return true;
}
 
Example #3
Source File: ActionBarView.java    From zen4android with MIT License 6 votes vote down vote up
@Override
public boolean expandItemActionView(MenuBuilder menu, MenuItemImpl item) {
    mExpandedActionView = item.getActionView();
    mExpandedHomeLayout.setIcon(mIcon.getConstantState().newDrawable(/* TODO getResources() */));
    mCurrentExpandedItem = item;
    if (mExpandedActionView.getParent() != ActionBarView.this) {
        addView(mExpandedActionView);
    }
    if (mExpandedHomeLayout.getParent() != ActionBarView.this) {
        addView(mExpandedHomeLayout);
    }
    mHomeLayout.setVisibility(GONE);
    if (mTitleLayout != null) mTitleLayout.setVisibility(GONE);
    if (mTabScrollView != null) mTabScrollView.setVisibility(GONE);
    if (mSpinner != null) mSpinner.setVisibility(GONE);
    if (mCustomNavView != null) mCustomNavView.setVisibility(GONE);
    requestLayout();
    item.setActionViewExpanded(true);

    if (mExpandedActionView instanceof CollapsibleActionView) {
        ((CollapsibleActionView) mExpandedActionView).onActionViewExpanded();
    }

    return true;
}
 
Example #4
Source File: ActionBarView.java    From zhangshangwuda with Apache License 2.0 6 votes vote down vote up
@Override
public boolean expandItemActionView(MenuBuilder menu, MenuItemImpl item) {
    mExpandedActionView = item.getActionView();
    mExpandedHomeLayout.setIcon(mIcon.getConstantState().newDrawable(/* TODO getResources() */));
    mCurrentExpandedItem = item;
    if (mExpandedActionView.getParent() != ActionBarView.this) {
        addView(mExpandedActionView);
    }
    if (mExpandedHomeLayout.getParent() != ActionBarView.this) {
        addView(mExpandedHomeLayout);
    }
    mHomeLayout.setVisibility(GONE);
    if (mTitleLayout != null) mTitleLayout.setVisibility(GONE);
    if (mTabScrollView != null) mTabScrollView.setVisibility(GONE);
    if (mSpinner != null) mSpinner.setVisibility(GONE);
    if (mCustomNavView != null) mCustomNavView.setVisibility(GONE);
    requestLayout();
    item.setActionViewExpanded(true);

    if (mExpandedActionView instanceof CollapsibleActionView) {
        ((CollapsibleActionView) mExpandedActionView).onActionViewExpanded();
    }

    return true;
}
 
Example #5
Source File: ActionBarView.java    From Libraries-for-Android-Developers with MIT License 6 votes vote down vote up
@Override
public boolean expandItemActionView(MenuBuilder menu, MenuItemImpl item) {
    mExpandedActionView = item.getActionView();
    mExpandedHomeLayout.setIcon(mIcon.getConstantState().newDrawable(/* TODO getResources() */));
    mCurrentExpandedItem = item;
    if (mExpandedActionView.getParent() != ActionBarView.this) {
        addView(mExpandedActionView);
    }
    if (mExpandedHomeLayout.getParent() != ActionBarView.this) {
        addView(mExpandedHomeLayout);
    }
    mHomeLayout.setVisibility(GONE);
    if (mTitleLayout != null) mTitleLayout.setVisibility(GONE);
    if (mTabScrollView != null) mTabScrollView.setVisibility(GONE);
    if (mSpinner != null) mSpinner.setVisibility(GONE);
    if (mCustomNavView != null) mCustomNavView.setVisibility(GONE);
    requestLayout();
    item.setActionViewExpanded(true);

    if (mExpandedActionView instanceof CollapsibleActionView) {
        ((CollapsibleActionView) mExpandedActionView).onActionViewExpanded();
    }

    return true;
}
 
Example #6
Source File: ActionBarView.java    From CSipSimple with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean collapseItemActionView(MenuBuilder menu, MenuItemImpl item) {
    // Do this before detaching the actionview from the hierarchy, in case
    // it needs to dismiss the soft keyboard, etc.
    if (mExpandedActionView instanceof CollapsibleActionView) {
        ((CollapsibleActionView) mExpandedActionView).onActionViewCollapsed();
    }

    removeView(mExpandedActionView);
    removeView(mExpandedHomeLayout);
    mExpandedActionView = null;
    if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_HOME) != 0) {
        mHomeLayout.setVisibility(VISIBLE);
    }
    if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_TITLE) != 0) {
        if (mTitleLayout == null) {
            initTitle();
        } else {
            mTitleLayout.setVisibility(VISIBLE);
        }
    }
    if (mTabScrollView != null && mNavigationMode == ActionBar.NAVIGATION_MODE_TABS) {
        mTabScrollView.setVisibility(VISIBLE);
    }
    if (mSpinner != null && mNavigationMode == ActionBar.NAVIGATION_MODE_LIST) {
        mSpinner.setVisibility(VISIBLE);
    }
    if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
        mCustomNavView.setVisibility(VISIBLE);
    }
    mExpandedHomeLayout.setIcon(null);
    mCurrentExpandedItem = null;
    requestLayout();
    item.setActionViewExpanded(false);

    return true;
}
 
Example #7
Source File: MenuItemWrapper.java    From CSipSimple with GNU General Public License v3.0 5 votes vote down vote up
@Override
public MenuItem setActionView(int resId) {
    //Allow the native menu to inflate the resource
    mNativeItem.setActionView(resId);
    if (resId != 0) {
        //Get newly created view
        View view = mNativeItem.getActionView();
        if (view instanceof CollapsibleActionView) {
            //Wrap it and re-set it
            mNativeItem.setActionView(new CollapsibleActionViewWrapper(view));
        }
    }
    return this;
}
 
Example #8
Source File: ActionBarView.java    From android-apps with MIT License 5 votes vote down vote up
@Override
public boolean collapseItemActionView(MenuBuilder menu, MenuItemImpl item) {
    // Do this before detaching the actionview from the hierarchy, in case
    // it needs to dismiss the soft keyboard, etc.
    if (mExpandedActionView instanceof CollapsibleActionView) {
        ((CollapsibleActionView) mExpandedActionView).onActionViewCollapsed();
    }

    removeView(mExpandedActionView);
    removeView(mExpandedHomeLayout);
    mExpandedActionView = null;
    if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_HOME) != 0) {
        mHomeLayout.setVisibility(VISIBLE);
    }
    if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_TITLE) != 0) {
        if (mTitleLayout == null) {
            initTitle();
        } else {
            mTitleLayout.setVisibility(VISIBLE);
        }
    }
    if (mTabScrollView != null && mNavigationMode == ActionBar.NAVIGATION_MODE_TABS) {
        mTabScrollView.setVisibility(VISIBLE);
    }
    if (mSpinner != null && mNavigationMode == ActionBar.NAVIGATION_MODE_LIST) {
        mSpinner.setVisibility(VISIBLE);
    }
    if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
        mCustomNavView.setVisibility(VISIBLE);
    }
    mExpandedHomeLayout.setIcon(null);
    mCurrentExpandedItem = null;
    requestLayout();
    item.setActionViewExpanded(false);

    return true;
}
 
Example #9
Source File: MenuItemWrapper.java    From zen4android with MIT License 5 votes vote down vote up
@Override
public MenuItem setActionView(int resId) {
    //Allow the native menu to inflate the resource
    mNativeItem.setActionView(resId);
    if (resId != 0) {
        //Get newly created view
        View view = mNativeItem.getActionView();
        if (view instanceof CollapsibleActionView) {
            //Wrap it and re-set it
            mNativeItem.setActionView(new CollapsibleActionViewWrapper(view));
        }
    }
    return this;
}
 
Example #10
Source File: ActionBarView.java    From zen4android with MIT License 5 votes vote down vote up
@Override
public boolean collapseItemActionView(MenuBuilder menu, MenuItemImpl item) {
    // Do this before detaching the actionview from the hierarchy, in case
    // it needs to dismiss the soft keyboard, etc.
    if (mExpandedActionView instanceof CollapsibleActionView) {
        ((CollapsibleActionView) mExpandedActionView).onActionViewCollapsed();
    }

    removeView(mExpandedActionView);
    removeView(mExpandedHomeLayout);
    mExpandedActionView = null;
    if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_HOME) != 0) {
        mHomeLayout.setVisibility(VISIBLE);
    }
    if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_TITLE) != 0) {
        if (mTitleLayout == null) {
            initTitle();
        } else {
            mTitleLayout.setVisibility(VISIBLE);
        }
    }
    if (mTabScrollView != null && mNavigationMode == ActionBar.NAVIGATION_MODE_TABS) {
        mTabScrollView.setVisibility(VISIBLE);
    }
    if (mSpinner != null && mNavigationMode == ActionBar.NAVIGATION_MODE_LIST) {
        mSpinner.setVisibility(VISIBLE);
    }
    if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
        mCustomNavView.setVisibility(VISIBLE);
    }
    mExpandedHomeLayout.setIcon(null);
    mCurrentExpandedItem = null;
    requestLayout();
    item.setActionViewExpanded(false);

    return true;
}
 
Example #11
Source File: ActionBarView.java    From Libraries-for-Android-Developers with MIT License 5 votes vote down vote up
@Override
public boolean collapseItemActionView(MenuBuilder menu, MenuItemImpl item) {
    // Do this before detaching the actionview from the hierarchy, in case
    // it needs to dismiss the soft keyboard, etc.
    if (mExpandedActionView instanceof CollapsibleActionView) {
        ((CollapsibleActionView) mExpandedActionView).onActionViewCollapsed();
    }

    removeView(mExpandedActionView);
    removeView(mExpandedHomeLayout);
    mExpandedActionView = null;
    if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_HOME) != 0) {
        mHomeLayout.setVisibility(VISIBLE);
    }
    if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_TITLE) != 0) {
        if (mTitleLayout == null) {
            initTitle();
        } else {
            mTitleLayout.setVisibility(VISIBLE);
        }
    }
    if (mTabScrollView != null && mNavigationMode == ActionBar.NAVIGATION_MODE_TABS) {
        mTabScrollView.setVisibility(VISIBLE);
    }
    if (mSpinner != null && mNavigationMode == ActionBar.NAVIGATION_MODE_LIST) {
        mSpinner.setVisibility(VISIBLE);
    }
    if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
        mCustomNavView.setVisibility(VISIBLE);
    }
    mExpandedHomeLayout.setIcon(null);
    mCurrentExpandedItem = null;
    requestLayout();
    item.setActionViewExpanded(false);

    return true;
}
 
Example #12
Source File: MenuItemWrapper.java    From zhangshangwuda with Apache License 2.0 5 votes vote down vote up
@Override
public MenuItem setActionView(int resId) {
    //Allow the native menu to inflate the resource
    mNativeItem.setActionView(resId);
    if (resId != 0) {
        //Get newly created view
        View view = mNativeItem.getActionView();
        if (view instanceof CollapsibleActionView) {
            //Wrap it and re-set it
            mNativeItem.setActionView(new CollapsibleActionViewWrapper(view));
        }
    }
    return this;
}
 
Example #13
Source File: ActionBarView.java    From zhangshangwuda with Apache License 2.0 5 votes vote down vote up
@Override
public boolean collapseItemActionView(MenuBuilder menu, MenuItemImpl item) {
    // Do this before detaching the actionview from the hierarchy, in case
    // it needs to dismiss the soft keyboard, etc.
    if (mExpandedActionView instanceof CollapsibleActionView) {
        ((CollapsibleActionView) mExpandedActionView).onActionViewCollapsed();
    }

    removeView(mExpandedActionView);
    removeView(mExpandedHomeLayout);
    mExpandedActionView = null;
    if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_HOME) != 0) {
        mHomeLayout.setVisibility(VISIBLE);
    }
    if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_TITLE) != 0) {
        if (mTitleLayout == null) {
            initTitle();
        } else {
            mTitleLayout.setVisibility(VISIBLE);
        }
    }
    if (mTabScrollView != null && mNavigationMode == ActionBar.NAVIGATION_MODE_TABS) {
        mTabScrollView.setVisibility(VISIBLE);
    }
    if (mSpinner != null && mNavigationMode == ActionBar.NAVIGATION_MODE_LIST) {
        mSpinner.setVisibility(VISIBLE);
    }
    if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
        mCustomNavView.setVisibility(VISIBLE);
    }
    mExpandedHomeLayout.setIcon(null);
    mCurrentExpandedItem = null;
    requestLayout();
    item.setActionViewExpanded(false);

    return true;
}
 
Example #14
Source File: MenuItemWrapper.java    From Libraries-for-Android-Developers with MIT License 5 votes vote down vote up
@Override
public MenuItem setActionView(int resId) {
    //Allow the native menu to inflate the resource
    mNativeItem.setActionView(resId);
    if (resId != 0) {
        //Get newly created view
        View view = mNativeItem.getActionView();
        if (view instanceof CollapsibleActionView) {
            //Wrap it and re-set it
            mNativeItem.setActionView(new CollapsibleActionViewWrapper(view));
        }
    }
    return this;
}
 
Example #15
Source File: CollapsibleActionViewWrapper.java    From Libraries-for-Android-Developers with MIT License 4 votes vote down vote up
public CollapsibleActionViewWrapper(View child) {
    super(child.getContext());
    this.child = (CollapsibleActionView) child;
    addView(child);
}
 
Example #16
Source File: CollapsibleActionViewWrapper.java    From zhangshangwuda with Apache License 2.0 4 votes vote down vote up
public CollapsibleActionViewWrapper(View child) {
    super(child.getContext());
    this.child = (CollapsibleActionView) child;
    addView(child);
}
 
Example #17
Source File: CollapsibleActionViewWrapper.java    From zen4android with MIT License 4 votes vote down vote up
public CollapsibleActionViewWrapper(View child) {
    super(child.getContext());
    this.child = (CollapsibleActionView) child;
    addView(child);
}
 
Example #18
Source File: CollapsibleActionViewWrapper.java    From CSipSimple with GNU General Public License v3.0 4 votes vote down vote up
public CollapsibleActionViewWrapper(View child) {
    super(child.getContext());
    this.child = (CollapsibleActionView) child;
    addView(child);
}