Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recents carousel for new home screen layout #6707

Merged
merged 10 commits into from
Aug 9, 2022

Conversation

fedrunov
Copy link
Contributor

@fedrunov fedrunov commented Aug 1, 2022

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

The carousel with recent chats, based on Breadcrumbs API

Motivation and context

part of #6502
closes #6504

Screenshots / GIFs

Light Dark Black
light dark black

output-optimised

@fedrunov fedrunov requested review from ericdecanini and a team and removed request for a team August 1, 2022 11:31
# Conflicts:
#	vector/build.gradle
#	vector/src/main/java/im/vector/app/features/home/HomeDetailFragment.kt
#	vector/src/main/java/im/vector/app/features/home/room/list/home/HomeRoomListFragment.kt
#	vector/src/main/java/im/vector/app/features/home/room/list/home/HomeRoomListViewModel.kt
#	vector/src/main/java/im/vector/app/features/home/room/list/home/HomeRoomSection.kt
@fedrunov fedrunov requested review from a team, mnaturel and ericdecanini and removed request for a team and ericdecanini August 2, 2022 08:50
Copy link
Contributor

@ericdecanini ericdecanini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation looks good. Please just revert the VectorFeature

@@ -53,5 +53,5 @@ class DefaultVectorFeatures : VectorFeatures {
override fun isScreenSharingEnabled(): Boolean = true
override fun forceUsageOfOpusEncoder(): Boolean = false
override fun shouldStartDmOnFirstMessage(): Boolean = false
override fun isNewAppLayoutEnabled(): Boolean = false
override fun isNewAppLayoutEnabled(): Boolean = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep this false by default

@@ -140,6 +144,11 @@ class VectorApplication :
Mavericks.initialize(debugMode = false)
EpoxyController.defaultDiffingHandler = EpoxyAsyncUtil.getAsyncBackgroundHandler()
EpoxyController.defaultModelBuildingHandler = EpoxyAsyncUtil.getAsyncBackgroundHandler()
Carousel.setDefaultGlobalSnapHelperFactory(object : Carousel.SnapHelperFactory() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should extract this into a dedicated private method (e.g. initDefaultSnapHelper) to reduce the size of the onCreate method and ease the readability.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've moved it to configureEpoxy method along with other epoxy related things

@@ -180,6 +183,14 @@ class HomeRoomListFragment @Inject constructor(
}
}.adapter
}
is HomeRoomSection.RecentRoomsData -> RecentRoomCarouselController(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see RecentRoomCarouselController is injectable. I think we should inject this controller in this fragment instead of AvatarRenderer.

is HomeRoomSection.RecentRoomsData -> RecentRoomCarouselController(
avatarRenderer = avatarRenderer
).also { controller ->
controller.listener = this
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any clean up of RecyclerViews in onDestroyView() of the fragment. Could we override it and clean the adapters associated to the lists (there is a RecyclerView.cleanUp() extension) + removing the listener from the controllers as we are passing the Fragment instance here.

id("recents_carousel")
withModelsFrom(data) { originalRoomSummary ->

var roomSummary = originalRoomSummary
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this variable is not necessary. And if it is, it should be a val I guess.

}
}

inline fun <T> CarouselModelBuilder.withModelsFrom(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we declare it as private as it is only used in this controller?

Copy link
Contributor

@mnaturel mnaturel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested. LGTM. I have just added some comments to improve code.

Copy link
Contributor

@mnaturel mnaturel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates! I have tested the app again but when enabling the new app layout, I don't see the carousel of recent rooms like before. Do I need to do something else? Also, since we no more have the left side menu in this new layout, I cannot find the hidden developer menu to access feature flags for example. Where can I find it when I am logged in?

@fedrunov
Copy link
Contributor Author

fedrunov commented Aug 5, 2022

@mnaturel I blindly assumed that merging few PRs from dev won't break anything, while actually they broke whole thing. I've fixed problem in a separate pr and also update some margins for recents.

@mnaturel
Copy link
Contributor

mnaturel commented Aug 5, 2022

@mnaturel I blindly assumed that merging few PRs from dev won't break anything, while actually they broke whole thing. I've fixed problem in a separate pr and also update some margins for recents.

Thanks for the update. Now it works but I have a UX question: when I enter a room by pressing one of the item of the recent chats list and pressing back to come back home, it changes the ordering of the recent chats. I would expect to only change when posting messages on it. Was it done on purpose? And if the order changes would be possible to reload the position of the list at the start? Or maybe we could simply load the recent chat once when entering the home (not observing them).

@fedrunov
Copy link
Contributor Author

fedrunov commented Aug 8, 2022

I would expect to only change when posting messages on it.

This is how breadcrumbs work now, I haven't changed behaviour of that. @daniellekirkwood what do you think?

And if the order changes would be possible to reload the position of the list at the start? Or maybe we could simply load the recent chat once when entering the home (not observing them).

I think this is only an issue when you have you list scrolled to the left (first item) and so when something moves to first position you expect list to stay at same position (0) not at same item (position = 1 after change). Do you know a way how to implement this? I know that we can react on inserting/changing item, but we'd also need to check scroll position (or first completely visible item position) before that, to not scroll when it's not necessary

@daniellekirkwood
Copy link
Contributor

daniellekirkwood commented Aug 8, 2022

when I enter a room by pressing one of the item of the recent chats list and pressing back to come back home, it changes the ordering of the recent chats. I would expect to only change when posting messages on it. Was it done on purpose?

Yes! This is how it's supposed to work - its the same on all the platforms. Recents act as Breadcrumbs so users can quickly jump in and out of the chats that they find most interesting.

And if the order changes would be possible to reload the position of the list at the start? Or maybe we could simply load the recent chat once when entering the home (not observing them).

It would make sense for the list to start at 0 again when hitting the home screen but happy to mark that as a "nice-to-have" for launch if we think it will take too much time to implement @fedrunov

@mnaturel
Copy link
Contributor

mnaturel commented Aug 8, 2022

In this case, I guess we could try adding a call to RecyclerView.scrollToPosition(0) when arriving on the home screen?

@amshakal
Copy link

amshakal commented Aug 8, 2022

Looking good. Just a few UI questions:

  1. What font size are we using to display room names in recents? It seems way too big
  2. When filters are deactivated and recents are activated, is it possible to have a line between them? It might imprive the hierarchy. Attaching image for reference.

Screenshot 2022-08-08 at 1 09 18 pm

Otherwise, all is good.

@fedrunov
Copy link
Contributor Author

fedrunov commented Aug 8, 2022

In this case, I guess we could try adding a call to RecyclerView.scrollToPosition(0) when arriving on the home screen?

this will reset your scroll every time you go back, this could be very annoying. I've filed a separate issue for this, let's unblock this PR and move discussion there: #6776

android:id="@+id/recentRoot"
android:layout_width="60dp"
android:layout_height="wrap_content"
android:background="?android:colorBackground"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ⚠️ Possible overdraw: Root element paints background ?android:colorBackground with a theme that also paints a background (inferred theme is @style/Theme.Vector.Light)
  • ⚠️ Possible overdraw: Root element paints background ?android:colorBackground with a theme that also paints a background (inferred theme is @style/Theme.Vector.Light)

android:background="?android:colorBackground"
android:clickable="true"
android:focusable="true"
android:foreground="?attr/selectableItemBackground"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ⚠️ Attribute android:foreground has no effect on API levels lower than 23 (current min is 21)
  • ⚠️ Attribute android:foreground has no effect on API levels lower than 23 (current min is 21)

@sonarcloud
Copy link

sonarcloud bot commented Aug 8, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

Copy link
Contributor

@ericdecanini ericdecanini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fedrunov fedrunov merged commit 6045eac into develop Aug 9, 2022
@fedrunov fedrunov deleted the feature/nfe/edit_layout_recents_list branch August 9, 2022 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

App Layout: Recent chats list
6 participants