mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-26 19:36:08 +03:00
Fix room name reset issue when rotating the screen
This commit is contained in:
parent
dc8668b222
commit
613573931e
1 changed files with 7 additions and 6 deletions
|
@ -20,6 +20,7 @@ import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import com.airbnb.mvrx.viewModel
|
import com.airbnb.mvrx.viewModel
|
||||||
|
import com.airbnb.mvrx.withState
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.core.di.ScreenComponent
|
import im.vector.app.core.di.ScreenComponent
|
||||||
import im.vector.app.core.extensions.addFragment
|
import im.vector.app.core.extensions.addFragment
|
||||||
|
@ -58,19 +59,19 @@ class RoomDirectoryActivity : VectorBaseActivity() {
|
||||||
.subscribe { sharedAction ->
|
.subscribe { sharedAction ->
|
||||||
when (sharedAction) {
|
when (sharedAction) {
|
||||||
is RoomDirectorySharedAction.Back -> onBackPressed()
|
is RoomDirectorySharedAction.Back -> onBackPressed()
|
||||||
is RoomDirectorySharedAction.CreateRoom ->
|
is RoomDirectorySharedAction.CreateRoom -> {
|
||||||
addFragmentToBackstack(R.id.simpleFragmentContainer, CreateRoomFragment::class.java)
|
addFragmentToBackstack(R.id.simpleFragmentContainer, CreateRoomFragment::class.java)
|
||||||
|
// Transmit the filter to the createRoomViewModel
|
||||||
|
withState(roomDirectoryViewModel) {
|
||||||
|
createRoomViewModel.handle(CreateRoomAction.SetName(it.currentFilter))
|
||||||
|
}
|
||||||
|
}
|
||||||
is RoomDirectorySharedAction.ChangeProtocol ->
|
is RoomDirectorySharedAction.ChangeProtocol ->
|
||||||
addFragmentToBackstack(R.id.simpleFragmentContainer, RoomDirectoryPickerFragment::class.java)
|
addFragmentToBackstack(R.id.simpleFragmentContainer, RoomDirectoryPickerFragment::class.java)
|
||||||
is RoomDirectorySharedAction.Close -> finish()
|
is RoomDirectorySharedAction.Close -> finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.disposeOnDestroy()
|
.disposeOnDestroy()
|
||||||
|
|
||||||
roomDirectoryViewModel.selectSubscribe(this, PublicRoomsViewState::currentFilter) { currentFilter ->
|
|
||||||
// Transmit the filter to the createRoomViewModel
|
|
||||||
createRoomViewModel.handle(CreateRoomAction.SetName(currentFilter))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun initUiAndData() {
|
override fun initUiAndData() {
|
||||||
|
|
Loading…
Reference in a new issue