Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用 Jetpack Compose 重构大部分功能 #149

Merged
merged 100 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
2d7b3ed
开始使用 Jetpack Compose 对待办重构
Super12138 Jan 9, 2025
daab017
feat: 适配主题色和 edge to edge
Super12138 Jan 10, 2025
daa9972
feat: 数据库架构初步实现
Super12138 Jan 11, 2025
35c67e4
feat: 完成待办列表和数据库的绑定&更新数据库结构
Super12138 Jan 11, 2025
68e282c
feat: 进度条和数据绑定 & 支持标记待办为已完成
Super12138 Jan 11, 2025
0054652
feat: 添加空项目提示
Super12138 Jan 11, 2025
52c9ce5
feat: 初步实现添加待办功能
Super12138 Jan 11, 2025
4bfa2c4
fix: 待办项目内容过长的显示错误(添加跑马灯效果)
Super12138 Jan 11, 2025
3143232
refactor: 将进度页面和主页面解耦
Super12138 Jan 11, 2025
6acabb0
fix: 删除中文字符串多打的字
Super12138 Jan 11, 2025
01efdcf
refactor: 国际化适配
Super12138 Jan 12, 2025
88dfabf
refactor: 优化字符串名称
Super12138 Jan 12, 2025
d19311b
refactor: 优化学科的存储方式
Super12138 Jan 12, 2025
3cc10cd
feat: 支持修改待办
Super12138 Jan 12, 2025
7ef2645
feat: 剩余项目提示
Super12138 Jan 12, 2025
8cbf9fb
fix: 待办内容过长导致页面内容不可见的问题
Super12138 Jan 12, 2025
111e2bb
feat: 尝试适配横屏下的布局
Super12138 Jan 12, 2025
70a1feb
feat: 添加彩带依赖(后续添加)
Super12138 Jan 12, 2025
0e54c94
feat: 标记待办为已完成后的彩带庆祝
Super12138 Jan 13, 2025
6553c4a
fix: 编辑待办时旋转屏幕无法修改原待办
Super12138 Jan 13, 2025
2964178
refactor: 组件化添加待办按钮
Super12138 Jan 13, 2025
017f9f9
fix: FAB 组件占位器位置错误
Super12138 Jan 13, 2025
dcd22ec
refactor: 空项目提示的语言表述
Super12138 Jan 13, 2025
d90768e
refactor: 使用 WindowSizeClass 对屏幕大小进行更广泛的适配
Super12138 Jan 13, 2025
b8f99d1
feat: 打包时移除无用资源
Super12138 Jan 13, 2025
42cd133
fix: FAB 组件占位器位置错误
Super12138 Jan 13, 2025
c20de80
feat: 待办列表滚动条的颜色
Super12138 Jan 13, 2025
d38a9d3
fix: 深色模式下状态栏文字由黑色变为白色的问题
Super12138 Jan 14, 2025
9861c46
feat: 应用崩溃页面
Super12138 Jan 14, 2025
1e5f595
style: 优化代码样式
Super12138 Jan 15, 2025
c86e6b8
feat: 提交缺失的依赖
Super12138 Jan 15, 2025
eeeb260
feat: 使崩溃页面的 FAB 具有动画效果
Super12138 Jan 15, 2025
cfe6228
refactor: 添加 Tokens 增加复用性
Super12138 Jan 15, 2025
1656063
feat: 删除单个待办
Super12138 Jan 15, 2025
366f19c
feat: 支持多选和删除待办(后续优化逻辑)
Super12138 Jan 15, 2025
0f27eab
refactor: 组件化顶部应用栏
Super12138 Jan 15, 2025
96fe734
feat: 支持动态显示已完成待办
Super12138 Jan 15, 2025
9ffe228
feat: AnimatedFAB 支持自定义阴影
Super12138 Jan 15, 2025
3855caf
feat: 删除待办前二次确认
Super12138 Jan 15, 2025
bfc774b
refactor: 删除无用代码,优化资源
Super12138 Jan 15, 2025
ae608fa
fix: 待办列表和操作按钮被系统状态栏遮挡
Super12138 Jan 16, 2025
c1cb9f7
fix: 边距位置错误
Super12138 Jan 16, 2025
a15f78b
feat: 部分设置和关于页面
Super12138 Jan 16, 2025
f801741
fix: 页面内容被系统状态栏遮挡
Super12138 Jan 16, 2025
ad44140
fix: 主页面内容在输入法打开时被顶起
Super12138 Jan 16, 2025
9f3fd5f
fix: 顶部应用栏按钮在输入法打开时被挤上去
Super12138 Jan 16, 2025
ca08c21
feat: 将待办 BottomSheet 提取为单独页面
Super12138 Jan 16, 2025
e962a9f
feat: 大型顶部应用栏支持 FAB
Super12138 Jan 17, 2025
08d7706
feat: 支持设置任务优先级
Super12138 Jan 17, 2025
12bf512
feat: 添加应用图标
Super12138 Jan 18, 2025
f01a08f
fix: 横屏状态下无法编辑待办
Super12138 Jan 18, 2025
eb8b64a
ci: 支持工作流
Super12138 Jan 23, 2025
2eec884
ci: 自动签名
Super12138 Jan 24, 2025
39e0f33
revert: 取消自动签名
Super12138 Jan 24, 2025
2a2bb2f
revert: 取消自动前面
Super12138 Jan 24, 2025
3711287
fix: 不上传APK
Super12138 Jan 24, 2025
e8af5d8
feat: 更新任务优先级的实现展示方式
Super12138 Feb 4, 2025
3f40e50
refactor: 移除无用类
Super12138 Feb 4, 2025
6218f63
feat: 添加使用过的开源项目
Super12138 Feb 4, 2025
e729125
feat: 适配 CI 构建
Super12138 Feb 4, 2025
32e2292
feat(settings): 添加外观与个性化设置
Super12138 Feb 5, 2025
1a123c6
fix(settings): 生成主题颜色不正确
Super12138 Feb 5, 2025
70da0be
refactor(settings): 将横向滚动设置项组件化
Super12138 Feb 5, 2025
72b75e2
feat(settings): 为主题样式设置添加解释
Super12138 Feb 5, 2025
7ab13cd
feat(settings): 支持深色模式
Super12138 Feb 5, 2025
1213344
feat(settings): 添加颜色对比度设置项
Super12138 Feb 5, 2025
086e0ce
feat(ui): 为更改主题样式或颜色时添加动画
Super12138 Feb 5, 2025
01aaa79
feat(settings): 支持自定义已完成待办的显示模式
Super12138 Feb 5, 2025
e37b2c1
feat(settings): 为关于页面添加图标
Super12138 Feb 5, 2025
c26d41b
feat(settings): 为关于页面添加链接
Super12138 Feb 5, 2025
66f5e9f
feat(settings): 为关于页面添加 Github 仓库
Super12138 Feb 5, 2025
3ce8e5b
fix(settings): 深色模式默认值配置错误
Super12138 Feb 5, 2025
4d43293
feat(main, editor): 更加丝滑的 FAB 过渡动画
Super12138 Feb 5, 2025
de27d5d
feat(main, editor): 更加流畅的待办内容动画
Super12138 Feb 6, 2025
40961c7
feat(editor): 在编辑模式下用户修改待办后阻止返回
Super12138 Feb 6, 2025
18f0642
fix(editor): 检测内容是否修改逻辑错误
Super12138 Feb 6, 2025
b3c36e9
refactor(main): 简化二次删除确认对话框的实现
Super12138 Feb 6, 2025
1aebd9f
refactor(main, editor): 简化对话框实现
Super12138 Feb 6, 2025
47885db
feat(ui): 开屏画面
Super12138 Feb 6, 2025
a0f385e
feat(settings): 支持自定义待办列表排序
Super12138 Feb 6, 2025
2fbccaf
feat(settings): 支持按学科排序
Super12138 Feb 6, 2025
0c566aa
fix(settings): 对比度滑块标签不显示
Super12138 Feb 6, 2025
f0c894e
feat(component): 为开关设置项添加边距
Super12138 Feb 6, 2025
df3ec53
fix(ui): 高对比度下待办项多选提示不显示
Super12138 Feb 6, 2025
31c58b3
feat(editor): 删除前二次确认
Super12138 Feb 6, 2025
990f0fd
feat(main): 优化空项目提示的显示
Super12138 Feb 6, 2025
7f1e3d9
style: 移除冗余导入
Super12138 Feb 6, 2025
4e1ede0
feat(settings): 支持自定义触感反馈
Super12138 Feb 6, 2025
e44dcb8
fix(settings): 在主题色板没用跟随用户设置切换深色模式
Super12138 Feb 6, 2025
9fe2544
fix(crash): 多余的触感反馈
Super12138 Feb 6, 2025
326f7ff
fix(settings): 漏传的参数
Super12138 Feb 6, 2025
746b663
feat(settings): 优化更多提示信息的显示方式
Super12138 Feb 6, 2025
b5f327c
feat(ui): 优化界面在小屏幕下的显示效果
Super12138 Feb 7, 2025
5bd2383
perf: 优化触感反馈的开启方式
Super12138 Feb 7, 2025
6a47900
fix(settings): 单选设置项的错误边距
Super12138 Feb 7, 2025
80a6208
feat(ui): 优化 FAB 文字的显示效果
Super12138 Feb 7, 2025
4958ca9
chore(deps): 升级依赖版本
Super12138 Feb 7, 2025
25e1f29
fix(main): 临时修复因添加共享元素转场导致的FAB动画不连贯
Super12138 Feb 7, 2025
758f099
fix(AppBar): 顶部应用栏过时的 API
Super12138 Feb 7, 2025
aa3ad69
Merge branch 'main' into compose-refactor
Super12138 Feb 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 47 additions & 23 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
alias(libs.plugins.ksp)
alias(libs.plugins.aboutlibraries)
}

ksp {
arg("room.schemaLocation", "$projectDir/schemas")
}

val baseVersionName = "1.0.6"
// 配置版本信息
val baseVersionName = "compose-refactor"
val commitHash by lazy { "git rev-parse --short HEAD".exec() }
val verCode by lazy { "git rev-list --count HEAD".exec().toInt() }

Expand Down Expand Up @@ -53,50 +57,70 @@ android {
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_18
targetCompatibility = JavaVersion.VERSION_18
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
kotlinOptions {
jvmTarget = "18"
jvmTarget = "21"
}
aboutLibraries {
configPath = "$projectDir/licences"
}
buildFeatures {
viewBinding = true
compose = true
}
}

dependencies {

// Android X
implementation(libs.androidx.core)
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.core.core.splashscreen)
implementation(libs.androidx.appcompat)
implementation(libs.androidx.activity)
implementation(libs.androidx.activity.ktx)
implementation(libs.androidx.constraintlayout)
implementation(libs.androidx.fragment)
implementation(libs.androidx.fragment.ktx)
implementation(libs.androidx.recyclerview)
implementation(libs.androidx.lifecycle.viewmodel)
implementation(libs.androidx.lifecycle.viewmodel.ktx)
implementation(libs.androidx.preference)
implementation(libs.androidx.preference.ktx)
implementation(libs.androidx.security)
// Material Design
implementation(libs.material)
implementation(libs.androidx.core.splashscreen)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.lifecycle.viewmodel.compose)
implementation(libs.androidx.compose.runtime.livedata)
// implementation(libs.androidx.security)
// Compose
implementation(libs.androidx.activity.compose)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.animation)
implementation(libs.androidx.navigation)
implementation(libs.androidx.material3.adaptive)
implementation(libs.androidx.ui)
implementation(libs.androidx.ui.android)
implementation(libs.androidx.ui.graphics)
implementation(libs.androidx.ui.tooling.preview)
implementation(libs.androidx.material3)
implementation(libs.androidx.material.icon.core)
implementation(libs.androidx.material.icon.extended)
// About Libraries
implementation(libs.aboutlibraries.core)
implementation(libs.aboutlibraries.compose)
// M3 Color
implementation(libs.com.kyant0.m3color)
// Konfetti
implementation(libs.nl.dionsegijn.konfetti.compose)
// Lazy Column Scrollbar
implementation(libs.lazycolumnscrollbar)
// Kotlin Coroutines
implementation(libs.kotlinx.coroutines.core)
implementation(libs.kotlinx.coroutines.android)
// Room
implementation(libs.androidx.room.runtime)
implementation(libs.androidx.room.ktx)
annotationProcessor(libs.androidx.room.compiler)
ksp(libs.androidx.room.compiler)
// FastScroll
implementation(project(":fastscroll"))
// Test
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(platform(libs.androidx.compose.bom))
androidTestImplementation(libs.androidx.ui.test.junit4)
debugImplementation(libs.androidx.ui.tooling)
debugImplementation(libs.androidx.ui.test.manifest)
}

// 命令执行工具类
fun String.exec(): String = exec(this)

fun Project.exec(command: String): String = providers.exec {
Expand Down
16 changes: 16 additions & 0 deletions app/licences/libraries/eastereggs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"uniqueId": "com.dede.android_eggs:3.4.0",
"artifactVersion": "3.4.0",
"name": "AndroidEasterEggs",
"developers": [
{
"name": "hushenghao"
}
],
"description": "Collections the Android release Easter Egg",
"website": "https://github.com/hushenghao/AndroidEasterEggs",
"tag": "custom",
"licenses": [
"Apache-2.0"
]
}
16 changes: 16 additions & 0 deletions app/licences/libraries/libchecker.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"uniqueId": "com.absinthe.libchecker:2.5.0",
"artifactVersion": "2.5.0",
"name": "LibChecker",
"developers": [
{
"name": "LibChecker"
}
],
"description": "An app to view libraries used in apps in your device.",
"website": "https://github.com/LibChecker/LibChecker",
"tag": "custom",
"licenses": [
"Apache-2.0"
]
}
16 changes: 16 additions & 0 deletions app/licences/libraries/mauth.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"uniqueId": "com.xinto.mauth:0.9.0",
"artifactVersion": "0.9.0",
"name": "Mauth",
"developers": [
{
"name": "X1nto"
}
],
"description": "A Material You Two-factor Authentication app",
"website": "https://github.com/X1nto/Mauth/",
"tag": "custom",
"licenses": [
"GPL-3.0-or-later"
]
}
16 changes: 16 additions & 0 deletions app/licences/libraries/readyou.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"uniqueId": "me.ash.reader:0.11.1",
"artifactVersion": "0.11.1",
"name": "Read You",
"developers": [
{
"name": "Ashinch"
}
],
"description": "An Android RSS reader presented in Material You style.",
"website": "https://github.com/Ashinch/ReadYou/",
"tag": "custom",
"licenses": [
"GPL-3.0-or-later"
]
}
13 changes: 13 additions & 0 deletions app/licences/libraries/skipad.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"uniqueId": "com.github.crayonxiaoxin.abc:1.0.1",
"artifactVersion": "1.0.1",
"name": "SkipAD",
"developers": [
{
"name": "crayonxiaoxin"
}
],
"description": "Android无障碍跳过开屏广告",
"website": "https://github.com/crayonxiaoxin/SkipAD",
"tag": "custom"
}
4 changes: 1 addition & 3 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,4 @@

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-dontwarn javax.annotation.Nullable
-dontwarn javax.annotation.concurrent.GuardedBy
#-renamesourcefileattribute SourceFile
52 changes: 0 additions & 52 deletions app/schemas/cn.super12138.todo.logic.dao.ToDoRoomDB/1.json

This file was deleted.

14 changes: 5 additions & 9 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,30 @@
xmlns:tools="http://schemas.android.com/tools">

<application
android:name=".ToDoApp"
android:name=".TodoApp"
android:allowBackup="true"
android:appCategory="productivity"
android:dataExtractionRules="@xml/data_extraction_rules"
android:enableOnBackInvokedCallback="true"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.ToDo.Starting"
tools:targetApi="35">

<activity
android:name=".views.activities.MainActivity"
android:name=".ui.activities.MainActivity"
android:exported="true"
android:launchMode="singleTask">
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<action android:name="android.intent.action.APPLICATION_PREFERENCES" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".views.activities.CrashActivity"
android:name=".ui.activities.CrashActivity"
android:exported="false"
android:theme="@style/Theme.ToDo" />
</application>

</manifest>
Binary file added app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,25 @@ package cn.super12138.todo
import android.annotation.SuppressLint
import android.app.Application
import android.content.Context
import cn.super12138.todo.logic.dao.ToDoRoomDB
import cn.super12138.todo.views.activities.CrashHandler
import com.google.android.material.color.DynamicColors
import cn.super12138.todo.logic.database.TodoDatabase
import cn.super12138.todo.ui.pages.crash.CrashHandler

class ToDoApp : Application() {
private val database by lazy { ToDoRoomDB.getDatabase(this) }
class TodoApp : Application() {
private val database by lazy { TodoDatabase.getDatabase(this) }

companion object {
@SuppressLint("StaticFieldLeak")
lateinit var context: Context
lateinit var db: ToDoRoomDB
lateinit var db: TodoDatabase
}

override fun onCreate() {
super.onCreate()
DynamicColors.applyToActivitiesIfAvailable(this)

db = database
context = applicationContext

val crashHandler = CrashHandler(this)
val crashHandler = CrashHandler(applicationContext)
Thread.setDefaultUncaughtExceptionHandler(crashHandler)

db = database
}
}
38 changes: 0 additions & 38 deletions app/src/main/kotlin/cn/super12138/todo/constant/Constants.kt

This file was deleted.

12 changes: 0 additions & 12 deletions app/src/main/kotlin/cn/super12138/todo/constant/GlobalValues.kt

This file was deleted.

Loading