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


Java OrientationHelper.HORIZONTAL属性代码示例

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


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

示例1: getItemOffsets

@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
    int spanCount = ((GridLayoutManager) parent.getLayoutManager()).getSpanCount();
    int orientation = ((GridLayoutManager)parent.getLayoutManager()).getOrientation();
    int position = parent.getChildLayoutPosition(view);
    if(orientation == OrientationHelper.VERTICAL && (position + 1) % spanCount == 0) {
        outRect.set(0, 0, 0, mDivider.getIntrinsicHeight());
        return;
    }

    if(orientation == OrientationHelper.HORIZONTAL && (position + 1) % spanCount == 0) {
        outRect.set(0, 0, mDivider.getIntrinsicWidth(), 0);
        return;
    }

    outRect.set(0, 0, mDivider.getIntrinsicWidth(), mDivider.getIntrinsicHeight());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:MDGridRvDividerDecoration.java

示例2: onScrollStateChanged

@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
    //Fix for bug with bottom selection bar and different month item height in horizontal mode (different count of weeks)
    View view = rvMonths.getLayoutManager().findViewByPosition(getFirstVisiblePosition(rvMonths.getLayoutManager()));
    if (view != null) {
        view.requestLayout();
    }

    if (getCalendarOrientation() == OrientationHelper.HORIZONTAL) {
        multipleSelectionBarAdapter.notifyDataSetChanged();

        //Hide navigation buttons
        boolean show = newState != RecyclerView.SCROLL_STATE_DRAGGING;
        ivPrevious.setVisibility(show ? View.VISIBLE : View.GONE);
        ivNext.setVisibility(show ? View.VISIBLE : View.GONE);
    }

    super.onScrollStateChanged(recyclerView, newState);
}
 
开发者ID:ApplikeySolutions,项目名称:CosmoCalendar,代码行数:19,代码来源:CalendarView.java

示例3: getItemOffsets

@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
    if(OrientationHelper.HORIZONTAL==orientation){
        outRect.set(0, 0, mDivider.getIntrinsicWidth(), 0);
    }else {
        outRect.set(0, 0, 0, mDivider.getIntrinsicHeight());
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:AdvanceDecoration.java

示例4: getOrientation

/**
 * Finds the layout orientation of the RecyclerView, no matter which LayoutManager is in use.
 *
 * @param layoutManager the LayoutManager instance in use by the RV
 * @return one of {@link OrientationHelper#HORIZONTAL}, {@link OrientationHelper#VERTICAL}
 */
public static int getOrientation(RecyclerView.LayoutManager layoutManager) {
	if (layoutManager instanceof LinearLayoutManager) {
		return ((LinearLayoutManager) layoutManager).getOrientation();
	} else if (layoutManager instanceof StaggeredGridLayoutManager) {
		return ((StaggeredGridLayoutManager) layoutManager).getOrientation();
	}
	return OrientationHelper.HORIZONTAL;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:Utils.java

示例5: computeScrollVectorForPosition

/**
 * Controls the direction in which smoothScroll looks for your view
 *
 * @return the vector position
 */
@Override
public PointF computeScrollVectorForPosition(int targetPosition) {
	final int firstChildPos = Utils.findFirstCompletelyVisibleItemPosition(layoutManager);
	final int direction = targetPosition < firstChildPos ? -1 : 1;

	if (Utils.getOrientation(layoutManager) == OrientationHelper.HORIZONTAL) {
		vectorPosition.set(direction, 0);
		return vectorPosition;
	} else {
		vectorPosition.set(0, direction);
		return vectorPosition;
	}
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:TopSnappedSmoothScroller.java

示例6: createComponent

@Override
public Component createComponent(ComponentContext c) {
  final RecyclerBinder imageRecyclerBinder =
      new RecyclerBinder(c, 4.0f, new LinearLayoutInfo(c, OrientationHelper.HORIZONTAL, false));

  for (String image : images) {
    ComponentInfo.Builder imageComponentInfoBuilder = ComponentInfo.create();
    imageComponentInfoBuilder.component(
        PicassoSingleImageComponent.create(c).image(image).fit(true).build());
    imageRecyclerBinder.insertItemAt(imageRecyclerBinder.getItemCount(),
        imageComponentInfoBuilder.build());
  }

  return FeedItemCard.create(c).artist(this).binder(imageRecyclerBinder).build();
}
 
开发者ID:charbgr,项目名称:litho-picasso,代码行数:15,代码来源:PicassoArtist.java

示例7: onCreateViewHolder

@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    int layoutResId = R.layout.item_one;
    RecyclerView.LayoutManager layoutManager = ((RecyclerView) parent).getLayoutManager();
    if (layoutManager instanceof LinearLayoutManager) {
        LinearLayoutManager manager = (LinearLayoutManager) layoutManager;
        if (manager.getOrientation() == OrientationHelper.HORIZONTAL) {
            layoutResId = R.layout.item_two;
        }
    }
    View view = mInflater.inflate(layoutResId, parent, false);
    return new TextViewHolder(view);
}
 
开发者ID:dkzwm,项目名称:ItemDecorations,代码行数:13,代码来源:NumberedAdapter.java

示例8: needToShowSelectedDaysRange

/**
 * Defines do we need to show range of selected days in bottom selection bar
 *
 * @return
 */
private boolean needToShowSelectedDaysRange() {
    if (getCalendarOrientation() == OrientationHelper.HORIZONTAL && getSelectionType() == SelectionType.RANGE) {
        if (selectionManager instanceof RangeSelectionManager) {
            if (((RangeSelectionManager) selectionManager).getDays() != null) {
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:ApplikeySolutions,项目名称:CosmoCalendar,代码行数:15,代码来源:CalendarView.java

示例9: UIDivider

public UIDivider(Context context, int orientation, int dividerColor, Drawable dividerDrawable,
                 int dividerWidth,int marginLeft,int marginRight) {
    if (orientation != OrientationHelper.HORIZONTAL && orientation !=OrientationHelper.VERTICAL){
        throw new IllegalArgumentException("分割线 方向出错");
    }
    if (dividerWidth <0)
        throw new IllegalArgumentException("分割线 尺寸出错");
    mOrientation = orientation;
    mDividerColor = dividerColor;
    mDividerDrawable = dividerDrawable;
    mDividerWidth = dividerWidth;
    mMarginLeft = marginLeft;
    mMarginRight = marginRight;
    initPaint();
}
 
开发者ID:Wilshion,项目名称:HeadlineNews,代码行数:15,代码来源:UIDivider.java

示例10: onDraw

@Override
public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
   if (mOrientation == OrientationHelper.HORIZONTAL){
       drawHorizontal(c,parent);
   }else {
       drawVertical(c,parent); 
   }
}
 
开发者ID:Wilshion,项目名称:HeadlineNews,代码行数:8,代码来源:UIDivider.java

示例11: onDraw

@Override
public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
    // 绘制间隔,每一个item,绘制右边和下方间隔样式
    int childCount = parent.getChildCount();
    int spanCount = ((GridLayoutManager)parent.getLayoutManager()).getSpanCount();
    int orientation = ((GridLayoutManager)parent.getLayoutManager()).getOrientation();
    boolean isDrawHorizontalDivider = true;
    boolean isDrawVerticalDivider = true;
    int extra = childCount % spanCount;
    extra = extra == 0 ? spanCount : extra;
    for(int i = 0; i < childCount; i++) {
        isDrawVerticalDivider = true;
        isDrawHorizontalDivider = true;
        // 如果是竖直方向,最右边一列不绘制竖直方向的间隔
        if(orientation == OrientationHelper.VERTICAL && (i + 1) % spanCount == 0) {
            isDrawVerticalDivider = false;
        }

        // 如果是竖直方向,最后一行不绘制水平方向间隔
        if(orientation == OrientationHelper.VERTICAL && i >= childCount - extra) {
            isDrawHorizontalDivider = false;
        }

        // 如果是水平方向,最下面一行不绘制水平方向的间隔
        if(orientation == OrientationHelper.HORIZONTAL && (i + 1) % spanCount == 0) {
            isDrawHorizontalDivider = false;
        }

        // 如果是水平方向,最后一列不绘制竖直方向间隔
        if(orientation == OrientationHelper.HORIZONTAL && i >= childCount - extra) {
            isDrawVerticalDivider = false;
        }

        if(isDrawHorizontalDivider) {
            drawHorizontalDivider(c, parent, i);
        }

        if(isDrawVerticalDivider) {
            drawVerticalDivider(c, parent, i);
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:42,代码来源:MDGridRvDividerDecoration.java

示例12: translateHeader

private void translateHeader() {
	// Sticky at zero offset (no translation)
	int headerOffsetX = 0, headerOffsetY = 0;
	// Get calculated elevation
	float elevation = mElevation;

	// Search for the position where the next header item is found and translate the new offset
	for (int i = 0; i < mRecyclerView.getChildCount(); i++) {
		final View nextChild = mRecyclerView.getChildAt(i);
		if (nextChild != null) {
			int adapterPos = mRecyclerView.getChildAdapterPosition(nextChild);
			int nextHeaderPosition = getStickyPosition(adapterPos);
			if (mHeaderPosition != nextHeaderPosition) {
				if (Utils.getOrientation(mRecyclerView.getLayoutManager()) == OrientationHelper.HORIZONTAL) {
					if (nextChild.getLeft() > 0) {
						int headerWidth = mStickyHolderLayout.getMeasuredWidth();
						int nextHeaderOffsetX = nextChild.getLeft() - headerWidth;
						headerOffsetX = Math.min(nextHeaderOffsetX, 0);
						// Early remove the elevation/shadow to match with the next view
						if (nextHeaderOffsetX < 5) elevation = 0f;
						if (headerOffsetX < 0) break;
					}
				} else {
					if (nextChild.getTop() > 0) {
						int headerHeight = mStickyHolderLayout.getMeasuredHeight();
						int nextHeaderOffsetY = nextChild.getTop() - headerHeight;
						headerOffsetY = Math.min(nextHeaderOffsetY, 0);
						// Early remove the elevation/shadow to match with the next view
						if (nextHeaderOffsetY < 5) elevation = 0f;
						if (headerOffsetY < 0) break;
					}
				}
			}
		}
	}
	// Apply the user elevation to the sticky container
	ViewCompat.setElevation(mStickyHolderLayout, elevation);
	// Apply translation (pushed up by another header)
	mStickyHolderLayout.setTranslationX(headerOffsetX);
	mStickyHolderLayout.setTranslationY(headerOffsetY);
	//Log.v(TAG, "TranslationX=" + headerOffsetX + " TranslationY=" + headerOffsetY);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:42,代码来源:StickyHeaderHelper.java

示例13: renderContent

private void renderContent(List<HomeSection> sections) {
    sRefresh.setRefreshing(false);
    ComponentInfo.Builder componentInfoBuilder;

    for (HomeSection section : sections) {

        componentInfoBuilder = ComponentInfo.create();

        if (section instanceof SingleBannerSection) {
            componentInfoBuilder
                    .component(
                            SingleBannerComponent
                                    .create(componentContext)
                                    .payload((SingleBannerSection) section)
                                    .key(((SingleBannerSection) section).title())
                                    .build()
                    );
        } else if (section instanceof TripleBannerSection) {

            componentInfoBuilder
                    .component(
                            TripleBannersComponent.create(componentContext)
                                    .payload((TripleBannerSection) section)
                                    .key(((TripleBannerSection) section).title())
                                    .build()
                    );
        } else if (section instanceof ProductSlideSection) {

            final RecyclerBinder productSlideBinder = new RecyclerBinder(componentContext, 4.0f,
                    new LinearLayoutInfo(this, OrientationHelper.HORIZONTAL, false));

            for (Product product : ((ProductSlideSection) section).products()) {
                componentInfoBuilder = ComponentInfo.create();
                componentInfoBuilder
                        .component(
                                ProductComponent.create(componentContext)
                                        .product(product)
                                        .key(product.id())
                                        .build()
                        );
                productSlideBinder.insertItemAt(productSlideBinder.getItemCount(), componentInfoBuilder.build());
            }

            componentInfoBuilder = ComponentInfo.create();
            componentInfoBuilder
                    .component(
                            ProductSlideComponent.create(componentContext)
                                    .title(((ProductSlideSection) section).title())
                                    .recyclerBinder(productSlideBinder)
                                    .key(((ProductSlideSection) section).title())
                                    .build()
                    );
        }
        recyclerBinder.insertItemAt(recyclerBinder.getItemCount(), componentInfoBuilder.build());
    }

    ltView.setComponent(
            HomeListComponent
                    .create(componentContext)
                    .binder(recyclerBinder)
                    .build()
    );
}
 
开发者ID:dbof10,项目名称:redux-observable,代码行数:63,代码来源:HomeActivity.java

示例14: onScrollStateChanged

@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
    switch (newState) {
        case RecyclerView.SCROLL_STATE_DRAGGING:
            // distinct drag to improve accuracy, init mDraggingStart and mDraggingEnd here
            mDragging = true;
            final int[] range = AbstractLayoutManagerUtils.getVisibleRange(recyclerView);
            mDraggingStart = range[0];
            mDraggingEnd = range[1];
            break;
        case RecyclerView.SCROLL_STATE_SETTLING:
            mDragging = false;
            break;
        case RecyclerView.SCROLL_STATE_IDLE:
            mDragging = false;

            // perform final update on the range we have ever visited
            updateVisibleRange(recyclerView);
            AbstractLogUtils.e(this, "==>  visible range: [" + mDraggingStart + ", " + mDraggingEnd + "]");
            MeasurableRecyclerViewHelper.notifyMeasurableViewHolderDataRangeChanged(recyclerView, mDraggingStart, mDraggingEnd);

            // reset mDraggingStart and mDraggingEnd here
            mDraggingStart = RecyclerView.NO_POSITION;
            mDraggingEnd = RecyclerView.NO_POSITION;

            final boolean rtl = AbstractUIUtils.isRightToLeft(getRef());
            if (mRtl ^ rtl) {
                /*
                 * [ANDROID-1778]
                 *
                 * immediately flush the statistics if user change between a ltr and rtl language
                 * on the fly; do the check in here for better performance
                 */
                final List<IMeasurableViewHolder> holders =
                        MeasurableRecyclerViewHelper.getViewHolders(recyclerView, IMeasurableViewHolder.class);
                for (IMeasurableViewHolder holder : holders) {
                    holder.flush();
                }

                if (AbstractLayoutManagerUtils.getOrientation(recyclerView.getLayoutManager())
                        == OrientationHelper.HORIZONTAL) {
                    AbstractLayoutManagerUtils.setReverseLayout(recyclerView.getLayoutManager(), mRtl);
                }
            }
            break;
        default:
            break;
    }
}
 
开发者ID:Tenor-Inc,项目名称:tenor-android-core,代码行数:49,代码来源:MeasurableOnScrollListener.java

示例15: PrettyItemDecoration

public PrettyItemDecoration()
{
    this(OrientationHelper.HORIZONTAL);
}
 
开发者ID:Ayvytr,项目名称:EasyAndroid,代码行数:4,代码来源:PrettyItemDecoration.java


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