Giter VIP home page Giter VIP logo

Comments (16)

rubensousa avatar rubensousa commented on June 11, 2024 1

@albka1986 for that use case, you need custom touch event handling. It's not possible to scroll one item only. For that, you need PagerSnapHelper. Check this StackOverflow question: https://stackoverflow.com/questions/53483268/how-to-have-recyclerview-snapped-to-center-and-yet-be-able-to-scroll-to-all-item/53510142#53510142

from gravitysnaphelper.

rubensousa avatar rubensousa commented on June 11, 2024

This would require another custom SnapHelper. I don't have any plans to implement this, though.

from gravitysnaphelper.

AndroidDeveloperLB avatar AndroidDeveloperLB commented on June 11, 2024

Too bad. Thanks anyway

from gravitysnaphelper.

rubensousa avatar rubensousa commented on June 11, 2024

@AndroidDeveloperLB , I'm adding something similar in 2.2.0. It'll not be exactly snapping on X views, but instead limiting the fling distance.
You can check this out here: https://github.com/rubensousa/RecyclerViewSnap/blob/develop/gravitysnaphelper/src/main/java/com/github/rubensousa/gravitysnaphelper/GravitySnapHelper.java#L293

You'll also be able to customise the snap speed:
https://github.com/rubensousa/RecyclerViewSnap/blob/develop/gravitysnaphelper/src/main/java/com/github/rubensousa/gravitysnaphelper/GravitySnapHelper.java#L331

from gravitysnaphelper.

rubensousa avatar rubensousa commented on June 11, 2024

Check this issue: #29

from gravitysnaphelper.

AndroidDeveloperLB avatar AndroidDeveloperLB commented on June 11, 2024

Why close it if it's not the same?
Can you please post a video of what was added?

from gravitysnaphelper.

rubensousa avatar rubensousa commented on June 11, 2024

It's not released yet, but it's in the develop branch if you want to check it out.

I closed the issue again since it's not really what you asked for, although it's similar. That's why I linked the other issue.

Here's a preview: https://drive.google.com/file/d/1vbJ5jz39cCcVgWIeGRv5vWF5ESOglDCr/view

from gravitysnaphelper.

AndroidDeveloperLB avatar AndroidDeveloperLB commented on June 11, 2024

It's not the same?
But if it's not the same, why close it?
I'm confused.

from gravitysnaphelper.

rubensousa avatar rubensousa commented on June 11, 2024

I closed it since I don't have plans to work on this specific feature at the moment. You closed this the last time because of that same reason

from gravitysnaphelper.

AndroidDeveloperLB avatar AndroidDeveloperLB commented on June 11, 2024

Sorry I don't remember.
Anyway, you added something that seem what I wrote, no? What's the difference between what I requested and what you've added?

from gravitysnaphelper.

rubensousa avatar rubensousa commented on June 11, 2024

You wanted to snap every X views, however I've added support for limiting the maximum fling according to a value you can set through: https://github.com/rubensousa/RecyclerViewSnap/blob/decfb4102dcd8d741cce65f88e2d82e768d840b7/gravitysnaphelper/src/main/java/com/github/rubensousa/gravitysnaphelper/GravitySnapHelper.java#L274
And https://github.com/rubensousa/RecyclerViewSnap/blob/decfb4102dcd8d741cce65f88e2d82e768d840b7/gravitysnaphelper/src/main/java/com/github/rubensousa/gravitysnaphelper/GravitySnapHelper.java#L289

Limiting snapping on every X view is different, since you may have views with different width.

from gravitysnaphelper.

AndroidDeveloperLB avatar AndroidDeveloperLB commented on June 11, 2024

Oh right.
Sorry for that.
Why not consider adding this functionality ?
It could be nice, for example, for a week view of a calendar app (shows a single week each time)

from gravitysnaphelper.

rubensousa avatar rubensousa commented on June 11, 2024

Because it requires time I don't have at the moment. However, I could leave this open so that anyone else could work on this instead. Meanwhile, If you need something similar, you could use the other approach.

from gravitysnaphelper.

AndroidDeveloperLB avatar AndroidDeveloperLB commented on June 11, 2024

OK please let it be open, then.

from gravitysnaphelper.

albka1986 avatar albka1986 commented on June 11, 2024

@rubensousa
Hello! Thanks for the lib it's very helpful.
I have a question about the feature "every x" I understand that you provided some another feature, but I try to use it and don't have a profit.
Here is my config:

    val snapHelper = GravitySnapHelper(Gravity.CENTER).apply {
            scrollMsPerInch = 1f
            maxFlingDistance = 20.dp.toPx()
            maxFlingSizeFraction = 0.0001f
        }
        snapHelper.attachToRecyclerView(recyclerView)
        snapHelper.scrollToPosition(Int.MAX_VALUE/2)

My view in XML:

   <com.github.rubensousa.gravitysnaphelper.GravitySnapRecyclerView
            android:id="@+id/camera_type_rv"
            android:layout_width="match_parent"
            android:layout_height="25dp"
            android:layout_marginStart="40dp"
            app:snapMaxFlingSizeFraction="0.1"
            android:layout_marginEnd="40dp"
            app:snapGravity="center"
            android:layout_marginBottom="100dp"
            android:animateLayoutChanges="false"
            android:orientation="horizontal"
            app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            tools:itemCount="3" />

My goal is to go through the list one by one.
But if it's impossible by this lib, I try to set slow speed of scrolling and it doesn't work with method scrollMsPerInch.

This is my current implementation:
https://drive.google.com/file/d/1GuraO_nDQR8IE1jzjZyZ51eyiOzfXlOb/view?usp=sharing

That is what I want to have:
https://drive.google.com/file/d/19k8MFVK69Xiorw1LErUgLt7-wEAQ0fat/view?usp=sharing

from gravitysnaphelper.

albka1986 avatar albka1986 commented on June 11, 2024

Thanks

from gravitysnaphelper.

Related Issues (20)

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.