本文整理汇总了Java中org.telegram.messenger.support.widget.RecyclerView.LayoutParams.getViewLayoutPosition方法的典型用法代码示例。如果您正苦于以下问题:Java LayoutParams.getViewLayoutPosition方法的具体用法?Java LayoutParams.getViewLayoutPosition怎么用?Java LayoutParams.getViewLayoutPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.telegram.messenger.support.widget.RecyclerView.LayoutParams
的用法示例。
在下文中一共展示了LayoutParams.getViewLayoutPosition方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: nextViewFromScrapList
import org.telegram.messenger.support.widget.RecyclerView.LayoutParams; //导入方法依赖的package包/类
/**
* Returns the next item from the scrap list.
* <p>
* Upon finding a valid VH, sets current item position to VH.itemPosition + mItemDirection
*
* @return View if an item in the current position or direction exists if not null.
*/
private View nextViewFromScrapList() {
final int size = mScrapList.size();
for (int i = 0; i < size; i++) {
final View view = mScrapList.get(i).itemView;
final LayoutParams lp = (LayoutParams) view.getLayoutParams();
if (lp.isItemRemoved()) {
continue;
}
if (mCurrentPosition == lp.getViewLayoutPosition()) {
assignPositionFromScrapList(view);
return view;
}
}
return null;
}
示例2: nextViewInLimitedList
import org.telegram.messenger.support.widget.RecyclerView.LayoutParams; //导入方法依赖的package包/类
public View nextViewInLimitedList(View ignore) {
int size = mScrapList.size();
View closest = null;
int closestDistance = Integer.MAX_VALUE;
if (DEBUG && mIsPreLayout) {
throw new IllegalStateException("Scrap list cannot be used in pre layout");
}
for (int i = 0; i < size; i++) {
View view = mScrapList.get(i).itemView;
final LayoutParams lp = (LayoutParams) view.getLayoutParams();
if (view == ignore || lp.isItemRemoved()) {
continue;
}
final int distance = (lp.getViewLayoutPosition() - mCurrentPosition) *
mItemDirection;
if (distance < 0) {
continue; // item is not in current direction
}
if (distance < closestDistance) {
closest = view;
closestDistance = distance;
if (distance == 0) {
break;
}
}
}
return closest;
}
示例3: isViewValidAsAnchor
import org.telegram.messenger.support.widget.RecyclerView.LayoutParams; //导入方法依赖的package包/类
private boolean isViewValidAsAnchor(View child, RecyclerView.State state) {
LayoutParams lp = (LayoutParams) child.getLayoutParams();
return !lp.isItemRemoved() && lp.getViewLayoutPosition() >= 0
&& lp.getViewLayoutPosition() < state.getItemCount();
}
示例4: isViewValidAsAnchor
import org.telegram.messenger.support.widget.RecyclerView.LayoutParams; //导入方法依赖的package包/类
boolean isViewValidAsAnchor(View child, RecyclerView.State state) {
LayoutParams lp = (LayoutParams) child.getLayoutParams();
return !lp.isItemRemoved() && lp.getViewLayoutPosition() >= 0
&& lp.getViewLayoutPosition() < state.getItemCount();
}