Search in sources :

Example 11 with Recycler

use of android.support.v7.widget.RecyclerView.Recycler in project android-parallax-recyclerview by kanytu.

the class HeaderLayoutManagerFixed method onFocusSearchFailed.

@Override
public View onFocusSearchFailed(View focused, int focusDirection, RecyclerView.Recycler recycler, RecyclerView.State state) {
    resolveShouldLayoutReverse();
    if (getChildCount() == 0) {
        return null;
    }
    final int layoutDir = convertFocusDirectionToLayoutDirection(focusDirection);
    if (layoutDir == RenderState.INVALID_LAYOUT) {
        return null;
    }
    final View referenceChild;
    if (layoutDir == RenderState.LAYOUT_START) {
        referenceChild = getChildClosestToStart();
    } else {
        referenceChild = getChildClosestToEnd();
    }
    ensureRenderState();
    final int maxScroll = (int) (MAX_SCROLL_FACTOR * (mOrientationHelper.getEndAfterPadding() - mOrientationHelper.getStartAfterPadding()));
    updateRenderState(layoutDir, maxScroll, false, state);
    mRenderState.mScrollingOffset = RenderState.SCOLLING_OFFSET_NaN;
    fill(recycler, mRenderState, state, true);
    final View nextFocus;
    if (layoutDir == RenderState.LAYOUT_START) {
        nextFocus = getChildClosestToStart();
    } else {
        nextFocus = getChildClosestToEnd();
    }
    if (nextFocus == referenceChild || !nextFocus.isFocusable()) {
        return null;
    }
    return nextFocus;
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 12 with Recycler

use of android.support.v7.widget.RecyclerView.Recycler in project qksms by moezbhatti.

the class WrappingLinearLayoutManager method measureChild.

private void measureChild(RecyclerView.Recycler recycler, int position, int widthSpec, int heightSpec, int[] dimensions) {
    final View child = recycler.getViewForPosition(position);
    final RecyclerView.LayoutParams p = (RecyclerView.LayoutParams) child.getLayoutParams();
    final int hPadding = getPaddingLeft() + getPaddingRight();
    final int vPadding = getPaddingTop() + getPaddingBottom();
    final int hMargin = p.leftMargin + p.rightMargin;
    final int vMargin = p.topMargin + p.bottomMargin;
    final int hDecoration = getRightDecorationWidth(child) + getLeftDecorationWidth(child);
    final int vDecoration = getTopDecorationHeight(child) + getBottomDecorationHeight(child);
    final int childWidthSpec = getChildMeasureSpec(widthSpec, hPadding + hMargin + hDecoration, p.width, canScrollHorizontally());
    final int childHeightSpec = getChildMeasureSpec(heightSpec, vPadding + vMargin + vDecoration, p.height, canScrollVertically());
    child.measure(childWidthSpec, childHeightSpec);
    dimensions[CHILD_WIDTH] = getDecoratedMeasuredWidth(child) + p.leftMargin + p.rightMargin;
    dimensions[CHILD_HEIGHT] = getDecoratedMeasuredHeight(child) + p.bottomMargin + p.topMargin;
    recycler.recycleView(child);
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 13 with Recycler

use of android.support.v7.widget.RecyclerView.Recycler in project mosby by sockeqwe.

the class CountriesActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.countries_list);
    ButterKnife.bind(this);
    // Setup contentView == SwipeRefreshView
    contentView.setOnRefreshListener(this);
    // Setup recycler view
    adapter = new CountriesAdapter(this);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setAdapter(adapter);
    loadData(false);
}
Also used : CountriesAdapter(com.hannesdorfmann.mosby3.sample.mvp.CountriesAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 14 with Recycler

use of android.support.v7.widget.RecyclerView.Recycler in project mosby by sockeqwe.

the class CountriesFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstance) {
    super.onViewCreated(view, savedInstance);
    unbinder = ButterKnife.bind(this, view);
    // Setup contentView == SwipeRefreshView
    contentView.setOnRefreshListener(this);
    // Setup recycler view
    adapter = new CountriesAdapter(getActivity());
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    recyclerView.setAdapter(adapter);
    loadData(false);
}
Also used : CountriesAdapter(com.hannesdorfmann.mosby3.sample.mvp.CountriesAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 15 with Recycler

use of android.support.v7.widget.RecyclerView.Recycler in project mosby by sockeqwe.

the class NotRetainingCountriesFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstance) {
    super.onViewCreated(view, savedInstance);
    unbinder = ButterKnife.bind(this, view);
    // Setup contentView == SwipeRefreshView
    contentView.setOnRefreshListener(this);
    // Setup recycler view
    adapter = new CountriesAdapter(getActivity());
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    recyclerView.setAdapter(adapter);
}
Also used : CountriesAdapter(com.hannesdorfmann.mosby3.sample.mvp.CountriesAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Aggregations

RecyclerView (android.support.v7.widget.RecyclerView)106 View (android.view.View)100 TextView (android.widget.TextView)19 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)15 ImageView (android.widget.ImageView)13 OrientationHelper (android.support.v7.widget.OrientationHelper)12 GridLayoutManager (android.support.v7.widget.GridLayoutManager)10 ViewHolder (android.support.v7.widget.RecyclerView.ViewHolder)10 Point (android.graphics.Point)7 VirtualLayoutManager (com.alibaba.android.vlayout.VirtualLayoutManager)7 SuppressLint (android.annotation.SuppressLint)6 Context (android.content.Context)6 Bundle (android.os.Bundle)6 ActivityManager (android.app.ActivityManager)5 AccessibilityNodeInfoCompat (android.support.v4.view.accessibility.AccessibilityNodeInfoCompat)5 SpanSizeLookup (android.support.v7.widget.GridLayoutManager.SpanSizeLookup)5 LayoutParams (android.support.v7.widget.RecyclerView.LayoutParams)5 Recycler (android.support.v7.widget.RecyclerView.Recycler)5 RecyclerListener (android.support.v7.widget.RecyclerView.RecyclerListener)5 ViewGroup (android.view.ViewGroup)5