Improve API
This commit is contained in:
parent
d88e5d8af8
commit
8597c2b9a2
|
@ -53,7 +53,7 @@ class AutoCompleter @Inject constructor(
|
||||||
private val autocompleteRoomPresenter: AutocompleteRoomPresenter,
|
private val autocompleteRoomPresenter: AutocompleteRoomPresenter,
|
||||||
private val autocompleteGroupPresenter: AutocompleteGroupPresenter
|
private val autocompleteGroupPresenter: AutocompleteGroupPresenter
|
||||||
) {
|
) {
|
||||||
private lateinit var fragment: Fragment
|
private lateinit var editText: EditText
|
||||||
|
|
||||||
fun enterSpecialMode() {
|
fun enterSpecialMode() {
|
||||||
commandAutocompletePolicy.enabled = false
|
commandAutocompletePolicy.enabled = false
|
||||||
|
@ -64,13 +64,13 @@ class AutoCompleter @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private val glideRequests by lazy {
|
private val glideRequests by lazy {
|
||||||
GlideApp.with(fragment)
|
GlideApp.with(editText)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setup(fragment: Fragment, editText: EditText, listener: AutoCompleterListener) {
|
fun setup(editText: EditText, listener: AutoCompleterListener) {
|
||||||
this.fragment = fragment
|
this.editText = editText
|
||||||
|
|
||||||
val backgroundDrawable = ColorDrawable(ThemeUtils.getColor(fragment.requireContext(), R.attr.riotx_background))
|
val backgroundDrawable = ColorDrawable(ThemeUtils.getColor(editText.context, R.attr.riotx_background))
|
||||||
|
|
||||||
setupCommands(backgroundDrawable, editText)
|
setupCommands(backgroundDrawable, editText)
|
||||||
setupUsers(backgroundDrawable, editText, listener)
|
setupUsers(backgroundDrawable, editText, listener)
|
||||||
|
@ -185,7 +185,7 @@ class AutoCompleter @Inject constructor(
|
||||||
val span = PillImageSpan(
|
val span = PillImageSpan(
|
||||||
glideRequests,
|
glideRequests,
|
||||||
avatarRenderer,
|
avatarRenderer,
|
||||||
fragment.requireContext(),
|
editText.context,
|
||||||
matrixItem
|
matrixItem
|
||||||
)
|
)
|
||||||
span.bind(editText)
|
span.bind(editText)
|
||||||
|
|
|
@ -559,7 +559,7 @@ class RoomDetailFragment @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupComposer() {
|
private fun setupComposer() {
|
||||||
autoCompleter.setup(this, composerLayout.composerEditText, this)
|
autoCompleter.setup(composerLayout.composerEditText, this)
|
||||||
|
|
||||||
composerLayout.callback = object : TextComposerView.Callback {
|
composerLayout.callback = object : TextComposerView.Callback {
|
||||||
override fun onAddAttachment() {
|
override fun onAddAttachment() {
|
||||||
|
|
Loading…
Reference in New Issue