refactor(view): 将SwitchButton迁移至项目内部

This commit is contained in:
2026-07-27 07:25:17 +08:00
parent d5c584c6fc
commit 8bf454bb2b
9 changed files with 1202 additions and 35 deletions

View File

@@ -373,7 +373,7 @@ dependencies {
implementation 'com.github.getActivity:Toaster:12.6'
// 权限请求框架https://github.com/getActivity/XXPermissions
implementation 'com.github.getActivity:XXPermissions:20.0'
implementation 'com.github.zcweng:switch-button:0.0.3@aar'
// implementation 'com.github.zcweng:switch-button:0.0.3@aar'
implementation "com.github.kongzue.DialogX:DialogX:0.0.50"
implementation 'cn.6tail:lunar:1.7.7'
implementation "io.github.cymchad:BaseRecyclerViewAdapterHelper4:4.4.0"
@@ -422,28 +422,3 @@ project.afterEvaluate {
)
}
}
//preBuild {
// doLast {
// def imlFile = file(project.name + ".iml")
//// def imlFile = file("..\\.idea\\modules\\" + project.name + "\\" + rootProject.name + "." + project.name + ".iml")
// println 'Change ' + project.name + '.iml order'
// try {
// def parsedXml = (new XmlParser()).parse(imlFile)
// def jdkNode = parsedXml.component[1].orderEntry.find { it.'@type' == 'jdk' }
// parsedXml.component[1].remove(jdkNode)
// def sdkString = "Android API " + android.compileSdkVersion.substring("android-".length()) + " Platform"
// println 'what' + sdkString
// new Node(parsedXml.component[1], 'orderEntry', ['type': 'jdk', 'jdkName': sdkString, 'jdkType': 'Android SDK'])
// groovy.xml.XmlUtil.serialize(parsedXml, new FileOutputStream(imlFile))
// } catch (FileNotFoundException e) {
// // nop, iml not found
// println "no iml found"
// }
// }
// //https://www.pianshen.com/article/93481144911/
// //https://blog.csdn.net/dhl_1986/article/details/102856026
// //https://blog.csdn.net/zhonghe1114/article/details/80923730
// //https://blog.csdn.net/u014175785/article/details/116235760
// //使用系统编译后的framework.jar
//}

View File

@@ -5,7 +5,7 @@ import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.view.View;
import com.suke.widget.SwitchButton;
import com.ttstd.dialer.view.SwitchButton;
import com.tencent.mmkv.MMKV;
import com.ttstd.dialer.R;
import com.ttstd.dialer.activity.main.MainActivity;

View File

@@ -2,7 +2,7 @@ package com.ttstd.dialer.view;
import androidx.databinding.BindingAdapter;
import com.suke.widget.SwitchButton;
import com.ttstd.dialer.view.SwitchButton;
public class BindingAdapters {

View File

@@ -14,7 +14,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.suke.widget.SwitchButton;
import com.ttstd.dialer.view.SwitchButton;
import com.ttstd.dialer.R;
import org.jetbrains.annotations.NotNull;

File diff suppressed because it is too large Load Diff

View File

@@ -203,7 +203,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.suke.widget.SwitchButton
<com.ttstd.dialer.view.SwitchButton
android:id="@+id/sb_emergency"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -240,7 +240,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.suke.widget.SwitchButton
<com.ttstd.dialer.view.SwitchButton
android:id="@+id/sb_show"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -278,7 +278,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.suke.widget.SwitchButton
<com.ttstd.dialer.view.SwitchButton
android:id="@+id/sb_pinned"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View File

@@ -207,7 +207,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.suke.widget.SwitchButton
<com.ttstd.dialer.view.SwitchButton
android:id="@+id/sb_emergency"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -245,7 +245,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.suke.widget.SwitchButton
<com.ttstd.dialer.view.SwitchButton
android:id="@+id/sb_show"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View File

@@ -49,7 +49,7 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<com.suke.widget.SwitchButton
<com.ttstd.dialer.view.SwitchButton
android:id="@+id/switch_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="SwitchButton">
<attr name="sb_shadow_radius" format="reference|dimension"/>
<attr name="sb_shadow_offset" format="reference|dimension"/>
<attr name="sb_shadow_color" format="reference|color"/>
<attr name="sb_uncheck_color" format="reference|color"/>
<attr name="sb_checked_color" format="reference|color"/>
<attr name="sb_border_width" format="reference|dimension"/>
<attr name="sb_checkline_color" format="reference|color"/>
<attr name="sb_checkline_width" format="reference|dimension"/>
<attr name="sb_uncheckcircle_color" format="reference|color"/>
<attr name="sb_uncheckcircle_width" format="reference|dimension"/>
<attr name="sb_uncheckcircle_radius" format="reference|dimension"/>
<attr name="sb_checked" format="reference|boolean"/>
<attr name="sb_shadow_effect" format="reference|boolean"/>
<attr name="sb_effect_duration" format="reference|integer"/>
<attr name="sb_button_color" format="reference|color"/>
<attr name="sb_show_indicator" format="reference|boolean"/>
<attr name="sb_background" format="reference|color"/>
<attr name="sb_enable_effect" format="reference|boolean"/>
<attr name="sb_checkedbutton_color" format="reference|color"/>
<attr name="sb_uncheckbutton_color" format="reference|color"/>
</declare-styleable>
</resources>