mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-21 12:39:58 +01:00
Improvements to contacts handling
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
618bcf5790
commit
8a3bd19d3b
@ -182,7 +182,7 @@ class MainActivity : BaseActivity(), ActionBarProvider {
|
||||
|
||||
private fun openNewConversationScreen() {
|
||||
router?.pushController(
|
||||
RouterTransaction.with(ContactsView<Any>())
|
||||
RouterTransaction.with(ContactsView())
|
||||
.pushChangeHandler(HorizontalChangeHandler())
|
||||
.popChangeHandler(HorizontalChangeHandler())
|
||||
)
|
||||
|
@ -66,6 +66,7 @@ import com.nextcloud.talk.models.json.converters.EnumNotificationLevelConverter
|
||||
import com.nextcloud.talk.models.json.generic.GenericOverall
|
||||
import com.nextcloud.talk.models.json.participants.Participant
|
||||
import com.nextcloud.talk.models.json.participants.ParticipantsOverall
|
||||
import com.nextcloud.talk.newarch.features.contactsflow.ContactsView
|
||||
import com.nextcloud.talk.newarch.local.models.UserNgEntity
|
||||
import com.nextcloud.talk.newarch.local.models.getCredentials
|
||||
import com.nextcloud.talk.newarch.utils.Images
|
||||
@ -501,10 +502,10 @@ class ConversationInfoController(args: Bundle) : BaseController(),
|
||||
adapter!!.addListener(this)
|
||||
actionTextView.setOnClickListener {
|
||||
val bundle = Bundle()
|
||||
bundle.putString(BundleKeys.KEY_TOKEN, conversation!!.token)
|
||||
bundle.putString(BundleKeys.KEY_CONVERSATION_TOKEN, conversation!!.token)
|
||||
|
||||
router.pushController(
|
||||
(RouterTransaction.with(ContactsController(bundle))
|
||||
(RouterTransaction.with(ContactsView(bundle))
|
||||
.pushChangeHandler(HorizontalChangeHandler())
|
||||
.popChangeHandler(HorizontalChangeHandler()))
|
||||
)
|
||||
|
@ -55,7 +55,7 @@ import kotlinx.android.synthetic.main.search_layout.*
|
||||
import kotlinx.android.synthetic.main.search_layout.view.*
|
||||
import org.koin.android.ext.android.inject
|
||||
|
||||
class ContactsView<T : Any>(private val bundle: Bundle? = null) : BaseView() {
|
||||
class ContactsView(private val bundle: Bundle? = null) : BaseView() {
|
||||
override val scopeProvider: LifecycleScopeProvider<*> = ControllerScopeProvider.from(this)
|
||||
|
||||
private lateinit var viewModel: ContactsViewModel
|
||||
@ -153,7 +153,6 @@ class ContactsView<T : Any>(private val bundle: Bundle? = null) : BaseView() {
|
||||
operationState.observe(this@ContactsView) { operationState ->
|
||||
when (operationState.operationState) {
|
||||
ContactsViewOperationState.OK -> {
|
||||
searchLayout?.searchProgressBar?.isVisible = true
|
||||
val bundle = Bundle()
|
||||
if (!hasToken || isNewGroupConversation) {
|
||||
bundle.putString(BundleKeys.KEY_CONVERSATION_TOKEN, operationState.conversationToken)
|
||||
@ -167,6 +166,7 @@ class ContactsView<T : Any>(private val bundle: Bundle? = null) : BaseView() {
|
||||
}
|
||||
ContactsViewOperationState.PROCESSING -> {
|
||||
searchLayout?.searchProgressBar?.isVisible = true
|
||||
floatingActionButton?.isVisible = false
|
||||
}
|
||||
ContactsViewOperationState.CONVERSATION_CREATION_FAILED -> {
|
||||
// dunno what to do yet, an error message somewhere
|
||||
@ -187,6 +187,7 @@ class ContactsView<T : Any>(private val bundle: Bundle? = null) : BaseView() {
|
||||
override fun onAttach(view: View) {
|
||||
super.onAttach(view)
|
||||
searchLayout?.settingsButton?.isVisible = false
|
||||
floatingActionButton?.isVisible = selectedParticipantsAdapter.itemCount > 0
|
||||
}
|
||||
|
||||
private fun toggleSelectedParticipantsViewVisibility() {
|
||||
@ -194,7 +195,7 @@ class ContactsView<T : Any>(private val bundle: Bundle? = null) : BaseView() {
|
||||
view?.divider?.isVisible = selectedParticipantsAdapter.itemCount > 0
|
||||
}
|
||||
|
||||
private fun onElementClick(page: Page, holder: Presenter.Holder, element: Element<T>) {
|
||||
private fun onElementClick(page: Page, holder: Presenter.Holder, element: Element<Any>) {
|
||||
if (element.data is Participant?) {
|
||||
val participant = element.data as Participant?
|
||||
|
||||
@ -239,6 +240,12 @@ class ContactsView<T : Any>(private val bundle: Bundle? = null) : BaseView() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView(view: View) {
|
||||
super.onDestroyView(view)
|
||||
activity?.inputEditText?.text = null
|
||||
searchLayout?.searchProgressBar?.isVisible = false
|
||||
}
|
||||
|
||||
override fun getAppBarLayoutType(): AppBarLayoutType {
|
||||
return AppBarLayoutType.SEARCH_BAR
|
||||
}
|
||||
|
@ -38,4 +38,6 @@ class FixedListSource(list: List<Any>, elementType: Int) : ListSource<Any>(list,
|
||||
override fun dependsOn(source: Source<*>): Boolean {
|
||||
return source is ContactsViewSource
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -228,9 +228,8 @@ class ConversationsListView : BaseView() {
|
||||
|
||||
private fun openNewConversationScreen() {
|
||||
val bundle = Bundle()
|
||||
bundle.putBoolean(BundleKeys.KEY_NEW_CONVERSATION, true)
|
||||
router.pushController(
|
||||
RouterTransaction.with(ContactsController(bundle))
|
||||
RouterTransaction.with(ContactsView())
|
||||
.pushChangeHandler(HorizontalChangeHandler())
|
||||
.popChangeHandler(HorizontalChangeHandler()))
|
||||
}
|
||||
@ -287,7 +286,7 @@ class ConversationsListView : BaseView() {
|
||||
|
||||
override fun onFloatingActionButtonClick() {
|
||||
router?.pushController(
|
||||
RouterTransaction.with(ContactsView<Any>())
|
||||
RouterTransaction.with(ContactsView())
|
||||
.pushChangeHandler(HorizontalChangeHandler())
|
||||
.popChangeHandler(HorizontalChangeHandler()))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user