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


Java FragmentContainerHelper類代碼示例

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


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

示例1: onPageScrolled

import net.lucode.hackware.magicindicator.FragmentContainerHelper; //導入依賴的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

示例2: onPageScrolled

import net.lucode.hackware.magicindicator.FragmentContainerHelper; //導入依賴的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

示例3: onPageScrolled

import net.lucode.hackware.magicindicator.FragmentContainerHelper; //導入依賴的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

示例4: onPageScrolled

import net.lucode.hackware.magicindicator.FragmentContainerHelper; //導入依賴的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

示例5: onPageScrolled

import net.lucode.hackware.magicindicator.FragmentContainerHelper; //導入依賴的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

示例6: onPageScrolled

import net.lucode.hackware.magicindicator.FragmentContainerHelper; //導入依賴的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;
    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;
    } else if (mMode == MODE_WRAP_CONTENT) {
        leftX = current.mContentLeft + mXOffset;
        nextLeftX = next.mContentLeft + mXOffset;
        rightX = current.mContentRight - mXOffset;
        nextRightX = next.mContentRight - mXOffset;
    } else {    // MODE_EXACTLY
        leftX = current.mLeft + (current.width() - mLineWidth) / 2;
        nextLeftX = next.mLeft + (next.width() - mLineWidth) / 2;
        rightX = current.mLeft + (current.width() + mLineWidth) / 2;
        nextRightX = next.mLeft + (next.width() + mLineWidth) / 2;
    }

    mLineRect.left = leftX + (nextLeftX - leftX) * mStartInterpolator.getInterpolation(positionOffset);
    mLineRect.right = rightX + (nextRightX - rightX) * mEndInterpolator.getInterpolation(positionOffset);
    mLineRect.top = getHeight() - mLineHeight - mYOffset;
    mLineRect.bottom = getHeight() - mYOffset;

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


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