Make id for recyclerView less generic, and remove unused layout

This commit is contained in:
Benoit Marty 2020-11-04 10:36:15 +01:00 committed by Benoit Marty
parent 07c805a019
commit b09d45718a
28 changed files with 61 additions and 204 deletions

View File

@ -178,7 +178,7 @@ class UiAllScreensSanityTest {
navigateToRoomSettings()
// Long click on the message
onView(withId(R.id.recyclerView))
onView(withId(R.id.timelineRecyclerView))
.perform(
actionOnItem<RecyclerView.ViewHolder>(
hasDescendant(withText("Hello world!")),

View File

@ -30,12 +30,12 @@ class DebugSasEmojiActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.fragment_generic_recycler)
val controller = SasEmojiController()
recyclerView.configureWith(controller)
genericRecyclerView.configureWith(controller)
controller.setData(SasState(getAllVerificationEmojis()))
}
override fun onDestroy() {
recyclerView.cleanup()
genericRecyclerView.cleanup()
super.onDestroy()
}
}

View File

@ -55,7 +55,7 @@ class DiscoverySettingsFragment @Inject constructor(
sharedViewModel = activityViewModelProvider.get(DiscoverySharedViewModel::class.java)
controller.listener = this
recyclerView.configureWith(controller)
genericRecyclerView.configureWith(controller)
sharedViewModel.navigateEvent.observeEvent(this) {
when (it) {
@ -74,7 +74,7 @@ class DiscoverySettingsFragment @Inject constructor(
}
override fun onDestroyView() {
recyclerView.cleanup()
genericRecyclerView.cleanup()
controller.listener = null
super.onDestroyView()
}

View File

@ -508,7 +508,7 @@ class RoomDetailFragment @Inject constructor(
modelBuildListener = null
autoCompleter.clear()
debouncer.cancelAll()
recyclerView.cleanup()
timelineRecyclerView.cleanup()
super.onDestroyView()
}
@ -535,7 +535,7 @@ class RoomDetailFragment @Inject constructor(
jumpToBottomViewVisibilityManager = JumpToBottomViewVisibilityManager(
jumpToBottomView,
debouncer,
recyclerView,
timelineRecyclerView,
layoutManager
)
}
@ -558,7 +558,7 @@ class RoomDetailFragment @Inject constructor(
if (scrollPosition == null) {
scrollOnHighlightedEventCallback.scheduleScrollTo(action.eventId)
} else {
recyclerView.stopScroll()
timelineRecyclerView.stopScroll()
layoutManager.scrollToPosition(scrollPosition)
}
}
@ -969,14 +969,14 @@ class RoomDetailFragment @Inject constructor(
timelineEventController.callback = this
timelineEventController.timeline = roomDetailViewModel.timeline
recyclerView.trackItemsVisibilityChange()
timelineRecyclerView.trackItemsVisibilityChange()
layoutManager = LinearLayoutManager(context, RecyclerView.VERTICAL, true)
val stateRestorer = LayoutManagerStateRestorer(layoutManager).register()
scrollOnNewMessageCallback = ScrollOnNewMessageCallback(layoutManager, timelineEventController)
scrollOnHighlightedEventCallback = ScrollOnHighlightedEventCallback(recyclerView, layoutManager, timelineEventController)
recyclerView.layoutManager = layoutManager
recyclerView.itemAnimator = null
recyclerView.setHasFixedSize(true)
scrollOnHighlightedEventCallback = ScrollOnHighlightedEventCallback(timelineRecyclerView, layoutManager, timelineEventController)
timelineRecyclerView.layoutManager = layoutManager
timelineRecyclerView.itemAnimator = null
timelineRecyclerView.setHasFixedSize(true)
modelBuildListener = OnModelBuildFinishedListener {
it.dispatchTo(stateRestorer)
it.dispatchTo(scrollOnNewMessageCallback)
@ -985,7 +985,7 @@ class RoomDetailFragment @Inject constructor(
jumpToBottomViewVisibilityManager.maybeShowJumpToBottomViewVisibilityWithDelay()
}
timelineEventController.addModelBuildListener(modelBuildListener)
recyclerView.adapter = timelineEventController.adapter
timelineRecyclerView.adapter = timelineEventController.adapter
if (vectorPreferences.swipeToReplyIsEnabled()) {
val quickReplyHandler = object : RoomMessageTouchHelperCallback.QuickReplayHandler {
@ -1015,9 +1015,9 @@ class RoomDetailFragment @Inject constructor(
}
val swipeCallback = RoomMessageTouchHelperCallback(requireContext(), R.drawable.ic_reply, quickReplyHandler)
val touchHelper = ItemTouchHelper(swipeCallback)
touchHelper.attachToRecyclerView(recyclerView)
touchHelper.attachToRecyclerView(timelineRecyclerView)
}
recyclerView.addGlidePreloader(
timelineRecyclerView.addGlidePreloader(
epoxyController = timelineEventController,
requestManager = GlideApp.with(this),
preloader = glidePreloader { requestManager, epoxyModel: MessageImageVideoItem, _ ->

View File

@ -41,12 +41,12 @@ class EmojiSearchResultFragment @Inject constructor(
super.onViewCreated(view, savedInstanceState)
sharedViewModel = activityViewModelProvider.get(EmojiChooserViewModel::class.java)
epoxyController.listener = this
recyclerView.configureWith(epoxyController, showDivider = true)
genericRecyclerView.configureWith(epoxyController, showDivider = true)
}
override fun onDestroyView() {
epoxyController.listener = null
recyclerView.cleanup()
genericRecyclerView.cleanup()
super.onDestroyView()
}

View File

@ -56,7 +56,7 @@ class RoomBannedMemberListFragment @Inject constructor(
roomMemberListController.callback = this
setupToolbar(roomSettingsToolbar)
setupSearchView()
recyclerView.configureWith(roomMemberListController, hasFixedSize = true)
roomSettingsRecyclerView.configureWith(roomMemberListController, hasFixedSize = true)
viewModel.observeViewEvents {
when (it) {
@ -83,7 +83,7 @@ class RoomBannedMemberListFragment @Inject constructor(
}
override fun onDestroyView() {
recyclerView.cleanup()
roomSettingsRecyclerView.cleanup()
super.onDestroyView()
}

View File

@ -57,7 +57,7 @@ class RoomMemberListFragment @Inject constructor(
setupToolbar(roomSettingsToolbar)
setupSearchView()
setupInviteUsersButton()
recyclerView.configureWith(roomMemberListController, hasFixedSize = true)
roomSettingsRecyclerView.configureWith(roomMemberListController, hasFixedSize = true)
}
private fun setupInviteUsersButton() {
@ -65,7 +65,7 @@ class RoomMemberListFragment @Inject constructor(
navigator.openInviteUsersToRoom(requireContext(), roomProfileArgs.roomId)
}
// Hide FAB when list is scrolling
recyclerView.addOnScrollListener(
roomSettingsRecyclerView.addOnScrollListener(
object : RecyclerView.OnScrollListener() {
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
when (newState) {
@ -99,7 +99,7 @@ class RoomMemberListFragment @Inject constructor(
}
override fun onDestroyView() {
recyclerView.cleanup()
roomSettingsRecyclerView.cleanup()
super.onDestroyView()
}

View File

@ -72,7 +72,7 @@ class RoomSettingsFragment @Inject constructor(
super.onViewCreated(view, savedInstanceState)
controller.callback = this
setupToolbar(roomSettingsToolbar)
recyclerView.configureWith(controller, hasFixedSize = true)
roomSettingsRecyclerView.configureWith(controller, hasFixedSize = true)
waiting_view_status_text.setText(R.string.please_wait)
waiting_view_status_text.isVisible = true
@ -93,7 +93,8 @@ class RoomSettingsFragment @Inject constructor(
}
override fun onDestroyView() {
recyclerView.cleanup()
controller.callback = null
roomSettingsRecyclerView.cleanup()
super.onDestroyView()
}

View File

@ -68,12 +68,12 @@ class CrossSigningSettingsFragment @Inject constructor(
}
private fun setupRecyclerView() {
recyclerView.configureWith(controller, hasFixedSize = false, disableItemAnimation = true)
genericRecyclerView.configureWith(controller, hasFixedSize = false, disableItemAnimation = true)
controller.interactionListener = this
}
override fun onDestroyView() {
recyclerView.cleanup()
genericRecyclerView.cleanup()
controller.interactionListener = null
super.onDestroyView()
}

View File

@ -61,7 +61,7 @@ class VectorSettingsDevicesFragment @Inject constructor(
waiting_view_status_text.setText(R.string.please_wait)
waiting_view_status_text.isVisible = true
devicesController.callback = this
recyclerView.configureWith(devicesController, showDivider = true)
genericRecyclerView.configureWith(devicesController, showDivider = true)
viewModel.observeViewEvents {
when (it) {
is DevicesViewEvents.Loading -> showLoading(it.message)
@ -97,7 +97,7 @@ class VectorSettingsDevicesFragment @Inject constructor(
override fun onDestroyView() {
devicesController.callback = null
recyclerView.cleanup()
genericRecyclerView.cleanup()
super.onDestroyView()
}

View File

@ -57,13 +57,13 @@ class AccountDataFragment @Inject constructor(
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
recyclerView.configureWith(epoxyController, showDivider = true)
genericRecyclerView.configureWith(epoxyController, showDivider = true)
epoxyController.interactionListener = this
}
override fun onDestroyView() {
super.onDestroyView()
recyclerView.cleanup()
genericRecyclerView.cleanup()
epoxyController.interactionListener = null
}

View File

@ -50,13 +50,13 @@ class GossipingEventsPaperTrailFragment @Inject constructor(
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
recyclerView.configureWith(epoxyController, showDivider = true)
genericRecyclerView.configureWith(epoxyController, showDivider = true)
epoxyController.interactionListener = this
}
override fun onDestroyView() {
super.onDestroyView()
recyclerView.cleanup()
genericRecyclerView.cleanup()
epoxyController.interactionListener = null
}

View File

@ -45,11 +45,11 @@ class IncomingKeyRequestListFragment @Inject constructor(
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
recyclerView.configureWith(epoxyController, showDivider = true)
genericRecyclerView.configureWith(epoxyController, showDivider = true)
}
override fun onDestroyView() {
super.onDestroyView()
recyclerView.cleanup()
genericRecyclerView.cleanup()
}
}

View File

@ -41,13 +41,13 @@ class OutgoingKeyRequestListFragment @Inject constructor(
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
recyclerView.configureWith(epoxyController, showDivider = true)
genericRecyclerView.configureWith(epoxyController, showDivider = true)
// epoxyController.interactionListener = this
}
override fun onDestroyView() {
super.onDestroyView()
recyclerView.cleanup()
genericRecyclerView.cleanup()
// epoxyController.interactionListener = null
}
}

View File

@ -49,7 +49,7 @@ class VectorSettingsIgnoredUsersFragment @Inject constructor(
waiting_view_status_text.setText(R.string.please_wait)
waiting_view_status_text.isVisible = true
ignoredUsersController.callback = this
recyclerView.configureWith(ignoredUsersController)
genericRecyclerView.configureWith(ignoredUsersController)
viewModel.observeViewEvents {
when (it) {
is IgnoredUsersViewEvents.Loading -> showLoading(it.message)
@ -60,7 +60,7 @@ class VectorSettingsIgnoredUsersFragment @Inject constructor(
override fun onDestroyView() {
ignoredUsersController.callback = null
recyclerView.cleanup()
genericRecyclerView.cleanup()
super.onDestroyView()
}

View File

@ -59,11 +59,11 @@ class PushGatewaysFragment @Inject constructor(
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
recyclerView.configureWith(epoxyController, showDivider = true)
genericRecyclerView.configureWith(epoxyController, showDivider = true)
}
override fun onDestroyView() {
recyclerView.cleanup()
genericRecyclerView.cleanup()
super.onDestroyView()
}

View File

@ -43,11 +43,11 @@ class PushRulesFragment @Inject constructor(
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
recyclerView.configureWith(epoxyController, showDivider = true)
genericRecyclerView.configureWith(epoxyController, showDivider = true)
}
override fun onDestroyView() {
recyclerView.cleanup()
genericRecyclerView.cleanup()
super.onDestroyView()
}

View File

@ -54,7 +54,7 @@ class ThreePidsSettingsFragment @Inject constructor(
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
recyclerView.configureWith(epoxyController)
genericRecyclerView.configureWith(epoxyController)
epoxyController.interactionListener = this
viewModel.observeViewEvents {
@ -73,7 +73,7 @@ class ThreePidsSettingsFragment @Inject constructor(
override fun onDestroyView() {
super.onDestroyView()
recyclerView.cleanup()
genericRecyclerView.cleanup()
epoxyController.interactionListener = null
}

View File

@ -70,12 +70,12 @@ class SoftLogoutFragment @Inject constructor(
}
private fun setupRecyclerView() {
recyclerView.configureWith(softLogoutController)
genericRecyclerView.configureWith(softLogoutController)
softLogoutController.listener = this
}
override fun onDestroyView() {
recyclerView.cleanup()
genericRecyclerView.cleanup()
softLogoutController.listener = null
super.onDestroyView()
}
@ -121,7 +121,7 @@ class SoftLogoutFragment @Inject constructor(
}
private fun cleanupUi() {
recyclerView.hideKeyboard()
genericRecyclerView.hideKeyboard()
}
override fun forgetPasswordClicked() {

View File

@ -82,7 +82,7 @@ class KnownUsersFragment @Inject constructor(
override fun onDestroyView() {
knownUsersController.callback = null
recyclerView.cleanup()
knownUsersRecyclerView.cleanup()
super.onDestroyView()
}
@ -124,7 +124,7 @@ class KnownUsersFragment @Inject constructor(
private fun setupRecyclerView() {
knownUsersController.callback = this
// Don't activate animation as we might have way to much item animation when filtering
recyclerView.configureWith(knownUsersController, disableItemAnimation = true)
knownUsersRecyclerView.configureWith(knownUsersController, disableItemAnimation = true)
}
private fun setupFilterView() {

View File

@ -28,7 +28,6 @@ import im.vector.app.core.extensions.hideKeyboard
import im.vector.app.core.extensions.setupAsSearch
import im.vector.app.core.extensions.showKeyboard
import im.vector.app.core.platform.VectorBaseFragment
import kotlinx.android.synthetic.main.fragment_create_direct_room_directory_users.recyclerView
import kotlinx.android.synthetic.main.fragment_user_directory.*
import org.matrix.android.sdk.api.session.user.model.User
import javax.inject.Inject
@ -51,14 +50,14 @@ class UserDirectoryFragment @Inject constructor(
}
override fun onDestroyView() {
recyclerView.cleanup()
userDirectoryRecyclerView.cleanup()
directRoomController.callback = null
super.onDestroyView()
}
private fun setupRecyclerView() {
directRoomController.callback = this
recyclerView.configureWith(directRoomController)
userDirectoryRecyclerView.configureWith(directRoomController)
}
private fun setupSearchByMatrixIdView() {

View File

@ -1,143 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.Toolbar
android:id="@+id/createDirectRoomToolbar"
style="@style/VectorToolbarStyle"
android:layout_width="0dp"
android:layout_height="?actionBarSize"
android:elevation="4dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/createDirectRoomClose"
android:layout_width="@dimen/layout_touch_size"
android:layout_height="@dimen/layout_touch_size"
android:clickable="true"
android:focusable="true"
android:foreground="?attr/selectableItemBackground"
android:scaleType="center"
android:src="@drawable/ic_x_18dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/createDirectRoomTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/fab_menu_create_chat"
android:textColor="?riotx_text_primary"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/createDirectRoomClose"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.appcompat.widget.Toolbar>
<im.vector.app.core.platform.MaxHeightScrollView
android:id="@+id/chipGroupScrollView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/layout_horizontal_margin"
android:layout_marginTop="8dp"
android:layout_marginEnd="@dimen/layout_horizontal_margin"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/createDirectRoomToolbar"
app:maxHeight="64dp">
<com.google.android.material.chip.ChipGroup
android:id="@+id/chipGroup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:lineSpacing="2dp" />
</im.vector.app.core.platform.MaxHeightScrollView>
<EditText
android:id="@+id/createDirectRoomFilter"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/layout_horizontal_margin"
android:layout_marginEnd="@dimen/layout_horizontal_margin"
android:background="@null"
android:drawablePadding="8dp"
android:gravity="center_vertical"
android:hint="@string/direct_room_filter_hint"
android:importantForAutofill="no"
android:inputType="text"
android:maxHeight="80dp"
android:paddingTop="16dp"
android:paddingBottom="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/chipGroupScrollView" />
<View
android:id="@+id/createDirectRoomFilterDivider"
android:layout_width="0dp"
android:layout_height="1dp"
android:background="?attr/vctr_list_divider_color"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/createDirectRoomFilter" />
<com.google.android.material.button.MaterialButton
android:id="@+id/addByMatrixId"
style="@style/VectorButtonStyleText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:minHeight="@dimen/layout_touch_size"
android:text="@string/add_by_matrix_id"
android:visibility="visible"
app:icon="@drawable/ic_plus_circle"
app:iconPadding="13dp"
app:iconTint="@color/riotx_accent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/createDirectRoomFilterDivider" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="0dp"
android:layout_height="0dp"
android:fastScrollEnabled="true"
android:overScrollMode="always"
android:scrollbars="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/addByMatrixId"
tools:listitem="@layout/item_create_direct_room_user" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -90,7 +90,7 @@
app:layout_constraintTop_toBottomOf="@+id/createDirectRoomSearchByIdContainer" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:id="@+id/createDirectRoomRecyclerView"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="16dp"

View File

@ -7,7 +7,7 @@
android:background="?riotx_background">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:id="@+id/genericRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:itemSpacing="1dp"

View File

@ -156,7 +156,7 @@
app:layout_constraintTop_toBottomOf="@id/addByMatrixId" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:id="@+id/knownUsersRecyclerView"
android:layout_width="0dp"
android:layout_height="0dp"
android:fastScrollEnabled="true"

View File

@ -82,7 +82,7 @@
</androidx.appcompat.widget.Toolbar>
<androidx.constraintlayout.widget.Barrier
android:id="@+id/recyclerViewBarrier"
android:id="@+id/timelineRecyclerViewBarrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="top"
@ -113,11 +113,11 @@
tools:visibility="visible" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:id="@+id/timelineRecyclerView"
android:layout_width="0dp"
android:layout_height="0dp"
android:overScrollMode="always"
app:layout_constraintBottom_toTopOf="@+id/recyclerViewBarrier"
app:layout_constraintBottom_toTopOf="@+id/timelineRecyclerViewBarrier"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/activeConferenceView"

View File

@ -62,7 +62,7 @@
app:layout_constraintTop_toBottomOf="@+id/roomSettingsToolbar">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:id="@+id/roomSettingsRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="always"

View File

@ -90,7 +90,7 @@
app:layout_constraintTop_toBottomOf="@+id/userDirectorySearchByIdContainer" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:id="@+id/userDirectoryRecyclerView"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="16dp"