Giter VIP home page Giter VIP logo

Comments (10)

rbro112 avatar rbro112 commented on June 28, 2024 1

@wching you're killing it! Thanks so much.

That's why I wasn't able to replicate, locally I've been experimenting with the most up to date version of the library. Will be good to know for future reference that often I'll need to drop my versioning down to ensure I'm checking older versions.

@mansigoel94 please let me know if updating to 1.0.6 works!

from android-indefinite-pager-indicator.

rbro112 avatar rbro112 commented on June 28, 2024

Great catch, thanks. I'll check this out in depth soon and have a fix before long.

from android-indefinite-pager-indicator.

rbro112 avatar rbro112 commented on June 28, 2024

@mansigoel94 would you mind sending me the XML layout file that is causing the error? I'm trying to recreate this on my side and I am unable to by just setting the recyclerview's root view layout_margin to an arbitrary value.

from android-indefinite-pager-indicator.

mansigoel94 avatar mansigoel94 commented on June 28, 2024

<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recycler_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        **android:layout_margin="8dp"** (here layout largin would not cause any problem)
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
      />

    <com.rbrooks.indefinitepagerindicator.IndefinitePagerIndicator
        android:id="@+id/recyclerview_pager_indicator"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="4dp"  (Here also margin would run just fine)
        app:dotColor="@android:color/black"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toBottomOf="@id/rv_top_search"
        app:selectedDotColor="@color/colorAccent" />

</android.support.constraint.ConstraintLayout>

But in another layout where you define recycler view items then in rootview margin would break code
example:

<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"> (this line would cause code to break.... Also margin_top, margin_bottom and margin_Right would run perfectly, only margin left doesn't)

<ImageView
    android:id="@+id/iv_preview"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:scaleType="fitXY"
    app:layout_constraintEnd_toEndOf="parent" />

</android.support.constraint.ConstraintLayout>

from android-indefinite-pager-indicator.

rbro112 avatar rbro112 commented on June 28, 2024

Unfortunately, I still haven't been able to recreate the bug on my end. I added the layout_margin to both the RecyclerView's rootview and the view item's root view and it still is working normally for me.

Upon further inspection of the stacktrace, it seems that this line is the actual bug:

Caused by: java.lang.IllegalStateException: An instance of OnFlingListener already set.

Are you setting an OnFlingListener in your code where you setup your recyclerview? Or are you calling recyclerView.setOnScrollListener(scrollListener) rather than recyclerView.addOnScollListener(scrollListener)? If so, this could be the issue as it would likely be overriding the IndefinitePagerIndicator's internal onScrollListener that's used to update the indicator.

from android-indefinite-pager-indicator.

rbro112 avatar rbro112 commented on June 28, 2024

@mansigoel94 any update on this? I'm going to close the issue if my comment above is the overall issue.

from android-indefinite-pager-indicator.

mansigoel94 avatar mansigoel94 commented on June 28, 2024

No I haven't used any ScrollListener or FlingListener and this error is still reproducible on my machine. I will share sample project with you.

from android-indefinite-pager-indicator.

mansigoel94 avatar mansigoel94 commented on June 28, 2024

https://github.com/mansigoel94/Library-Issue.git.
Check this code, I have added one todo for you where 'layout-margin' is causing library to crash

from android-indefinite-pager-indicator.

wching avatar wching commented on June 28, 2024

@mansigoel94 based on the code you shared, I can see that you are using version 1.0.3 and indeed the crash happens because null is getting to the RecyclerView's
findContainingItemView(View view) method.

That was fixed by @rbro112 in this commit (line 268):
2311872
which was basically a fix released on version 1.0.4 🎉

So I think the solution to your bug will be updating to the latest version [ current is 1.0.6 ] of the library 😃

from android-indefinite-pager-indicator.

rbro112 avatar rbro112 commented on June 28, 2024

Looks like 1.0.6+ is the fix. Closing this issue!

from android-indefinite-pager-indicator.

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.