├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── dimens.xml │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ └── themes.xml │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── drawable-xxhdpi │ │ │ │ └── ic_user_count.png │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── values-night │ │ │ │ └── themes.xml │ │ │ ├── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── layout │ │ │ │ └── activity_main.xml │ │ │ └── drawable │ │ │ │ └── ic_launcher_background.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── jeanboy │ │ │ └── app │ │ │ └── wheelfortune │ │ │ └── MainActivity.kt │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── jeanboy │ │ │ └── app │ │ │ └── wheelfortune │ │ │ └── ExampleUnitTest.kt │ └── androidTest │ │ └── java │ │ └── com │ │ └── jeanboy │ │ └── app │ │ └── wheelfortune │ │ └── ExampleInstrumentedTest.kt ├── proguard-rules.pro └── build.gradle ├── component_wheelfortune ├── .gitignore ├── consumer-rules.pro ├── src │ ├── main │ │ ├── res │ │ │ ├── drawable-xxhdpi │ │ │ │ ├── bg_wheel_panel.png │ │ │ │ ├── bg_wheel_tray.png │ │ │ │ ├── default_avatar.png │ │ │ │ ├── bg_wheel_border.png │ │ │ │ ├── bg_wheel_dialog.png │ │ │ │ ├── bg_wheel_shadow.png │ │ │ │ ├── bg_wheel_action_join.png │ │ │ │ ├── bg_wheel_border_light1.png │ │ │ │ ├── bg_wheel_border_light2.png │ │ │ │ └── bg_wheel_action_running.png │ │ │ ├── drawable │ │ │ │ ├── bg_sector.xml │ │ │ │ └── bg_circle.xml │ │ │ └── layout │ │ │ │ ├── layout_disk_container.xml │ │ │ │ ├── layout_disk_avatar.xml │ │ │ │ └── layout_wheel_fortune.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── jeanboy │ │ │ │ └── component │ │ │ │ └── wheelfortune │ │ │ │ ├── ItemData.kt │ │ │ │ ├── DiskTray.kt │ │ │ │ ├── WheelFortuneView.kt │ │ │ │ └── DiskLayout.kt │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── jeanboy │ │ │ └── component │ │ │ └── wheelfortune │ │ │ └── ExampleUnitTest.kt │ └── androidTest │ │ └── java │ │ └── com │ │ └── jeanboy │ │ └── component │ │ └── wheelfortune │ │ └── ExampleInstrumentedTest.kt ├── proguard-rules.pro └── build.gradle ├── resources ├── 00.gif ├── 00.mp4 ├── 01.jpeg ├── 02.jpeg ├── 03.jpeg └── 04.jpeg ├── settings.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── LICENSE ├── gradle.properties ├── README.md ├── .gitignore ├── gradlew.bat └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /component_wheelfortune/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /component_wheelfortune/consumer-rules.pro: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/00.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/HEAD/resources/00.gif -------------------------------------------------------------------------------- /resources/00.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/HEAD/resources/00.mp4 -------------------------------------------------------------------------------- /resources/01.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/HEAD/resources/01.jpeg -------------------------------------------------------------------------------- /resources/02.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/HEAD/resources/02.jpeg -------------------------------------------------------------------------------- /resources/03.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/HEAD/resources/03.jpeg -------------------------------------------------------------------------------- /resources/04.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/HEAD/resources/04.jpeg -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':component_wheelfortune' 2 | include ':app' 3 | rootProject.name = "WheelFortune" -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 40dp 4 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_user_count.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/HEAD/app/src/main/res/drawable-xxhdpi/ic_user_count.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | WheelFortune 3 | %d/%d 4 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /component_wheelfortune/src/main/res/drawable-xxhdpi/bg_wheel_panel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/HEAD/component_wheelfortune/src/main/res/drawable-xxhdpi/bg_wheel_panel.png -------------------------------------------------------------------------------- /component_wheelfortune/src/main/res/drawable-xxhdpi/bg_wheel_tray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/HEAD/component_wheelfortune/src/main/res/drawable-xxhdpi/bg_wheel_tray.png -------------------------------------------------------------------------------- /component_wheelfortune/src/main/res/drawable-xxhdpi/default_avatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/HEAD/component_wheelfortune/src/main/res/drawable-xxhdpi/default_avatar.png -------------------------------------------------------------------------------- /component_wheelfortune/src/main/res/drawable-xxhdpi/bg_wheel_border.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/HEAD/component_wheelfortune/src/main/res/drawable-xxhdpi/bg_wheel_border.png -------------------------------------------------------------------------------- /component_wheelfortune/src/main/res/drawable-xxhdpi/bg_wheel_dialog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/HEAD/component_wheelfortune/src/main/res/drawable-xxhdpi/bg_wheel_dialog.png -------------------------------------------------------------------------------- /component_wheelfortune/src/main/res/drawable-xxhdpi/bg_wheel_shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/HEAD/component_wheelfortune/src/main/res/drawable-xxhdpi/bg_wheel_shadow.png -------------------------------------------------------------------------------- /component_wheelfortune/src/main/res/drawable-xxhdpi/bg_wheel_action_join.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/HEAD/component_wheelfortune/src/main/res/drawable-xxhdpi/bg_wheel_action_join.png -------------------------------------------------------------------------------- /component_wheelfortune/src/main/res/drawable-xxhdpi/bg_wheel_border_light1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/HEAD/component_wheelfortune/src/main/res/drawable-xxhdpi/bg_wheel_border_light1.png -------------------------------------------------------------------------------- /component_wheelfortune/src/main/res/drawable-xxhdpi/bg_wheel_border_light2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/HEAD/component_wheelfortune/src/main/res/drawable-xxhdpi/bg_wheel_border_light2.png -------------------------------------------------------------------------------- /component_wheelfortune/src/main/res/drawable-xxhdpi/bg_wheel_action_running.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/HEAD/component_wheelfortune/src/main/res/drawable-xxhdpi/bg_wheel_action_running.png -------------------------------------------------------------------------------- /component_wheelfortune/src/main/java/com/jeanboy/component/wheelfortune/ItemData.kt: -------------------------------------------------------------------------------- 1 | package com.jeanboy.component.wheelfortune 2 | 3 | /** 4 | * Created by jeanboy on 2021/1/23 17:10. 5 | */ 6 | data class ItemData( 7 | val avatar: String, 8 | val self: Boolean 9 | ) 10 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Jan 21 14:24:25 CST 2021 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip 7 | -------------------------------------------------------------------------------- /component_wheelfortune/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /component_wheelfortune/src/main/res/drawable/bg_sector.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /component_wheelfortune/src/main/res/drawable/bg_circle.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | #FF000000 9 | #FFFFFFFF 10 | -------------------------------------------------------------------------------- /app/src/test/java/com/jeanboy/app/wheelfortune/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.jeanboy.app.wheelfortune 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } -------------------------------------------------------------------------------- /component_wheelfortune/src/test/java/com/jeanboy/component/wheelfortune/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.jeanboy.component.wheelfortune 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } -------------------------------------------------------------------------------- /component_wheelfortune/src/main/res/layout/layout_disk_container.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 12 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/jeanboy/app/wheelfortune/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.jeanboy.app.wheelfortune 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("com.jeanboy.app.wheelfortune", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /component_wheelfortune/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /component_wheelfortune/src/androidTest/java/com/jeanboy/component/wheelfortune/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.jeanboy.component.wheelfortune 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("com.jeanboy.component.wheelfortune.test", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Jeanboy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app"s APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | # Kotlin code style for this project: "official" or "obsolete": 21 | kotlin.code.style=official -------------------------------------------------------------------------------- /component_wheelfortune/src/main/res/layout/layout_disk_avatar.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 15 | 16 | 17 | 25 | 26 | 37 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | id 'kotlin-android' 4 | } 5 | 6 | android { 7 | compileSdkVersion 30 8 | buildToolsVersion "30.0.2" 9 | 10 | defaultConfig { 11 | applicationId "com.jeanboy.app.wheelfortune" 12 | minSdkVersion 21 13 | targetSdkVersion 30 14 | versionCode 1 15 | versionName "1.0" 16 | 17 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 18 | } 19 | 20 | buildTypes { 21 | release { 22 | minifyEnabled false 23 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 24 | } 25 | } 26 | compileOptions { 27 | sourceCompatibility JavaVersion.VERSION_1_8 28 | targetCompatibility JavaVersion.VERSION_1_8 29 | } 30 | kotlinOptions { 31 | jvmTarget = '1.8' 32 | } 33 | } 34 | 35 | dependencies { 36 | 37 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 38 | implementation 'androidx.core:core-ktx:1.3.2' 39 | implementation 'androidx.appcompat:appcompat:1.2.0' 40 | implementation 'com.google.android.material:material:1.2.1' 41 | implementation 'androidx.constraintlayout:constraintlayout:2.0.4' 42 | implementation project(path: ':component_wheelfortune') 43 | testImplementation 'junit:junit:4.+' 44 | androidTestImplementation 'androidx.test.ext:junit:1.1.2' 45 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' 46 | 47 | } -------------------------------------------------------------------------------- /component_wheelfortune/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.library' 3 | id 'kotlin-android' 4 | } 5 | 6 | android { 7 | compileSdkVersion 30 8 | buildToolsVersion "30.0.2" 9 | 10 | defaultConfig { 11 | minSdkVersion 21 12 | targetSdkVersion 30 13 | versionCode 1 14 | versionName "1.0" 15 | 16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 17 | consumerProguardFiles "consumer-rules.pro" 18 | } 19 | 20 | buildTypes { 21 | release { 22 | minifyEnabled false 23 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 24 | } 25 | } 26 | compileOptions { 27 | sourceCompatibility JavaVersion.VERSION_1_8 28 | targetCompatibility JavaVersion.VERSION_1_8 29 | } 30 | kotlinOptions { 31 | jvmTarget = '1.8' 32 | } 33 | } 34 | 35 | dependencies { 36 | testImplementation 'junit:junit:4.+' 37 | androidTestImplementation 'androidx.test.ext:junit:1.1.2' 38 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' 39 | 40 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 41 | implementation 'androidx.core:core-ktx:1.3.2' 42 | implementation 'androidx.appcompat:appcompat:1.2.0' 43 | implementation 'com.google.android.material:material:1.2.1' 44 | 45 | implementation "com.makeramen:roundedimageview:2.3.0" 46 | implementation 'com.github.bumptech.glide:glide:4.11.0' 47 | annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0' 48 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WheelFortune 2 | 3 | 幸运抽奖转盘,类似于StarMaker直播间抽奖。 4 | 5 | ## 效果图 6 | 7 | ![效果图1](https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/main/resources/01.jpeg) 8 | ![效果图2](https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/main/resources/02.jpeg) 9 | ![效果图3](https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/main/resources/03.jpeg) 10 | ![效果图4](https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/main/resources/04.jpeg) 11 | 12 | ![效果图5](https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/main/resources/00.gif) 13 | [点击查看效果视频](https://raw.githubusercontent.com/jeanboydev/Android-WheelFortune/main/resources/00.mp4) 14 | 15 | ## 使用 16 | 17 | - 设置布局 18 | 19 | ```xml 20 | 25 | ``` 26 | 27 | - 处理回调 28 | 29 | ```kotlin 30 | val wheelFortuneView = findViewById(R.id.wheelFortuneView) 31 | tv_user_count = findViewById(R.id.tv_user_count) 32 | 33 | wheelFortuneView?.setListener(object : WheelFortuneView.WheelStateListener { 34 | override fun onJoinClick() { 35 | // join 按钮点击时回调,移除 item 36 | wheelFortuneView?.toRunning(0) 37 | } 38 | 39 | override fun onCountChange(count: Int) { 40 | // item 数量变化回调 41 | tv_user_count?.text = resources.getString(R.string.user_count, count, dataList.size) 42 | } 43 | 44 | override fun onRemove(removeData: ItemData) { 45 | // item 移除时回调 46 | } 47 | }) 48 | ``` 49 | 50 | - 处理数据 51 | 52 | ```kotlin 53 | // 添加数据 54 | wheelFortuneView?.addData(dataList[index]) 55 | 56 | // 清除数据 57 | wheelFortuneView?.clearData() 58 | ``` 59 | 60 | 61 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.aar 4 | *.ap_ 5 | *.aab 6 | 7 | # Files for the ART/Dalvik VM 8 | *.dex 9 | 10 | # Java class files 11 | *.class 12 | 13 | # Generated files 14 | bin/ 15 | gen/ 16 | out/ 17 | # Uncomment the following line in case you need and you don't have the release build type files in your app 18 | # release/ 19 | 20 | # Gradle files 21 | .gradle/ 22 | build/ 23 | 24 | # Local configuration file (sdk path, etc) 25 | local.properties 26 | 27 | # Proguard folder generated by Eclipse 28 | proguard/ 29 | 30 | # Log Files 31 | *.log 32 | 33 | # Android Studio Navigation editor temp files 34 | .navigation/ 35 | 36 | # Android Studio captures folder 37 | captures/ 38 | 39 | # IntelliJ 40 | *.iml 41 | .idea/workspace.xml 42 | .idea/tasks.xml 43 | .idea/gradle.xml 44 | .idea/assetWizardSettings.xml 45 | .idea/dictionaries 46 | .idea/libraries 47 | # Android Studio 3 in .gitignore file. 48 | .idea/caches 49 | .idea/modules.xml 50 | # Comment next line if keeping position of elements in Navigation Editor is relevant for you 51 | .idea/navEditor.xml 52 | 53 | # Keystore files 54 | # Uncomment the following lines if you do not want to check your keystore files in. 55 | #*.jks 56 | #*.keystore 57 | 58 | # External native build folder generated in Android Studio 2.2 and later 59 | .externalNativeBuild 60 | .cxx/ 61 | 62 | # Google Services (e.g. APIs or Firebase) 63 | # google-services.json 64 | 65 | # Freeline 66 | freeline.py 67 | freeline/ 68 | freeline_project_description.json 69 | 70 | # fastlane 71 | fastlane/report.xml 72 | fastlane/Preview.html 73 | fastlane/screenshots 74 | fastlane/test_output 75 | fastlane/readme.md 76 | 77 | # Version control 78 | vcs.xml 79 | 80 | # lint 81 | lint/intermediates/ 82 | lint/generated/ 83 | lint/outputs/ 84 | lint/tmp/ 85 | # lint/reports/ 86 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /component_wheelfortune/src/main/res/layout/layout_wheel_fortune.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 12 | 13 | 14 | 21 | 22 | 23 | 28 | 29 | 30 | 35 | 36 | 37 | 44 | 45 | 46 | 53 | 54 | 55 | 61 | 62 | 63 | 70 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 15 | 16 | 25 | 26 | 37 | 38 | 47 | 48 | 53 | 54 | 59 | 60 | 69 | 70 | 71 | 72 | 78 | 79 |