Skip to content

Commit

Permalink
fix: LiquidKeyboardEditActivity didn't follow the night mode
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiredPlanck committed Apr 30, 2024
1 parent 7df876a commit 335464d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
android:label="@string/edit"
android:launchMode="singleInstance"
android:taskAffinity=".ui.main.LiquidKeyboardEditActivity"
android:theme="@android:style/Theme.DeviceDefault.Light.Dialog"
android:theme="@style/Theme.DialogTheme"
android:windowSoftInputMode="stateAlwaysVisible|adjustPan" />

<!-- Using an activity alias to disable/enable the app icon in the launcher -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ import android.content.Intent
import android.os.Bundle
import android.view.Gravity
import android.widget.EditText
import androidx.lifecycle.lifecycleScope
import com.osfans.trime.data.db.ClipboardHelper
import com.osfans.trime.data.db.CollectionHelper
import com.osfans.trime.data.db.DraftHelper
import com.osfans.trime.databinding.ActivityLiquidKeyboardEditBinding
import com.osfans.trime.ime.core.TrimeInputMethodService
import com.osfans.trime.ime.symbol.SymbolBoardType
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.launch
import timber.log.Timber

class LiquidKeyboardEditActivity : Activity() {
private val service: TrimeInputMethodService = TrimeInputMethodService.getService()
private val scope: CoroutineScope = MainScope()
private var id: Int? = null
private lateinit var editText: EditText
private var type: SymbolBoardType? = null
Expand Down Expand Up @@ -61,19 +61,19 @@ class LiquidKeyboardEditActivity : Activity() {
val newText = editText.text.toString()
when (type) {
SymbolBoardType.CLIPBOARD -> {
service.lifecycleScope.launch {
scope.launch {
ClipboardHelper.updateText(id!!, newText)
}
}

SymbolBoardType.COLLECTION -> {
service.lifecycleScope.launch {
scope.launch {
CollectionHelper.updateText(id!!, newText)
}
}

SymbolBoardType.DRAFT -> {
service.lifecycleScope.launch {
scope.launch {
DraftHelper.updateText(id!!, newText)
}
}
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values-night/themes.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.DialogTheme" parent="@android:style/Theme.DeviceDefault.Dialog" />
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ SPDX-License-Identifier: GPL-3.0-or-later
<item name="colorOnSurface">@color/colorOnSurface</item>
<item name="colorOnError">@color/colorOnError</item>
</style>

<style name="Theme.DialogTheme" parent="@android:style/Theme.DeviceDefault.Light.Dialog" />
</resources>

0 comments on commit 335464d

Please sign in to comment.