-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
1,803 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
app/src/main/java/com/github/jing332/tts_dict_editor/const/ConfigConst.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package com.github.jing332.tts_dict_editor.const | ||
|
||
object ConfigConst { | ||
const val KEY_THEME = "theme" | ||
const val KEY_SOFT_KEYBOARD_TOOLBAR = "softKeyboardToolbar" | ||
const val KEY_DICT_EXPORT_FORMAT = "exportFormat" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
app/src/main/java/com/github/jing332/tts_dict_editor/ui/ThemeSettingsDialog.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package com.github.jing332.tts_dict_editor.ui | ||
|
||
import androidx.compose.foundation.layout.ExperimentalLayoutApi | ||
import androidx.compose.foundation.layout.FlowRow | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.filled.Check | ||
import androidx.compose.material3.AlertDialog | ||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.material3.FilterChip | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.Text | ||
import androidx.compose.material3.TextButton | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.res.stringResource | ||
import com.github.jing332.tts_dict_editor.R | ||
import com.github.jing332.tts_dict_editor.ui.theme.AppTheme | ||
|
||
//@Preview | ||
//@Composable | ||
//private fun PreviewDialog() { | ||
// var isVisible by remember { mutableStateOf(true) } | ||
// if (isVisible) | ||
// ThemeSettingsDialog({ | ||
// isVisible = false | ||
// }, { | ||
// | ||
// }) | ||
// | ||
//} | ||
|
||
@OptIn(ExperimentalLayoutApi::class, ExperimentalMaterial3Api::class) | ||
@Composable | ||
fun ThemeSettingsDialog( | ||
onDismissRequest: () -> Unit, | ||
currentTheme: AppTheme, | ||
onChangeTheme: (AppTheme) -> Unit | ||
) { | ||
AlertDialog(onDismissRequest = onDismissRequest, | ||
title = { | ||
Text(text = stringResource(id = R.string.theme)) | ||
}, confirmButton = { | ||
TextButton(onClick = onDismissRequest) { | ||
Text(stringResource(id = R.string.confirm)) | ||
} | ||
}, text = { | ||
FlowRow { | ||
AppTheme.values().forEach { | ||
val leadingIcon: @Composable () -> Unit = { Icon(Icons.Default.Check, null) } | ||
// var selected by remember { mutableStateOf(it == AppTheme.DEFAULT) } | ||
val selected = currentTheme.id == it.id | ||
FilterChip( | ||
selected, | ||
leadingIcon = if (selected) leadingIcon else null, | ||
onClick = { | ||
onChangeTheme(it) | ||
}, | ||
label = { Text(stringResource(id = it.stringResId)) } | ||
) | ||
} | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
app/src/main/java/com/github/jing332/tts_dict_editor/ui/theme/AppTheme.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.github.jing332.tts_dict_editor.ui.theme | ||
|
||
import com.github.jing332.tts_dict_editor.R | ||
|
||
enum class AppTheme(val id: String, val stringResId: Int = -1) { | ||
DEFAULT("", R.string.theme_default), | ||
DYNAMIC_COLOR("dynamicColor", R.string.dynamic_color), | ||
GREEN("green", R.string.green), | ||
RED("red", R.string.red), | ||
PINK("pink", R.string.pink ), | ||
BLUE("blue", R.string.blue), | ||
CYAN("cyan", R.string.cyan), | ||
ORANGE("orange", R.string.orange), | ||
PURPLE("purple", R.string.purple), | ||
BROWN("brown", R.string.brown), | ||
GRAY("gray", R.string.gray) | ||
} |
Oops, something went wrong.