當前位置: 首頁>>代碼示例>>Java>>正文


Java PositionData類代碼示例

本文整理匯總了Java中net.lucode.hackware.magicindicator.buildins.commonnavigator.model.PositionData的典型用法代碼示例。如果您正苦於以下問題:Java PositionData類的具體用法?Java PositionData怎麽用?Java PositionData使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PositionData類屬於net.lucode.hackware.magicindicator.buildins.commonnavigator.model包,在下文中一共展示了PositionData類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getImitativePositionData

import net.lucode.hackware.magicindicator.buildins.commonnavigator.model.PositionData; //導入依賴的package包/類
/**
 * IPagerIndicator支持彈性效果的輔助方法
 *
 * @param positionDataList
 * @param index
 * @return
 */
public static PositionData getImitativePositionData(List<PositionData> positionDataList, int index) {
    if (index >= 0 && index <= positionDataList.size() - 1) { // 越界後,返回假的PositionData
        return positionDataList.get(index);
    } else {
        PositionData result = new PositionData();
        PositionData referenceData;
        int offset;
        if (index < 0) {
            offset = index;
            referenceData = positionDataList.get(0);
        } else {
            offset = index - positionDataList.size() + 1;
            referenceData = positionDataList.get(positionDataList.size() - 1);
        }
        result.mLeft = referenceData.mLeft + offset * referenceData.width();
        result.mTop = referenceData.mTop;
        result.mRight = referenceData.mRight + offset * referenceData.width();
        result.mBottom = referenceData.mBottom;
        result.mContentLeft = referenceData.mContentLeft + offset * referenceData.width();
        result.mContentTop = referenceData.mContentTop;
        result.mContentRight = referenceData.mContentRight + offset * referenceData.width();
        result.mContentBottom = referenceData.mContentBottom;
        return result;
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:33,代碼來源:FragmentContainerHelper.java

示例2: preparePositionData

import net.lucode.hackware.magicindicator.buildins.commonnavigator.model.PositionData; //導入依賴的package包/類
/**
 * 獲取title的位置信息,為打造不同的指示器、各種效果提供可能
 */
private void preparePositionData() {
    mPositionDataList.clear();
    for (int i = 0, j = mNavigatorHelper.getTotalCount(); i < j; i++) {
        PositionData data = new PositionData();
        View v = mTitleContainer.getChildAt(i);
        if (v != null) {
            data.mLeft = v.getLeft();
            data.mTop = v.getTop();
            data.mRight = v.getRight();
            data.mBottom = v.getBottom();
            if (v instanceof IMeasurablePagerTitleView) {
                IMeasurablePagerTitleView view = (IMeasurablePagerTitleView) v;
                data.mContentLeft = view.getContentLeft();
                data.mContentTop = view.getContentTop();
                data.mContentRight = view.getContentRight();
                data.mContentBottom = view.getContentBottom();
            } else {
                data.mContentLeft = data.mLeft;
                data.mContentTop = data.mTop;
                data.mContentRight = data.mRight;
                data.mContentBottom = data.mBottom;
            }
        }
        mPositionDataList.add(data);
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:30,代碼來源:CommonNavigator.java

示例3: onPageScrolled

import net.lucode.hackware.magicindicator.buildins.commonnavigator.model.PositionData; //導入依賴的package包/類
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
    if (mAdapter != null) {

        mNavigatorHelper.onPageScrolled(position, positionOffset, positionOffsetPixels);
        if (mIndicator != null) {
            mIndicator.onPageScrolled(position, positionOffset, positionOffsetPixels);
        }

        // 手指跟隨滾動
        if (mScrollView != null && mPositionDataList.size() > 0 && position >= 0 && position < mPositionDataList.size()) {
            if (mFollowTouch) {
                int currentPosition = Math.min(mPositionDataList.size() - 1, position);
                int nextPosition = Math.min(mPositionDataList.size() - 1, position + 1);
                PositionData current = mPositionDataList.get(currentPosition);
                PositionData next = mPositionDataList.get(nextPosition);
                float scrollTo = current.horizontalCenter() - mScrollView.getWidth() * mScrollPivotX;
                float nextScrollTo = next.horizontalCenter() - mScrollView.getWidth() * mScrollPivotX;
                mScrollView.scrollTo((int) (scrollTo + (nextScrollTo - scrollTo) * positionOffset), 0);
            } else if (!mEnablePivotScroll) {
                // TODO 實現待選中項完全顯示出來
            }
        }
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:26,代碼來源:CommonNavigator.java

示例4: onPageScrolled

import net.lucode.hackware.magicindicator.buildins.commonnavigator.model.PositionData; //導入依賴的package包/類
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
    if (mPositionDataList == null || mPositionDataList.isEmpty()) {
        return;
    }

    // 計算錨點位置
    PositionData current = FragmentContainerHelper.getImitativePositionData(mPositionDataList, position);
    PositionData next = FragmentContainerHelper.getImitativePositionData(mPositionDataList, position + 1);

    mOutRect.left = current.mLeft + (next.mLeft - current.mLeft) * positionOffset;
    mOutRect.top = current.mTop + (next.mTop - current.mTop) * positionOffset;
    mOutRect.right = current.mRight + (next.mRight - current.mRight) * positionOffset;
    mOutRect.bottom = current.mBottom + (next.mBottom - current.mBottom) * positionOffset;

    mInnerRect.left = current.mContentLeft + (next.mContentLeft - current.mContentLeft) * positionOffset;
    mInnerRect.top = current.mContentTop + (next.mContentTop - current.mContentTop) * positionOffset;
    mInnerRect.right = current.mContentRight + (next.mContentRight - current.mContentRight) * positionOffset;
    mInnerRect.bottom = current.mContentBottom + (next.mContentBottom - current.mContentBottom) * positionOffset;

    invalidate();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:23,代碼來源:TestPagerIndicator.java

示例5: onPageScrolled

import net.lucode.hackware.magicindicator.buildins.commonnavigator.model.PositionData; //導入依賴的package包/類
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
    if (mPositionDataList == null || mPositionDataList.isEmpty()) {
        return;
    }

    // 計算錨點位置
    PositionData current = FragmentContainerHelper.getImitativePositionData(mPositionDataList, position);
    PositionData next = FragmentContainerHelper.getImitativePositionData(mPositionDataList, position + 1);

    mRect.left = current.mContentLeft - mHorizontalPadding + (next.mContentLeft - current.mContentLeft) * mEndInterpolator.getInterpolation(positionOffset);
    mRect.top = current.mContentTop - mVerticalPadding;
    mRect.right = current.mContentRight + mHorizontalPadding + (next.mContentRight - current.mContentRight) * mStartInterpolator.getInterpolation(positionOffset);
    mRect.bottom = current.mContentBottom + mVerticalPadding;

    if (!mRoundRadiusSet) {
        mRoundRadius = mRect.height() / 2;
    }

    invalidate();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:22,代碼來源:WrapPagerIndicator.java

示例6: onPageScrolled

import net.lucode.hackware.magicindicator.buildins.commonnavigator.model.PositionData; //導入依賴的package包/類
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
    if (mPositionDataList == null || mPositionDataList.isEmpty()) {
        return;
    }

    // 計算錨點位置
    PositionData current = FragmentContainerHelper.getImitativePositionData(mPositionDataList, position);
    PositionData next = FragmentContainerHelper.getImitativePositionData(mPositionDataList, position + 1);

    float leftX = current.mLeft + (current.mRight - current.mLeft) / 2;
    float rightX = next.mLeft + (next.mRight - next.mLeft) / 2;

    mAnchorX = leftX + (rightX - leftX) * mStartInterpolator.getInterpolation(positionOffset);

    invalidate();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:18,代碼來源:TriangularPagerIndicator.java

示例7: onPageScrolled

import net.lucode.hackware.magicindicator.buildins.commonnavigator.model.PositionData; //導入依賴的package包/類
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
    if (mPositionDataList == null || mPositionDataList.isEmpty()) {
        return;
    }

    // 計算錨點位置
    int currentPosition = Math.min(mPositionDataList.size() - 1, position);
    int nextPosition = Math.min(mPositionDataList.size() - 1, position + 1);
    PositionData current = mPositionDataList.get(currentPosition);
    PositionData next = mPositionDataList.get(nextPosition);

    mOutRect.left = current.mLeft + (next.mLeft - current.mLeft) * positionOffset;
    mOutRect.top = current.mTop + (next.mTop - current.mTop) * positionOffset;
    mOutRect.right = current.mRight + (next.mRight - current.mRight) * positionOffset;
    mOutRect.bottom = current.mBottom + (next.mBottom - current.mBottom) * positionOffset;

    mInnerRect.left = current.mContentLeft + (next.mContentLeft - current.mContentLeft) * positionOffset;
    mInnerRect.top = current.mContentTop + (next.mContentTop - current.mContentTop) * positionOffset;
    mInnerRect.right = current.mContentRight + (next.mContentRight - current.mContentRight) * positionOffset;
    mInnerRect.bottom = current.mContentBottom + (next.mContentBottom - current.mContentBottom) * positionOffset;

    invalidate();
}
 
開發者ID:lizubing1992,項目名稱:Li-MVPArms,代碼行數:25,代碼來源:TestPagerIndicator.java

示例8: onPageScrolled

import net.lucode.hackware.magicindicator.buildins.commonnavigator.model.PositionData; //導入依賴的package包/類
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
    if (mPositionDataList == null || mPositionDataList.isEmpty()) {
        return;
    }

    // 計算錨點位置
    int currentPosition = Math.min(mPositionDataList.size() - 1, position);
    int nextPosition = Math.min(mPositionDataList.size() - 1, position + 1);
    PositionData current = mPositionDataList.get(currentPosition);
    PositionData next = mPositionDataList.get(nextPosition);

    mRect.left = current.mContentLeft - mHorizontalPadding + (next.mContentLeft - current.mContentLeft) * mEndInterpolator.getInterpolation(positionOffset);
    mRect.top = current.mContentTop - mVerticalPadding;
    mRect.right = current.mContentRight + mHorizontalPadding + (next.mContentRight - current.mContentRight) * mStartInterpolator.getInterpolation(positionOffset);
    mRect.bottom = current.mContentBottom + mVerticalPadding;

    if (!mRoundRadiusSet) {
        mRoundRadius = mRect.height() / 2;
    }

    invalidate();
}
 
開發者ID:lizubing1992,項目名稱:Li-MVPArms,代碼行數:24,代碼來源:WrapPagerIndicator.java

示例9: onPageScrolled

import net.lucode.hackware.magicindicator.buildins.commonnavigator.model.PositionData; //導入依賴的package包/類
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
    if (mPositionDataList == null || mPositionDataList.isEmpty()) {
        return;
    }

    // 計算錨點位置
    int currentPosition = Math.min(mPositionDataList.size() - 1, position);
    int nextPosition = Math.min(mPositionDataList.size() - 1, position + 1);
    PositionData current = mPositionDataList.get(currentPosition);
    PositionData next = mPositionDataList.get(nextPosition);

    float leftX = current.mLeft + (current.mRight - current.mLeft) / 2;
    float rightX = next.mLeft + (next.mRight - next.mLeft) / 2;

    mAnchorX = leftX + (rightX - leftX) * mStartInterpolator.getInterpolation(positionOffset);

    invalidate();
}
 
開發者ID:lizubing1992,項目名稱:Li-MVPArms,代碼行數:20,代碼來源:TriangularPagerIndicator.java

示例10: onPageSelected

import net.lucode.hackware.magicindicator.buildins.commonnavigator.model.PositionData; //導入依賴的package包/類
@Override
public void onPageSelected(int position) {
    if (mDataList == null || mDataList.isEmpty()) {
        return;
    }
    PositionData data = mDataList.get(position);
    mCircleCenterX = data.mLeft + data.width() / 2;
    invalidate();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:10,代碼來源:DotPagerIndicator.java

示例11: onSelected

import net.lucode.hackware.magicindicator.buildins.commonnavigator.model.PositionData; //導入依賴的package包/類
@Override
public void onSelected(int index, int totalCount) {
    if (mTitleContainer == null) {
        return;
    }
    View v = mTitleContainer.getChildAt(index);
    if (v instanceof IPagerTitleView) {
        ((IPagerTitleView) v).onSelected(index, totalCount);
    }
    if (!mAdjustMode && !mFollowTouch && mScrollView != null && mPositionDataList.size() > 0) {
        int currentIndex = Math.min(mPositionDataList.size() - 1, index);
        PositionData current = mPositionDataList.get(currentIndex);
        if (mEnablePivotScroll) {
            float scrollTo = current.horizontalCenter() - mScrollView.getWidth() * mScrollPivotX;
            if (mSmoothScroll) {
                mScrollView.smoothScrollTo((int) (scrollTo), 0);
            } else {
                mScrollView.scrollTo((int) (scrollTo), 0);
            }
        } else {
            // 如果當前項被部分遮擋,則滾動顯示完全
            if (mScrollView.getScrollX() > current.mLeft) {
                if (mSmoothScroll) {
                    mScrollView.smoothScrollTo(current.mLeft, 0);
                } else {
                    mScrollView.scrollTo(current.mLeft, 0);
                }
            } else if (mScrollView.getScrollX() + getWidth() < current.mRight) {
                if (mSmoothScroll) {
                    mScrollView.smoothScrollTo(current.mRight - getWidth(), 0);
                } else {
                    mScrollView.scrollTo(current.mRight - getWidth(), 0);
                }
            }
        }
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:38,代碼來源:CommonNavigator.java

示例12: onPageScrolled

import net.lucode.hackware.magicindicator.buildins.commonnavigator.model.PositionData; //導入依賴的package包/類
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
    if (mPositionDataList == null || mPositionDataList.isEmpty()) {
        return;
    }

    // 計算顏色
    if (mColors != null && mColors.size() > 0) {
        int currentColor = mColors.get(Math.abs(position) % mColors.size());
        int nextColor = mColors.get(Math.abs(position + 1) % mColors.size());
        int color = ArgbEvaluatorHolder.eval(positionOffset, currentColor, nextColor);
        mPaint.setColor(color);
    }

    // 計算錨點位置
    PositionData current = FragmentContainerHelper.getImitativePositionData(mPositionDataList, position);
    PositionData next = FragmentContainerHelper.getImitativePositionData(mPositionDataList, position + 1);

    float leftX = current.mLeft + (current.mRight - current.mLeft) / 2;
    float rightX = next.mLeft + (next.mRight - next.mLeft) / 2;

    mLeftCircleX = leftX + (rightX - leftX) * mStartInterpolator.getInterpolation(positionOffset);
    mRightCircleX = leftX + (rightX - leftX) * mEndInterpolator.getInterpolation(positionOffset);
    mLeftCircleRadius = mMaxCircleRadius + (mMinCircleRadius - mMaxCircleRadius) * mEndInterpolator.getInterpolation(positionOffset);
    mRightCircleRadius = mMinCircleRadius + (mMaxCircleRadius - mMinCircleRadius) * mStartInterpolator.getInterpolation(positionOffset);

    invalidate();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:29,代碼來源:BezierPagerIndicator.java

示例13: onPageScrolled

import net.lucode.hackware.magicindicator.buildins.commonnavigator.model.PositionData; //導入依賴的package包/類
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
    if (mPositionDataList == null || mPositionDataList.isEmpty()) {
        return;
    }

    // 計算顏色
    if (mColors != null && mColors.size() > 0) {
        int currentColor = mColors.get(position % mColors.size());
        int nextColor = mColors.get((position + 1) % mColors.size());
        int color = ArgbEvaluatorHolder.eval(positionOffset, currentColor, nextColor);
        mPaint.setColor(color);
    }

    // 計算錨點位置
    int currentPosition = Math.min(mPositionDataList.size() - 1, position);
    int nextPosition = Math.min(mPositionDataList.size() - 1, position + 1);
    PositionData current = mPositionDataList.get(currentPosition);
    PositionData next = mPositionDataList.get(nextPosition);

    float leftX = current.mLeft + (current.mRight - current.mLeft) / 2;
    float rightX = next.mLeft + (next.mRight - next.mLeft) / 2;

    mLeftCircleX = leftX + (rightX - leftX) * mStartInterpolator.getInterpolation(positionOffset);
    mRightCircleX = leftX + (rightX - leftX) * mEndInterpolator.getInterpolation(positionOffset);
    mLeftCircleRadius = mMaxCircleRadius + (mMinCircleRadius - mMaxCircleRadius) * mEndInterpolator.getInterpolation(positionOffset);
    mRightCircleRadius = mMinCircleRadius + (mMaxCircleRadius - mMinCircleRadius) * mStartInterpolator.getInterpolation(positionOffset);

    invalidate();
}
 
開發者ID:lizubing1992,項目名稱:Li-MVPArms,代碼行數:31,代碼來源:BezierPagerIndicator.java

示例14: onPositionDataProvide

import net.lucode.hackware.magicindicator.buildins.commonnavigator.model.PositionData; //導入依賴的package包/類
@Override
public void onPositionDataProvide(List<PositionData> dataList) {
    mDataList = dataList;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:5,代碼來源:DotPagerIndicator.java

示例15: onPageScrolled

import net.lucode.hackware.magicindicator.buildins.commonnavigator.model.PositionData; //導入依賴的package包/類
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
    if (mIndicatorDrawable == null) {
        return;
    }

    if (mPositionDataList == null || mPositionDataList.isEmpty()) {
        return;
    }

    // 計算錨點位置
    PositionData current = FragmentContainerHelper.getImitativePositionData(mPositionDataList, position);
    PositionData next = FragmentContainerHelper.getImitativePositionData(mPositionDataList, position + 1);

    float leftX;
    float nextLeftX;
    float rightX;
    float nextRightX;
    if (mMode == MODE_MATCH_EDGE) {
        leftX = current.mLeft + mXOffset;
        nextLeftX = next.mLeft + mXOffset;
        rightX = current.mRight - mXOffset;
        nextRightX = next.mRight - mXOffset;
        mDrawableRect.top = (int) mYOffset;
        mDrawableRect.bottom = (int) (getHeight() - mYOffset);
    } else if (mMode == MODE_WRAP_CONTENT) {
        leftX = current.mContentLeft + mXOffset;
        nextLeftX = next.mContentLeft + mXOffset;
        rightX = current.mContentRight - mXOffset;
        nextRightX = next.mContentRight - mXOffset;
        mDrawableRect.top = (int) (current.mContentTop - mYOffset);
        mDrawableRect.bottom = (int) (current.mContentBottom + mYOffset);
    } else {    // MODE_EXACTLY
        leftX = current.mLeft + (current.width() - mDrawableWidth) / 2;
        nextLeftX = next.mLeft + (next.width() - mDrawableWidth) / 2;
        rightX = current.mLeft + (current.width() + mDrawableWidth) / 2;
        nextRightX = next.mLeft + (next.width() + mDrawableWidth) / 2;
        mDrawableRect.top = (int) (getHeight() - mDrawableHeight - mYOffset);
        mDrawableRect.bottom = (int) (getHeight() - mYOffset);
    }

    mDrawableRect.left = (int) (leftX + (nextLeftX - leftX) * mStartInterpolator.getInterpolation(positionOffset));
    mDrawableRect.right = (int) (rightX + (nextRightX - rightX) * mEndInterpolator.getInterpolation(positionOffset));
    mIndicatorDrawable.setBounds(mDrawableRect);

    invalidate();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:48,代碼來源:CommonPagerIndicator.java


注:本文中的net.lucode.hackware.magicindicator.buildins.commonnavigator.model.PositionData類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。