Skip to content

Commit

Permalink
feat: [List] Migrate to new UI
Browse files Browse the repository at this point in the history
Change-Id: Ia9d8fc813d7fa9296d0b4298eb5b512ec2438118
  • Loading branch information
XayahSuSuSu committed Sep 8, 2024
1 parent 2e07fac commit f2bad3c
Show file tree
Hide file tree
Showing 99 changed files with 5,519 additions and 780 deletions.
3 changes: 3 additions & 0 deletions source/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import com.android.build.gradle.internal.api.BaseVariantOutputImpl
plugins {
alias(libs.plugins.application.common)
alias(libs.plugins.application.hilt)
alias(libs.plugins.application.hilt.work)
alias(libs.plugins.application.compose)
alias(libs.plugins.refine)
}
Expand Down Expand Up @@ -122,6 +123,7 @@ dependencies {
implementation(project(":core:data"))
implementation(project(":core:datastore"))
implementation(project(":core:util"))
implementation(project(":core:work"))
compileOnly(project(":core:hiddenapi"))
implementation(project(":core:rootservice"))

Expand All @@ -138,6 +140,7 @@ dependencies {
implementation(project(":feature:main:settings"))
implementation(project(":feature:main:configurations"))
implementation(project(":feature:main:processing"))
implementation(project(":feature:main:list"))
implementation(project(":feature:main:packages"))
implementation(project(":feature:main:medium"))
implementation(project(":feature:main:directory"))
Expand Down
6 changes: 6 additions & 0 deletions source/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,11 @@
android:name="autoStoreLocales"
android:value="true" />
</service>

<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
tools:node="remove">
</provider>
</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package com.xayah.databackup

import android.app.Application
import androidx.hilt.work.HiltWorkerFactory
import androidx.work.Configuration
import dagger.hilt.android.HiltAndroidApp
import org.bouncycastle.jce.provider.BouncyCastleProvider
import java.security.Security

import javax.inject.Inject

@HiltAndroidApp
class DataBackupApplication : Application() {
class DataBackupApplication : Application(), Configuration.Provider {
companion object {
lateinit var application: Application
}
Expand All @@ -34,4 +36,13 @@ class DataBackupApplication : Application() {
Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME)
Security.insertProviderAt(BouncyCastleProvider(), 1)
}

// Hilt: Inject HiltWorkFactory instance
@Inject
lateinit var workerFactory: HiltWorkerFactory

override val workManagerConfiguration: Configuration
get() = Configuration.Builder()
.setWorkerFactory(workerFactory)
.build()
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import com.xayah.feature.main.cloud.add.PageWebDAVSetup
import com.xayah.feature.main.configurations.PageConfigurations
import com.xayah.feature.main.dashboard.PageDashboard
import com.xayah.feature.main.directory.PageDirectory
import com.xayah.feature.main.list.ListRoute
import com.xayah.feature.main.medium.backup.detail.PageMediumBackupDetail
import com.xayah.feature.main.medium.backup.list.PageMediumBackupList
import com.xayah.feature.main.medium.restore.detail.PageMediumRestoreDetail
Expand Down Expand Up @@ -102,6 +103,9 @@ class MainActivity : AppCompatActivity() {
composable(MainRoutes.PackagesBackupList.route) {
PagePackagesBackupList()
}
composable(MainRoutes.List.route) {
ListRoute()
}
composable(MainRoutes.PackagesBackupDetail.route) {
PagePackagesBackupDetail()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.core.view.WindowCompat
import com.xayah.core.datastore.getCurrentAppVersionName
import com.xayah.core.datastore.readAppVersionName
import com.xayah.core.work.WorkManagerInitializer
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.runBlocking
Expand All @@ -29,6 +30,7 @@ class SplashActivity : AppCompatActivity() {
// There is an update
startActivity(Intent(this, SetupActivity::class.java))
} else {
WorkManagerInitializer.fullInitialize(this)
startActivity(Intent(this, MainActivity::class.java))
}
finish()
Expand Down
16 changes: 16 additions & 0 deletions source/app/src/main/res/drawable/ic_rounded_android_circle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M9.73,12.48c-0.16,0 -0.29,0.05 -0.4,0.16s-0.16,0.24 -0.16,0.4 0.05,0.29 0.16,0.4 0.24,0.16 0.4,0.16 0.29,-0.05 0.4,-0.16 0.16,-0.24 0.16,-0.4 -0.05,-0.29 -0.16,-0.4 -0.24,-0.16 -0.4,-0.16Z" />
<path
android:fillColor="@android:color/white"
android:pathData="M14.27,12.48c-0.16,0 -0.29,0.05 -0.4,0.16s-0.16,0.24 -0.16,0.4 0.05,0.29 0.16,0.4 0.24,0.16 0.4,0.16 0.29,-0.05 0.4,-0.16 0.16,-0.24 0.16,-0.4 -0.05,-0.29 -0.16,-0.4 -0.24,-0.16 -0.4,-0.16Z" />
<path
android:fillColor="@android:color/white"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2ZM7,14.87c0.07,-0.81 0.32,-1.56 0.74,-2.24s1,-1.22 1.71,-1.62l-0.84,-1.45c-0.05,-0.07 -0.06,-0.14 -0.03,-0.22 0.02,-0.08 0.07,-0.13 0.15,-0.17 0.06,-0.04 0.13,-0.05 0.2,-0.02s0.14,0.07 0.18,0.14l0.84,1.45c0.65,-0.27 1.33,-0.41 2.05,-0.41s1.39,0.14 2.05,0.41l0.84,-1.45c0.05,-0.07 0.11,-0.11 0.18,-0.14s0.14,-0.02 0.2,0.02c0.08,0.04 0.12,0.09 0.15,0.17 0.02,0.08 0.01,0.15 -0.03,0.22l-0.84,1.45c0.71,0.4 1.28,0.94 1.71,1.62s0.68,1.43 0.74,2.24H7Z" />
</vector>
10 changes: 10 additions & 0 deletions source/app/src/main/res/drawable/ic_rounded_database_circle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2ZM15.81,14.26c0,0.48 -0.37,0.89 -1.11,1.23 -0.74,0.34 -1.64,0.51 -2.7,0.51s-1.96,-0.17 -2.7,-0.51c-0.74,-0.34 -1.11,-0.75 -1.11,-1.23v-1.22c0,0.29 0.12,0.54 0.37,0.76 0.25,0.21 0.56,0.4 0.95,0.54 0.38,0.15 0.8,0.26 1.24,0.33 0.45,0.07 0.86,0.11 1.25,0.11s0.8,-0.04 1.25,-0.11c0.45,-0.07 0.86,-0.18 1.24,-0.33 0.38,-0.15 0.7,-0.33 0.95,-0.54 0.25,-0.22 0.37,-0.47 0.37,-0.76v1.22ZM15.81,12c0,0.48 -0.37,0.89 -1.11,1.23 -0.74,0.34 -1.64,0.51 -2.7,0.51s-1.96,-0.17 -2.7,-0.51c-0.74,-0.34 -1.11,-0.75 -1.11,-1.23v-1.22c0,0.29 0.12,0.54 0.37,0.76 0.25,0.22 0.56,0.4 0.95,0.55 0.38,0.15 0.8,0.26 1.24,0.34 0.45,0.08 0.86,0.11 1.25,0.11s0.8,-0.04 1.25,-0.11c0.45,-0.08 0.86,-0.19 1.24,-0.34 0.38,-0.15 0.7,-0.33 0.95,-0.55 0.25,-0.22 0.37,-0.47 0.37,-0.76v1.22ZM14.7,10.98c-0.74,0.35 -1.64,0.52 -2.7,0.52s-1.96,-0.17 -2.7,-0.52c-0.74,-0.35 -1.11,-0.76 -1.11,-1.24s0.37,-0.89 1.11,-1.23c0.74,-0.34 1.64,-0.51 2.7,-0.51s1.96,0.17 2.7,0.51c0.74,0.34 1.11,0.75 1.11,1.23s-0.37,0.9 -1.11,1.24Z" />
</vector>
22 changes: 22 additions & 0 deletions source/app/src/main/res/drawable/ic_rounded_package_2_circle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2ZM16.5,13.99c0,0.18 -0.04,0.35 -0.13,0.5 -0.09,0.15 -0.21,0.27 -0.37,0.36l-3.5,2.01c-0.16,0.09 -0.33,0.14 -0.5,0.14s-0.34,-0.05 -0.5,-0.14l-3.5,-2.01c-0.16,-0.09 -0.28,-0.21 -0.37,-0.36 -0.09,-0.15 -0.13,-0.32 -0.13,-0.5v-3.97c0,-0.18 0.04,-0.35 0.13,-0.5 0.09,-0.15 0.21,-0.27 0.37,-0.36l3.5,-2.01c0.16,-0.09 0.33,-0.14 0.5,-0.14s0.34,0.05 0.5,0.14l3.5,2.01c0.16,0.09 0.28,0.21 0.37,0.36 0.09,0.15 0.13,0.32 0.13,0.5v3.97Z" />
<path
android:fillColor="@android:color/white"
android:pathData="M10.01,9.15l-0.97,0.56l2.96,1.71l0.97,-0.56l-2.96,-1.71z" />
<path
android:fillColor="@android:color/white"
android:pathData="M8.5,13.97l3,1.74l0,-3.42l-3,-1.74l0,3.42z" />
<path
android:fillColor="@android:color/white"
android:pathData="M14.96,9.71l-2.96,-1.71l-0.97,0.56l2.97,1.7l0.96,-0.55z" />
<path
android:fillColor="@android:color/white"
android:pathData="M12.5,15.71l3,-1.74l0,-3.42l-3,1.74l0,3.42z" />
</vector>
16 changes: 16 additions & 0 deletions source/app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -344,4 +344,20 @@
<string name="download">下载</string>
<string name="changelog">更新日志</string>
<string name="args_update_from">你可以从%1$s版本更新到%2$s版本</string>
<string name="no_item_selected">没有选中任何数据项</string>
<string name="apk_selected">仅选择了安装包</string>
<string name="data_selected">仅选择了数据</string>
<string name="all_selected">选择了所有数据项</string>
<string name="custom_selected">选择了自定义数据项</string>
<string name="data_items">数据项</string>
<string name="unselect_all">全部不选</string>
<string name="reverse_selection">反选选择项</string>
<string name="for_selected">对于已选择的…</string>
<string name="block">禁用</string>
<string name="detailed_data_items">详细数据项</string>
<string name="refresh">刷新</string>
<string name="initializing_app_list">正在初始化应用列表</string>
<string name="updating_app_list">正在更新应用列表</string>
<string name="loading_backups">正在加载备份</string>
<string name="updating_file_list">正在更新文件列表</string>
</resources>
16 changes: 16 additions & 0 deletions source/app/src/main/res/values-zh-rHK/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -344,4 +344,20 @@
<string name="download">下載</string>
<string name="changelog">更新日志</string>
<string name="args_update_from">你可以從%1$s版本更新到%2$s版本</string>
<string name="no_item_selected">沒有選取任何資料項目</string>
<string name="apk_selected">僅選擇了安裝套件</string>
<string name="data_selected">僅選擇了資料</string>
<string name="all_selected">選擇了所有資料項</string>
<string name="custom_selected">選擇了自訂資料項</string>
<string name="data_items">數據項</string>
<string name="unselect_all">全部不選</string>
<string name="reverse_selection">反選選擇項</string>
<string name="for_selected">對於已選擇的…</string>
<string name="block">停用</string>
<string name="detailed_data_items">詳細數據項</string>
<string name="refresh">刷新</string>
<string name="initializing_app_list">正在初始化應用列表</string>
<string name="updating_app_list">正在更新應用列表</string>
<string name="loading_backups">正在加載備份</string>
<string name="updating_file_list">正在更新文件列表</string>
</resources>
16 changes: 16 additions & 0 deletions source/app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -344,4 +344,20 @@
<string name="download">下載</string>
<string name="changelog">更新日志</string>
<string name="args_update_from">你可以從%1$s版本更新到%2$s版本</string>
<string name="no_item_selected">沒有選取任何資料項目</string>
<string name="apk_selected">僅選擇了安裝套件</string>
<string name="data_selected">僅選擇了資料</string>
<string name="all_selected">選擇了所有資料項</string>
<string name="custom_selected">選擇了自訂資料項</string>
<string name="data_items">數據項</string>
<string name="unselect_all">全部不選</string>
<string name="reverse_selection">反選選擇項</string>
<string name="for_selected">對於已選擇的…</string>
<string name="block">停用</string>
<string name="detailed_data_items">詳細數據項</string>
<string name="refresh">刷新</string>
<string name="initializing_app_list">正在初始化應用列表</string>
<string name="updating_app_list">正在更新應用列表</string>
<string name="loading_backups">正在加載備份</string>
<string name="updating_file_list">正在更新文件列表</string>
</resources>
16 changes: 16 additions & 0 deletions source/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -354,4 +354,20 @@
<string name="download">Download</string>
<string name="changelog">Changelog</string>
<string name="args_update_from">You can update from version %1$s to version %2$s</string>
<string name="no_item_selected">No item selected</string>
<string name="apk_selected">APK selected</string>
<string name="data_selected">Data selected</string>
<string name="all_selected">All items selected</string>
<string name="custom_selected">Custom items selected</string>
<string name="data_items">Data items</string>
<string name="unselect_all">Unselect all</string>
<string name="reverse_selection">Reverse selection</string>
<string name="for_selected">For selected…</string>
<string name="block">Block</string>
<string name="detailed_data_items">Detailed data items</string>
<string name="refresh">Refresh</string>
<string name="initializing_app_list">Initializing app list</string>
<string name="updating_app_list">Updating app list</string>
<string name="loading_backups">Loading backups</string>
<string name="updating_file_list">Updating file list</string>
</resources>
8 changes: 8 additions & 0 deletions source/build-logic/convention/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ gradlePlugin {
id = "application.hilt"
implementationClass = "ApplicationHiltConventionPlugin"
}
register("applicationHiltWork") {
id = "application.hilt.work"
implementationClass = "ApplicationHiltWorkConventionPlugin"
}

register("libraryCommon") {
id = "library.common"
Expand All @@ -48,6 +52,10 @@ gradlePlugin {
id = "library.hilt"
implementationClass = "LibraryHiltConventionPlugin"
}
register("libraryHiltWork") {
id = "library.hilt.work"
implementationClass = "LibraryHiltWorkConventionPlugin"
}
register("libraryRoom") {
id = "library.room"
implementationClass = "LibraryRoomConventionPlugin"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import com.android.build.api.dsl.ApplicationExtension
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.getByType

class ApplicationHiltWorkConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
extensions.getByType<ApplicationExtension>().apply {
dependencies {
add("implementation", catalogLibs.findLibrary("hilt.work").get())
add("kapt", catalogLibs.findLibrary("hilt.work.compiler").get())
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import com.android.build.gradle.LibraryExtension
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.getByType

class LibraryHiltWorkConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
extensions.getByType<LibraryExtension>().apply {
dependencies {
add("implementation", catalogLibs.findLibrary("hilt.work").get())
add("kapt", catalogLibs.findLibrary("hilt.work.compiler").get())
}
}
}
}
}
3 changes: 3 additions & 0 deletions source/core/data/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,7 @@ dependencies {

// PickYou
implementation(libs.pickyou)

// Work manager
implementation(libs.androidx.work.runtime.ktx)
}
Loading

0 comments on commit f2bad3c

Please sign in to comment.