-
Notifications
You must be signed in to change notification settings - Fork 270
🐛 Fixed issue: laggy animation of MARQUEE ellipsize text. #293
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
base: master
Are you sure you want to change the base?
🐛 Fixed issue: laggy animation of MARQUEE ellipsize text. #293
Conversation
Updated RecyclerView so it's no longer re-creates all the view every update from JS Bridge. Used DiffUtil to calculate diff and make updates only for changed ones.
👷 Deploy request for mytonwallet-tma pending review.Visit the deploys page to approve it
|
👷 Deploy request for mtw-opensource pending review.Visit the deploys page to approve it
|
👷 Deploy request for mtw-giveaway pending review.Visit the deploys page to approve it
|
override fun isSame(comparing: WEquatable<*>): Boolean { | ||
return if (comparing is EarnItem && comparing::class == this::class) { | ||
comparing.timestamp == timestamp && comparing.amount == amount | ||
comparing.timestamp == timestamp && comparing.amount == amount && comparing.amountInBaseCurrency == amountInBaseCurrency |
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.
isSame
should compare identifiers (or similar unique properties) to check if two instances refer to the same item. Comparing amountInBaseCurrency
shouldn't be necessary here.
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.
Fixed
|
||
val diffResult = DiffUtil.calculateDiff(diffCallback) | ||
previousHistoryItems = newItems.toList() // Store copy for next comparison | ||
diffResult.dispatchUpdatesTo(rvAdapter) |
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.
How about using List<WEquatable<*>>.diff and WRecyclerViewAdapter.applyChanges? Did you try to use that instead? It should be ready-to-use and probably easier to apply to all the necessary screens.
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.
Yes, thanks, didn't notice that utils. Fixed
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 check my comments.
Updated RecyclerView so it's no longer re-creates all the view every update from JS Bridge. Used DiffUtil to calculate diff and make updates only for changed ones.
Alternative way to fix: The issue could be addressed at the ViewModel level first by reducing frequent state emissions, rather than introducing DiffUtil if that’s not the standard approach in the project.