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


Java PagerAdapter.POSITION_NONE属性代码示例

本文整理汇总了Java中android.support.v4.view.PagerAdapter.POSITION_NONE属性的典型用法代码示例。如果您正苦于以下问题:Java PagerAdapter.POSITION_NONE属性的具体用法?Java PagerAdapter.POSITION_NONE怎么用?Java PagerAdapter.POSITION_NONE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.support.v4.view.PagerAdapter的用法示例。


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

示例1: getItemPosition

@Override
public int getItemPosition(Object object) {
    //这是ViewPager适配器的特点,有两个值 POSITION_NONE,POSITION_UNCHANGED,默认就是POSITION_UNCHANGED,
    // 表示数据没变化不用更新.notifyDataChange的时候重新调用getViewForPage
    return PagerAdapter.POSITION_NONE;
}
 
开发者ID:snowwolf10285,项目名称:PicShow-zhaipin,代码行数:6,代码来源:PhotoDetailAdapter.java

示例2: getItemPosition

public int getItemPosition(Object object) {
    return PagerAdapter.POSITION_NONE;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:3,代码来源:VtexPagerAdapter.java

示例3: getItemPosition

@Override
public int getItemPosition(Object object) {
    return PagerAdapter.POSITION_NONE;
}
 
开发者ID:Kelvin65535,项目名称:Android_Songshuhui,代码行数:4,代码来源:SlidingTabLayout.java

示例4: dataSetChanged

void dataSetChanged() {
    // This method only gets called if our observer is attached, so mAdapter is non-null.

    final int adapterCount = mAdapter.getCount();
    mExpectedAdapterCount = adapterCount;
    boolean needPopulate = mItems.size() < mOffscreenPageLimit * 2 + 1
            && mItems.size() < adapterCount;
    int newCurrItem = mCurItem;

    boolean isUpdating = false;
    for (int i = 0; i < mItems.size(); i++) {
        final YViewPagerOrigin.ItemInfo ii = mItems.get(i);
        final int newPos = mAdapter.getItemPosition(ii.object);

        if (newPos == PagerAdapter.POSITION_UNCHANGED) {
            continue;
        }

        if (newPos == PagerAdapter.POSITION_NONE) {
            mItems.remove(i);
            i--;

            if (!isUpdating) {
                mAdapter.startUpdate(this);
                isUpdating = true;
            }

            mAdapter.destroyItem(this, ii.position, ii.object);
            needPopulate = true;

            if (mCurItem == ii.position) {
                // Keep the current item in the valid range
                newCurrItem = Math.max(0, Math.min(mCurItem, adapterCount - 1));
                needPopulate = true;
            }
            continue;
        }

        if (ii.position != newPos) {
            if (ii.position == mCurItem) {
                // Our current item changed position. Follow it.
                newCurrItem = newPos;
            }

            ii.position = newPos;
            needPopulate = true;
        }
    }

    if (isUpdating) {
        mAdapter.finishUpdate(this);
    }

    Collections.sort(mItems, COMPARATOR);

    if (needPopulate) {
        // Reset our known page widths; populate will recompute them.
        final int childCount = getChildCount();
        for (int i = 0; i < childCount; i++) {
            final View child = getChildAt(i);
            final YViewPagerOrigin.LayoutParams lp = (YViewPagerOrigin.LayoutParams) child.getLayoutParams();
            if (!lp.isDecor) {
                lp.widthFactor = 0.f;
            }
        }
        if (isVertical) {
            setCurrentItemInternalVertical(newCurrItem, false, true);
        } else {
            setCurrentItemInternalHorizontal(newCurrItem, false, true);
        }
        requestLayout();
    }
}
 
开发者ID:youngkaaa,项目名称:YViewPagerDemo,代码行数:73,代码来源:YViewPagerOrigin.java

示例5: dataSetChanged

void dataSetChanged() {
    // This method only gets called if our observer is attached, so mAdapter is non-null.

    final int adapterCount = mAdapter.getCount();
    mExpectedAdapterCount = adapterCount;
    boolean needPopulate = mItems.size() < mOffscreenPageLimit * 2 + 1 &&
            mItems.size() < adapterCount;
    int newCurrItem = mCurItem;

    boolean isUpdating = false;
    for (int i = 0; i < mItems.size(); i++) {
        final ItemInfo ii = mItems.get(i);
        final int newPos = mAdapter.getItemPosition(ii.object);

        if (newPos == PagerAdapter.POSITION_UNCHANGED) {
            continue;
        }

        if (newPos == PagerAdapter.POSITION_NONE) {
            mItems.remove(i);
            i--;

            if (!isUpdating) {
                mAdapter.startUpdate(this);
                isUpdating = true;
            }

            mAdapter.destroyItem(this, ii.position, ii.object);
            needPopulate = true;

            if (mCurItem == ii.position) {
                // Keep the current item in the valid range
                newCurrItem = Math.max(0, Math.min(mCurItem, adapterCount - 1));
                needPopulate = true;
            }
            continue;
        }

        if (ii.position != newPos) {
            if (ii.position == mCurItem) {
                // Our current item changed position. Follow it.
                newCurrItem = newPos;
            }

            ii.position = newPos;
            needPopulate = true;
        }
    }

    if (isUpdating) {
        mAdapter.finishUpdate(this);
    }

    Collections.sort(mItems, COMPARATOR);

    if (needPopulate) {
        // Reset our known page widths; populate will recompute them.
        final int childCount = getChildCount();
        for (int i = 0; i < childCount; i++) {
            final View child = getChildAt(i);
            final LayoutParams lp = (LayoutParams) child.getLayoutParams();
            if (!lp.isDecor) {
                lp.heightFactor = 0.f;
            }
        }

        setCurrentItemInternal(newCurrItem, false, true);
        requestLayout();
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:70,代码来源:VerticalViewPager.java

示例6: dataSetChanged

void dataSetChanged() {
    // This method only gets called if our observer is attached, so mAdapter is non-null.

    final int adapterCount = mAdapter.getCount();
    mExpectedAdapterCount = adapterCount;
    boolean needPopulate = mItems.size() < mOffscreenPageLimit * 2 + 1 &&
            mItems.size() < adapterCount;
    int newCurrItem = mCurItem;

    boolean isUpdating = false;
    for (int i = 0; i < mItems.size(); i++) {
        final ItemInfo ii = mItems.get(i);
        final int newPos = mAdapter.getItemPosition(ii.object);

        if (newPos == PagerAdapter.POSITION_UNCHANGED) {
            continue;
        }

        if (newPos == PagerAdapter.POSITION_NONE) {
            mItems.remove(i);
            i--;

            if (!isUpdating) {
                mAdapter.startUpdate(this);
                isUpdating = true;
            }

            mAdapter.destroyItem(this, ii.position, ii.object);
            needPopulate = true;

            if (mCurItem == ii.position) {
                // Keep the current item in the valid range
                newCurrItem = Math.max(0, Math.min(mCurItem, adapterCount - 1));
                needPopulate = true;
            }
            continue;
        }

        if (ii.position != newPos) {
            if (ii.position == mCurItem) {
                // Our current item changed position. Follow it.
                newCurrItem = newPos;
            }

            ii.position = newPos;
            needPopulate = true;
        }
    }

    if (isUpdating) {
        mAdapter.finishUpdate(this);
    }

    Collections.sort(mItems, COMPARATOR);

    if (needPopulate) {
        // Reset our known page widths; populate will recompute them.
        final int childCount = getChildCount();
        for (int i = 0; i < childCount; i++) {
            final View child = getChildAt(i);
            final LayoutParams lp = (LayoutParams) child.getLayoutParams();
            if (!lp.isDecor) {
                if (isHorizontal()) {
                    lp.widthFactor = 0.f;
                } else {
                    lp.heightFactor = 0.f;
                }
            }
        }

        setCurrentItemInternal(newCurrItem, false, true);
        requestLayout();
    }
}
 
开发者ID:ynztlxdeai,项目名称:TextReader,代码行数:74,代码来源:DirectionalViewpager.java

示例7: getItemPosition

@Override
public int getItemPosition(Object object) {
	// TODO Auto-generated method stub
	return PagerAdapter.POSITION_NONE;
}
 
开发者ID:yun2win,项目名称:tvConnect_android,代码行数:5,代码来源:ImageFragementPagerAdapter.java

示例8: dataSetChanged

void dataSetChanged() {
        // This method only gets called if our observer is attached, so mAdapter is non-null.

        final int adapterCount = getAdapterCount();
        mExpectedAdapterCount = adapterCount;
        boolean needPopulate = mItems.size() < mOffscreenPageLimit * 2 + 1
                && mItems.size() < adapterCount;
        int newCurrItem = mCurItem;

        boolean isUpdating = false;
        for (int i = 0; i < mItems.size(); i++) {
            final YViewPagerNew.ItemInfo ii = mItems.get(i);
            final int newPos = mAdapter.getItemPosition(ii.object);

            if (newPos == PagerAdapter.POSITION_UNCHANGED) {
                continue;
            }

            if (newPos ==PagerAdapter.POSITION_NONE) {
                mItems.remove(i);
                i--;

                if (!isUpdating) {
                    mAdapter.startUpdate(this);
                    isUpdating = true;
                }

                mAdapter.destroyItem(this, ii.position, ii.object);
                needPopulate = true;

                if (mCurItem == ii.position) {
                    // Keep the current item in the valid range
                    newCurrItem = Math.max(0, Math.min(mCurItem, adapterCount - 1));
                    needPopulate = true;
                }
                continue;
            }

            if (ii.position != newPos) {
                if (ii.position == mCurItem) {
                    // Our current item changed position. Follow it.
                    newCurrItem = newPos;
                }

                ii.position = newPos;
                needPopulate = true;
            }
        }

        if (isUpdating) {
            mAdapter.finishUpdate(this);
        }

        Collections.sort(mItems, COMPARATOR);

        if (needPopulate) {
            // Reset our known page widths; populate will recompute them.
            final int childCount = getChildCount();
            for (int i = 0; i < childCount; i++) {
                final View child = getChildAt(i);
                final YViewPagerNew.LayoutParams lp = (YViewPagerNew.LayoutParams) child.getLayoutParams();
                if (!lp.isDecor) {
                    setFieldValue(lp,"widthFactor",0.f);
//                    lp.widthFactor = 0.f;
                }
            }
            if (isVertical) {
                setCurrentItemInternalVertical(newCurrItem, false, true);
            } else {
                setCurrentItemInternalHorizontal(newCurrItem, false, true);
            }
            requestLayout();
        }
    }
 
开发者ID:youngkaaa,项目名称:YViewPagerDemo,代码行数:74,代码来源:YViewPagerNew.java

示例9: getItemPosition

@Override
public int getItemPosition(Object object) {
    // FragmentPagerAdapter 的坑,notifyDataChanged不刷新的问题,fucking
    // 两个值: 1. POSITION_UNCHANGED, 2. POSITION_NONE, todo read source[ F4 查看某个抽象类的实现者 ]
    return PagerAdapter.POSITION_NONE;
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:6,代码来源:BaseViewPagerAdapter.java

示例10: getItemPosition

@Override public int getItemPosition(Object object) {
    return PagerAdapter.POSITION_NONE;
}
 
开发者ID:wuhighway,项目名称:DailyStudy,代码行数:3,代码来源:ImagePagerAdapter.java


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