-
-
Notifications
You must be signed in to change notification settings - Fork 381
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
1 parent
3f91d3d
commit 1ed4c7b
Showing
14 changed files
with
125 additions
and
151 deletions.
There are no files selected for viewing
24 changes: 0 additions & 24 deletions
24
app/src/main/java/com/osfans/trime/data/theme/EventManager.kt
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
app/src/main/java/com/osfans/trime/data/theme/KeyActionManager.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,23 @@ | ||
// SPDX-FileCopyrightText: 2015 - 2024 Rime community | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
package com.osfans.trime.data.theme | ||
|
||
import android.view.KeyEvent | ||
import com.osfans.trime.ime.keyboard.KeyAction | ||
|
||
object KeyActionManager { | ||
private val actionCache = mutableMapOf<String, KeyAction>() | ||
|
||
fun getAction(actionId: String): KeyAction = | ||
actionCache[actionId] | ||
?: KeyAction(actionId).also { | ||
// 空格的 label 需要根据方案动态显示,所以不加入缓存 | ||
if (it.code != KeyEvent.KEYCODE_SPACE) { | ||
actionCache[actionId] = it | ||
} | ||
} | ||
|
||
fun resetCache() = actionCache.clear() | ||
} |
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
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
Oops, something went wrong.