Java Code Examples for com.actionbarsherlock.app.ActionBar#NAVIGATION_MODE_TABS

The following examples show how to use com.actionbarsherlock.app.ActionBar#NAVIGATION_MODE_TABS . 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 5 votes vote down vote up
public void setEmbeddedTabView(ScrollingTabContainerView tabs) {
    if (mTabScrollView != null) {
        removeView(mTabScrollView);
    }
    mTabScrollView = tabs;
    mIncludeTabs = tabs != null;
    if (mIncludeTabs && mNavigationMode == ActionBar.NAVIGATION_MODE_TABS) {
        addView(mTabScrollView);
        ViewGroup.LayoutParams lp = mTabScrollView.getLayoutParams();
        lp.width = LayoutParams.WRAP_CONTENT;
        lp.height = LayoutParams.MATCH_PARENT;
        tabs.setAllowCollapse(true);
    }
}
 
Example 2
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 3
Source File: ActionBarView.java    From android-apps with MIT License 5 votes vote down vote up
public void setEmbeddedTabView(ScrollingTabContainerView tabs) {
    if (mTabScrollView != null) {
        removeView(mTabScrollView);
    }
    mTabScrollView = tabs;
    mIncludeTabs = tabs != null;
    if (mIncludeTabs && mNavigationMode == ActionBar.NAVIGATION_MODE_TABS) {
        addView(mTabScrollView);
        ViewGroup.LayoutParams lp = mTabScrollView.getLayoutParams();
        lp.width = LayoutParams.WRAP_CONTENT;
        lp.height = LayoutParams.MATCH_PARENT;
        tabs.setAllowCollapse(true);
    }
}
 
Example 4
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 5
Source File: ActionBarView.java    From zen4android with MIT License 5 votes vote down vote up
public void setEmbeddedTabView(ScrollingTabContainerView tabs) {
    if (mTabScrollView != null) {
        removeView(mTabScrollView);
    }
    mTabScrollView = tabs;
    mIncludeTabs = tabs != null;
    if (mIncludeTabs && mNavigationMode == ActionBar.NAVIGATION_MODE_TABS) {
        addView(mTabScrollView);
        ViewGroup.LayoutParams lp = mTabScrollView.getLayoutParams();
        lp.width = LayoutParams.WRAP_CONTENT;
        lp.height = LayoutParams.MATCH_PARENT;
        tabs.setAllowCollapse(true);
    }
}
 
Example 6
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 7
Source File: ActionBarView.java    From zhangshangwuda with Apache License 2.0 5 votes vote down vote up
public void setEmbeddedTabView(ScrollingTabContainerView tabs) {
    if (mTabScrollView != null) {
        removeView(mTabScrollView);
    }
    mTabScrollView = tabs;
    mIncludeTabs = tabs != null;
    if (mIncludeTabs && mNavigationMode == ActionBar.NAVIGATION_MODE_TABS) {
        addView(mTabScrollView);
        ViewGroup.LayoutParams lp = mTabScrollView.getLayoutParams();
        lp.width = LayoutParams.WRAP_CONTENT;
        lp.height = LayoutParams.MATCH_PARENT;
        tabs.setAllowCollapse(true);
    }
}
 
Example 8
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 9
Source File: ActionBarView.java    From Libraries-for-Android-Developers with MIT License 5 votes vote down vote up
public void setEmbeddedTabView(ScrollingTabContainerView tabs) {
    if (mTabScrollView != null) {
        removeView(mTabScrollView);
    }
    mTabScrollView = tabs;
    mIncludeTabs = tabs != null;
    if (mIncludeTabs && mNavigationMode == ActionBar.NAVIGATION_MODE_TABS) {
        addView(mTabScrollView);
        ViewGroup.LayoutParams lp = mTabScrollView.getLayoutParams();
        lp.width = LayoutParams.WRAP_CONTENT;
        lp.height = LayoutParams.MATCH_PARENT;
        tabs.setAllowCollapse(true);
    }
}
 
Example 10
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 11
Source File: ActionBarView.java    From CSipSimple with GNU General Public License v3.0 4 votes vote down vote up
public void setNavigationMode(int mode) {
    final int oldMode = mNavigationMode;
    if (mode != oldMode) {
        switch (oldMode) {
        case ActionBar.NAVIGATION_MODE_LIST:
            if (mListNavLayout != null) {
                removeView(mListNavLayout);
            }
            break;
        case ActionBar.NAVIGATION_MODE_TABS:
            if (mTabScrollView != null && mIncludeTabs) {
                removeView(mTabScrollView);
            }
        }

        switch (mode) {
        case ActionBar.NAVIGATION_MODE_LIST:
            if (mSpinner == null) {
                mSpinner = new IcsSpinner(mContext, null,
                        R.attr.actionDropDownStyle);
                mListNavLayout = (IcsLinearLayout) LayoutInflater.from(mContext)
                        .inflate(R.layout.abs__action_bar_tab_bar_view, null);
                LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
                        LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
                params.gravity = Gravity.CENTER;
                mListNavLayout.addView(mSpinner, params);
            }
            if (mSpinner.getAdapter() != mSpinnerAdapter) {
                mSpinner.setAdapter(mSpinnerAdapter);
            }
            mSpinner.setOnItemSelectedListener(mNavItemSelectedListener);
            addView(mListNavLayout);
            break;
        case ActionBar.NAVIGATION_MODE_TABS:
            if (mTabScrollView != null && mIncludeTabs) {
                addView(mTabScrollView);
            }
            break;
        }
        mNavigationMode = mode;
        requestLayout();
    }
}
 
Example 12
Source File: ActionBarView.java    From android-apps with MIT License 4 votes vote down vote up
public void setNavigationMode(int mode) {
    final int oldMode = mNavigationMode;
    if (mode != oldMode) {
        switch (oldMode) {
        case ActionBar.NAVIGATION_MODE_LIST:
            if (mListNavLayout != null) {
                removeView(mListNavLayout);
            }
            break;
        case ActionBar.NAVIGATION_MODE_TABS:
            if (mTabScrollView != null && mIncludeTabs) {
                removeView(mTabScrollView);
            }
        }

        switch (mode) {
        case ActionBar.NAVIGATION_MODE_LIST:
            if (mSpinner == null) {
                mSpinner = new IcsSpinner(mContext, null,
                        R.attr.actionDropDownStyle);
                mListNavLayout = (IcsLinearLayout) LayoutInflater.from(mContext)
                        .inflate(R.layout.abs__action_bar_tab_bar_view, null);
                LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
                        LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
                params.gravity = Gravity.CENTER;
                mListNavLayout.addView(mSpinner, params);
            }
            if (mSpinner.getAdapter() != mSpinnerAdapter) {
                mSpinner.setAdapter(mSpinnerAdapter);
            }
            mSpinner.setOnItemSelectedListener(mNavItemSelectedListener);
            addView(mListNavLayout);
            break;
        case ActionBar.NAVIGATION_MODE_TABS:
            if (mTabScrollView != null && mIncludeTabs) {
                addView(mTabScrollView);
            }
            break;
        }
        mNavigationMode = mode;
        requestLayout();
    }
}
 
Example 13
Source File: ActionBarView.java    From zen4android with MIT License 4 votes vote down vote up
public void setNavigationMode(int mode) {
    final int oldMode = mNavigationMode;
    if (mode != oldMode) {
        switch (oldMode) {
        case ActionBar.NAVIGATION_MODE_LIST:
            if (mListNavLayout != null) {
                removeView(mListNavLayout);
            }
            break;
        case ActionBar.NAVIGATION_MODE_TABS:
            if (mTabScrollView != null && mIncludeTabs) {
                removeView(mTabScrollView);
            }
        }

        switch (mode) {
        case ActionBar.NAVIGATION_MODE_LIST:
            if (mSpinner == null) {
                mSpinner = new IcsSpinner(mContext, null,
                        R.attr.actionDropDownStyle);
                mListNavLayout = (IcsLinearLayout) LayoutInflater.from(mContext)
                        .inflate(R.layout.abs__action_bar_tab_bar_view, null);
                LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
                        LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
                params.gravity = Gravity.CENTER;
                mListNavLayout.addView(mSpinner, params);
            }
            if (mSpinner.getAdapter() != mSpinnerAdapter) {
                mSpinner.setAdapter(mSpinnerAdapter);
            }
            mSpinner.setOnItemSelectedListener(mNavItemSelectedListener);
            addView(mListNavLayout);
            break;
        case ActionBar.NAVIGATION_MODE_TABS:
            if (mTabScrollView != null && mIncludeTabs) {
                addView(mTabScrollView);
            }
            break;
        }
        mNavigationMode = mode;
        requestLayout();
    }
}
 
Example 14
Source File: ActionBarView.java    From zhangshangwuda with Apache License 2.0 4 votes vote down vote up
public void setNavigationMode(int mode) {
    final int oldMode = mNavigationMode;
    if (mode != oldMode) {
        switch (oldMode) {
        case ActionBar.NAVIGATION_MODE_LIST:
            if (mListNavLayout != null) {
                removeView(mListNavLayout);
            }
            break;
        case ActionBar.NAVIGATION_MODE_TABS:
            if (mTabScrollView != null && mIncludeTabs) {
                removeView(mTabScrollView);
            }
        }

        switch (mode) {
        case ActionBar.NAVIGATION_MODE_LIST:
            if (mSpinner == null) {
                mSpinner = new IcsSpinner(mContext, null,
                        R.attr.actionDropDownStyle);
                mListNavLayout = (IcsLinearLayout) LayoutInflater.from(mContext)
                        .inflate(R.layout.abs__action_bar_tab_bar_view, null);
                LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
                        LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
                params.gravity = Gravity.CENTER;
                mListNavLayout.addView(mSpinner, params);
            }
            if (mSpinner.getAdapter() != mSpinnerAdapter) {
                mSpinner.setAdapter(mSpinnerAdapter);
            }
            mSpinner.setOnItemSelectedListener(mNavItemSelectedListener);
            addView(mListNavLayout);
            break;
        case ActionBar.NAVIGATION_MODE_TABS:
            if (mTabScrollView != null && mIncludeTabs) {
                addView(mTabScrollView);
            }
            break;
        }
        mNavigationMode = mode;
        requestLayout();
    }
}
 
Example 15
Source File: ActionBarView.java    From Libraries-for-Android-Developers with MIT License 4 votes vote down vote up
public void setNavigationMode(int mode) {
    final int oldMode = mNavigationMode;
    if (mode != oldMode) {
        switch (oldMode) {
        case ActionBar.NAVIGATION_MODE_LIST:
            if (mListNavLayout != null) {
                removeView(mListNavLayout);
            }
            break;
        case ActionBar.NAVIGATION_MODE_TABS:
            if (mTabScrollView != null && mIncludeTabs) {
                removeView(mTabScrollView);
            }
        }

        switch (mode) {
        case ActionBar.NAVIGATION_MODE_LIST:
            if (mSpinner == null) {
                mSpinner = new IcsSpinner(mContext, null,
                        R.attr.actionDropDownStyle);
                mListNavLayout = (IcsLinearLayout) LayoutInflater.from(mContext)
                        .inflate(R.layout.abs__action_bar_tab_bar_view, null);
                LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
                        LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
                params.gravity = Gravity.CENTER;
                mListNavLayout.addView(mSpinner, params);
            }
            if (mSpinner.getAdapter() != mSpinnerAdapter) {
                mSpinner.setAdapter(mSpinnerAdapter);
            }
            mSpinner.setOnItemSelectedListener(mNavItemSelectedListener);
            addView(mListNavLayout);
            break;
        case ActionBar.NAVIGATION_MODE_TABS:
            if (mTabScrollView != null && mIncludeTabs) {
                addView(mTabScrollView);
            }
            break;
        }
        mNavigationMode = mode;
        requestLayout();
    }
}