Ensure textview fields can be copy/pasted (#3707)
The Android libraries have a bug where a TextView can forget that it contains selectable text, can be pasted in to, etc. See https://issuetracker.google.com/issues/37095917 Fix this with an extension method that toggles the selectable state to re-enable it, and use this on the profile fields when editing an account. Fixes https://github.com/tuskyapp/Tusky/issues/3706
This commit is contained in:
parent
5fd532d69b
commit
84486c7f13
2 changed files with 17 additions and 0 deletions
|
|
@ -22,6 +22,7 @@ import androidx.recyclerview.widget.RecyclerView
|
|||
import com.keylesspalace.tusky.databinding.ItemEditFieldBinding
|
||||
import com.keylesspalace.tusky.entity.StringField
|
||||
import com.keylesspalace.tusky.util.BindingHolder
|
||||
import com.keylesspalace.tusky.util.fixTextSelection
|
||||
|
||||
class AccountFieldEditAdapter : RecyclerView.Adapter<BindingHolder<ItemEditFieldBinding>>() {
|
||||
|
||||
|
|
@ -87,6 +88,10 @@ class AccountFieldEditAdapter : RecyclerView.Adapter<BindingHolder<ItemEditField
|
|||
holder.binding.accountFieldValueText.doAfterTextChanged { newText ->
|
||||
fieldData[holder.bindingAdapterPosition].second = newText.toString()
|
||||
}
|
||||
|
||||
// Ensure the textview contents are selectable
|
||||
holder.binding.accountFieldNameText.fixTextSelection()
|
||||
holder.binding.accountFieldValueText.fixTextSelection()
|
||||
}
|
||||
|
||||
class MutableStringPair(var first: String, var second: String)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue