File tree Expand file tree Collapse file tree 5 files changed +17
-8
lines changed
Expand file tree Collapse file tree 5 files changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -29,15 +29,10 @@ object ThemeManager {
2929 DataManager .addOnChangedListener(onDataDirChange)
3030 }
3131
32- private val suffixRegex = Regex (" (.*?)(\\ .trime\\ .yaml$|\\ .yaml$)" )
33-
3432 private fun listThemes (path : File ): MutableList <String > {
3533 return path.listFiles { _, name -> name.endsWith(" trime.yaml" ) }
3634 ?.mapNotNull { f ->
37- suffixRegex.matchEntire(f.name)?.let { result ->
38- val basename = if (result.groups[2 ]?.value == " .trime.yaml" ) result.groupValues[1 ] else f.nameWithoutExtension
39- basename
40- }
35+ if (f.name == " trime.yaml" ) " trime" else f.name.substringBeforeLast(" .trime.yaml" )
4136 }
4237 ?.toMutableList() ? : mutableListOf ()
4338 }
Original file line number Diff line number Diff line change @@ -23,16 +23,24 @@ object ThemePickerDialog {
2323 withContext(Dispatchers .IO ) {
2424 ThemeManager .getAllThemes()
2525 }
26+ val allNames =
27+ all.map {
28+ when (it) {
29+ " trime" -> context.getString(R .string.theme_trime)
30+ " tongwenfeng" -> context.getString(R .string.theme_tongwenfeng)
31+ else -> it
32+ }
33+ }
2634 val current =
2735 AppPrefs .defaultInstance().theme.selectedTheme
2836 val currentIndex = all.indexOfFirst { it == current }
2937 return AlertDialog .Builder (context).apply {
3038 setTitle(R .string.looks__selected_theme_title)
31- if (all .isEmpty()) {
39+ if (allNames .isEmpty()) {
3240 setMessage(R .string.no_theme_to_select)
3341 } else {
3442 setSingleChoiceItems(
35- all .toTypedArray(),
43+ allNames .toTypedArray(),
3644 currentIndex,
3745 ) { dialog, which ->
3846 scope.launch {
Original file line number Diff line number Diff line change @@ -286,4 +286,6 @@ SPDX-License-Identifier: GPL-3.0-or-later
286286 <item >跟随键盘背景色</item >
287287 <item >键盘背景图片</item >
288288 </string-array >
289+ <string name =" theme_trime" >默认</string >
290+ <string name =" theme_tongwenfeng" >同文风</string >
289291</resources >
Original file line number Diff line number Diff line change @@ -287,4 +287,6 @@ SPDX-License-Identifier: GPL-3.0-or-later
287287 <item >跟隨鍵盤背景色</item >
288288 <item >鍵盤背景圖片</item >
289289 </string-array >
290+ <string name =" theme_trime" >預設</string >
291+ <string name =" theme_tongwenfeng" >同文風</string >
290292</resources >
Original file line number Diff line number Diff line change @@ -288,4 +288,6 @@ SPDX-License-Identifier: GPL-3.0-or-later
288288 <item >Follow keyboard color</item >
289289 <item >Keyboard background image</item >
290290 </string-array >
291+ <string name =" theme_trime" >default</string >
292+ <string name =" theme_tongwenfeng" >tongwenfeng</string >
291293</resources >
You can’t perform that action at this time.
0 commit comments