开源项目 click-debounce
使用教程
click-debounceUsing ASM to handle Android's click debounce, specially a quick double click.项目地址:https://gitcode.com/gh_mirrors/cl/click-debounce
1. 项目的目录结构及介绍
click-debounce/
├── README.md
├── build.gradle
├── gradle
│ └── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── settings.gradle
└── src
├── main
│ ├── java
│ │ └── com
│ │ └── smartdengg
│ │ └── clickdebounce
│ │ ├── ClickDebounce.kt
│ │ └── MainActivity.kt
│ └── res
│ ├── drawable
│ ├── layout
│ │ └── activity_main.xml
│ ├── mipmap-hdpi
│ ├── mipmap-mdpi
│ ├── mipmap-xhdpi
│ ├── mipmap-xxhdpi
│ ├── mipmap-xxxhdpi
│ └── values
│ ├── colors.xml
│ ├── strings.xml
│ └── styles.xml
└── test
└── java
└── com
└── smartdengg
└── clickdebounce
└── ExampleUnitTest.kt
目录结构介绍
README.md
: 项目说明文档。build.gradle
: 项目的构建脚本。gradle/wrapper/
: Gradle 包装器相关文件。gradle.properties
: Gradle 配置属性文件。gradlew
和 gradlew.bat
: Gradle 包装器脚本。settings.gradle
: 项目设置文件。src/main/java/com/smartdengg/clickdebounce/
: 主要代码目录,包含 ClickDebounce.kt
和 MainActivity.kt
。src/main/res/
: 资源文件目录,包含布局文件 activity_main.xml
和其他资源文件。src/test/java/com/smartdengg/clickdebounce/
: 测试代码目录,包含 ExampleUnitTest.kt
。
2. 项目的启动文件介绍
MainActivity.kt
package com.smartdengg.clickdebounce
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.smartdengg.clickdebounce.databinding.ActivityMainBinding
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
}
}
介绍
MainActivity.kt
是项目的启动文件,继承自 AppCompatActivity
。- 在
onCreate
方法中,通过 ActivityMainBinding
绑定布局文件 activity_main.xml
。
3. 项目的配置文件介绍
build.gradle
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdk 30
defaultConfig {
applicationId "com.smartdengg.clickdebounce"
minSdk 21
targetSdk 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
click-debounceUsing ASM to handle Android's click debounce, specially a quick double click.项目地址:https://gitcode.com/gh_mirrors/cl/click-debounce