diff --git a/vector/src/main/java/im/vector/riotredesign/core/listener/Listener.kt b/vector/src/main/java/im/vector/riotredesign/features/autocomplete/AutocompleteClickListener.kt similarity index 84% rename from vector/src/main/java/im/vector/riotredesign/core/listener/Listener.kt rename to vector/src/main/java/im/vector/riotredesign/features/autocomplete/AutocompleteClickListener.kt index 8746883cd9..aa2226d5b2 100644 --- a/vector/src/main/java/im/vector/riotredesign/core/listener/Listener.kt +++ b/vector/src/main/java/im/vector/riotredesign/features/autocomplete/AutocompleteClickListener.kt @@ -14,12 +14,12 @@ * limitations under the License. */ -package im.vector.riotredesign.core.listener +package im.vector.riotredesign.features.autocomplete /** * Simple generic listener interface */ -interface Listener { +interface AutocompleteClickListener { - fun onEvent(t: T) + fun onItemClick(t: T) } \ No newline at end of file diff --git a/vector/src/main/java/im/vector/riotredesign/features/autocomplete/EpoxyAutocompletePresenter.kt b/vector/src/main/java/im/vector/riotredesign/features/autocomplete/EpoxyAutocompletePresenter.kt index 552b0eb6df..ebdee91b16 100644 --- a/vector/src/main/java/im/vector/riotredesign/features/autocomplete/EpoxyAutocompletePresenter.kt +++ b/vector/src/main/java/im/vector/riotredesign/features/autocomplete/EpoxyAutocompletePresenter.kt @@ -23,9 +23,8 @@ import androidx.recyclerview.widget.RecyclerView import com.airbnb.epoxy.EpoxyController import com.airbnb.epoxy.EpoxyRecyclerView import com.otaliastudios.autocomplete.AutocompletePresenter -import im.vector.riotredesign.core.listener.Listener -abstract class EpoxyAutocompletePresenter(context: Context) : AutocompletePresenter(context), Listener { +abstract class EpoxyAutocompletePresenter(context: Context) : AutocompletePresenter(context), AutocompleteClickListener { private var recyclerView: EpoxyRecyclerView? = null private var clicks: AutocompletePresenter.ClickProvider? = null @@ -64,7 +63,7 @@ abstract class EpoxyAutocompletePresenter(context: Context) : AutocompletePre observer?.onChanged() } - override fun onEvent(t: T) { + override fun onItemClick(t: T) { clicks?.click(t) } diff --git a/vector/src/main/java/im/vector/riotredesign/features/autocomplete/command/AutocompleteCommandController.kt b/vector/src/main/java/im/vector/riotredesign/features/autocomplete/command/AutocompleteCommandController.kt index 1dbbcaad31..7356364c6c 100644 --- a/vector/src/main/java/im/vector/riotredesign/features/autocomplete/command/AutocompleteCommandController.kt +++ b/vector/src/main/java/im/vector/riotredesign/features/autocomplete/command/AutocompleteCommandController.kt @@ -17,13 +17,13 @@ package im.vector.riotredesign.features.autocomplete.command import com.airbnb.epoxy.TypedEpoxyController -import im.vector.riotredesign.core.listener.Listener import im.vector.riotredesign.core.resources.StringProvider +import im.vector.riotredesign.features.autocomplete.AutocompleteClickListener import im.vector.riotredesign.features.command.Command class AutocompleteCommandController(private val stringProvider: StringProvider) : TypedEpoxyController>() { - var listener: Listener? = null + var listener: AutocompleteClickListener? = null override fun buildModels(data: List?) { if (data.isNullOrEmpty()) { @@ -36,7 +36,7 @@ class AutocompleteCommandController(private val stringProvider: StringProvider) parameters(command.parameters) description(stringProvider.getString(command.description)) clickListener { _ -> - listener?.onEvent(command) + listener?.onItemClick(command) } } } diff --git a/vector/src/main/java/im/vector/riotredesign/features/autocomplete/user/AutocompleteUserController.kt b/vector/src/main/java/im/vector/riotredesign/features/autocomplete/user/AutocompleteUserController.kt index 6c9965c56c..bec9adb022 100644 --- a/vector/src/main/java/im/vector/riotredesign/features/autocomplete/user/AutocompleteUserController.kt +++ b/vector/src/main/java/im/vector/riotredesign/features/autocomplete/user/AutocompleteUserController.kt @@ -18,11 +18,11 @@ package im.vector.riotredesign.features.autocomplete.user import com.airbnb.epoxy.TypedEpoxyController import im.vector.matrix.android.api.session.user.model.User -import im.vector.riotredesign.core.listener.Listener +import im.vector.riotredesign.features.autocomplete.AutocompleteClickListener class AutocompleteUserController : TypedEpoxyController>() { - var listener: Listener? = null + var listener: AutocompleteClickListener? = null override fun buildModels(data: List?) { if (data.isNullOrEmpty()) { @@ -34,7 +34,7 @@ class AutocompleteUserController : TypedEpoxyController>() { name(user.displayName) avatarUrl(user.avatarUrl) clickListener { _ -> - listener?.onEvent(user) + listener?.onItemClick(user) } } } diff --git a/vector/src/main/java/im/vector/riotredesign/features/autocomplete/user/AutocompleteUserPresenter.kt b/vector/src/main/java/im/vector/riotredesign/features/autocomplete/user/AutocompleteUserPresenter.kt index 916b0f97ed..be4ec7e702 100644 --- a/vector/src/main/java/im/vector/riotredesign/features/autocomplete/user/AutocompleteUserPresenter.kt +++ b/vector/src/main/java/im/vector/riotredesign/features/autocomplete/user/AutocompleteUserPresenter.kt @@ -21,12 +21,11 @@ import com.airbnb.epoxy.EpoxyController import com.airbnb.mvrx.Async import com.airbnb.mvrx.Success import im.vector.matrix.android.api.session.user.model.User -import im.vector.riotredesign.core.listener.Listener import im.vector.riotredesign.features.autocomplete.EpoxyAutocompletePresenter class AutocompleteUserPresenter(context: Context, private val controller: AutocompleteUserController -) : EpoxyAutocompletePresenter(context), Listener { +) : EpoxyAutocompletePresenter(context) { var callback: Callback? = null