reddit / IndicatorFastScroll

Android library providing a simple UI control for scrolling through RecyclerViews
MIT License
707 stars 58 forks source link

Question Java #27

Closed anneso-duchene closed 5 years ago

anneso-duchene commented 5 years ago

Hello guys,

My project is old so it's use Java. I'm trying to use your libray but I have some issue

issue

It's seem that I cannot initialize the item. Can anyone had this issue ?

I have try an another way but I still have issue

Issue2

Thanks in advance : )

DSteve595 commented 5 years ago

I think you have two options:

  1. Enable Java 8 desugaring by adding this to your build.gradle:

    android {
    compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
    }
    }

    This will let you use Java 8 language features, like lambdas and method references.

  2. Instantiate an anonymous inner class (new Function1() { ... }) instead of a lambda.

I'd recommend option 1.

anneso-duchene commented 5 years ago

Steve,

I have already enable Java 8. All my lambdas functions are working like this one

image

For the option 2, I have tried to instiate anonymous inner class by I annot found wich one to use. I have this error for example:

image

Thanks for the tips anyway : )

Somebody else ?

DSteve595 commented 5 years ago

Will try on a Java project and see what's up.

anneso-duchene commented 5 years ago

Maybe I need to enable Kotlin library for my project ?

DSteve595 commented 5 years ago

Are you able to use Kotlin types like Function1?

anneso-duchene commented 5 years ago

I don't understand : ( Use it like a variable ?

image

DSteve595 commented 5 years ago

If that class can't be imported, it's likely because our library isn't sharing the dependency. Sorry about that. I'll check and fix that. In the meantime, adding the Kotlin standard library as a dependency will temporarily fix it.

anneso-duchene commented 5 years ago

Yeahhhh : D

After adding Kotlin in my Project it's working !!

image

Thanks a lot for your help. It's really a perfect library ! I was searching for it for a long time : )

DSteve595 commented 5 years ago

Very glad to hear it! Will fix the dependency issue in an update.

DSteve595 commented 5 years ago

This should be fixed in version 1.2.1. Let me know if you still see any issues.