Search in sources :

Example 61 with Recycler

use of android.support.v7.widget.RecyclerView.Recycler in project iNGAGE by davis123123.

the class RecentCommentsFragment method crossFadeRecyler.

private void crossFadeRecyler() {
    adapter = new RecentCommentsAdapter(getContext());
    recycler = (RecyclerView) rootView.findViewById(R.id.rvRecentComments);
    final LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
    recycler.setLayoutManager(layoutManager);
    recycler.setAdapter(adapter);
    for (int i = 0; i < UserProfileActivity.recentComments.size(); i++) {
        // Log.i("STATE", "recent comment : " + UserProfileActivity.recentComments.get(i).thread_title + ", " + UserProfileActivity.recentComments.get(i).recent_comment);
        adapter.add(UserProfileActivity.recentComments.get(i));
    }
    adapter.notifyDataSetChanged();
    // if no recent activities/comments, then show message
    if (adapter.getItemCount() == 0) {
        recycler.setVisibility(View.GONE);
        RelativeLayout rlMessage = (RelativeLayout) rootView.findViewById(R.id.rlMessage);
        rlMessage.setAlpha(0f);
        rlMessage.setVisibility(View.VISIBLE);
        // Animate the content view to 100% opacity, and clear any animation
        // listener set on the view.
        rlMessage.animate().alpha(1f).setDuration(mShortAnimationDuration).setListener(null);
        // Animate the loading view to 0% opacity. After the animation ends,
        // set its visibility to GONE as an optimization step (it won't
        // participate in layout passes, etc.)
        mLoadingView.animate().alpha(0f).setDuration(mShortAnimationDuration).setListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                mLoadingView.setVisibility(View.GONE);
            }
        });
    // ImageView icon = (ImageView) rootView.findViewById(R.id.ivIcon);
    // icon.setColorFilter(getContext().getResources().getColor(R.color.dark_gray));
    } else {
        recycler.setAlpha(0f);
        recycler.setVisibility(View.VISIBLE);
        // Animate the content view to 100% opacity, and clear any animation
        // listener set on the view.
        recycler.animate().alpha(1f).setDuration(mShortAnimationDuration).setListener(null);
    }
    // Animate the loading view to 0% opacity. After the animation ends,
    // set its visibility to GONE as an optimization step (it won't
    // participate in layout passes, etc.)
    mLoadingView.animate().alpha(0f).setDuration(mShortAnimationDuration).setListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            mLoadingView.setVisibility(View.GONE);
        }
    });
}
Also used : Animator(android.animation.Animator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) RelativeLayout(android.widget.RelativeLayout) RecentCommentsAdapter(ingage.ingage20.adapters.RecentCommentsAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 62 with Recycler

use of android.support.v7.widget.RecyclerView.Recycler in project FastDev4Android by jiangqqlmj.

the class CustomLinearLayoutManager method onMeasure.

@Override
public void onMeasure(RecyclerView.Recycler recycler, RecyclerView.State state, int widthSpec, int heightSpec) {
    View view = recycler.getViewForPosition(0);
    if (view != null) {
        measureChild(view, widthSpec, heightSpec);
        int mWidth = View.MeasureSpec.getSize(widthSpec);
        int mHeight = view.getMeasuredHeight();
        setMeasuredDimension(mWidth, mHeight);
    }
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 63 with Recycler

use of android.support.v7.widget.RecyclerView.Recycler in project AwesomeRecyclerView by forceLain.

the class AwesomeLayoutManager method fillUp.

private void fillUp(@Nullable View anchorView, RecyclerView.Recycler recycler) {
    int anchorPos;
    int anchorTop = 0;
    if (anchorView != null) {
        anchorPos = getPosition(anchorView);
        anchorTop = getDecoratedTop(anchorView);
    } else {
        anchorPos = mAnchorPos;
    }
    boolean fillUp = true;
    int pos = anchorPos - 1;
    int viewBottom = anchorTop;
    int viewHeight = (int) (getHeight() * ITEM_HEIGHT_PERCENT);
    final int widthSpec = View.MeasureSpec.makeMeasureSpec(getWidth(), View.MeasureSpec.EXACTLY);
    final int heightSpec = View.MeasureSpec.makeMeasureSpec(getHeight(), View.MeasureSpec.EXACTLY);
    while (fillUp && pos >= 0) {
        View view = viewCache.get(pos);
        if (view == null) {
            view = recycler.getViewForPosition(pos);
            addView(view, 0);
            measureChildWithDecorationsAndMargin(view, widthSpec, heightSpec);
            int decoratedMeasuredWidth = getDecoratedMeasuredWidth(view);
            layoutDecorated(view, 0, viewBottom - viewHeight, decoratedMeasuredWidth, viewBottom);
        } else {
            attachView(view, 0);
            viewCache.remove(pos);
        }
        viewBottom = getDecoratedTop(view);
        fillUp = (viewBottom > 0);
        pos--;
    }
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 64 with Recycler

use of android.support.v7.widget.RecyclerView.Recycler in project AwesomeRecyclerView by forceLain.

the class AwesomeLayoutManager method fillDown.

private void fillDown(@Nullable View anchorView, RecyclerView.Recycler recycler) {
    int anchorPos;
    int anchorTop = 0;
    if (anchorView != null) {
        anchorPos = getPosition(anchorView);
        anchorTop = getDecoratedTop(anchorView);
    } else {
        anchorPos = mAnchorPos;
    }
    int pos = anchorPos;
    boolean fillDown = true;
    int height = getHeight();
    int viewTop = anchorTop;
    int itemCount = getItemCount();
    int viewHeight = (int) (getHeight() * ITEM_HEIGHT_PERCENT);
    final int widthSpec = View.MeasureSpec.makeMeasureSpec(getWidth(), View.MeasureSpec.EXACTLY);
    final int heightSpec = View.MeasureSpec.makeMeasureSpec(getHeight(), View.MeasureSpec.EXACTLY);
    while (fillDown && pos < itemCount) {
        View view = viewCache.get(pos);
        if (view == null) {
            view = recycler.getViewForPosition(pos);
            addView(view);
            measureChildWithDecorationsAndMargin(view, widthSpec, heightSpec);
            int decoratedMeasuredWidth = getDecoratedMeasuredWidth(view);
            layoutDecorated(view, 0, viewTop, decoratedMeasuredWidth, viewTop + viewHeight);
        } else {
            attachView(view);
            viewCache.remove(pos);
        }
        viewTop = getDecoratedBottom(view);
        fillDown = viewTop <= height;
        pos++;
    }
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 65 with Recycler

use of android.support.v7.widget.RecyclerView.Recycler in project Colorful by garretyoder.

the class ColorPickerDialog method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.dialog_colorpicker);
    recycler = ((RecyclerView) findViewById(R.id.colorful_color_picker_recycler));
    toolbar = ((Toolbar) findViewById(R.id.colorful_color_picker_toolbar));
    toolbar.setNavigationOnClickListener(this);
    toolbar.setBackgroundColor(getContext().getResources().getColor(Colorful.getThemeDelegate().getPrimaryColor().getColorRes()));
    toolbar.setTitle(R.string.select_color);
    toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_48px);
    recycler.setLayoutManager(new GridLayoutManager(getContext(), 4));
    ColorPickerAdapter adapter = new ColorPickerAdapter(getContext());
    adapter.setOnItemClickListener(this);
    recycler.setAdapter(adapter);
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) Toolbar(android.support.v7.widget.Toolbar)

Aggregations

RecyclerView (android.support.v7.widget.RecyclerView)108 View (android.view.View)102 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)20 TextView (android.widget.TextView)19 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 Bundle (android.os.Bundle)7 VirtualLayoutManager (com.alibaba.android.vlayout.VirtualLayoutManager)7 SuppressLint (android.annotation.SuppressLint)6 Context (android.content.Context)6 ViewGroup (android.view.ViewGroup)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