An open API service indexing awesome lists of open source software.

https://github.com/ouattararomuald/android-image-slider

Android image slider
https://github.com/ouattararomuald/android-image-slider

android image-slider image-viewer kotlin

Last synced: 9 months ago
JSON representation

Android image slider

Awesome Lists containing this project

README

          

[![CircleCI](https://circleci.com/gh/ouattararomuald/android-image-slider.svg?style=svg)](https://circleci.com/gh/ouattararomuald/android-image-slider)
[![](https://img.shields.io/maven-central/v/com.ouattararomuald/slider.svg)](https://search.maven.org/search?q=g:com.ouattararomuald%20a:slider)
[![](https://img.shields.io/badge/code--style-square-green.svg)](https://github.com/square/java-code-styles)

# Image Slider

An image slider for android that let you pick the image loader library that best suits your needs.

## Usage

Create a simple slider with the following code:

**activity_main.xml**
```xml

```

**MainActivity.kt**
```kotlin
class MainActivity : AppCompatActivity() {

companion object {
private const val SLIDE_NUMBER = 10
}

private lateinit var imageSlider: ImageSlider
private val imageUrls = arrayListOf(
"http://i.imgur.com/CqmBjo5.jpg",
"http://i.imgur.com/zkaAooq.jpg",
"http://i.imgur.com/0gqnEaY.jpg"
)

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

imageSlider = findViewById(R.id.image_slider)
imageSlider.adapter = SliderAdapter(
this,
PicassoImageLoaderFactory(),
imageUrls = imageUrls,
descriptions = Data.generateDescriptions(imageUrls.size)
)
}
}
```

`Slider` comes with Picasso as dependency to load images. If you want to use another library,
you must extend `ImageLoader#Factory` and pass your factory to `SliderAdapter` (see Wiki).

## Download

Download the [latest AAR](https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.ouattararomuald%22%20AND%20a%3A%22slider%22) or grab via Gradle:

```gradle
implementation 'com.ouattararomuald:slider-coil:3.0.1' // If you use Coil
implementation 'com.ouattararomuald:slider-glide:3.0.1' // If you use Glide
implementation 'com.ouattararomuald:slider-picasso:3.0.1' // If you use Picasso
```

If you want to use another image loading library include:

```gradle
implementation 'com.ouattararomuald:slider:3.0.1'
```

and create you custom `ImageLoader` by implementing `ImageLoader#Factory` (see `glide-loader` or `picasso-loader`).

or Maven:

```xml

com.ouattararomuald
slider-coil
3.0.1

```

```xml

com.ouattararomuald
slider-glide
3.0.1

```

```xml

com.ouattararomuald
slider-picasso
3.0.1

```

```xml

com.ouattararomuald
slider
3.0.1

```

Snapshots of the development version are available in [Sonatype's snapshots repository](https://oss.sonatype.org/content/repositories/snapshots/).

## Contributing

Contributions you say? Yes please!

**Bug report?**

If at all possible, please attach a minimal sample project or code which reproduces the bug.
Screenshots are also a huge help if the problem is visual.

**Send a pull request!**

If you're fixing a bug, please add a failing test or code that can reproduce the issue.

**Build steps**

1. Build artifacts with `./gradlew assemble`
1. Run Tests `./gradlew test`
1. Run Instrumented Test `./gradlew :sample:connectedAndroidTest`
1. Run Android Lint `./gradlew lint`
1. Run Kotlin Lint `./gradlew detekt`

## License

```
Copyright 2018 Ouattara Gninlikpoho Romuald

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```