-
Notifications
You must be signed in to change notification settings - Fork 731
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
Conversation
# 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
There was a problem hiding this 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 |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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?
There was a problem hiding this 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.
There was a problem hiding this 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?
@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). |
This is how breadcrumbs work now, I haven't changed behaviour of that. @daniellekirkwood what do you think?
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 |
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.
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 |
In this case, I guess we could try adding a call to |
Looking good. Just a few UI questions:
Otherwise, all is good. |
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" |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚠️ Attributeandroid:foreground
has no effect on API levels lower than 23 (current min is 21)⚠️ Attributeandroid:foreground
has no effect on API levels lower than 23 (current min is 21)
SonarCloud Quality Gate failed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Type of change
Content
The carousel with recent chats, based on Breadcrumbs API
Motivation and context
part of #6502
closes #6504
Screenshots / GIFs