diff --git a/vector/src/main/AndroidManifest.xml b/vector/src/main/AndroidManifest.xml index a1be26c1c2..881e6568a6 100644 --- a/vector/src/main/AndroidManifest.xml +++ b/vector/src/main/AndroidManifest.xml @@ -270,8 +270,6 @@ - - { - startActivity(RoomMemberListActivity.newIntent(requireContext(), roomDetailArgs.roomId)) + navigator.openRoomProfile(requireContext(), roomDetailArgs.roomId, RoomProfileActivity.EXTRA_DIRECT_ACCESS_ROOM_MEMBERS) true } R.id.show_room_info -> { diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/RoomProfileActivity.kt b/vector/src/main/java/im/vector/app/features/roomprofile/RoomProfileActivity.kt index 125f0876c8..7b92007692 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/RoomProfileActivity.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/RoomProfileActivity.kt @@ -46,7 +46,7 @@ import kotlinx.coroutines.flow.onEach import javax.inject.Inject @AndroidEntryPoint -open class RoomProfileActivity : +class RoomProfileActivity : VectorBaseActivity(), ToolbarConfigurable { @@ -68,7 +68,7 @@ open class RoomProfileActivity : } private lateinit var sharedActionViewModel: RoomProfileSharedActionViewModel - protected lateinit var roomProfileArgs: RoomProfileArgs + private lateinit var roomProfileArgs: RoomProfileArgs private val requireActiveMembershipViewModel: RequireActiveMembershipViewModel by viewModel() @@ -83,7 +83,16 @@ open class RoomProfileActivity : sharedActionViewModel = viewModelProvider.get(RoomProfileSharedActionViewModel::class.java) roomProfileArgs = intent?.extras?.getParcelable(Mavericks.KEY_ARG) ?: return if (isFirstCreation()) { - addInitialFragment() + when (intent?.extras?.getInt(EXTRA_DIRECT_ACCESS, EXTRA_DIRECT_ACCESS_ROOM_ROOT)) { + EXTRA_DIRECT_ACCESS_ROOM_SETTINGS -> { + addFragment(views.simpleFragmentContainer, RoomProfileFragment::class.java, roomProfileArgs) + addFragmentToBackstack(views.simpleFragmentContainer, RoomSettingsFragment::class.java, roomProfileArgs) + } + EXTRA_DIRECT_ACCESS_ROOM_MEMBERS -> { + addFragment(views.simpleFragmentContainer, RoomMemberListFragment::class.java, roomProfileArgs) + } + else -> addFragment(views.simpleFragmentContainer, RoomProfileFragment::class.java, roomProfileArgs) + } } sharedActionViewModel .stream() @@ -107,19 +116,6 @@ open class RoomProfileActivity : } } - open fun addInitialFragment() { - when (intent?.extras?.getInt(EXTRA_DIRECT_ACCESS, EXTRA_DIRECT_ACCESS_ROOM_ROOT)) { - EXTRA_DIRECT_ACCESS_ROOM_SETTINGS -> { - addFragment(views.simpleFragmentContainer, RoomProfileFragment::class.java, roomProfileArgs) - addFragmentToBackstack(views.simpleFragmentContainer, RoomSettingsFragment::class.java, roomProfileArgs) - } - EXTRA_DIRECT_ACCESS_ROOM_MEMBERS -> { - addFragment(views.simpleFragmentContainer, RoomMemberListFragment::class.java, roomProfileArgs) - } - else -> addFragment(views.simpleFragmentContainer, RoomProfileFragment::class.java, roomProfileArgs) - } - } - override fun onResume() { super.onResume() if (roomDetailPendingActionStore.data != null) { diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/members/RoomMemberListActivity.kt b/vector/src/main/java/im/vector/app/features/roomprofile/members/RoomMemberListActivity.kt deleted file mode 100644 index 128a438cd7..0000000000 --- a/vector/src/main/java/im/vector/app/features/roomprofile/members/RoomMemberListActivity.kt +++ /dev/null @@ -1,26 +0,0 @@ -package im.vector.app.features.roomprofile.members - -import android.content.Context -import android.content.Intent -import com.airbnb.mvrx.Mavericks -import im.vector.app.core.extensions.addFragment -import im.vector.app.features.roomprofile.RoomProfileActivity -import im.vector.app.features.roomprofile.RoomProfileArgs - -class RoomMemberListActivity : - RoomProfileActivity() { - - companion object { - - fun newIntent(context: Context, roomId: String): Intent { - val roomProfileArgs = RoomProfileArgs(roomId) - return Intent(context, RoomMemberListActivity::class.java).apply { - putExtra(Mavericks.KEY_ARG, roomProfileArgs) - } - } - } - - override fun addInitialFragment() { - addFragment(views.simpleFragmentContainer, RoomMemberListFragment::class.java, roomProfileArgs) - } -}