Java Code Examples for android.support.v7.widget.ViewUtils

The following examples show how to use android.support.v7.widget.ViewUtils. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: ImitateTaobaoApp   Source File: HotFragment.java    License: Apache License 2.0 4 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View view= inflater.inflate(R.layout.fragment_hot,container,false);

    mRecyclerView = (RecyclerView) view.findViewById(R.id.recyclerview_hot);

    mRefreshLayout = (MaterialRefreshLayout) view.findViewById(R.id.refresh_view);


    com.lidroid.xutils.ViewUtils.inject(view);

    initRefreshLayout();
    getData();
    return view ;
}
 
Example 2
Source Project: BottomSheetPickers   Source File: TimePickerPadLayout.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
    final int paddingLeft = getPaddingLeft();
    final int paddingRight = getPaddingRight();
    final int paddingTop = getPaddingTop();
    final int paddingBottom = getPaddingBottom();

    final boolean isRTL = ViewUtils.isLayoutRtl(this);
    final int columnWidth =
            Math.round((float) (right - left - paddingLeft - paddingRight)) / mColumnCount;
    final int rowHeight =
            Math.round((float) (bottom - top - paddingTop - paddingBottom)) / mRowCount;

    int rowIndex = 0, columnIndex = 0;
    for (int childIndex = 0; childIndex < getChildCount(); ++childIndex) {
        final View childView = getChildAt(childIndex);
        if (childView.getVisibility() == View.GONE) {
            continue;
        }

        final MarginLayoutParams lp = (MarginLayoutParams) childView.getLayoutParams();

        final int childTop = paddingTop + lp.topMargin + rowIndex * rowHeight;
        final int childBottom = childTop - lp.topMargin - lp.bottomMargin + rowHeight;
        final int childLeft = paddingLeft + lp.leftMargin +
                (isRTL ? (mColumnCount - 1) - columnIndex : columnIndex) * columnWidth;
        final int childRight = childLeft - lp.leftMargin - lp.rightMargin + columnWidth;

        final int childWidth = childRight - childLeft;
        final int childHeight = childBottom - childTop;
        if (childWidth != childView.getMeasuredWidth() ||
                childHeight != childView.getMeasuredHeight()) {
            childView.measure(
                    MeasureSpec.makeMeasureSpec(childWidth, MeasureSpec.EXACTLY),
                    MeasureSpec.makeMeasureSpec(childHeight, MeasureSpec.EXACTLY));
        }
        childView.layout(childLeft, childTop, childRight, childBottom);

        rowIndex = (rowIndex + (columnIndex + 1) / mColumnCount) % mRowCount;
        columnIndex = (columnIndex + 1) % mColumnCount;
    }
}
 
Example 3
Source Project: android-md-core   Source File: MdCheckBox.java    License: Apache License 2.0 4 votes vote down vote up
private boolean isLayoutRtl() {
  return ViewUtils.isLayoutRtl(this);
}