Create other sessions activity.

This commit is contained in:
Onuray Sahin 2022-09-06 17:23:03 +03:00
parent 604b7dafbd
commit 3bfeaa764c
4 changed files with 54 additions and 2 deletions

View File

@ -17,6 +17,7 @@
package im.vector.app.features.settings.devices.v2
import android.content.Context
import im.vector.app.features.settings.devices.v2.othersessions.OtherSessionsActivity
import im.vector.app.features.settings.devices.v2.overview.SessionOverviewActivity
import javax.inject.Inject
@ -25,4 +26,8 @@ class VectorSettingsDevicesViewNavigator @Inject constructor() {
fun navigateToSessionOverview(context: Context, deviceId: String) {
context.startActivity(SessionOverviewActivity.newIntent(context, deviceId))
}
fun navigateToOtherSessions(context: Context) {
context.startActivity(OtherSessionsActivity.newIntent(context))
}
}

View File

@ -0,0 +1,45 @@
/*
* Copyright (c) 2022 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.app.features.settings.devices.v2.othersessions
import android.content.Context
import android.content.Intent
import android.os.Bundle
import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.core.extensions.addFragment
import im.vector.app.core.platform.SimpleFragmentActivity
@AndroidEntryPoint
class OtherSessionsActivity : SimpleFragmentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (isFirstCreation()) {
addFragment(
container = views.container,
fragmentClass = OtherSessionsFragment::class.java
)
}
}
companion object {
fun newIntent(context: Context): Intent {
return Intent(context, OtherSessionsActivity::class.java)
}
}
}

View File

@ -37,11 +37,12 @@ class OtherSessionsFragment : VectorBaseFragment<FragmentOtherSessionsBinding>()
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setupToolbar(views.otherSessionsToolbar)
initFilterView()
}
private fun initFilterView() {
views.otherSessionsFilterFrameLayout.setOnClickListener {
views.otherSessionsFilterFrameLayout.debouncedClicks {
DeviceManagerFilterBottomSheet
.newInstance(this)
.show(requireActivity().supportFragmentManager, "SHOW_DEVICE_MANAGER_FILTER_BOTTOM_SHEET")
@ -50,7 +51,7 @@ class OtherSessionsFragment : VectorBaseFragment<FragmentOtherSessionsBinding>()
override fun onBottomSheetResult(resultCode: Int, data: Any?) {
if (resultCode == RESULT_OK && data != null) {
Toast.makeText(requireContext(), data.toString(), Toast.LENGTH_LONG)
Toast.makeText(requireContext(), data.toString(), Toast.LENGTH_LONG).show()
}
}
}

View File

@ -13,6 +13,7 @@
app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/otherSessionsToolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:navigationIcon="@drawable/ic_back_24dp"