Search in sources :

Example 96 with ViewGroup

use of android.view.ViewGroup in project HoloEverywhere by Prototik.

the class ActionBarActivityDelegateBase method setContentView.

@Override
public void setContentView(View v) {
    ensureSubDecor();
    if (mHasActionBar) {
        final ViewGroup contentParent = (ViewGroup) mActivity.findViewById(R.id.action_bar_activity_content);
        contentParent.removeAllViews();
        contentParent.addView(v);
    } else {
        mActivity.superSetContentView(v);
    }
}
Also used : ViewGroup(android.view.ViewGroup)

Example 97 with ViewGroup

use of android.view.ViewGroup in project HoloEverywhere by Prototik.

the class ActionBarContextView method setSplitActionBar.

@Override
public void setSplitActionBar(boolean split) {
    if (mSplitActionBar != split) {
        if (mActionMenuPresenter != null) {
            // Mode is already active; move everything over and adjust the menu itself.
            final ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.FILL_PARENT);
            if (!split) {
                mMenuView = (ActionMenuView) mActionMenuPresenter.getMenuView(this);
                mMenuView.setBackgroundDrawable(null);
                final ViewGroup oldParent = (ViewGroup) mMenuView.getParent();
                if (oldParent != null) {
                    oldParent.removeView(mMenuView);
                }
                addView(mMenuView, layoutParams);
            } else {
                // Allow full screen width in split mode.
                mActionMenuPresenter.setWidthLimit(getContext().getResources().getDisplayMetrics().widthPixels, true);
                // No limit to the item count; use whatever will fit.
                mActionMenuPresenter.setItemLimit(Integer.MAX_VALUE);
                // Span the whole width
                layoutParams.width = ViewGroup.LayoutParams.FILL_PARENT;
                layoutParams.height = mContentHeight;
                mMenuView = (ActionMenuView) mActionMenuPresenter.getMenuView(this);
                mMenuView.setBackgroundDrawable(mSplitBackground);
                final ViewGroup oldParent = (ViewGroup) mMenuView.getParent();
                if (oldParent != null) {
                    oldParent.removeView(mMenuView);
                }
                mSplitView.addView(mMenuView, layoutParams);
            }
        }
        super.setSplitActionBar(split);
    }
}
Also used : ViewGroup(android.view.ViewGroup)

Example 98 with ViewGroup

use of android.view.ViewGroup in project HoloEverywhere by Prototik.

the class ActionBarView method setMenu.

public void setMenu(SupportMenu menu, MenuPresenter.Callback cb) {
    if (menu == mOptionsMenu) {
        return;
    }
    if (mOptionsMenu != null) {
        mOptionsMenu.removeMenuPresenter(mActionMenuPresenter);
        mOptionsMenu.removeMenuPresenter(mExpandedMenuPresenter);
    }
    MenuBuilder builder = (MenuBuilder) menu;
    mOptionsMenu = builder;
    if (mMenuView != null) {
        final ViewGroup oldParent = (ViewGroup) mMenuView.getParent();
        if (oldParent != null) {
            oldParent.removeView(mMenuView);
        }
    }
    if (mActionMenuPresenter == null) {
        mActionMenuPresenter = new ActionMenuPresenter(mContext);
        mActionMenuPresenter.setCallback(cb);
        mActionMenuPresenter.setId(R.id.action_menu_presenter);
        mExpandedMenuPresenter = new ExpandedActionViewMenuPresenter();
    }
    ActionMenuView menuView;
    final LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT);
    if (!mSplitActionBar) {
        mActionMenuPresenter.setExpandedActionViewsExclusive(getResources().getBoolean(R.bool.abc_action_bar_expanded_action_views_exclusive));
        configPresenters(builder);
        menuView = (ActionMenuView) mActionMenuPresenter.getMenuView(this);
        final ViewGroup oldParent = (ViewGroup) menuView.getParent();
        if (oldParent != null && oldParent != this) {
            oldParent.removeView(menuView);
        }
        addView(menuView, layoutParams);
    } else {
        mActionMenuPresenter.setExpandedActionViewsExclusive(false);
        // Allow full screen width in split mode.
        mActionMenuPresenter.setWidthLimit(getContext().getResources().getDisplayMetrics().widthPixels, true);
        // No limit to the item count; use whatever will fit.
        mActionMenuPresenter.setItemLimit(Integer.MAX_VALUE);
        // Span the whole width
        layoutParams.width = LayoutParams.FILL_PARENT;
        configPresenters(builder);
        menuView = (ActionMenuView) mActionMenuPresenter.getMenuView(this);
        if (mSplitView != null) {
            final ViewGroup oldParent = (ViewGroup) menuView.getParent();
            if (oldParent != null && oldParent != mSplitView) {
                oldParent.removeView(menuView);
            }
            menuView.setVisibility(getAnimatedVisibility());
            mSplitView.addView(menuView, layoutParams);
        } else {
            // We'll add this later if we missed it this time.
            menuView.setLayoutParams(layoutParams);
        }
    }
    mMenuView = menuView;
}
Also used : ViewGroup(android.view.ViewGroup) ActionMenuView(android.support.v7.internal.view.menu.ActionMenuView) MenuBuilder(android.support.v7.internal.view.menu.MenuBuilder) SubMenuBuilder(android.support.v7.internal.view.menu.SubMenuBuilder) ActionMenuPresenter(android.support.v7.internal.view.menu.ActionMenuPresenter)

Example 99 with ViewGroup

use of android.view.ViewGroup in project HoloEverywhere by Prototik.

the class ActionBarActivityDelegateBase method setContentView.

@Override
public void setContentView(int resId) {
    ensureSubDecor();
    if (mHasActionBar) {
        final ViewGroup contentParent = (ViewGroup) mActivity.findViewById(R.id.action_bar_activity_content);
        contentParent.removeAllViews();
        final LayoutInflater inflater = LayoutInflater.from(mActivity);
        inflater.inflate(resId, contentParent);
    } else {
        mActivity.superSetContentView(resId);
    }
}
Also used : ViewGroup(android.view.ViewGroup) LayoutInflater(org.holoeverywhere.LayoutInflater)

Example 100 with ViewGroup

use of android.view.ViewGroup in project HoloEverywhere by Prototik.

the class ActionBarActivityDelegateBase method addContentView.

@Override
public void addContentView(View v, ViewGroup.LayoutParams lp) {
    ensureSubDecor();
    if (mHasActionBar) {
        final ViewGroup contentParent = (ViewGroup) mActivity.findViewById(R.id.action_bar_activity_content);
        contentParent.addView(v, lp);
    } else {
        mActivity.superSetContentView(v, lp);
    }
}
Also used : ViewGroup(android.view.ViewGroup)

Aggregations

ViewGroup (android.view.ViewGroup)2280 View (android.view.View)1268 TextView (android.widget.TextView)439 ImageView (android.widget.ImageView)279 ArrayList (java.util.ArrayList)198 ViewParent (android.view.ViewParent)184 ListView (android.widget.ListView)156 Paint (android.graphics.Paint)125 FrameLayout (android.widget.FrameLayout)121 LayoutInflater (android.view.LayoutInflater)115 AdapterView (android.widget.AdapterView)115 LinearLayout (android.widget.LinearLayout)110 AbsListView (android.widget.AbsListView)106 Animator (android.animation.Animator)94 Drawable (android.graphics.drawable.Drawable)93 RecyclerView (android.support.v7.widget.RecyclerView)91 AnimatedView (carbon.animation.AnimatedView)88 ComponentView (carbon.component.ComponentView)88 RippleView (carbon.drawable.ripple.RippleView)88 ShadowView (carbon.shadow.ShadowView)88