@@ -15,21 +15,17 @@ import androidx.activity.compose.setContent
15
15
import androidx.appcompat.app.AppCompatActivity
16
16
import androidx.compose.animation.AnimatedVisibility
17
17
import androidx.compose.foundation.ExperimentalFoundationApi
18
- import androidx.compose.foundation.background
19
18
import androidx.compose.foundation.combinedClickable
20
19
import androidx.compose.foundation.interaction.MutableInteractionSource
21
20
import androidx.compose.foundation.layout.Column
22
21
import androidx.compose.foundation.layout.Row
23
22
import androidx.compose.foundation.layout.Spacer
24
- import androidx.compose.foundation.layout.fillMaxHeight
25
23
import androidx.compose.foundation.layout.fillMaxSize
26
24
import androidx.compose.foundation.layout.fillMaxWidth
27
25
import androidx.compose.foundation.layout.height
28
26
import androidx.compose.foundation.layout.padding
29
27
import androidx.compose.foundation.layout.size
30
- import androidx.compose.foundation.layout.width
31
28
import androidx.compose.foundation.rememberScrollState
32
- import androidx.compose.foundation.shape.CornerSize
33
29
import androidx.compose.foundation.verticalScroll
34
30
import androidx.compose.material.icons.Icons
35
31
import androidx.compose.material.icons.filled.ArrowCircleUp
@@ -41,7 +37,6 @@ import androidx.compose.material3.DrawerValue
41
37
import androidx.compose.material3.HorizontalDivider
42
38
import androidx.compose.material3.Icon
43
39
import androidx.compose.material3.MaterialTheme
44
- import androidx.compose.material3.ModalNavigationDrawer
45
40
import androidx.compose.material3.NavigationDrawerItem
46
41
import androidx.compose.material3.NavigationDrawerItemDefaults
47
42
import androidx.compose.material3.Text
@@ -85,10 +80,7 @@ import com.github.jing332.database.entities.systts.SystemTtsV2
85
80
import com.github.jing332.tts_server_android.BuildConfig
86
81
import com.github.jing332.tts_server_android.R
87
82
import com.github.jing332.tts_server_android.ShortCuts
88
- import com.github.jing332.tts_server_android.compose.forwarder.systts.SystemTtsForwarderScreen
89
83
import com.github.jing332.tts_server_android.compose.nav.NavRoutes
90
- import com.github.jing332.tts_server_android.compose.settings.SettingsScreen
91
- import com.github.jing332.tts_server_android.compose.systts.SystemTtsScreen
92
84
import com.github.jing332.tts_server_android.compose.systts.list.ui.widgets.TtsEditContainerScreen
93
85
import com.github.jing332.tts_server_android.compose.theme.AppTheme
94
86
import com.github.jing332.tts_server_android.conf.AppConfig
@@ -188,10 +180,6 @@ private fun MainScreen(finish: () -> Unit) {
188
180
val drawerState = rememberDrawerState(initialValue = DrawerValue .Closed )
189
181
val entryState by navController.currentBackStackEntryAsState()
190
182
191
- val gesturesEnabled = remember(entryState) {
192
- NavRoutes .routes.find { it.id == entryState?.destination?.route } != null
193
- }
194
-
195
183
var lastBackDownTime by remember { mutableLongStateOf(0L ) }
196
184
BackHandler (enabled = drawerState.isClosed) {
197
185
val duration = 2000
@@ -208,68 +196,45 @@ private fun MainScreen(finish: () -> Unit) {
208
196
LocalNavController provides navController,
209
197
LocalDrawerState provides drawerState,
210
198
) {
211
- ModalNavigationDrawer (
212
- drawerState = drawerState,
213
- gesturesEnabled = gesturesEnabled,
214
- drawerContent = {
215
- NavDrawerContent (
216
- Modifier
217
- .fillMaxHeight()
218
- .width(300 .dp)
219
- .clip(
220
- MaterialTheme .shapes.large.copy(
221
- topStart = CornerSize (0 .dp),
222
- bottomStart = CornerSize (0 .dp)
223
- )
224
- )
225
- .background(MaterialTheme .colorScheme.background)
226
- .padding(12 .dp),
227
- navController,
228
- drawerState,
229
- )
230
- }) {
231
-
232
- val sharedVM: SharedViewModel = viewModel()
233
- NavHost (
234
- navController = navController,
235
- startDestination = NavRoutes .SystemTTS .id
236
- ) {
237
- composable(NavRoutes .SystemTTS .id) { SystemTtsScreen (sharedVM) }
238
- composable(NavRoutes .SystemTtsForwarder .id) {
239
- SystemTtsForwarderScreen ()
240
- }
241
- composable(NavRoutes .Settings .id) { SettingsScreen (drawerState) }
242
-
243
- composable(NavRoutes .TtsEdit .id) {
244
- var stateSystemTts by rememberSaveable {
245
- mutableStateOf(
246
- checkNotNull(sharedVM.getOnce<SystemTtsV2 >(NavRoutes .TtsEdit .DATA )) {
247
- " Not found systemTts from sharedVM"
248
- }
249
- )
250
- }
199
+ val sharedVM: SharedViewModel = viewModel()
200
+ NavHost (
201
+ navController = navController,
202
+ startDestination = NavRoutes .MainPager .id
203
+ ) {
204
+ composable(NavRoutes .MainPager .id) { MainPager (sharedVM) }
205
+ // composable(NavRoutes.SystemTtsForwarder.id) {
206
+ // SystemTtsForwarderScreen()
207
+ // }
208
+ // composable(NavRoutes.Settings.id) { SettingsScreen(drawerState) }
251
209
252
- TtsEditContainerScreen (
253
- modifier = Modifier
254
- .fillMaxSize(),
255
- systts = stateSystemTts,
256
- onSysttsChange = {
257
- stateSystemTts = it
258
- println (" UpdateSystemTTS: $it " )
259
- },
260
- onSave = {
261
- navController.popBackStack()
262
- dbm.systemTtsV2.insert(stateSystemTts)
263
- if (stateSystemTts.isEnabled) SystemTtsService .notifyUpdateConfig()
264
- },
265
- onCancel = {
266
- navController.popBackStack()
210
+ composable(NavRoutes .TtsEdit .id) {
211
+ var stateSystemTts by rememberSaveable {
212
+ mutableStateOf(
213
+ checkNotNull(sharedVM.getOnce<SystemTtsV2 >(NavRoutes .TtsEdit .DATA )) {
214
+ " Not found systemTts from sharedVM"
267
215
}
268
216
)
269
217
}
218
+
219
+ TtsEditContainerScreen (
220
+ modifier = Modifier
221
+ .fillMaxSize(),
222
+ systts = stateSystemTts,
223
+ onSysttsChange = {
224
+ stateSystemTts = it
225
+ println (" UpdateSystemTTS: $it " )
226
+ },
227
+ onSave = {
228
+ navController.popBackStack()
229
+ dbm.systemTtsV2.insert(stateSystemTts)
230
+ if (stateSystemTts.isEnabled) SystemTtsService .notifyUpdateConfig()
231
+ },
232
+ onCancel = {
233
+ navController.popBackStack()
234
+ }
235
+ )
270
236
}
271
237
}
272
-
273
238
}
274
239
}
275
240
0 commit comments