Skip to content

Commit

Permalink
refactor: separation module for lib-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
jing332 committed Aug 12, 2024
1 parent 4edc37c commit ee05aad
Show file tree
Hide file tree
Showing 125 changed files with 768 additions and 864 deletions.
14 changes: 4 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -215,23 +215,17 @@ dependencies {

implementation libs.bundles.accompanist

implementation("io.github.dokar3:sheets-m3:0.5.4")


implementation(libs.bundles.lifecycle)
implementation(libs.bundles.compose)

def composeBom = platform(libs.composeBom)
def composeBom = platform(libs.compose.bom)
// def composeBom = platform("dev.chrisbanes.compose:compose-bom:2024.01.00-alpha01")
implementation composeBom
androidTestImplementation composeBom

implementation("androidx.compose.material3:material3")
implementation("androidx.compose.foundation:foundation")
implementation("androidx.compose.ui:ui")

implementation("androidx.compose.material:material-icons-core")
implementation("androidx.compose.material:material-icons-extended")
implementation("androidx.compose.material3:material3-window-size-class")
implementation(libs.bundles.compose)
implementation(libs.bundles.compose.material3)

androidTestImplementation 'androidx.compose.ui:ui-test-junit4'
debugImplementation 'androidx.compose.ui:ui-test-manifest'
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.github.jing332.tts_server_android
import android.content.Context
import com.github.jing332.tts_server_android.constant.AppConst
import com.github.jing332.lib_gojni.NativeUtils
import com.github.jing332.tts_server_android.utils.ClipboardUtils
import com.github.jing332.common.utils.ClipboardUtils
import com.github.jing332.common.utils.longToast
import com.github.jing332.common.utils.runOnUI
import java.time.LocalDateTime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextAlign.Companion
import androidx.compose.ui.unit.dp
import androidx.core.net.toUri
import com.github.jing332.compose.widgets.AppDialog
import com.github.jing332.compose.widgets.AppLauncherIcon
import com.github.jing332.tts_server_android.BuildConfig
import com.github.jing332.tts_server_android.R
import com.github.jing332.tts_server_android.compose.widgets.AppDialog
import com.github.jing332.tts_server_android.compose.widgets.AppLauncherIcon

@Composable
fun AboutDialog(onDismissRequest: () -> Unit) {
Expand All @@ -36,7 +36,7 @@ fun AboutDialog(onDismissRequest: () -> Unit) {
onDismissRequest = onDismissRequest,
title = {
Row(verticalAlignment = Alignment.CenterVertically) {
AppLauncherIcon(modifier = Modifier.size(64.dp))
AppLauncherIcon(modifier = Modifier.size(64.dp), R.mipmap.ic_app_launcher_round)
Text(
stringResource(id = R.string.app_name),
modifier = Modifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.github.jing332.common.DateFormatConst
import com.github.jing332.common.utils.ClipboardUtils
import com.github.jing332.compose.widgets.AppDialog
import com.github.jing332.compose.widgets.Markdown
import com.github.jing332.tts_server_android.R
import com.github.jing332.tts_server_android.compose.widgets.AppDialog
import com.github.jing332.tts_server_android.compose.widgets.Markdown
import com.github.jing332.tts_server_android.constant.AppConst
import com.github.jing332.tts_server_android.model.updater.AppUpdateChecker
import com.github.jing332.tts_server_android.utils.ClipboardUtils

@Preview
@Composable
Expand Down Expand Up @@ -101,8 +100,7 @@ fun AppUpdateDialog(
ClipboardUtils.copyText("TTS Server", url)
context.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url)))
}

AppDialog(onDismissRequest = onDismissRequest,
AppDialog(onDismissRequest = onDismissRequest,
title = {
Text(
stringResource(id = R.string.check_update),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ import androidx.navigation.compose.composable
import androidx.navigation.compose.currentBackStackEntryAsState
import androidx.navigation.compose.rememberNavController
import com.github.jing332.common.DateFormatConst
import com.github.jing332.common.utils.clone
import com.github.jing332.common.utils.longToast
import com.github.jing332.common.utils.performLongPress
import com.github.jing332.common.utils.toast
import com.github.jing332.compose.widgets.AppLauncherIcon
import com.github.jing332.tts_server_android.BuildConfig
import com.github.jing332.tts_server_android.R
import com.github.jing332.tts_server_android.ShortCuts
Expand All @@ -90,7 +95,6 @@ import com.github.jing332.tts_server_android.compose.settings.SettingsScreen
import com.github.jing332.tts_server_android.compose.systts.SystemTtsScreen
import com.github.jing332.tts_server_android.compose.systts.list.edit.TtsEditContainerScreen
import com.github.jing332.tts_server_android.compose.theme.AppTheme
import com.github.jing332.tts_server_android.compose.widgets.AppLauncherIcon
import com.github.jing332.tts_server_android.conf.AppConfig
import com.github.jing332.tts_server_android.constant.AppConst
import com.github.jing332.tts_server_android.data.appDb
Expand All @@ -99,10 +103,6 @@ import com.github.jing332.tts_server_android.model.speech.tts.ITextToSpeechEngin
import com.github.jing332.tts_server_android.service.systts.SystemTtsService
import com.github.jing332.tts_server_android.ui.AppHelpDocumentActivity
import com.github.jing332.tts_server_android.utils.MyTools.killBattery
import com.github.jing332.tts_server_android.utils.clone
import com.github.jing332.common.utils.longToast
import com.github.jing332.tts_server_android.utils.performLongPress
import com.github.jing332.common.utils.toast
import com.google.accompanist.permissions.ExperimentalPermissionsApi
import com.google.accompanist.permissions.isGranted
import com.google.accompanist.permissions.rememberPermissionState
Expand Down Expand Up @@ -362,7 +362,7 @@ fun NavDrawerContent(
}
)) {
Row(verticalAlignment = Alignment.CenterVertically) {
AppLauncherIcon(Modifier.size(64.dp))
AppLauncherIcon(Modifier.size(64.dp), R.mipmap.ic_app_launcher_round)
Column(
modifier = Modifier
.padding(start = 8.dp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.lifecycle.viewmodel.compose.viewModel
import com.github.jing332.compose.widgets.AppDialog
import com.github.jing332.compose.widgets.TextCheckBox
import com.github.jing332.tts_server_android.R
import com.github.jing332.tts_server_android.compose.widgets.AppDialog
import com.github.jing332.tts_server_android.compose.widgets.TextCheckBox
import com.github.jing332.tts_server_android.ui.AppActivityResultContracts
import com.github.jing332.tts_server_android.ui.FilePickerActivity
import com.github.jing332.tts_server_android.ui.view.AppDialogs.displayErrorDialog
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel
import com.github.jing332.tts_server_android.R
import com.github.jing332.tts_server_android.app
import com.github.jing332.tts_server_android.compose.widgets.AppDialog
import com.github.jing332.tts_server_android.compose.widgets.LoadingContent
import com.github.jing332.tts_server_android.ui.AppActivityResultContracts
import com.github.jing332.tts_server_android.ui.FilePickerActivity
import com.github.jing332.tts_server_android.ui.view.AppDialogs.displayErrorDialog
import com.github.jing332.common.utils.FileUtils.readBytes
import com.github.jing332.compose.widgets.AppDialog
import com.github.jing332.compose.widgets.LoadingContent
import kotlinx.coroutines.launch

@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.lazy.items
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material.icons.automirrored.filled.InsertDriveFile
import androidx.compose.material.icons.automirrored.filled.WrapText
import androidx.compose.material.icons.filled.BugReport
import androidx.compose.material.icons.filled.ColorLens
import androidx.compose.material.icons.filled.InsertDriveFile
import androidx.compose.material.icons.filled.MoreVert
import androidx.compose.material.icons.filled.Save
import androidx.compose.material.icons.filled.SettingsRemote
Expand Down Expand Up @@ -43,14 +43,14 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel
import com.github.jing332.compose.ComposeExtensions.clickableRipple
import com.github.jing332.compose.widgets.CheckedMenuItem
import com.github.jing332.compose.widgets.LongClickIconButton
import com.github.jing332.tts_server_android.R
import com.github.jing332.tts_server_android.compose.widgets.CheckedMenuItem
import com.github.jing332.tts_server_android.compose.widgets.LongClickIconButton
import com.github.jing332.tts_server_android.conf.CodeEditorConfig
import com.github.jing332.tts_server_android.ui.AppActivityResultContracts
import com.github.jing332.tts_server_android.ui.FilePickerActivity
import com.github.jing332.tts_server_android.ui.view.AppDialogs.displayErrorDialog
import com.github.jing332.tts_server_android.utils.clickableRipple
import io.github.rosemoe.sora.widget.CodeEditor
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -157,7 +157,7 @@ fun CodeEditorScreen(
)
}
},
leadingIcon = { Icon(Icons.Default.InsertDriveFile, null) }
leadingIcon = { Icon(Icons.AutoMirrored.Filled.InsertDriveFile, null) }
)

var syncEnabled by remember { CodeEditorConfig.isRemoteSyncEnabled }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.withStyle
import androidx.compose.ui.unit.dp
import com.github.jing332.tts_server_android.compose.widgets.AppBottomSheet
import com.github.jing332.compose.widgets.AppBottomSheet
import com.github.jing332.common.LogLevel

@OptIn(ExperimentalMaterial3Api::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.github.jing332.tts_server_android.R
import com.github.jing332.tts_server_android.compose.widgets.AppDialog
import com.github.jing332.tts_server_android.compose.widgets.DenseOutlinedField
import com.github.jing332.compose.widgets.AppDialog
import com.github.jing332.compose.widgets.DenseOutlinedField
import com.github.jing332.tts_server_android.conf.CodeEditorConfig

@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import com.github.jing332.tts_server_android.R
import com.github.jing332.tts_server_android.compose.widgets.AppSelectionDialog
import com.github.jing332.compose.widgets.AppSelectionDialog
import com.github.jing332.tts_server_android.conf.CodeEditorConfig
import com.github.jing332.tts_server_android.constant.CodeEditorTheme

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.github.jing332.common.LogLevel
import com.github.jing332.compose.widgets.DenseOutlinedField
import com.github.jing332.compose.widgets.LocalBroadcastReceiver
import com.github.jing332.compose.widgets.SwitchFloatingButton
import com.github.jing332.tts_server_android.R
import com.github.jing332.tts_server_android.compose.systts.LogScreen
import com.github.jing332.tts_server_android.compose.widgets.DenseOutlinedField
import com.github.jing332.tts_server_android.compose.widgets.LocalBroadcastReceiver
import com.github.jing332.tts_server_android.compose.widgets.SwitchFloatingButton
import com.github.jing332.tts_server_android.constant.KeyConst
import com.github.jing332.common.LogLevel
import com.github.jing332.tts_server_android.constant.AppLog
import com.github.jing332.tts_server_android.constant.KeyConst

@Suppress("DEPRECATION")
@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import com.github.jing332.tts_server_android.R
import com.github.jing332.tts_server_android.compose.widgets.LocalBroadcastReceiver
import com.github.jing332.compose.widgets.LocalBroadcastReceiver
import com.github.jing332.tts_server_android.service.forwarder.system.SysTtsForwarderService
import com.google.accompanist.web.rememberWebViewNavigator
import com.google.accompanist.web.rememberWebViewState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import androidx.compose.ui.res.stringResource
import androidx.core.net.toUri
import com.github.jing332.tts_server_android.R
import com.github.jing332.tts_server_android.compose.nav.NavTopAppBar
import com.github.jing332.tts_server_android.compose.widgets.CheckedMenuItem
import com.github.jing332.compose.widgets.CheckedMenuItem
import com.github.jing332.common.utils.toast

@OptIn(ExperimentalMaterial3Api::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import com.github.jing332.tts_server_android.compose.forwarder.BasicConfigScreen
import com.github.jing332.tts_server_android.compose.forwarder.BasicForwarderScreen
import com.github.jing332.tts_server_android.compose.forwarder.ConfigViewModel
import com.github.jing332.tts_server_android.compose.forwarder.ForwarderTopAppBar
import com.github.jing332.tts_server_android.compose.widgets.TextFieldDialog
import com.github.jing332.compose.widgets.TextFieldDialog
import com.github.jing332.tts_server_android.conf.MsTtsForwarderConfig
import com.github.jing332.tts_server_android.service.forwarder.ForwarderServiceManager.switchMsTtsForwarder
import com.github.jing332.tts_server_android.service.forwarder.ms.MsTtsForwarderService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import com.github.jing332.tts_server_android.R
import com.github.jing332.tts_server_android.compose.LocalDrawerState
import com.github.jing332.tts_server_android.compose.widgets.AppTooltip
import com.github.jing332.compose.widgets.AppTooltip
import kotlinx.coroutines.launch

@OptIn(ExperimentalMaterial3Api::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import com.github.jing332.tts_server_android.R
import com.github.jing332.tts_server_android.compose.widgets.AppDialog
import com.github.jing332.tts_server_android.compose.widgets.LabelSlider
import com.github.jing332.compose.widgets.AppDialog
import com.github.jing332.compose.widgets.LabelSlider

@Composable
internal fun DropdownPreference(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.drake.net.utils.withMain
import com.github.jing332.common.utils.ClipboardUtils
import com.github.jing332.common.utils.toast
import com.github.jing332.compose.ComposeExtensions.clickableRipple
import com.github.jing332.compose.widgets.AppDialog
import com.github.jing332.compose.widgets.LoadingContent
import com.github.jing332.tts_server_android.R
import com.github.jing332.tts_server_android.compose.widgets.AppDialog
import com.github.jing332.tts_server_android.compose.widgets.LoadingContent
import com.github.jing332.tts_server_android.conf.AppConfig
import com.github.jing332.tts_server_android.data.entities.systts.SystemTts
import com.github.jing332.tts_server_android.utils.ClipboardUtils
import com.github.jing332.tts_server_android.utils.StringUtils.sizeToReadable
import com.github.jing332.tts_server_android.utils.clickableRipple
import com.github.jing332.common.utils.toast
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.viewinterop.AndroidView
import com.github.jing332.tts_server_android.R
import com.github.jing332.tts_server_android.compose.systts.directlink.LinkUploadSelectionDialog
import com.github.jing332.tts_server_android.compose.widgets.AppBottomSheet
import com.github.jing332.compose.widgets.AppBottomSheet
import com.github.jing332.tts_server_android.ui.AppActivityResultContracts
import com.github.jing332.tts_server_android.ui.FilePickerActivity
import com.github.jing332.tts_server_android.ui.view.BigTextView
import com.github.jing332.tts_server_android.utils.ClipboardUtils
import com.github.jing332.common.utils.ClipboardUtils
import com.github.jing332.common.utils.toast


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ import com.drake.net.Net
import com.drake.net.okhttp.trustSSLCertificate
import com.drake.net.utils.withMain
import com.github.jing332.tts_server_android.R
import com.github.jing332.tts_server_android.compose.widgets.AppBottomSheet
import com.github.jing332.tts_server_android.compose.widgets.AppDialog
import com.github.jing332.tts_server_android.compose.widgets.RowToggleButtonGroup
import com.github.jing332.compose.widgets.AppBottomSheet
import com.github.jing332.compose.widgets.AppDialog
import com.github.jing332.compose.widgets.RowToggleButtonGroup
import com.github.jing332.tts_server_android.ui.AppActivityResultContracts
import com.github.jing332.tts_server_android.ui.FilePickerActivity
import com.github.jing332.tts_server_android.ui.view.AppDialogs.displayErrorDialog
import com.github.jing332.tts_server_android.utils.ClipboardUtils
import com.github.jing332.common.utils.ClipboardUtils
import com.github.jing332.common.utils.FileUtils.readAllText
import com.github.jing332.common.utils.longToast
import com.github.jing332.tts_server_android.utils.toJsonListString
Expand Down
Loading

0 comments on commit ee05aad

Please sign in to comment.