Fixes #188

parent 5ac008f5
......@@ -23,7 +23,7 @@ import androidx.annotation.StyleRes
import de.kuschku.quasseldroid.R
data class AppearanceSettings(
val inputEnter: InputEnterMode = InputEnterMode.EMOJI,
val inputEnter: InputEnterMode = InputEnterMode.NEWLINE,
val showLag: Boolean = true,
val theme: Theme = Theme.MATERIAL_LIGHT,
val language: String = "",
......@@ -31,7 +31,8 @@ data class AppearanceSettings(
) {
enum class InputEnterMode {
EMOJI,
SEND;
SEND,
NEWLINE;
companion object {
private val map = values().associateBy { it.name }
......
......@@ -172,14 +172,18 @@ class EditorHelper(
}
editText.imeOptions = when (appearanceSettings.inputEnter) {
AppearanceSettings.InputEnterMode.EMOJI -> listOf(
AppearanceSettings.InputEnterMode.EMOJI -> listOf(
EditorInfo.IME_ACTION_NONE,
EditorInfo.IME_FLAG_NO_EXTRACT_UI
)
AppearanceSettings.InputEnterMode.SEND -> listOf(
AppearanceSettings.InputEnterMode.SEND -> listOf(
EditorInfo.IME_ACTION_SEND,
EditorInfo.IME_FLAG_NO_EXTRACT_UI
)
AppearanceSettings.InputEnterMode.NEWLINE -> listOf(
EditorInfo.IME_ACTION_UNSPECIFIED,
EditorInfo.IME_FLAG_NO_EXTRACT_UI
)
}.fold(0, Int::or)
}
......
......@@ -290,11 +290,9 @@ class RichEditText : EditTextSelectionChange {
val selectionStart = selectionStart
val selectionEnd = selectionEnd
inputType = if (enabled) {
inputType or InputType.TYPE_TEXT_FLAG_MULTI_LINE
} else {
inputType and InputType.TYPE_TEXT_FLAG_MULTI_LINE.inv()
}
inputType =
if (enabled) inputType or InputType.TYPE_TEXT_FLAG_MULTI_LINE
else inputType and InputType.TYPE_TEXT_FLAG_MULTI_LINE.inv()
setSelection(selectionStart, selectionEnd)
}
......
......@@ -69,10 +69,12 @@
<string-array name="preference_input_enter_entries" translatable="false">
<item>@string/preference_input_enter_entry_emoji</item>
<item>@string/preference_input_enter_entry_send</item>
<item>@string/preference_input_enter_entry_newline</item>
</string-array>
<string-array name="preference_input_enter_entryvalues" translatable="false">
<item>EMOJI</item>
<item>SEND</item>
<item>NEWLINE</item>
</string-array>
<string name="preference_show_lag_key" translatable="false">show_lag</string>
......
......@@ -36,7 +36,7 @@
android:title="@string/preference_theme_title" />
<DropDownPreference
android:defaultValue="EMOJI"
android:defaultValue="NEWLINE"
android:entries="@array/preference_input_enter_entries"
android:entryValues="@array/preference_input_enter_entryvalues"
android:key="@string/preference_input_enter_key"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment