Code Monkey home page Code Monkey logo

circlerecyclerview's Introduction

CircleRecyclerView

the library is a loop RecyclerView, can show some effects when display

screenshot

CircularViewMode

CircularViewMode

ScaleXViewMode & ScaleYViewMode

ScaleXYViewMode

RotateXScaleYViewMode & RotateYScaleXViewMode

RotateXYScaleXYViewMode

NoLoop but CenterForce (setClipPadding(l,t,r,b); setClipChildren(false);)

CircularHorizontalMode

CircularHorizontalMode

usage


mCircleRecyclerView = (CircleRecyclerView) view.findViewById(R.id.circle_rv);
mCircleRecyclerView.setLayoutManager(mLayoutManager);
mCircleRecyclerView.setViewMode(mItemViewMode); // T implements ItemViewMode, after setLayoutManager(manager)
mCircleRecyclerView.setNeedCenterForce(true); // when SCROLL_STATE_IDLE == state, nearly center itemview scroll to center

mCircleRecyclerView.setNeedLoop(true); // default is true

// if setCenterForce(true), can set this callback
mCircleRecyclerView.setOnCenterItemClickListener(new CircleRecyclerView.OnCenterItemClickListener() {
    @Override
    public void onCenterItemClick(View v) {
        Toast.makeText(getContext(), "Center Clicked", Toast.LENGTH_SHORT).show();
    }
});

and if loop is true, the RecyclerView.Adapter need like this:

@Override
public void onBindViewHolder(VH holder, int position) {
    positionData = mDataList.get(position % mDataList.size());
}

@Override
public int getItemCount() {
    return Integer.MAX_VALUE;
}
 

circlerecyclerview's People

Contributors

khrystal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

circlerecyclerview's Issues

Make the view as full circle

Hi @kHRYSTAL

Thank you for your effort and sharing this code, I need to know if there is any way that I can use the view as full circle instead of half circle in HORIZONTAL_CIRCL mode.

How I can achieve that?

App was crashing, if I'm using androidX.

java.lang.NullPointerException: Attempt to read from field 'android.view.View androidx.recyclerview.widget.RecyclerView$ViewHolder.itemView' on a null object reference

issue at Override method-> onLayout()

水平那个圆弧

今天老板让我们做一个水平可以滑动的圆弧找了很久才找到作者的这个裤,然而我下载了看了下非常棒,
,然而公司要求 是 圆弧朝上不是朝下,然而自己不太会修改·所以联系到了作者的 QQ 作者人很好·然后说晚上下班了·加一个上去····

CircularViewRTLMode get selected value

Please let us know how i can get selected value and scoll list on click to next item and code below of
CircularViewRTLMode.

@OverRide
public void applyToView(View v, RecyclerView parent) {
float halfHeight = v.getHeight() * 0.5f;
float parentHalfHeight = parent.getHeight() * 0.5f;
float y = v.getY();
float rot = parentHalfHeight - halfHeight - y;
Log.e("paent", "applyToView:>>"+parent.getChildAdapterPosition(v) );
ViewCompat.setPivotX(v, v.getWidth());
ViewCompat.setPivotY(v, halfHeight);
ViewCompat.setRotation(v, -1 * rot * 0.05f);
ViewCompat.setTranslationX(v, -1 * (float) (-Math.cos(rot * mTranslationRatio * mDegToRad) + 1) * mCircleOffset);

    float scale = 1.0f - Math.abs(parentHalfHeight - halfHeight - y) * mScalingRatio;
    ViewCompat.setScaleX(v, scale);
    ViewCompat.setScaleY(v, scale);
}

ViewCompat.setRotation导致view消失

某些机型,在跳出当前app后回来的时候,view消失了。我设置的是显示三个,只能看到中间的一个了,旁边的两个还存在,就是不见了

Need all images in same height

Hi Dude, your code is perfectly working for me. But I need a small favour from you. particular centre item was in perfect height and the remaining are decreasing the sizes. but I need all are in the same size.

好假

我还真以为是循环呢!2的31次方用的好6

Items not showing

In RotateYScaleXViewMode item not showing on display, mean it's display like blank recyclerview

Cardview not set in center

I have used this. Its demo works fine. When i add card view as items in CircleRecyclerView, its work fine without this line circleRecyclerView.setNeedCenterForce(true);

But i want center card view item event in my project. So i add circleRecyclerView.setNeedCenterForce(true); then its shows error java.lang.NullPointerException: Attempt to invoke virtual method 'float android.view.View.getX()' on a null object reference

I do lots of debug on this. then I find getChildCount() in CircleRecyclerView return null. How to resolve this?

感谢大佬的裤·

今天下午给作者说了下·水平滚动的话·位子 不符合我的需求·结果老大·非常低调的问我需要什么需求·然后说晚上修改一个出来·结果·真的到晚上的时候大佬就修改出来了·非常好用···

CircularViewMode

Is there a way to make CircularViewMode rotate in the left side of the screen instead of right side?

Contineous Scrolling

Hello @kHRYSTAL thanks for this library
I am use in my project some of customization i have done but is there any changes to auto scrolling smoothing
i have tried but its scrolling step by step not smoothing and RV method smooth scroll not working as per name

auto scroll when open app wehn rtl app

hi
i am set android:supportsRtl="false" and tools:replace="android:supportsRtl" in file manifest And when the app opens The recyclerview automatically scrool be and goes to another item And the other does not work properly
what should I do i need to android:supportsRtl="false" and tools:replace="android:supportsRtl" my project

How to show and move to the first item

image
Hello, i used ScaleYMode, i want to set height for item and recyclerview =100dp, my aim was show only one item.
When i opened the app, the recyclerview show the item in position 3 instead of 0.
How to show the item 0 first? Please help me, and thanks for reading

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.