本文整理汇总了Java中android.support.v4.view.ViewPager.SCROLL_STATE_IDLE属性的典型用法代码示例。如果您正苦于以下问题:Java ViewPager.SCROLL_STATE_IDLE属性的具体用法?Java ViewPager.SCROLL_STATE_IDLE怎么用?Java ViewPager.SCROLL_STATE_IDLE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.support.v4.view.ViewPager
的用法示例。
在下文中一共展示了ViewPager.SCROLL_STATE_IDLE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: playAnimation
private void playAnimation() {
if (mViewPagerState == ViewPager.SCROLL_STATE_IDLE) {
Observable.timer(500, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<Long>() {
@Override
public void accept(Long aLong) throws Exception {
if (mViewPagerState == ViewPager.SCROLL_STATE_IDLE) {
if (((float) mAnimator.getAnimatedValue()) == END_VALUE) {
startEnd2StartAnimation();
}
}
}
});
}
}
示例2: onPageSelected
@Override
public void onPageSelected(int position) {
for (int i = 0; i < mTabViews.size(); i++) {
if(i == position){
((TextView)mTabViews.get(i)).setTextColor(mSelectedTabColor);
}else{
((TextView)mTabViews.get(i)).setTextColor(mTabViewDefaultColor);
}
}
if (mScrollState == ViewPager.SCROLL_STATE_IDLE) {
mCurrentPage = position;
mPositionOffset = 0;
invalidate();
mFadeRunnable.run();
}
if (mListener != null) {
mListener.onPageSelected(position);
}
}
示例3: setCurrentItem
@Override
public void setCurrentItem(int item, boolean anim) {
int count = fixedIndicatorView.getCount();
if (count == 0) {
return;
}
if (item < 0) {
item = 0;
} else if (item > count - 1) {
item = count - 1;
}
unScrollPosition = -1;
if (state == ViewPager.SCROLL_STATE_IDLE) {
if (anim) {
animateToTab(item);
} else {
final View tabView = fixedIndicatorView.getChildAt(item);
final int scrollPos = tabView.getLeft() - (getWidth() - tabView.getWidth()) / 2;
scrollTo(scrollPos, 0);
unScrollPosition = item;
}
} else {
}
fixedIndicatorView.setCurrentItem(item, anim);
}
示例4: onPageScrollStateChanged
@Override
public void onPageScrollStateChanged(int state) {
if (state == ViewPager.SCROLL_STATE_IDLE) {
int current = mViewPager.getCurrentItem();
int lastReal = mViewPager.getAdapter().getCount() - 2;
if (current == 0) {
mViewPager.setCurrentItem(lastReal, false);
} else if (current == lastReal + 1) {
mViewPager.setCurrentItem(1, false);
}
}
}
示例5: onPageScrollStateChanged
@Override
public void onPageScrollStateChanged(int state) {
if (state == ViewPager.SCROLL_STATE_IDLE) {
scrollToChild(pager.getCurrentItem(), 0);
}
if (delegatePageListener != null) {
delegatePageListener.onPageScrollStateChanged(state);
}
}
示例6: onPageScrollStateChanged
@Override
public void onPageScrollStateChanged(int state) {
if (state == ViewPager.SCROLL_STATE_IDLE) {
scrollToChild(pager.getCurrentItem(), 0);
}
if (delegatePageListener != null) {
delegatePageListener.onPageScrollStateChanged(state);
}
}
示例7: onPageSelected
@Override
public void onPageSelected(int position) {
if (mScrollState == ViewPager.SCROLL_STATE_IDLE) {
mCurrentPage = position;
invalidate();
}
if (mListener != null) {
mListener.onPageSelected(position);
}
}
示例8: onPageScrollStateChanged
@Override
public void onPageScrollStateChanged(int state) {
if (state == ViewPager.SCROLL_STATE_IDLE) {
updateFolderHSVIndicator(folderStateManagers.get(pager.getCurrentItem()));
updateSize();
}
}
示例9: onPageSelected
@Override
public void onPageSelected(int position) {
if (mScrollState == ViewPager.SCROLL_STATE_IDLE) {
mTabStrip.onViewPagerPageChanged(position, 0f);
scrollToTab(position, 0);
}
for (int i = 0; i < mTabStrip.getChildCount(); i++) {
mTabStrip.getChildAt(i).setSelected(position == i);
}
if (mViewPagerPageChangeListener != null) {
mViewPagerPageChangeListener.onPageSelected(position);
}
}
示例10: callPageScrollStateChanged
public void callPageScrollStateChanged(int state, int viewPageItem) {
if (state == ViewPager.SCROLL_STATE_IDLE) {
if (viewPageItem != mCurrentPosition) {
mCurrentPosition = viewPageItem;
mCurrentPositionOffset = 0;
}
scrollToChild(viewPageItem, 0, false);
}
}
示例11: onPageSelected
@Override
public void onPageSelected(int position) {
if (mScrollState == ViewPager.SCROLL_STATE_IDLE) {
mCurrentPage = position;
mPositionOffset = 0;
invalidate();
mFadeRunnable.run();
}
if (mListener != null) {
mListener.onPageSelected(position);
}
}
示例12: onPageScrollStateChanged
@Override
public void onPageScrollStateChanged(final int state) {
if (state == ViewPager.SCROLL_STATE_IDLE) {//固定状态
mViewPagerState = state;
playAnimation();
} else {//正在滚动
mViewPagerState = state;
playAfterEndAnimation = false;
if (((float) mAnimator.getAnimatedValue()) != END_VALUE) {
startStart2EndAnimation();
}
}
}
示例13: onPageSelected
@Override
public void onPageSelected(int position) {
if (mSnap || mScrollState == ViewPager.SCROLL_STATE_IDLE) {
mCurrentPage = position;
mSnapPage = position;
invalidate();
}
if (mListener != null) {
mListener.onPageSelected(position);
}
}
示例14: onPageScrollStateChanged
@Override
public void onPageScrollStateChanged(int state) {
if (state == ViewPager.SCROLL_STATE_IDLE) {
isDragging = false;
} else {
isDragging = true;
}
}
示例15: onPageSelected
@Override
public void onPageSelected(int position) {
if (scrollState == ViewPager.SCROLL_STATE_IDLE) {
tabStrip.onViewPagerPageChanged(position, 0f);
scrollToTab(position, 0);
}
for (int i = 0, size = tabStrip.getChildCount(); i < size; i++) {
tabStrip.getChildAt(i).setSelected(position == i);
}
if (viewPagerPageChangeListener != null) {
viewPagerPageChangeListener.onPageSelected(position);
}
}