Skip to content

Commit 30b2f4b

Browse files
committed
refactor(theme): cleanup deprecated params
1 parent 449db4e commit 30b2f4b

File tree

6 files changed

+2
-35
lines changed

6 files changed

+2
-35
lines changed

app/src/main/assets/shared/tongwenfeng.trime.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,9 @@ style:
5959
reset_ascii_mode: false #显示键盘时重置为中文状态
6060
round_corner: *round1 #按键圆角半径
6161
shadow_radius: 0.0 #按键阴影半径
62-
speech_opencc_config: none #语音输入简繁转换
6362
symbol_font: symbol.ttf #符号字体
6463
symbol_text_size: 10 #符号字号
6564
text_font: latin.ttf #编码字体
66-
#text_height: 32 #编码区高度
67-
text_size: 14 #编码区字号
6865
vertical_correction: -5
6966
vertical_gap: *sgap #键盘行距
7067
enter_label_mode: 0 #是否使用App提供的ActionLabel内容作为Enter键的文本(由于多数App没有适配ActionLable,实际影响不大)。0不使用,1只使用actionlabel,2优先使用,3当其他方式没有获得label时才读取actionlabel

app/src/main/assets/shared/trime.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ style:
1515
candidate_padding: 5 #候選項內邊距
1616
candidate_spacing: 0.5 #候選間距
1717
candidate_text_size: 22 #候選字號
18-
candidate_use_cursor: true #高亮候選項
1918
candidate_view_height: 28 #候選區高度
2019
comment_font: comment.ttf #編碼提示字型
2120
comment_height: 12 #編碼提示區高度
@@ -48,17 +47,12 @@ style:
4847
reset_ascii_mode: false #顯示鍵盤時重置爲中文狀態
4948
round_corner: 8 #按鍵圓角半徑
5049
shadow_radius: 0.0 #按鍵陰影半徑
51-
speech_opencc_config: s2t.json #語音輸入簡繁轉換
5250
symbol_font: symbol.ttf #符號字型
5351
symbol_text_size: 10 #符號字號
5452
text_font: latin.ttf #編碼字型
55-
#text_height: 22 #編碼區高度
56-
text_size: 16 #編碼區字號
5753
vertical_correction: -10
5854
vertical_gap: 1 #鍵盤行距
59-
long_text_font: comment.ttf #剪贴板等可能包含大段文本使用的字体
6055
#background_folder: #背景图保存在background目录下的哪个子目录
61-
key_long_text_border: 1
6256
enter_label_mode: 0 #是否使用App提供的ActionLabel内容作为Enter键的文本(由于多数App没有适配ActionLable,实际影响不大)。0不使用,1只使用actionlabel,2优先使用,3当其他方式没有获得label时才读取actionlabel
6357
enter_labels: # 定义Enter键的文本
6458
go: 前往

app/src/main/java/com/osfans/trime/data/theme/FontManager.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ object FontManager {
111111
FontKey.PREVIEW_FONT -> style.previewFont
112112
FontKey.SYMBOL_FONT -> style.symbolFont
113113
FontKey.TEXT_FONT -> style.textFont
114-
FontKey.LONG_TEXT_FONT -> style.longTextFont
115114
FontKey.TOOLBAR_FONT -> theme.toolBar.buttonFont
116115
else -> null
117116
}

app/src/main/java/com/osfans/trime/data/theme/mapper/GeneralStyleMapper.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ class GeneralStyleMapper(
1919
candidatePadding = getInt("candidate_padding"),
2020
candidateSpacing = getFloat("candidate_spacing"),
2121
candidateTextSize = getFloat("candidate_text_size"),
22-
candidateUseCursor = getBoolean("candidate_use_cursor"),
2322
candidateViewHeight = getInt("candidate_view_height"),
2423
commentFont = getStringList("comment_font"),
2524
commentHeight = getInt("comment_height"),
@@ -62,16 +61,12 @@ class GeneralStyleMapper(
6261
resetASCIIMode = getBoolean("reset_ascii_mode"),
6362
roundCorner = getFloat("round_corner"),
6463
shadowRadius = getFloat("shadow_radius"),
65-
speechOpenccConfig = getString("speech_opencc_config"),
6664
symbolFont = getStringList("symbol_font"),
6765
symbolTextSize = getFloat("symbol_text_size"),
6866
textFont = getStringList("text_font"),
69-
textSize = getFloat("text_size"),
7067
verticalCorrection = getInt("vertical_correction"),
7168
verticalGap = getInt("vertical_gap"),
72-
longTextFont = getStringList("long_text_font"),
7369
backgroundFolder = getString("background_folder"),
74-
keyLongTextBorder = getInt("key_long_text_border"),
7570
enterLabelMode = getInt("enter_label_mode"),
7671
enterLabel =
7772
when (val map = node.get<YamlMap>("enter_labels")) {

app/src/main/java/com/osfans/trime/data/theme/model/GeneralStyle.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ data class GeneralStyle(
1818
val candidatePadding: Int = 0,
1919
val candidateSpacing: Float = 0f,
2020
val candidateTextSize: Float = 15f,
21-
val candidateUseCursor: Boolean = false,
2221
val candidateViewHeight: Int = 28,
2322
val commentFont: List<String> = emptyList(),
2423
val commentHeight: Int = 12,
@@ -61,16 +60,12 @@ data class GeneralStyle(
6160
val resetASCIIMode: Boolean = false,
6261
val roundCorner: Float = 0f,
6362
val shadowRadius: Float = 0f,
64-
val speechOpenccConfig: String = "tw2s.json",
6563
val symbolFont: List<String> = emptyList(),
6664
val symbolTextSize: Float = 0f,
6765
val textFont: List<String> = emptyList(),
68-
val textSize: Float = 0f,
6966
val verticalCorrection: Int = 0,
7067
val verticalGap: Int = 0,
71-
val longTextFont: List<String> = emptyList(),
7268
val backgroundFolder: String = "backgrounds",
73-
val keyLongTextBorder: Int = 0,
7469
val enterLabelMode: Int = 0,
7570
val enterLabel: EnterLabel = EnterLabel(),
7671
) : Parcelable {

app/src/test/java/com/osfans/trime/data/theme/GeneralStyleTest.kt

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ package com.osfans.trime.data.theme
66

77
import com.osfans.trime.BuildConfig
88
import com.osfans.trime.core.Rime
9-
import com.osfans.trime.core.RimeConfig
10-
import com.osfans.trime.data.theme.mapper.GeneralStyleMapper
119
import com.osfans.trime.data.theme.model.GeneralStyle
1210
import io.kotest.core.spec.style.BehaviorSpec
1311
import io.kotest.matchers.shouldBe
@@ -26,15 +24,11 @@ class GeneralStyleTest :
2624
)
2725

2826
When("loaded") {
29-
val generalStyle =
30-
RimeConfig.openUserConfig("trime").use {
31-
GeneralStyleMapper("style", it).map()
32-
}
27+
val generalStyle = Theme.decodeByConfigId("trime").generalStyle
3328

3429
Then("it should not be null") {
3530
generalStyle shouldNotBe null
3631
generalStyle.autoCaps shouldBe "false"
37-
generalStyle.backgroundDimAmount shouldBe 0.5
3832

3933
generalStyle.candidateFont shouldBe listOf("han.ttf")
4034
}
@@ -53,23 +47,16 @@ class GeneralStyleTest :
5347
)
5448

5549
When("loaded") {
56-
val generalStyle =
57-
RimeConfig.openUserConfig("incorrect").use {
58-
GeneralStyleMapper("style", it).map()
59-
}
50+
val generalStyle = Theme.decodeByConfigId("incorrect").generalStyle
6051

6152
Then("with default value without exception") {
6253
generalStyle.autoCaps shouldBe ""
63-
generalStyle.backgroundDimAmount shouldBe 0
6454
generalStyle.candidateBorder shouldBe 0
6555
generalStyle.candidateFont shouldBe emptyList()
66-
generalStyle.candidateUseCursor shouldBe false
6756
generalStyle.commentPosition shouldBe GeneralStyle.CommentPosition.UNKNOWN
6857

6958
generalStyle.enterLabel shouldNotBe null
7059
generalStyle.enterLabel.go shouldBe "go"
71-
72-
generalStyle.layout shouldNotBe null
7360
}
7461
}
7562

0 commit comments

Comments
 (0)