Skip to content

Commit 7226d3f

Browse files
committed
Spell check and keyboard disabled
1 parent 9b78901 commit 7226d3f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

app/src/main/kotlin/org/fossify/notes/fragments/TextFragment.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import android.text.TextWatcher
1010
import android.text.method.KeyListener
1111
import android.text.style.UnderlineSpan
1212
import android.text.util.Linkify
13+
import android.text.InputType
1314
import android.util.TypedValue
1415
import android.view.LayoutInflater
1516
import android.view.MotionEvent
@@ -22,6 +23,7 @@ import android.widget.TextView
2223
import androidx.viewbinding.ViewBinding
2324
import org.fossify.commons.extensions.*
2425
import org.fossify.commons.views.MyEditText
26+
import org.fossify.commons.extensions.hideKeyboard
2527
import org.fossify.notes.R
2628
import org.fossify.notes.activities.MainActivity
2729
import org.fossify.notes.databinding.FragmentTextBinding
@@ -361,14 +363,16 @@ class TextFragment : NoteFragment() {
361363

362364
fun updateReadOnlyState(isReadOnly: Boolean) {
363365
noteEditText.apply {
366+
val baseInputType = InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_MULTI_LINE
364367
if (isReadOnly == true) {
368+
inputType = baseInputType or InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
365369
keyListener = null
370+
requireActivity().hideKeyboard(this)
366371
}
367372
if (isReadOnly == false) {
373+
inputType = baseInputType
368374
keyListener = initialKeyListener
369375
}
370-
isLongClickable = true
371-
setTextIsSelectable(true)
372376
saveText(force = true)
373377
}
374378
}

0 commit comments

Comments
 (0)