Code Monkey home page Code Monkey logo

android-roulette-wheel-view's Introduction

Android Roulette Wheel View Project


roulette_sample_image


소개



Gradle

Project Gradle

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}



App Gradle

dependencies {
    implementation 'com.github.JhDroid:android-roulette-wheel-view:{version}'
}



How to use ?

layout (xml)

<androidx.constraintlayout.widget.ConstraintLayout
    <com.jhdroid.view.Roulette
        android:id="@+id/roulette"
        android:layout_width="wrap_content"
        android:layout_height="0dp"/>
</androidx.constraintlayout.widget.ConstraintLayout>
  • setup android:layout_height is match_parent (or ConstraintLayout : 0dp)
  • (필수) height속성은 match_parent(ConstraintLayout은 0dp)설정해야 합니다.



Activity or Fragment

val rouletteData = listOf("JhDroid", "Android", "Blog", "IT", "Developer", "Kotlin", "Java", "Happy")
roulette.apply {
    setRouletteSize(8) // 2 ~ 8
    setRouletteDataList(rouletteData)
}



Rotate and get result

fun rotateRoulette() {
    val rouletteListener = object : RotateListener {
        override fun onRotateStart() {
            // rotate animation start
        }
        override fun onRotateEnd(result: String) {
            // rotate animation end
        }
    }
    // random degrees (options)
    val toDegrees = (2000..10000).random().toFloat()
    roulette.rotateRoulette(toDegrees, 4000, rouletteListener)
}
 /**
   * 룰렛 회전 함수
   * @param toDegrees : end angle (start angle is '0')
   * @param duration : rotate duration
   * @param rotateListener : rotate anim start, end listener (선택)
  * */
fun rotateRoulette(toDegrees: Float, duration: Long, rotateListener: RotateListener?)



example

roulette_sample_image



android-roulette-wheel-view's People

Contributors

jhdroid avatar

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.