Skip to content

Commit b933757

Browse files
ENOA-ANSUL-EDENBambooin
authored andcommitted
1 parent c72623b commit b933757

21 files changed

+804
-283
lines changed

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

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,12 @@ style:
5050
latin_font: latin.ttf #西文本体
5151
keyboard_height: 250 #锁定键盘高度,避免切换时键盘高度变化而造成闪烁
5252
keyboard_height_land: 200 #锁定横屏下键盘高度,避免切换时键盘高度变化而造成闪烁
53-
preview_font: latin.ttf #按键提示字体
54-
preview_height: 56 #按键提示高度
55-
preview_offset: -32 #按键提示纵向偏移
56-
preview_text_size: 40 #按键提示字号
53+
popup_font: latin.ttf #按键提示字体
54+
popup_width: 38 #按键提示宽度
55+
popup_height: 48 #按键提示高度
56+
popup_bottom_margin: 68 #按键提示底边距
57+
popup_key_height: 48 #按键提示内键高度
58+
popup_text_size: 23 #按键提示字号
5759
proximity_correction: true #按键纠错
5860
reset_ascii_mode: false #显示键盘时重置为中文状态
5961
round_corner: *round1 #按键圆角半径
@@ -1048,7 +1050,7 @@ tool_bar:
10481050
edit_button: &edit_button
10491051
foreground:
10501052
style: "ic@cursor_text"
1051-
action: Keyboard_numberb
1053+
action: Keyboard_edit
10521054

10531055
ascii_mode_button: &ascii_mode_button
10541056
foreground:
@@ -1097,7 +1099,7 @@ preset_keyboards:
10971099
- {click: l, long_click: '(){Left}', swipe_down: "=", key_back_color: bh2, key_text_color: th2}
10981100
- {width: 5, key_back_color: bh2, key_text_color: th2}
10991101

1100-
- {click: Shift_L, double_click: Shift_L3, composing: delimiter, width: 15, hilited_key_back_color: benter, key_back_color: bbs, key_text_color: tbs}
1102+
- {click: Shift_L, label_symbol: " ", long_click: Shift_L, double_click: Shift_L3, composing: delimiter, width: 15, hilited_key_back_color: benter, key_back_color: bbs, key_text_color: tbs}
11011103
- {click: z, long_click: '`', swipe_down: '[]{Left}', key_back_color: bh3, key_text_color: th3}
11021104
- {click: x, long_click: cut, swipe_down: '{}{Left}', key_back_color: bh3, key_text_color: th3}
11031105
- {click: c, long_click: copy, swipe_down: ' ', key_back_color: bh3, key_text_color: th3}
@@ -1113,7 +1115,7 @@ preset_keyboards:
11131115
- {click: space, long_click: Mode_switch, swipe_left: "Left", swipe_right: "Right", swipe_up: Schema_switchcn, width: 30, key_back_color: bkg, key_text_color: tkg}
11141116
- {click: '.', label: '。', long_click: liquid_keyboard_clipboard, key_back_color: bh4, key_text_color: th4}
11151117
- {click: '/', long_click: liquid_keyboard_switch , key_text_size: "18", key_back_color: bh4, key_text_color: th4}
1116-
- {click: Return, composing: Return1, swipe_up: Escape, width: 15, key_back_color: benter, key_text_color: tenter}
1118+
- {click: Return, label_symbol: "wiki", popup: ["TrimeWiki", "Settings"], composing: Return1, swipe_up: Escape, width: 15, key_back_color: benter, key_text_color: tenter}
11171119

11181120
letter:
11191121
author: "暖暖"
@@ -1200,7 +1202,7 @@ preset_keyboards:
12001202
- {click: '=', long_click: '≠', key_back_color: bgn, key_text_color: tgn}
12011203
- {click: Return, long_click: Menu, key_back_color: benter, key_text_color: tenter}
12021204

1203-
numberb:
1205+
edit:
12041206
ascii_mode: 1
12051207
author: flypy.com
12061208
name: "编辑键盘"
@@ -4021,7 +4023,7 @@ preset_keys:
40214023
Keyboard_default: { label: 返回, functional: false, send: Eisu_toggle, select: .default }
40224024
Keyboard_switch: { label: 键盘, functional: true, send: Eisu_toggle, select: .next }
40234025
Keyboard_number: { label: 123, functional: false, send: Eisu_toggle, select: number }
4024-
Keyboard_numberb: { label: 123, functional: false, send: Eisu_toggle, select: numberb }
4026+
Keyboard_edit: { label: edit, functional: false, send: Eisu_toggle, select: edit }
40254027
Keyboard_symbols: { label: 更多, functional: false, send: Eisu_toggle, select: symbols }
40264028
Keyboard_move: { label: ❖, functional: true, send: Eisu_toggle, select: move }
40274029
Keyboard_next: { label: 后退, functional: false, send: Eisu_toggle, select: .next }
@@ -4058,6 +4060,7 @@ preset_keys:
40584060
TrimeApp: {label: 同文, send: function, command: run, option: "com.osfans.trime"} #運行程序: run 包名
40594061
TrimeCmp: {label: 同文組件, send: function, command: run, option: "com.osfans.trime/.Pref"} #運行程序指定組件: run 包名/組件名
40604062
Homepage: {label: 同文主頁, send: function, command: run, option: "https://github.com/osfans/trime"} #查看網頁: run 網址
4063+
TrimeWiki: {label: Wiki, send: function, command: run, option: "https://github.com/osfans/trime/wiki/trime.yaml-詳解"}
40614064
Wiki: {label: 維基, send: function, command: run, option: "https://zh.wikipedia.org/wiki/%s"} #搜索網頁: %s或者%1$s爲當前字符
40624065
Google: {label: 谷歌, send: function, command: run, option: "https://www.google.com/search?q=%s"} #搜索網頁: %s或者%1$s爲當前字符
40634066
MoeDict: {label: 萌典, send: function, command: run, option: "https://www.moedict.tw/%3$s"} #搜索網頁: %3$s爲光標前字符

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,10 @@ object ColorManager {
8686
"off_key_text_color" to "key_text_color",
8787
"on_key_back_color" to "hilited_key_back_color",
8888
"on_key_text_color" to "hilited_key_text_color",
89-
"preview_back_color" to "key_back_color",
90-
"preview_text_color" to "key_text_color",
89+
"popup_back_color" to "key_back_color",
90+
"popup_text_color" to "key_text_color",
91+
"hilited_popup_back_color" to "hilited_key_back_color",
92+
"hilited_popup_text_color" to "hilited_key_text_color",
9193
"shadow_color" to "border_color",
9294
"root_background" to "back_color",
9395
"candidate_background" to "back_color",

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ object FontManager {
2323
COMMENT_FONT,
2424
KEY_FONT,
2525
LABEL_FONT,
26-
PREVIEW_FONT,
26+
POPUP_FONT,
2727
SYMBOL_FONT,
2828
TEXT_FONT,
2929
LONG_TEXT_FONT,
@@ -108,7 +108,7 @@ object FontManager {
108108
FontKey.COMMENT_FONT -> style.commentFont
109109
FontKey.KEY_FONT -> style.keyFont
110110
FontKey.LABEL_FONT -> style.labelFont
111-
FontKey.PREVIEW_FONT -> style.previewFont
111+
FontKey.POPUP_FONT -> style.popupFont
112112
FontKey.SYMBOL_FONT -> style.symbolFont
113113
FontKey.TEXT_FONT -> style.textFont
114114
FontKey.TOOLBAR_FONT -> theme.toolBar.buttonFont

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,12 @@ class GeneralStyleMapper(
5252
latinFont = getStringList("latin_font"),
5353
keyboardHeight = getInt("keyboard_height"),
5454
keyboardHeightLand = getInt("keyboard_height_land"),
55-
previewFont = getStringList("preview_font"),
56-
previewHeight = getInt("preview_height"),
57-
previewOffset = getInt("preview_offset"),
58-
previewTextSize = getFloat("preview_text_size"),
55+
popupBottomMargin = getInt("popup_bottom_margin"),
56+
popupWidth = getInt("popup_width"),
57+
popupHeight = getInt("popup_height"),
58+
popupKeyHeight = getInt("popup_key_height"),
59+
popupFont = getStringList("popup_font"),
60+
popupTextSize = getFloat("popup_text_size"),
5961
proximityCorrection = getBoolean("proximity_correction"),
6062
resetASCIIMode = getBoolean("reset_ascii_mode"),
6163
roundCorner = getFloat("round_corner"),

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import com.osfans.trime.util.getBool
1313
import com.osfans.trime.util.getFloat
1414
import com.osfans.trime.util.getInt
1515
import com.osfans.trime.util.getString
16+
import com.osfans.trime.util.getStringList
1617
import timber.log.Timber
1718

1819
class TextKeyboardMapper(
@@ -48,6 +49,7 @@ class TextKeyboardMapper(
4849
hlKeyTextColor = it.getString("hilited_key_text_color"),
4950
hlKeyBackColor = it.getString("hilited_key_back_color"),
5051
hlKeySymbolColor = it.getString("hilited_key_symbol_color"),
52+
popup = it.getStringList("popup") ?: emptyList(),
5153
behaviors =
5254
buildMap {
5355
KeyBehavior.entries.forEach { entry ->

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,12 @@ data class GeneralStyle(
5151
val latinFont: List<String> = emptyList(),
5252
val keyboardHeight: Int = 0,
5353
val keyboardHeightLand: Int = 0,
54-
val previewFont: List<String> = emptyList(),
55-
val previewHeight: Int = 0,
56-
val previewOffset: Int = 0,
57-
val previewTextSize: Float = 0f,
54+
val popupBottomMargin: Int = 0,
55+
val popupWidth: Int = 0,
56+
val popupHeight: Int = 0,
57+
val popupKeyHeight: Int = 0,
58+
val popupFont: List<String> = emptyList(),
59+
val popupTextSize: Float = 0f,
5860
val proximityCorrection: Boolean = false,
5961
val resetASCIIMode: Boolean = false,
6062
val roundCorner: Float = 0f,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ data class TextKeyboard(
7171
val hlKeyTextColor: String,
7272
val hlKeyBackColor: String,
7373
val hlKeySymbolColor: String,
74+
val popup: List<String> = emptyList(),
7475
val behaviors: Map<KeyBehavior, String>,
7576
) : Parcelable
7677
}

app/src/main/java/com/osfans/trime/ime/core/InputView.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import com.osfans.trime.ime.dependency.InputComponent
3131
import com.osfans.trime.ime.dependency.create
3232
import com.osfans.trime.ime.keyboard.KeyboardPrefs.isLandscapeMode
3333
import com.osfans.trime.ime.keyboard.KeyboardWindow
34-
import com.osfans.trime.ime.preview.KeyPreviewChoreographer
34+
import com.osfans.trime.ime.popup.PopupComponent
3535
import com.osfans.trime.ime.symbol.LiquidWindow
3636
import kotlinx.coroutines.Job
3737
import kotlinx.coroutines.launch
@@ -99,7 +99,7 @@ class InputView(
9999
private val liquidWindow: LiquidWindow = inputComponent.liquidWindow
100100
private val compactCandidate: CompactCandidateModule = inputComponent.candidate.compactCandidateModule
101101
private val suggestionCandidate: SuggestionCandidateModule = inputComponent.candidate.suggestionCandidateModule
102-
private val preview: KeyPreviewChoreographer = inputComponent.preview
102+
private val popup: PopupComponent = inputComponent.popup
103103

104104
private fun addBroadcastReceivers() {
105105
broadcaster.addReceiver(quickBar)
@@ -221,7 +221,7 @@ class InputView(
221221
)
222222

223223
add(
224-
preview.root,
224+
popup.root,
225225
lParams(matchParent, matchParent) {
226226
centerInParent()
227227
},
@@ -345,7 +345,7 @@ class InputView(
345345
// cancel the notification job and clear all broadcast receivers,
346346
// implies that InputView should not be attached again after detached.
347347
updateWindowViewHeightJob.cancel()
348-
preview.root.removeAllViews()
348+
popup.root.removeAllViews()
349349
broadcaster.clear()
350350
super.onDetachedFromWindow()
351351
}

app/src/main/java/com/osfans/trime/ime/dependency/InputComponent.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import com.osfans.trime.ime.core.InputView
1616
import com.osfans.trime.ime.core.TrimeInputMethodService
1717
import com.osfans.trime.ime.keyboard.CommonKeyboardActionListener
1818
import com.osfans.trime.ime.keyboard.KeyboardWindow
19-
import com.osfans.trime.ime.preview.KeyPreviewChoreographer
19+
import com.osfans.trime.ime.popup.PopupComponent
2020
import com.osfans.trime.ime.symbol.LiquidWindow
2121
import com.osfans.trime.ime.window.BoardWindowManager
2222
import me.tatarka.inject.annotations.Component
@@ -36,7 +36,7 @@ abstract class InputComponent(
3636
abstract val quickBar: QuickBar
3737
abstract val preedit: PreeditModule
3838
abstract val windowManager: BoardWindowManager
39-
abstract val preview: KeyPreviewChoreographer
39+
abstract val popup: PopupComponent
4040
abstract val keyboardWindow: KeyboardWindow
4141
abstract val commonKeyboardActionListener: CommonKeyboardActionListener
4242
abstract val liquidWindow: LiquidWindow

app/src/main/java/com/osfans/trime/ime/keyboard/Key.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class Key(
4646
private val label = selfConfig?.label ?: ""
4747
private val labelSymbol = selfConfig?.labelSymbol ?: ""
4848
val hint: String = selfConfig?.hint ?: ""
49+
val popup = selfConfig?.popup ?: emptyList()
4950

5051
val keyTextSize: Float = selfConfig?.keyTextSize ?: 0f
5152
val symbolTextSize: Float = selfConfig?.symbolTextSize ?: 0f

0 commit comments

Comments
 (0)