Search in sources :

Example 1 with FrameLayout

use of org.holoeverywhere.widget.FrameLayout in project HoloEverywhere by Prototik.

the class MenuPopupHelper method measureContentWidth.

private int measureContentWidth(ListAdapter adapter) {
    // Menus don't tend to be long, so this is more sane than it looks.
    int width = 0;
    View itemView = null;
    int itemType = 0;
    final int widthMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
    final int heightMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
    final int count = adapter.getCount();
    for (int i = 0; i < count; i++) {
        final int positionType = adapter.getItemViewType(i);
        if (positionType != itemType) {
            itemType = positionType;
            itemView = null;
        }
        if (mMeasureParent == null) {
            mMeasureParent = new FrameLayout(mContext);
        }
        itemView = adapter.getView(i, itemView, mMeasureParent);
        itemView.measure(widthMeasureSpec, heightMeasureSpec);
        width = Math.max(width, itemView.getMeasuredWidth());
    }
    return width;
}
Also used : FrameLayout(org.holoeverywhere.widget.FrameLayout) View(android.view.View) AdapterView(android.widget.AdapterView)

Example 2 with FrameLayout

use of org.holoeverywhere.widget.FrameLayout in project HoloEverywhere by Prototik.

the class ActionBarActivityDelegateBase method getListMenuView.

private MenuView getListMenuView(Context context, MenuPresenter.Callback cb) {
    if (mMenu == null) {
        return null;
    }
    if (mListMenuPresenter == null) {
        TypedArray a = context.obtainStyledAttributes(R.styleable.Theme);
        final int listPresenterTheme = a.getResourceId(R.styleable.Theme_panelMenuListTheme, R.style.Theme_AppCompat_CompactMenu);
        a.recycle();
        mListMenuPresenter = new ListMenuPresenter(R.layout.abc_list_menu_item_layout, listPresenterTheme);
        mListMenuPresenter.setCallback(cb);
        mMenu.addMenuPresenter(mListMenuPresenter);
    } else {
        // Make sure we update the ListView
        mListMenuPresenter.updateMenuView(false);
    }
    return mListMenuPresenter.getMenuView(new FrameLayout(context));
}
Also used : TypedArray(android.content.res.TypedArray) FrameLayout(org.holoeverywhere.widget.FrameLayout) ListMenuPresenter(android.support.v7.internal.view.menu.ListMenuPresenter)

Example 3 with FrameLayout

use of org.holoeverywhere.widget.FrameLayout in project little-bear-dictionary by daimajia.

the class PopupMenuHelper method measureContentWidth.

private int measureContentWidth(ListAdapter adapter) {
    int width = 0;
    View itemView = null;
    int itemType = 0;
    final int widthMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
    final int heightMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
    final int count = adapter.getCount();
    for (int i = 0; i < count; i++) {
        final int positionType = adapter.getItemViewType(i);
        if (positionType != itemType) {
            itemType = positionType;
            itemView = null;
        }
        if (mMeasureParent == null) {
            mMeasureParent = new FrameLayout(mContext);
        }
        itemView = adapter.getView(i, itemView, mMeasureParent);
        itemView.measure(widthMeasureSpec, heightMeasureSpec);
        width = Math.max(width, itemView.getMeasuredWidth());
    }
    return width;
}
Also used : FrameLayout(org.holoeverywhere.widget.FrameLayout) View(android.view.View) AdapterView(android.widget.AdapterView)

Aggregations

FrameLayout (org.holoeverywhere.widget.FrameLayout)3 View (android.view.View)2 AdapterView (android.widget.AdapterView)2 TypedArray (android.content.res.TypedArray)1 ListMenuPresenter (android.support.v7.internal.view.menu.ListMenuPresenter)1