Search in sources :

Example 51 with ViewGroup

use of android.view.ViewGroup in project UltimateAndroid by cymcsg.

the class SwipeLayout method open.

public void open(boolean smooth, boolean notify) {
    ViewGroup surface = getSurfaceView(), bottom = getBottomView();
    int dx, dy;
    Rect rect = computeSurfaceLayoutArea(true);
    if (smooth) {
        mDragHelper.smoothSlideViewTo(getSurfaceView(), rect.left, rect.top);
    } else {
        dx = rect.left - surface.getLeft();
        dy = rect.top - surface.getTop();
        surface.layout(rect.left, rect.top, rect.right, rect.bottom);
        if (getShowMode() == ShowMode.PullOut) {
            Rect bRect = computeBottomLayoutAreaViaSurface(ShowMode.PullOut, rect);
            bottom.layout(bRect.left, bRect.top, bRect.right, bRect.bottom);
        }
        if (notify) {
            dispatchRevealEvent(rect.left, rect.top, rect.right, rect.bottom);
            dispatchSwipeEvent(rect.left, rect.top, dx, dy);
        } else {
            safeBottomView();
        }
    }
    invalidate();
}
Also used : Rect(android.graphics.Rect) ViewGroup(android.view.ViewGroup)

Example 52 with ViewGroup

use of android.view.ViewGroup in project GreenDroid by cyrilmottier.

the class QuickActionGrid method populateQuickActions.

@Override
protected void populateQuickActions(final List<QuickAction> quickActions) {
    mGridView.setAdapter(new BaseAdapter() {

        public View getView(int position, View view, ViewGroup parent) {
            TextView textView = (TextView) view;
            if (view == null) {
                final LayoutInflater inflater = LayoutInflater.from(getContext());
                textView = (TextView) inflater.inflate(R.layout.gd_quick_action_grid_item, mGridView, false);
            }
            QuickAction quickAction = quickActions.get(position);
            textView.setText(quickAction.mTitle);
            textView.setCompoundDrawablesWithIntrinsicBounds(null, quickAction.mDrawable, null, null);
            return textView;
        }

        public long getItemId(int position) {
            return position;
        }

        public Object getItem(int position) {
            return null;
        }

        public int getCount() {
            return quickActions.size();
        }
    });
    mGridView.setOnItemClickListener(mInternalItemClickListener);
}
Also used : ViewGroup(android.view.ViewGroup) LayoutInflater(android.view.LayoutInflater) TextView(android.widget.TextView) BaseAdapter(android.widget.BaseAdapter) GridView(android.widget.GridView) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView)

Example 53 with ViewGroup

use of android.view.ViewGroup in project Libraries-for-Android-Developers by eoecn.

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 LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_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 = LayoutParams.MATCH_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 54 with ViewGroup

use of android.view.ViewGroup in project Libraries-for-Android-Developers by eoecn.

the class ActionBarView method onFinishInflate.

@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    addView(mHomeLayout);
    if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
        final ViewParent parent = mCustomNavView.getParent();
        if (parent != this) {
            if (parent instanceof ViewGroup) {
                ((ViewGroup) parent).removeView(mCustomNavView);
            }
            addView(mCustomNavView);
        }
    }
}
Also used : ViewParent(android.view.ViewParent) ViewGroup(android.view.ViewGroup)

Example 55 with ViewGroup

use of android.view.ViewGroup in project Libraries-for-Android-Developers by eoecn.

the class ActionBarView method setMenu.

public void setMenu(Menu 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.abs__action_menu_presenter);
        mExpandedMenuPresenter = new ExpandedActionViewMenuPresenter();
    }
    ActionMenuView menuView;
    final LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
    if (!mSplitActionBar) {
        mActionMenuPresenter.setExpandedActionViewsExclusive(getResources_getBoolean(getContext(), R.bool.abs__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.MATCH_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(com.actionbarsherlock.internal.view.menu.ActionMenuView) SubMenuBuilder(com.actionbarsherlock.internal.view.menu.SubMenuBuilder) MenuBuilder(com.actionbarsherlock.internal.view.menu.MenuBuilder) ActionMenuPresenter(com.actionbarsherlock.internal.view.menu.ActionMenuPresenter)

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