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


Java OrientationHelper.getStartAfterPadding方法代码示例

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


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

示例1: cacheReferenceLineAndClear

import android.support.v7.widget.OrientationHelper; //导入方法依赖的package包/类
void cacheReferenceLineAndClear(boolean reverseLayout, int offset, OrientationHelper helper) {
    int reference;
    if (reverseLayout) {
        reference = getEndLine(helper);
    } else {
        reference = getStartLine(helper);
    }
    clear();
    if (reference == INVALID_LINE) {
        return;
    }
    if ((reverseLayout && reference < helper.getEndAfterPadding()) ||
            (!reverseLayout && reference > helper.getStartAfterPadding())) {
        // return;
    }
    if (offset != INVALID_OFFSET) {
        reference += offset;
    }
    mCachedStart = mCachedEnd = reference;
    mLastEdgeStart = mLastEdgeEnd = INVALID_LINE;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:StaggeredGridLayoutHelper.java

示例2: findOneVisibleChild

import android.support.v7.widget.OrientationHelper; //导入方法依赖的package包/类
private View findOneVisibleChild(int fromIndex, int toIndex, boolean completelyVisible,
                                 boolean acceptPartiallyVisible) {
    OrientationHelper helper;
    if (layoutManager.canScrollVertically()) {
        helper = OrientationHelper.createVerticalHelper(layoutManager);
    } else {
        helper = OrientationHelper.createHorizontalHelper(layoutManager);
    }

    final int start = helper.getStartAfterPadding();
    final int end = helper.getEndAfterPadding();
    final int next = toIndex > fromIndex ? 1 : -1;
    View partiallyVisible = null;
    for (int i = fromIndex; i != toIndex; i += next) {
        final View child = layoutManager.getChildAt(i);
        final int childStart = helper.getDecoratedStart(child);
        final int childEnd = helper.getDecoratedEnd(child);
        if (childStart < end && childEnd > start) {
            if (completelyVisible) {
                if (childStart >= start && childEnd <= end) {
                    return child;
                } else if (acceptPartiallyVisible && partiallyVisible == null) {
                    partiallyVisible = child;
                }
            } else {
                return child;
            }
        }
    }
    return partiallyVisible;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:32,代码来源:RecyclerViewPositionHelper.java

示例3: distanceToStart

import android.support.v7.widget.OrientationHelper; //导入方法依赖的package包/类
private int distanceToStart(View targetView, OrientationHelper helper, boolean fromEnd) {
    if (isRtlHorizontal && !fromEnd) {
        return distanceToEnd(targetView, helper, true);
    }

    return helper.getDecoratedStart(targetView) - helper.getStartAfterPadding();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:GravityDelegate.java

示例4: distanceToStart

import android.support.v7.widget.OrientationHelper; //导入方法依赖的package包/类
private int distanceToStart(View targetView, OrientationHelper helper, boolean fromEnd) {
    if (mIsRtlHorizontal && !fromEnd) {
        return distanceToEnd(targetView, helper, true);
    }

    return helper.getDecoratedStart(targetView) - helper.getStartAfterPadding();
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:8,代码来源:GravitySnapHelper.java

示例5: findCenterView

import android.support.v7.widget.OrientationHelper; //导入方法依赖的package包/类
/**
 * Return the child view that is currently closest to the center of this parent.
 *
 * @param layoutManager The {@link RecyclerView.LayoutManager} associated with the attached
 *                      {@link RecyclerView}.
 * @param helper        The relevant {@link OrientationHelper} for the attached {@link RecyclerView}.
 * @return the child view that is currently closest to the center of this parent.
 */
@Nullable
private View findCenterView(RecyclerView.LayoutManager layoutManager,
                            OrientationHelper helper) {
    int childCount = layoutManager.getChildCount();
    if (childCount == 0) {
        return null;
    }

    View closestChild = null;
    final int center;
    if (layoutManager.getClipToPadding()) {
        center = helper.getStartAfterPadding() + helper.getTotalSpace() / 2;
    } else {
        center = helper.getEnd() / 2;
    }
    int absClosest = Integer.MAX_VALUE;

    for (int i = 0; i < childCount; i++) {
        final View child = layoutManager.getChildAt(i);
        final int childMonthIndex = layoutManager.getPosition(child) % ITEM_PER_MONTH;
        if (childMonthIndex != ITEM_PER_MONTH / 2) {
            i += ITEM_PER_MONTH * (childMonthIndex > ITEM_PER_MONTH / 2 ? 1.5f : 0.5f) - childMonthIndex - 1;
            continue;
        }
        int childCenter = helper.getDecoratedStart(child)
                + (helper.getDecoratedMeasurement(child) / 2);
        int absDistance = Math.abs(childCenter - center);

        // if child center is closer than previous closest, set it as closest
        if (absDistance < absClosest) {
            absClosest = absDistance;
            closestChild = child;
        }
    }
    return closestChild;
}
 
开发者ID:thaihuynhxyz,项目名称:recycler-view-calendar,代码行数:45,代码来源:CalendarSnapHelper.java

示例6: findOneVisibleChild

import android.support.v7.widget.OrientationHelper; //导入方法依赖的package包/类
View findOneVisibleChild(int fromIndex, int toIndex, boolean completelyVisible,
                         boolean acceptPartiallyVisible) {
    OrientationHelper helper;
    if (layoutManager.canScrollVertically()) {
        helper = OrientationHelper.createVerticalHelper(layoutManager);
    } else {
        helper = OrientationHelper.createHorizontalHelper(layoutManager);
    }

    final int start = helper.getStartAfterPadding();
    final int end = helper.getEndAfterPadding();
    final int next = toIndex > fromIndex ? 1 : -1;
    View partiallyVisible = null;
    for (int i = fromIndex; i != toIndex; i += next) {
        final View child = layoutManager.getChildAt(i);
        final int childStart = helper.getDecoratedStart(child);
        final int childEnd = helper.getDecoratedEnd(child);
        if (childStart < end && childEnd > start) {
            if (completelyVisible) {
                if (childStart >= start && childEnd <= end) {
                    return child;
                } else if (acceptPartiallyVisible && partiallyVisible == null) {
                    partiallyVisible = child;
                }
            } else {
                return child;
            }
        }
    }
    return partiallyVisible;
}
 
开发者ID:NICOLITE,项目名称:HutHelper,代码行数:32,代码来源:RecycleViewPositonHelper.java

示例7: findOneVisibleChild

import android.support.v7.widget.OrientationHelper; //导入方法依赖的package包/类
View findOneVisibleChild(int fromIndex, int toIndex, boolean completelyVisible,
                         boolean acceptPartiallyVisible) {
  OrientationHelper helper;
  if (layoutManager.canScrollVertically()) {
    helper = OrientationHelper.createVerticalHelper(layoutManager);
  } else {
    helper = OrientationHelper.createHorizontalHelper(layoutManager);
  }

  final int start = helper.getStartAfterPadding();
  final int end = helper.getEndAfterPadding();
  final int next = toIndex > fromIndex ? 1 : -1;
  View partiallyVisible = null;
  for (int i = fromIndex; i != toIndex; i += next) {
    final View child = layoutManager.getChildAt(i);
    final int childStart = helper.getDecoratedStart(child);
    final int childEnd = helper.getDecoratedEnd(child);
    if (childStart < end && childEnd > start) {
      if (completelyVisible) {
        if (childStart >= start && childEnd <= end) {
          return child;
        } else if (acceptPartiallyVisible && partiallyVisible == null) {
          partiallyVisible = child;
        }
      } else {
        return child;
      }
    }
  }
  return partiallyVisible;
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:32,代码来源:RecyclerViewPositionHelper.java

示例8: distanceToStart

import android.support.v7.widget.OrientationHelper; //导入方法依赖的package包/类
private int distanceToStart(View targetView, OrientationHelper helper) {
    return helper.getDecoratedStart(targetView) - helper.getStartAfterPadding();
}
 
开发者ID:hoanganhtuan95ptit,项目名称:EditPhoto,代码行数:4,代码来源:StartSnapHelper.java

示例9: getContainerPosition

import android.support.v7.widget.OrientationHelper; //导入方法依赖的package包/类
@Override
int getContainerPosition(RecyclerView.LayoutManager layoutManager, OrientationHelper helper) {
    return layoutManager.getClipToPadding()
            ? helper.getStartAfterPadding() + helper.getTotalSpace() / 2
            : helper.getEnd() / 2;
}
 
开发者ID:TakuSemba,项目名称:MultiSnapRecyclerView,代码行数:7,代码来源:CenterSnapHelperDelegator.java

示例10: getContainerPosition

import android.support.v7.widget.OrientationHelper; //导入方法依赖的package包/类
@Override
int getContainerPosition(RecyclerView.LayoutManager layoutManager, OrientationHelper helper) {
    return helper.getStartAfterPadding();
}
 
开发者ID:TakuSemba,项目名称:MultiSnapRecyclerView,代码行数:5,代码来源:StartSnapHelperDelegator.java

示例11: getContainerPosition

import android.support.v7.widget.OrientationHelper; //导入方法依赖的package包/类
@Override
int getContainerPosition(RecyclerView.LayoutManager layoutManager, OrientationHelper helper) {
    return layoutManager.getClipToPadding()
            ? helper.getStartAfterPadding() + helper.getTotalSpace()
            : helper.getEnd() - helper.getEndPadding();
}
 
开发者ID:TakuSemba,项目名称:MultiSnapRecyclerView,代码行数:7,代码来源:EndSnapHelperDelegator.java

示例12: distanceToStart

import android.support.v7.widget.OrientationHelper; //导入方法依赖的package包/类
private int distanceToStart(View targetView, OrientationHelper helper) {
  if (mIsRtl) {
    return distanceToEnd(targetView, helper);
  }
  return helper.getDecoratedStart(targetView) - helper.getStartAfterPadding();
}
 
开发者ID:liuguoquan727,项目名称:android-study,代码行数:7,代码来源:GravitySnapHelper.java

示例13: distanceToEnd

import android.support.v7.widget.OrientationHelper; //导入方法依赖的package包/类
private int distanceToEnd(View targetView, OrientationHelper helper) {
  if (mIsRtl) {
    return helper.getDecoratedStart(targetView) - helper.getStartAfterPadding();
  }
  return helper.getDecoratedEnd(targetView) - helper.getEndAfterPadding();
}
 
开发者ID:liuguoquan727,项目名称:android-study,代码行数:7,代码来源:GravitySnapHelper.java

示例14: calculateDistanceCenter

import android.support.v7.widget.OrientationHelper; //导入方法依赖的package包/类
/**
 * @param child
 * @param pendingOffset child view will scroll by
 * @return
 */
private int calculateDistanceCenter(View child, float pendingOffset) {
    OrientationHelper orientationHelper = getOrientationHelper();
    int parentCenter = (orientationHelper.getEndAfterPadding() - orientationHelper.getStartAfterPadding()) / 2 + orientationHelper.getStartAfterPadding();

    return (int) (child.getWidth() / 2 - pendingOffset + child.getLeft() - parentCenter);


}
 
开发者ID:Manuaravind1989,项目名称:InfiniteTabsView,代码行数:14,代码来源:TabLayoutManager.java


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