Navigate to other sessions screen.

This commit is contained in:
Onuray Sahin 2022-09-06 17:46:56 +03:00
parent 3bfeaa764c
commit 39364a68b1
6 changed files with 23 additions and 4 deletions

View File

@ -339,6 +339,7 @@
<activity android:name=".features.call.dialpad.PstnDialActivity" />
<activity android:name=".features.home.room.list.home.invites.InvitesActivity"/>
<activity android:name=".features.settings.devices.v2.overview.SessionOverviewActivity"/>
<activity android:name=".features.settings.devices.v2.othersessions.OtherSessionsActivity" />
<!-- Services -->

View File

@ -44,6 +44,7 @@ import im.vector.app.features.settings.devices.DevicesAction
import im.vector.app.features.settings.devices.DevicesViewEvents
import im.vector.app.features.settings.devices.DevicesViewModel
import im.vector.app.features.settings.devices.v2.list.OtherSessionsController
import im.vector.app.features.settings.devices.v2.list.OtherSessionsView
import im.vector.app.features.settings.devices.v2.list.SESSION_IS_MARKED_AS_INACTIVE_AFTER_DAYS
import im.vector.app.features.settings.devices.v2.list.SecurityRecommendationViewState
import im.vector.app.features.settings.devices.v2.list.SessionInfoViewState
@ -54,7 +55,8 @@ import javax.inject.Inject
*/
@AndroidEntryPoint
class VectorSettingsDevicesFragment :
VectorBaseFragment<FragmentSettingsDevicesBinding>() {
VectorBaseFragment<FragmentSettingsDevicesBinding>(),
OtherSessionsView.Callback {
@Inject lateinit var viewNavigator: VectorSettingsDevicesViewNavigator
@ -126,6 +128,7 @@ class VectorSettingsDevicesFragment :
}
private fun initOtherSessionsView() {
views.deviceListOtherSessions.callback = this
views.deviceListOtherSessions.setCallback(object : OtherSessionsController.Callback {
override fun onItemClicked(deviceId: String) {
navigateToSessionOverview(deviceId)
@ -260,4 +263,8 @@ class VectorSettingsDevicesFragment :
else -> false
}
}
override fun onViewAllOtherSessionsClicked() {
viewNavigator.navigateToOtherSessions(requireActivity())
}
}

View File

@ -34,13 +34,22 @@ class OtherSessionsView @JvmOverloads constructor(
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) {
interface Callback {
fun onViewAllOtherSessionsClicked()
}
@Inject lateinit var otherSessionsController: OtherSessionsController
private val views: ViewOtherSessionsBinding
var callback: Callback? = null
init {
inflate(context, R.layout.view_other_sessions, this)
views = ViewOtherSessionsBinding.bind(this)
views.otherSessionsViewAllButton.setOnClickListener {
callback?.onViewAllOtherSessionsClicked()
}
}
fun render(devices: List<DeviceFullInfo>) {

View File

@ -19,6 +19,7 @@ package im.vector.app.features.settings.devices.v2.othersessions
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.view.View
import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.core.extensions.addFragment
import im.vector.app.core.platform.SimpleFragmentActivity
@ -29,6 +30,8 @@ class OtherSessionsActivity : SimpleFragmentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
views.toolbar.visibility = View.GONE
if (isFirstCreation()) {
addFragment(
container = views.container,

View File

@ -37,7 +37,7 @@ class OtherSessionsFragment : VectorBaseFragment<FragmentOtherSessionsBinding>()
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setupToolbar(views.otherSessionsToolbar)
setupToolbar(views.otherSessionsToolbar).allowBack()
initFilterView()
}

View File

@ -77,8 +77,7 @@
style="@style/TextAppearance.Vector.Body.DevicesManagement"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:text="@string/device_manager_filter_option_inactive_description" />
android:layout_gravity="end" />
</RadioGroup>