Skip to content

Commit fcc00fc

Browse files
committed
fix: workaround for sound effect malfunction
1 parent d18ef42 commit fcc00fc

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

app/src/main/java/com/osfans/trime/TrimeApplication.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ class TrimeApplication : Application() {
134134
Timber.d("Last pid is $lastPid. Set it to current pid: $currentPid")
135135
setValue(currentPid)
136136
}
137-
SoundEffectManager.init()
138137
ClipboardHelper.init(applicationContext)
139138
CollectionHelper.init(applicationContext)
140139
registerBroadcastReceiver()

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

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
// SPDX-FileCopyrightText: 2015 - 2024 Rime community
2-
//
3-
// SPDX-License-Identifier: GPL-3.0-or-later
1+
/*
2+
* SPDX-FileCopyrightText: 2015 - 2025 Rime community
3+
* SPDX-License-Identifier: GPL-3.0-or-later
4+
*/
45

56
package com.osfans.trime.ime.core
67

@@ -45,6 +46,7 @@ import com.osfans.trime.daemon.RimeSession
4546
import com.osfans.trime.data.prefs.AppPrefs
4647
import com.osfans.trime.data.prefs.PreferenceDelegate
4748
import com.osfans.trime.data.prefs.PreferenceDelegateProvider
49+
import com.osfans.trime.data.soundeffect.SoundEffectManager
4850
import com.osfans.trime.data.theme.ColorManager
4951
import com.osfans.trime.data.theme.Theme
5052
import com.osfans.trime.data.theme.ThemeManager
@@ -177,20 +179,13 @@ open class TrimeInputMethodService : LifecycleInputMethodService() {
177179
ThemeManager.init(resources.configuration)
178180
ThemeManager.addOnChangedListener(onThemeChangeListener)
179181
ColorManager.addOnChangedListener(onColorChangeListener)
182+
SoundEffectManager.init()
183+
InputFeedbackManager.init(this)
184+
registerReceiver()
180185
super.onCreate()
186+
Timber.d("onCreate")
181187
decorView = window.window!!.decorView
182188
contentView = decorView.findViewById(android.R.id.content)
183-
// MUST WRAP all code within Service onCreate() in try..catch to prevent any crash loops
184-
try {
185-
// Additional try..catch wrapper as the event listeners chain or the super.onCreate() method
186-
// could crash
187-
// and lead to a crash loop
188-
Timber.d("onCreate")
189-
InputFeedbackManager.init(this)
190-
registerReceiver()
191-
} catch (e: Exception) {
192-
Timber.e(e)
193-
}
194189
}
195190

196191
private fun handleRimeMessage(it: RimeMessage<*>) {

0 commit comments

Comments
 (0)