当前位置: 首页>>代码示例>>Java>>正文


Java PositionMetadata.recycle方法代码示例

本文整理汇总了Java中org.holoeverywhere.widget.ExpandableListConnector.PositionMetadata.recycle方法的典型用法代码示例。如果您正苦于以下问题:Java PositionMetadata.recycle方法的具体用法?Java PositionMetadata.recycle怎么用?Java PositionMetadata.recycle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.holoeverywhere.widget.ExpandableListConnector.PositionMetadata的用法示例。


在下文中一共展示了PositionMetadata.recycle方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: drawDivider

import org.holoeverywhere.widget.ExpandableListConnector.PositionMetadata; //导入方法依赖的package包/类
@Override
void drawDivider(Canvas canvas, Rect bounds, int childIndex) {
    int flatListPosition = childIndex + getFirstVisiblePosition();
    if (flatListPosition >= 0) {
        final int adjustedPosition =
                getFlatPositionForConnector(flatListPosition);
        PositionMetadata pos = mConnector.getUnflattenedPos(adjustedPosition);
        if (pos.position.type ==
                ExpandableListPosition.CHILD || pos.isExpanded() &&
                pos.groupMetadata.lastChildFlPos != pos.groupMetadata.flPos) {
            Drawable divider = mChildDivider;
            divider.setBounds(bounds);
            divider.draw(canvas);
            pos.recycle();
            return;
        }
        pos.recycle();
    }
    super.drawDivider(canvas, bounds, flatListPosition);
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:21,代码来源:ExpandableListView.java

示例2: expandGroup

import org.holoeverywhere.widget.ExpandableListConnector.PositionMetadata; //导入方法依赖的package包/类
public boolean expandGroup(int groupPos, boolean animate) {
    ExpandableListPosition elGroupPos = ExpandableListPosition.obtain(
            ExpandableListPosition.GROUP, groupPos, -1, -1);
    PositionMetadata pm = mConnector.getFlattenedPos(elGroupPos);
    elGroupPos.recycle();
    boolean retValue = mConnector.expandGroup(pm);
    if (mOnGroupExpandListener != null) {
        mOnGroupExpandListener.onGroupExpand(groupPos);
    }
    // TODO Make it works on Eclair
    if (animate && VERSION.SDK_INT >= VERSION_CODES.FROYO) {
        final int groupFlatPos = pm.position.flatListPos;
        final int shiftedGroupPosition = groupFlatPos + getHeaderViewsCount();
        smoothScrollToPosition(shiftedGroupPosition + mAdapter.getChildrenCount(groupPos),
                shiftedGroupPosition);
    }
    pm.recycle();
    return retValue;
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:20,代码来源:ExpandableListView.java

示例3: setSelectedChild

import org.holoeverywhere.widget.ExpandableListConnector.PositionMetadata; //导入方法依赖的package包/类
public boolean setSelectedChild(int groupPosition, int childPosition, boolean shouldExpandGroup) {
    ExpandableListPosition elChildPos = ExpandableListPosition.obtainChildPosition(
            groupPosition, childPosition);
    PositionMetadata flatChildPos = mConnector.getFlattenedPos(elChildPos);
    if (flatChildPos == null) {
        if (!shouldExpandGroup) {
            return false;
        }
        expandGroup(groupPosition);
        flatChildPos = mConnector.getFlattenedPos(elChildPos);
        if (flatChildPos == null) {
            throw new IllegalStateException("Could not find child");
        }
    }
    int absoluteFlatPosition = getAbsoluteFlatPosition(flatChildPos.position.flatListPos);
    super.setSelection(absoluteFlatPosition);
    elChildPos.recycle();
    flatChildPos.recycle();
    return true;
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:21,代码来源:ExpandableListView.java

示例4: createContextMenuInfo

import org.holoeverywhere.widget.ExpandableListConnector.PositionMetadata; //导入方法依赖的package包/类
@Override
protected ContextMenuInfo createContextMenuInfo(View view, int flatListPosition, long id) {
    if (isHeaderOrFooterPosition(flatListPosition)) {
        return super.createContextMenuInfo(view, flatListPosition, id);
    }
    final int adjustedPosition = getFlatPositionForConnector(flatListPosition);
    PositionMetadata pm = mConnector.getUnflattenedPos(adjustedPosition);
    ExpandableListPosition pos = pm.position;
    id = getChildOrGroupId(pos);
    long packedPosition = pos.getPackedPosition();
    pm.recycle();
    return new ExpandableListContextMenuInfo(view, packedPosition, id);
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:14,代码来源:ExpandableListView.java

示例5: getExpandableListPosition

import org.holoeverywhere.widget.ExpandableListConnector.PositionMetadata; //导入方法依赖的package包/类
public long getExpandableListPosition(int flatListPosition) {
    if (isHeaderOrFooterPosition(flatListPosition)) {
        return PACKED_POSITION_VALUE_NULL;
    }
    final int adjustedPosition = getFlatPositionForConnector(flatListPosition);
    PositionMetadata pm = mConnector.getUnflattenedPos(adjustedPosition);
    long packedPos = pm.position.getPackedPosition();
    pm.recycle();
    return packedPos;
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:11,代码来源:ExpandableListView.java

示例6: getFlatListPosition

import org.holoeverywhere.widget.ExpandableListConnector.PositionMetadata; //导入方法依赖的package包/类
public int getFlatListPosition(long packedPosition) {
    ExpandableListPosition elPackedPos = ExpandableListPosition
            .obtainPosition(packedPosition);
    PositionMetadata pm = mConnector.getFlattenedPos(elPackedPos);
    elPackedPos.recycle();
    final int flatListPosition = pm.position.flatListPos;
    pm.recycle();
    return getAbsoluteFlatPosition(flatListPosition);
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:10,代码来源:ExpandableListView.java

示例7: setSelectedGroup

import org.holoeverywhere.widget.ExpandableListConnector.PositionMetadata; //导入方法依赖的package包/类
public void setSelectedGroup(int groupPosition) {
    ExpandableListPosition elGroupPos = ExpandableListPosition
            .obtainGroupPosition(groupPosition);
    PositionMetadata pm = mConnector.getFlattenedPos(elGroupPos);
    elGroupPos.recycle();
    final int absoluteFlatPosition = getAbsoluteFlatPosition(pm.position.flatListPos);
    super.setSelection(absoluteFlatPosition);
    pm.recycle();
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:10,代码来源:ExpandableListView.java

示例8: dispatchDraw

import org.holoeverywhere.widget.ExpandableListConnector.PositionMetadata; //导入方法依赖的package包/类
@Override
protected void dispatchDraw(Canvas canvas) {
    super.dispatchDraw(canvas);
    if (mChildIndicator == null && mGroupIndicator == null) {
        return;
    }
    int saveCount = 0;
    final boolean clipToPadding = mClipToPadding;
    if (clipToPadding) {
        saveCount = canvas.save();
        final int scrollX = getScrollX();
        final int scrollY = getScrollY();
        canvas.clipRect(scrollX + getPaddingLeft(), scrollY + getPaddingTop(),
                scrollX + getRight() - getLeft() - getPaddingRight(),
                scrollY + getBottom() - getTop() - getPaddingBottom());
    }
    final int headerViewsCount = getHeaderViewsCount();
    final int lastChildFlPos = getCount() - getFooterViewsCount() - headerViewsCount - 1;
    final int myB = getBottom();
    PositionMetadata pos;
    View item;
    Drawable indicator;
    int t, b;
    int lastItemType = ~(ExpandableListPosition.CHILD | ExpandableListPosition.GROUP);
    final Rect indicatorRect = mIndicatorRect;
    final int childCount = getChildCount();
    for (int i = 0, childFlPos = getFirstVisiblePosition() - headerViewsCount; i < childCount; i++, childFlPos++) {
        if (childFlPos < 0) {
            continue;
        } else if (childFlPos > lastChildFlPos) {
            break;
        }
        item = getChildAt(i);
        t = item.getTop();
        b = item.getBottom();
        if (b < 0 || t > myB) {
            continue;
        }
        pos = mConnector.getUnflattenedPos(childFlPos);
        if (pos.position.type != lastItemType) {
            if (pos.position.type == ExpandableListPosition.CHILD) {
                indicatorRect.left = mChildIndicatorLeft == CHILD_INDICATOR_INHERIT ?
                        mIndicatorLeft : mChildIndicatorLeft;
                indicatorRect.right = mChildIndicatorRight == CHILD_INDICATOR_INHERIT ?
                        mIndicatorRight : mChildIndicatorRight;
            } else {
                indicatorRect.left = mIndicatorLeft;
                indicatorRect.right = mIndicatorRight;
            }
            indicatorRect.left += getPaddingLeft();
            indicatorRect.right += getPaddingLeft();
            lastItemType = pos.position.type;
        }

        if (indicatorRect.left != indicatorRect.right) {
            if (isStackFromBottom()) {
                indicatorRect.top = t;
                indicatorRect.bottom = b;
            } else {
                indicatorRect.top = t;
                indicatorRect.bottom = b;
            }
            indicator = getIndicator(pos);
            if (indicator != null) {
                indicator.setBounds(indicatorRect);
                indicator.draw(canvas);
            }
        }
        pos.recycle();
    }

    if (clipToPadding) {
        canvas.restoreToCount(saveCount);
    }
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:76,代码来源:ExpandableListView.java


注:本文中的org.holoeverywhere.widget.ExpandableListConnector.PositionMetadata.recycle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。