- 🐞 Fixed #74:
Changing
infiniteCarousel
attribute now will callinitAdapter()
.
Note: Before changing the infiniteCarousel
, it is better to clear the data-set, then change the
infiniteCarousel
attribute and finally set the data. Changing the infiniteCarousel
with existing
data can create undesirable issues.
Example code:
// Step 1: Clear existing data
carousel.setData(emptyList())
// Step 2: Change infiniteCarousel
carousel.infiniteCarousel = true // or false
// Step 3: Finally, set data
carousel.setData(itemList) // itemList is List<CarouselItem>
- ⬆ Dependencies upgraded to the latest version.
- 🆕 Some instrumented tests were added.
- 🐞 Fixed #72: Indicator will now indicate first item after data replace.
- ⬆ Updated deprecated lifecycle code.
- ⬆ Kotlin and other libs upgraded to the latest version.
- 🐞 Fixed #50: Fixed a crash when dataset changed.
- 🐞 Fixed some bugs related to data insert.
- ⬆ Kotlin and other libs upgraded to the latest version.
- 🐞
Fixed #43:
currentPosition
will now give real data position. For virtual data position ininfiniteCarousel
usecurrentVirtualPosition
. - 🐞 Fixed #45:
autoPlay
will now work after slide.
- 🐞 Fixed: wrong
position
value inonScrollStateChanged
listener.
- 🆕
registerLifecycle(lifecycleOwner: LifecycleOwner)
method added. - 🛠️ Java sample converted into a
Fragment
example.
- 🆕 Previous boring custom layout system removed. And view-binding supported custom layout system
added. See
CarouselListener
in the sample app for details. 🎉 - 🆕 The carousel is now supported Infinite ∞ looping (Infinite Carousel) 🥳! It's default now. You
can disable it by setting
infiniteCarousel
tofalse
. - 🆕 Carousel now supports touch-to-pause auto-play. It is default now. You can disable it by
setting
touchToPause
tofalse
. 🎊 - 🆕
carouselGravity
attribute added. So you can set carousel item view gravitySTART
if you want. - 🆕 Carousel padding attributes added. You can use
carouselPadding
,carouselPaddingStart
,carouselPaddingTop
,carouselPaddingEnd
, andcarouselPaddingBottom
to set carousel padding. - 🆕 The
ImageCarousel
is now a lifecycle component. You can register any lifecycle withregisterLifecycle()
method. It is recommended if you enableautoPlay
andinfiniteCarousel
. So that when the application is in the pause state, the carousel will be paused and resumed on the app resume. It is also used to correctly initialize the infinite carousel when the app is in the background. - 🆕 You can now use
setData()
to setCarouselItem
list. AndaddData()
to add single or multiple items to the carousel. If you set/add data only once, then you can continue usingaddData()
method. - 🆕 You can now get the carousel items using
getData()
method. - 🆕 Sample app re-designed. Various use cases and inspiring 💡 examples are added. 😎
⚠️ OnItemClickListener
renamed toCarouselListener
and two new method (onCreateViewHolder()
andonBindViewHolder()
) added for the latest custom view feature.setOnItemClickListener()
also renamed tosetCarouselListener()
.⚠️ CarouselListener
(previouslyOnItemClickListener
) package changed fromorg.imaginativeworld.whynotimagecarousel
toorg.imaginativeworld.whynotimagecarousel.listener
.⚠️ CarouselItem
package changed fromorg.imaginativeworld.whynotimagecarousel
toorg.imaginativeworld.whynotimagecarousel.model
.- ️🛠 New parameters
position
andcarouselItem
add toonScrolled
method inCarouselOnScrollListener
. - 🛠️ The default carousel background changed to transparent. You can always change the background
of the carousel using
carouselBackground
. The previous value was#333333
. - 🛠️ Left and right navigation default button icon replaced with a rounded chevron icon.
Header field is added to the CarouselItem
.
Examples:
// Kotlin
val headers = mutableMapOf<String, String>()
headers["header_key"] = "header_value"
val carouselItem1 = CarouselItem(
imageUrl = "https://images.unsplash.com/photo-1549577434-d7615fd4ceac?w=1080",
caption = "Photo by Jeremy Bishop on Unsplash",
headers = headers
)
val carouselItem2 = CarouselItem(
imageUrl = "https://images.unsplash.com/photo-1549577434-d7615fd4ceac?w=1080",
headers = headers
)
// Java
Map<String, String> headers=new HashMap<>();
headers.put("header_key","header_value");
CarouselItem carouselItem1=new CarouselItem(
"https://images.unsplash.com/photo-1549577434-d7615fd4ceac?w=1080",
"Photo by Jeremy Bishop on Unsplash",
headers
);
CarouselItem carouselItem2=new CarouselItem(
"https://images.unsplash.com/photo-1549577434-d7615fd4ceac?w=1080",
headers
);
We move our library from jitpack.io to maven repository. So no need to add any repositories for using the library.
View binding added to the sample. Dependent libraries updated.
Image drawable support added.
The initial release of the library.