From 4f044c0cd6010578ed1dda6121bb67622ba49f1e Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 10 Jun 2019 08:27:27 +0200 Subject: [PATCH] Create room screen - Navigate to change protocol --- .../features/roomdirectory/PublicRoomsFragment.kt | 2 +- .../features/roomdirectory/RoomDirectoryActivity.kt | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/vector/src/main/java/im/vector/riotredesign/features/roomdirectory/PublicRoomsFragment.kt b/vector/src/main/java/im/vector/riotredesign/features/roomdirectory/PublicRoomsFragment.kt index e5524256f4..bb079b020a 100644 --- a/vector/src/main/java/im/vector/riotredesign/features/roomdirectory/PublicRoomsFragment.kt +++ b/vector/src/main/java/im/vector/riotredesign/features/roomdirectory/PublicRoomsFragment.kt @@ -91,7 +91,7 @@ class PublicRoomsFragment : VectorBaseFragment(), PublicRoomsController.Callback override fun onOptionsItemSelected(item: MenuItem): Boolean { return when (item.itemId) { R.id.menu_room_directory_change_protocol -> { - vectorBaseActivity.addFragmentToBackstack(RoomDirectoryPickerFragment(), R.id.simpleFragmentContainer) + navigationViewModel.goTo(RoomDirectoryActivity.Navigation.ChangeProtocol) true } else -> diff --git a/vector/src/main/java/im/vector/riotredesign/features/roomdirectory/RoomDirectoryActivity.kt b/vector/src/main/java/im/vector/riotredesign/features/roomdirectory/RoomDirectoryActivity.kt index 1351a25ee4..083f1d882b 100644 --- a/vector/src/main/java/im/vector/riotredesign/features/roomdirectory/RoomDirectoryActivity.kt +++ b/vector/src/main/java/im/vector/riotredesign/features/roomdirectory/RoomDirectoryActivity.kt @@ -24,6 +24,7 @@ import im.vector.riotredesign.core.extensions.addFragment import im.vector.riotredesign.core.extensions.addFragmentToBackstack import im.vector.riotredesign.core.platform.VectorBaseActivity import im.vector.riotredesign.features.roomdirectory.createroom.CreateRoomFragment +import im.vector.riotredesign.features.roomdirectory.picker.RoomDirectoryPickerFragment import org.koin.android.scope.ext.android.bindScope import org.koin.android.scope.ext.android.getOrCreateScope @@ -34,6 +35,7 @@ class RoomDirectoryActivity : VectorBaseActivity() { object Back : Navigation() object CreateRoom : Navigation() object Close : Navigation() + object ChangeProtocol : Navigation() } @@ -48,9 +50,10 @@ class RoomDirectoryActivity : VectorBaseActivity() { navigationViewModel.navigateTo.observe(this, Observer { liveEvent -> when (liveEvent.getContentIfNotHandled() ?: return@Observer) { - is Navigation.Back -> onBackPressed() - is Navigation.CreateRoom -> gotoCreateRoom() - is Navigation.Close -> finish() + is Navigation.Back -> onBackPressed() + is Navigation.CreateRoom -> addFragmentToBackstack(CreateRoomFragment(), R.id.simpleFragmentContainer) + is Navigation.ChangeProtocol -> addFragmentToBackstack(RoomDirectoryPickerFragment(), R.id.simpleFragmentContainer) + is Navigation.Close -> finish() } }) } @@ -61,7 +64,4 @@ class RoomDirectoryActivity : VectorBaseActivity() { } } - private fun gotoCreateRoom() { - addFragmentToBackstack(CreateRoomFragment(), R.id.simpleFragmentContainer) - } } \ No newline at end of file