Implement clear filter.
This commit is contained in:
parent
11079afa6b
commit
0ec67c1ab8
|
@ -3304,5 +3304,9 @@
|
||||||
<item quantity="one">Consider signing out from old sessions (%1$d day or more) you don’t use anymore.</item>
|
<item quantity="one">Consider signing out from old sessions (%1$d day or more) you don’t use anymore.</item>
|
||||||
<item quantity="other">Consider signing out from old sessions (%1$d days or more) you don’t use anymore.</item>
|
<item quantity="other">Consider signing out from old sessions (%1$d days or more) you don’t use anymore.</item>
|
||||||
</plurals>
|
</plurals>
|
||||||
|
<string name="device_manager_other_sessions_no_verified_sessions_found">No verified sessions found.</string>
|
||||||
|
<string name="device_manager_other_sessions_no_unverified_sessions_found">No unverified sessions found.</string>
|
||||||
|
<string name="device_manager_other_sessions_no_inactive_sessions_found">No inactive sessions found.</string>
|
||||||
|
<string name="device_manager_other_sessions_clear_filter">Clear Filter</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -64,6 +64,10 @@ class OtherSessionsFragment : VectorBaseFragment<FragmentOtherSessionsBinding>()
|
||||||
.show(requireActivity().supportFragmentManager, "SHOW_DEVICE_MANAGER_FILTER_BOTTOM_SHEET")
|
.show(requireActivity().supportFragmentManager, "SHOW_DEVICE_MANAGER_FILTER_BOTTOM_SHEET")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
views.otherSessionsClearFilterButton.debouncedClicks {
|
||||||
|
viewModel.handle(DevicesAction.FilterDevices(DeviceManagerFilterType.ALL_SESSIONS))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBottomSheetResult(resultCode: Int, data: Any?) {
|
override fun onBottomSheetResult(resultCode: Int, data: Any?) {
|
||||||
|
@ -98,6 +102,7 @@ class OtherSessionsFragment : VectorBaseFragment<FragmentOtherSessionsBinding>()
|
||||||
imageTintColorResourceId = colorProvider.getColor(R.color.shield_color_trust_background)
|
imageTintColorResourceId = colorProvider.getColor(R.color.shield_color_trust_background)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
views.otherSessionsNotFoundTextView.text = getString(R.string.device_manager_other_sessions_no_verified_sessions_found)
|
||||||
}
|
}
|
||||||
DeviceManagerFilterType.UNVERIFIED -> {
|
DeviceManagerFilterType.UNVERIFIED -> {
|
||||||
views.otherSessionsSecurityRecommendationView.render(
|
views.otherSessionsSecurityRecommendationView.render(
|
||||||
|
@ -108,6 +113,7 @@ class OtherSessionsFragment : VectorBaseFragment<FragmentOtherSessionsBinding>()
|
||||||
imageTintColorResourceId = colorProvider.getColor(R.color.shield_color_warning_background)
|
imageTintColorResourceId = colorProvider.getColor(R.color.shield_color_warning_background)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
views.otherSessionsNotFoundTextView.text = getString(R.string.device_manager_other_sessions_no_unverified_sessions_found)
|
||||||
}
|
}
|
||||||
DeviceManagerFilterType.INACTIVE -> {
|
DeviceManagerFilterType.INACTIVE -> {
|
||||||
views.otherSessionsSecurityRecommendationView.render(
|
views.otherSessionsSecurityRecommendationView.render(
|
||||||
|
@ -122,14 +128,17 @@ class OtherSessionsFragment : VectorBaseFragment<FragmentOtherSessionsBinding>()
|
||||||
imageTintColorResourceId = ThemeUtils.getColor(requireContext(), R.attr.vctr_system)
|
imageTintColorResourceId = ThemeUtils.getColor(requireContext(), R.attr.vctr_system)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
views.otherSessionsNotFoundTextView.text = getString(R.string.device_manager_other_sessions_no_inactive_sessions_found)
|
||||||
}
|
}
|
||||||
DeviceManagerFilterType.ALL_SESSIONS -> { /* NOOP. View is not visible */ }
|
DeviceManagerFilterType.ALL_SESSIONS -> { /* NOOP. View is not visible */ }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (devices.isNullOrEmpty()) {
|
if (devices.isNullOrEmpty()) {
|
||||||
views.deviceListOtherSessions.isVisible = false
|
views.deviceListOtherSessions.isVisible = false
|
||||||
|
views.otherSessionsNotFoundLayout.isVisible = true
|
||||||
} else {
|
} else {
|
||||||
views.deviceListOtherSessions.isVisible = true
|
views.deviceListOtherSessions.isVisible = true
|
||||||
|
views.otherSessionsNotFoundLayout.isVisible = false
|
||||||
views.deviceListOtherSessions.render(devices, devices.size)
|
views.deviceListOtherSessions.render(devices, devices.size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,37 @@
|
||||||
app:otherSessionsRecommendationTitle="@string/device_manager_other_sessions_recommendation_title_unverified"
|
app:otherSessionsRecommendationTitle="@string/device_manager_other_sessions_recommendation_title_unverified"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/otherSessionsNotFoundLayout"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="72dp"
|
||||||
|
android:layout_marginTop="32dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/otherSessionsSecurityRecommendationView">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/otherSessionsNotFoundTextView"
|
||||||
|
style="@style/TextAppearance.Vector.Body"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
tools:text="@string/device_manager_other_sessions_no_verified_sessions_found" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/otherSessionsClearFilterButton"
|
||||||
|
style="@style/Widget.Vector.Button.Text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:gravity="start"
|
||||||
|
android:padding="0dp"
|
||||||
|
android:text="@string/device_manager_other_sessions_clear_filter" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<im.vector.app.features.settings.devices.v2.list.OtherSessionsView
|
<im.vector.app.features.settings.devices.v2.list.OtherSessionsView
|
||||||
android:id="@+id/deviceListOtherSessions"
|
android:id="@+id/deviceListOtherSessions"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
|
Loading…
Reference in New Issue