@@ -10,6 +10,7 @@ import android.text.TextWatcher
1010import android.text.method.KeyListener
1111import android.text.style.UnderlineSpan
1212import android.text.util.Linkify
13+ import android.text.InputType
1314import android.util.TypedValue
1415import android.view.LayoutInflater
1516import android.view.MotionEvent
@@ -22,6 +23,7 @@ import android.widget.TextView
2223import androidx.viewbinding.ViewBinding
2324import org.fossify.commons.extensions.*
2425import org.fossify.commons.views.MyEditText
26+ import org.fossify.commons.extensions.hideKeyboard
2527import org.fossify.notes.R
2628import org.fossify.notes.activities.MainActivity
2729import 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