├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── attrs.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 │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── layout │ │ │ │ ├── activity_tai_ji_view.xml │ │ │ │ ├── activity_point_beat_view.xml │ │ │ │ ├── activity_wave_view.xml │ │ │ │ ├── activity_circle_refresh_view.xml │ │ │ │ ├── activity_wave_loading_view.xml │ │ │ │ └── activity_main.xml │ │ │ ├── values-night │ │ │ │ └── themes.xml │ │ │ ├── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ │ └── drawable │ │ │ │ └── ic_launcher_background.xml │ │ ├── java │ │ │ └── github │ │ │ │ └── leavesc │ │ │ │ └── customview │ │ │ │ ├── widget │ │ │ │ └── OnSeekBarChangeSimpleListener.kt │ │ │ │ ├── base │ │ │ │ ├── BaseActivity.kt │ │ │ │ └── BaseView.kt │ │ │ │ ├── ViewActivity.kt │ │ │ │ ├── MainActivity.kt │ │ │ │ ├── utils │ │ │ │ └── Utils.kt │ │ │ │ ├── CircleRefreshViewActivity.kt │ │ │ │ ├── WaveViewActivity.kt │ │ │ │ └── view │ │ │ │ ├── TaiJiView.kt │ │ │ │ ├── WaveView.kt │ │ │ │ ├── PointBeatView.kt │ │ │ │ ├── WaveLoadingView.kt │ │ │ │ └── CircleRefreshView.kt │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── github │ │ │ └── leavesc │ │ │ └── customview │ │ │ └── ExampleUnitTest.kt │ └── androidTest │ │ └── java │ │ └── github │ │ └── leavesc │ │ └── customview │ │ └── ExampleInstrumentedTest.kt ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── .idea ├── .gitignore ├── compiler.xml ├── vcs.xml ├── runConfigurations.xml ├── misc.xml ├── gradle.xml └── jarRepositories.xml ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── gradle.properties ├── gradlew.bat └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = "CustomView" 2 | include ':app' 3 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | CustomView 3 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leavesCZY/CustomView/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leavesCZY/CustomView/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leavesCZY/CustomView/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leavesCZY/CustomView/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leavesCZY/CustomView/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leavesCZY/CustomView/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leavesCZY/CustomView/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/leavesCZY/CustomView/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leavesCZY/CustomView/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/leavesCZY/CustomView/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/leavesCZY/CustomView/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Mar 05 16:02:08 CST 2021 2 | distributionBase=GRADLE_USER_HOME 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | local.properties 16 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | -------------------------------------------------------------------------------- /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/github/leavesc/customview/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package github.leavesc.customview 2 | 3 | import org.junit.Assert.assertEquals 4 | import org.junit.Test 5 | 6 | /** 7 | * Example local unit test, which will execute on the development machine (host). 8 | * 9 | * See [testing documentation](http://d.android.com/tools/testing). 10 | */ 11 | class ExampleUnitTest { 12 | @Test 13 | fun addition_isCorrect() { 14 | assertEquals(4, 2 + 2) 15 | } 16 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_tai_ji_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_point_beat_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/java/github/leavesc/customview/widget/OnSeekBarChangeSimpleListener.kt: -------------------------------------------------------------------------------- 1 | package github.leavesc.customview.widget 2 | 3 | import android.widget.SeekBar 4 | import android.widget.SeekBar.OnSeekBarChangeListener 5 | 6 | open class OnSeekBarChangeSimpleListener : OnSeekBarChangeListener { 7 | 8 | override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) { 9 | 10 | } 11 | 12 | override fun onStartTrackingTouch(seekBar: SeekBar) { 13 | 14 | } 15 | 16 | override fun onStopTrackingTouch(seekBar: SeekBar) { 17 | 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /app/src/main/java/github/leavesc/customview/base/BaseActivity.kt: -------------------------------------------------------------------------------- 1 | package github.leavesc.customview.base 2 | 3 | import android.app.Activity 4 | import android.content.Intent 5 | import android.util.Log 6 | import android.widget.Toast 7 | import androidx.appcompat.app.AppCompatActivity 8 | 9 | open class BaseActivity : AppCompatActivity() { 10 | 11 | private val tag = this::class.java.name 12 | 13 | protected fun startActivity(clazz: Class) { 14 | startActivity(Intent(this, clazz)) 15 | } 16 | 17 | protected fun showToast(msg: Any) { 18 | Toast.makeText(this, msg.toString(), Toast.LENGTH_SHORT).show() 19 | } 20 | 21 | protected fun log(log: Any?) { 22 | Log.e(tag, log.toString()) 23 | } 24 | 25 | } -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 19 | 20 | -------------------------------------------------------------------------------- /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/androidTest/java/github/leavesc/customview/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package github.leavesc.customview 2 | 3 | import androidx.test.ext.junit.runners.AndroidJUnit4 4 | import androidx.test.platform.app.InstrumentationRegistry 5 | import org.junit.Assert.assertEquals 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | /** 10 | * Instrumented test, which will execute on an Android device. 11 | * 12 | * See [testing documentation](http://d.android.com/tools/testing). 13 | */ 14 | @RunWith(AndroidJUnit4::class) 15 | class ExampleInstrumentedTest { 16 | @Test 17 | fun useAppContext() { 18 | // Context of the app under test. 19 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 20 | assertEquals("github.leavesc.customview", appContext.packageName) 21 | } 22 | } -------------------------------------------------------------------------------- /app/src/main/java/github/leavesc/customview/ViewActivity.kt: -------------------------------------------------------------------------------- 1 | package github.leavesc.customview 2 | 3 | import android.content.Intent 4 | import android.os.Bundle 5 | import androidx.annotation.LayoutRes 6 | import github.leavesc.customview.base.BaseActivity 7 | 8 | class ViewActivity : BaseActivity() { 9 | 10 | companion object { 11 | 12 | private const val KEY_LAYOUT_ID = "keyLayoutId" 13 | 14 | fun navTo(activity: BaseActivity, @LayoutRes layoutId: Int) { 15 | val intent = Intent(activity, ViewActivity::class.java) 16 | intent.putExtra(KEY_LAYOUT_ID, layoutId) 17 | activity.startActivity(intent) 18 | } 19 | 20 | } 21 | 22 | override fun onCreate(savedInstanceState: Bundle?) { 23 | super.onCreate(savedInstanceState) 24 | setContentView(intent.getIntExtra(KEY_LAYOUT_ID, 0)) 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/java/github/leavesc/customview/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package github.leavesc.customview 2 | 3 | import android.os.Bundle 4 | import android.view.View 5 | import github.leavesc.customview.base.BaseActivity 6 | 7 | class MainActivity : BaseActivity() { 8 | 9 | override fun onCreate(savedInstanceState: Bundle?) { 10 | super.onCreate(savedInstanceState) 11 | setContentView(R.layout.activity_main) 12 | } 13 | 14 | fun startWaveViewActivity(view: View) { 15 | startActivity(WaveViewActivity::class.java) 16 | } 17 | 18 | fun startWaveLoadingViewActivity(view: View) { 19 | ViewActivity.navTo(this, R.layout.activity_wave_loading_view) 20 | } 21 | 22 | fun startCircleRefreshViewActivity(view: View) { 23 | startActivity(CircleRefreshViewActivity::class.java) 24 | } 25 | 26 | fun startPointBeatViewActivity(view: View) { 27 | ViewActivity.navTo(this, R.layout.activity_point_beat_view) 28 | } 29 | 30 | fun startTaiJiViewActivity(view: View) { 31 | ViewActivity.navTo(this, R.layout.activity_tai_ji_view) 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | -------------------------------------------------------------------------------- /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 | # Kotlin code style for this project: "official" or "obsolete": 19 | kotlin.code.style=official -------------------------------------------------------------------------------- /app/src/main/java/github/leavesc/customview/utils/Utils.kt: -------------------------------------------------------------------------------- 1 | package github.leavesc.customview.utils 2 | 3 | import android.graphics.Color 4 | import java.util.* 5 | import kotlin.random.Random 6 | 7 | object Utils { 8 | 9 | fun getRandomColor(): String { 10 | var r: String = Integer.toHexString(Random.nextInt(256)).toUpperCase(Locale.ROOT) 11 | var g: String = Integer.toHexString(Random.nextInt(256)).toUpperCase(Locale.ROOT) 12 | var b: String = Integer.toHexString(Random.nextInt(256)).toUpperCase(Locale.ROOT) 13 | r = if (r.length == 1) "0$r" else r 14 | g = if (g.length == 1) "0$g" else g 15 | b = if (b.length == 1) "0$b" else b 16 | return "#$r$g$b" 17 | } 18 | 19 | fun getRandomColorInt(): Int { 20 | var r: String = Integer.toHexString(Random.nextInt(256)).toUpperCase(Locale.ROOT) 21 | var g: String = Integer.toHexString(Random.nextInt(256)).toUpperCase(Locale.ROOT) 22 | var b: String = Integer.toHexString(Random.nextInt(256)).toUpperCase(Locale.ROOT) 23 | r = if (r.length == 1) "0$r" else r 24 | g = if (g.length == 1) "0$g" else g 25 | b = if (b.length == 1) "0$b" else b 26 | return Color.parseColor("#$r$g$b") 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | id 'kotlin-android' 4 | id 'kotlin-android-extensions' 5 | } 6 | 7 | android { 8 | compileSdkVersion 30 9 | buildToolsVersion "30.0.3" 10 | defaultConfig { 11 | applicationId "github.leavesc.customview" 12 | minSdkVersion 21 13 | targetSdkVersion 30 14 | versionCode 1 15 | versionName "1.0" 16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 17 | } 18 | buildTypes { 19 | release { 20 | minifyEnabled false 21 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 22 | } 23 | } 24 | compileOptions { 25 | sourceCompatibility JavaVersion.VERSION_1_8 26 | targetCompatibility JavaVersion.VERSION_1_8 27 | } 28 | kotlinOptions { 29 | jvmTarget = '1.8' 30 | } 31 | } 32 | 33 | dependencies { 34 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 35 | testImplementation 'junit:junit:4.13.2' 36 | androidTestImplementation 'androidx.test.ext:junit:1.1.2' 37 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' 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 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_wave_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 20 | 21 | 26 | 27 | 32 | 33 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_circle_refresh_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 |