From a2722e8769f37b41a28e779740ea0f8d775bc827 Mon Sep 17 00:00:00 2001 From: zhangmengxiong Date: Thu, 21 Dec 2023 15:08:38 +0800 Subject: [PATCH 1/2] 666 --- .idea/compiler.xml | 2 +- .idea/deploymentTargetDropDown.xml | 10 ++++++ .idea/gradle.xml | 5 ++- .idea/kotlinc.xml | 2 +- .idea/migrations.xml | 10 ++++++ .idea/misc.xml | 2 +- LibDialog/build.gradle | 7 ++--- .../main/java/com/mx/dialog/utils/MXUtils.kt | 3 +- app/build.gradle | 23 +++++++------- .../java/com/mx/example/TipDialogActivity.kt | 23 +++++++------- build.gradle | 31 +++++-------------- gradle/wrapper/gradle-wrapper.properties | 4 +-- settings.gradle | 25 ++++++++++++++- 13 files changed, 85 insertions(+), 62 deletions(-) create mode 100644 .idea/deploymentTargetDropDown.xml create mode 100644 .idea/migrations.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml index fb7f4a8..b589d56 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml new file mode 100644 index 0000000..0c0c338 --- /dev/null +++ b/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index a4029a3..932d7db 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -4,10 +4,8 @@ diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml index e1eea1d..0fc3113 100644 --- a/.idea/kotlinc.xml +++ b/.idea/kotlinc.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/.idea/migrations.xml b/.idea/migrations.xml new file mode 100644 index 0000000..f8051a6 --- /dev/null +++ b/.idea/migrations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index d87ec42..81e146d 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -49,7 +49,7 @@ - + diff --git a/LibDialog/build.gradle b/LibDialog/build.gradle index b9b49a4..64b610b 100644 --- a/LibDialog/build.gradle +++ b/LibDialog/build.gradle @@ -18,11 +18,11 @@ android { } } compileOptions { - sourceCompatibility JavaVersion.VERSION_11 - targetCompatibility JavaVersion.VERSION_11 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '11' + jvmTarget = JavaVersion.VERSION_17 } namespace 'com.mx.dialog' } @@ -41,6 +41,5 @@ afterEvaluate { } dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" compileOnly 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4' } \ No newline at end of file diff --git a/LibDialog/src/main/java/com/mx/dialog/utils/MXUtils.kt b/LibDialog/src/main/java/com/mx/dialog/utils/MXUtils.kt index e31d516..9d86517 100644 --- a/LibDialog/src/main/java/com/mx/dialog/utils/MXUtils.kt +++ b/LibDialog/src/main/java/com/mx/dialog/utils/MXUtils.kt @@ -4,14 +4,13 @@ import android.animation.ObjectAnimator import android.animation.ValueAnimator import android.content.Context import android.view.View -import com.mx.dialog.BuildConfig import java.text.DecimalFormat import kotlin.math.max import kotlin.math.min import kotlin.math.roundToInt internal object MXUtils { - private var debug = BuildConfig.DEBUG + private var debug = false fun setDebug(debug: Boolean) { this.debug = debug } diff --git a/app/build.gradle b/app/build.gradle index 1d9176f..6d0a67e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,8 +1,6 @@ -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' -androidExtensions { - experimental = true +plugins { + id 'com.android.application' + id 'kotlin-android' } android { @@ -16,7 +14,9 @@ android { multiDexEnabled true } - + viewBinding { + enabled = true + } buildTypes { release { minifyEnabled false @@ -24,24 +24,23 @@ android { } } compileOptions { - sourceCompatibility JavaVersion.VERSION_11 - targetCompatibility JavaVersion.VERSION_11 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '11' + jvmTarget = JavaVersion.VERSION_17 } namespace 'com.mx.example' } dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4' implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1' - implementation 'androidx.core:core-ktx:1.9.0' + implementation 'androidx.core:core-ktx:1.10.1' implementation 'androidx.appcompat:appcompat:1.6.1' - implementation 'com.google.android.material:material:1.8.0' + implementation 'com.google.android.material:material:1.9.0' implementation 'com.squareup.okhttp3:okhttp:4.9.3' implementation 'com.squareup.okio:okio:2.10.0' diff --git a/app/src/main/java/com/mx/example/TipDialogActivity.kt b/app/src/main/java/com/mx/example/TipDialogActivity.kt index 5728604..ed36434 100644 --- a/app/src/main/java/com/mx/example/TipDialogActivity.kt +++ b/app/src/main/java/com/mx/example/TipDialogActivity.kt @@ -12,14 +12,15 @@ import com.mx.dialog.tip.MXDialogPosition import com.mx.dialog.tip.MXDialogType import com.mx.dialog.tip.MXTipDialog import com.mx.dialog.utils.MXButtonStyle -import kotlinx.android.synthetic.main.activity_tip_dialog.* +import com.mx.example.databinding.ActivityTipDialogBinding class TipDialogActivity : AppCompatActivity() { + private val binding by lazy { ActivityTipDialogBinding.inflate(layoutInflater) } private val tipDialog by lazy { MXTipDialog(this) } private val position = MXDialogPosition() override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - setContentView(R.layout.activity_tip_dialog) + setContentView(binding.root) initView() } @@ -29,18 +30,18 @@ class TipDialogActivity : AppCompatActivity() { tipDialog.setOnCancelListener { Toast.makeText(this, "取消操作", Toast.LENGTH_SHORT).show() } - titleEdt.addTextChangedListener { + binding.titleEdt.addTextChangedListener { tipDialog.setTitle(it) } - infoEdt.addTextChangedListener { + binding.infoEdt.addTextChangedListener { tipDialog.setMessage(it) } - widthRatioEdt.addTextChangedListener { + binding.widthRatioEdt.addTextChangedListener { tipDialog.setMaxContentRatio(it?.toString()?.toFloatOrNull() ?: 0f) } tipDialog.setMaxContentRatio(0.6f) - radioSeekBar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener { + binding.radioSeekBar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener { override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) { tipDialog.setCardBackgroundRadius(progress.toFloat()) } @@ -54,21 +55,21 @@ class TipDialogActivity : AppCompatActivity() { } }) - positionGroup.children.forEachIndexed { index, view -> + binding.positionGroup.children.forEachIndexed { index, view -> val gravitys = arrayOf(Gravity.TOP, Gravity.CENTER, Gravity.BOTTOM) view.setOnClickListener { position.gravity = gravitys[index] tipDialog.show() } } - backgroundGroup.children.forEachIndexed { index, view -> + binding.backgroundGroup.children.forEachIndexed { index, view -> val colors = arrayOf("#33000000", "#66000000", "#99000000") view.setOnClickListener { tipDialog.setDialogBackGroundColor(Color.parseColor(colors[index])) tipDialog.show() } } - iconGroup.children.forEachIndexed { index, view -> + binding.iconGroup.children.forEachIndexed { index, view -> val types = arrayOf( MXDialogType.NONE, MXDialogType.SUCCESS, @@ -80,7 +81,7 @@ class TipDialogActivity : AppCompatActivity() { tipDialog.show() } } - actionGroup.children.forEachIndexed { index, view -> + binding.actionGroup.children.forEachIndexed { index, view -> val types = arrayOf( MXButtonStyle.Rounded, MXButtonStyle.FillBackground, @@ -91,7 +92,7 @@ class TipDialogActivity : AppCompatActivity() { tipDialog.show() } } - marginEdt.addTextChangedListener { + binding.marginEdt.addTextChangedListener { tipDialog.setCardMargin(it?.toString()?.toFloatOrNull() ?: 0f) } tipDialog.setActionBtn { diff --git a/build.gradle b/build.gradle index 238ec38..c50f649 100644 --- a/build.gradle +++ b/build.gradle @@ -1,31 +1,14 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. -buildscript { - ext.kotlin_version = "1.7.20" - repositories { - maven { url 'https://maven.aliyun.com/repository/google' } - maven { url 'https://maven.aliyun.com/repository/public' } - maven { url 'https://jitpack.io' } - google() - } - dependencies { - classpath 'com.android.tools.build:gradle:7.3.1' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0' - - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files - } +plugins { + id 'com.android.application' version '8.2.0' apply false + id 'com.android.library' version '8.2.0' apply false + id 'org.jetbrains.kotlin.android' version '1.8.10' apply false } -allprojects { - repositories { - maven { url 'https://maven.aliyun.com/repository/google' } - maven { url 'https://maven.aliyun.com/repository/public' } - maven { url 'https://jitpack.io' } - google() +task clean(type: Delete) { + for (project in allprojects) { + delete project.buildDir } } - ext { compileSdkVersion = 33 targetSdkVersion = 33 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f0d4593..1a0651d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Aug 09 13:56:32 CST 2021 +#Thu Apr 13 13:24:46 CST 2023 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/settings.gradle b/settings.gradle index eb4ce8a..70b84ef 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1,26 @@ +pluginManagement { + repositories { + maven { url 'https://maven.aliyun.com/repository/google' } + maven { url 'https://maven.aliyun.com/repository/public' } + maven { url 'https://jitpack.io' } + maven { url "https://mvn.mob.com/android" } + gradlePluginPortal() + google() + mavenCentral() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) + repositories { + maven { url 'https://maven.aliyun.com/repository/google' } + maven { url 'https://maven.aliyun.com/repository/public' } + maven { url 'https://jitpack.io' } + maven { url "https://mvn.mob.com/android" } + google() + mavenCentral() + } +} + rootProject.name = "MXDialog" include ':app' -include ':LibDialog' +include ':LibDialog' \ No newline at end of file -- Gitee From 8f1bbc32a7469fd6a17bd9eaa94238cc03234224 Mon Sep 17 00:00:00 2001 From: zmx Date: Mon, 23 Sep 2024 16:04:04 +0800 Subject: [PATCH 2/2] 1.6.4 --- .idea/deploymentTargetSelector.xml | 18 +++ .idea/misc.xml | 1 - .../src/main/java/com/mx/dialog/MXDialog.kt | 4 +- .../java/com/mx/dialog/tip/MXTipBaseDialog.kt | 104 +++++++++++------- .../main/res/layout/mx_content_action_btn.xml | 16 +++ .../src/main/res/layout/mx_content_tip.xml | 14 --- .../java/com/mx/example/TipDialogActivity.kt | 5 +- build.gradle | 6 +- gradle/wrapper/gradle-wrapper.properties | 6 +- 9 files changed, 110 insertions(+), 64 deletions(-) create mode 100644 .idea/deploymentTargetSelector.xml create mode 100644 LibDialog/src/main/res/layout/mx_content_action_btn.xml diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml new file mode 100644 index 0000000..db5436b --- /dev/null +++ b/.idea/deploymentTargetSelector.xml @@ -0,0 +1,18 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 81e146d..ebbea0f 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,3 @@ -