GithubHelp home page GithubHelp logo

ouattararomuald / android-image-slider Goto Github PK

View Code? Open in Web Editor NEW
49.0 2.0 13.0 676 KB

Android image slider

Home Page: https://ouattararomuald.github.io/android-image-slider/

License: Apache License 2.0

Kotlin 96.66% Java 3.34%
kotlin android image-viewer image-slider

android-image-slider's Introduction

CircleCI

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

<com.ouattararomuald.slider.ImageSlider
  android:id="@+id/image_slider"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
/>

MainActivity.kt

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 or grab via 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:

implementation 'com.ouattararomuald:slider:3.0.1'

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

or Maven:

<!-- If you use Coil -->
<dependency>
  <groupId>com.ouattararomuald</groupId>
  <artifactId>slider-coil</artifactId>
  <version>3.0.1</version>
</dependency>
<!-- If you use Glide -->
<dependency>
  <groupId>com.ouattararomuald</groupId>
  <artifactId>slider-glide</artifactId>
  <version>3.0.1</version>
</dependency>
<!-- If you use Picasso -->
<dependency>
  <groupId>com.ouattararomuald</groupId>
  <artifactId>slider-picasso</artifactId>
  <version>3.0.1</version>
</dependency>
<!-- If you want a custom image loader -->
<dependency>
  <groupId>com.ouattararomuald</groupId>
  <artifactId>slider</artifactId>
  <version>3.0.1</version>
</dependency>

Snapshots of the development version are available in Sonatype's snapshots repository.

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
  2. Run Tests ./gradlew test
  3. Run Instrumented Test ./gradlew :sample:connectedAndroidTest
  4. Run Android Lint ./gradlew lint
  5. 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.

android-image-slider's People

Contributors

ouattararomuald avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

android-image-slider's Issues

Improve design

Breaking changes:

  • Provide Picasso as default image loader but allow user to switch to their favorite lib.
  • Reduce responsability of ImageSlider.

Request For Turn Off Auto-Cycling

Halo, I have read the documentation but there is no function to turn off auto-cycling. Could you add function to turn off auto-cycling? thanks

Cannot resolve 1.1.0 dependencies

I've tried resolving any of the 1.1.0 dependencies in Gradle and only get "Failed to resolve" errors. The only one I found that works is the first version (com.ouattararomuald:slider:1.0.0).

Avoid plain http

Sample project use plain http which cause the project to not load images on android P.

Deploy step in Circle fails

This is due to:
IllegalStateException:

  • message: Duplicate Key Signature

Why? I don't know (need investigation).

Remove image loader dependency

It has been a very bad choice to add Picasso as a dependency.
Image loader factories will be provided as external dependency.
Something like:

  • com.ouattararomuald:picasso-loader:1.0.0
  • com.ouattararomuald:glide-loader:1.0.0

Image resizing option

Add the ability for a user to resize the displayed image - e.g via Picasso centerCrop, centerFit, etc.

Reconfigure CI

Two possible solutions:

  1. Move to Travis CI
  2. Migrate to Circle CI 2.0 since 1.0 will be discontinued on August 31

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.