[PR #1447] [MERGED] Workaround for off-screen draw bug in XF4.5+ #2896

Closed
opened 2025-11-26 23:25:37 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/1447
Author: @mpbw2
Created: 6/30/2021
Status: Merged
Merged: 6/30/2021
Merged by: @mpbw2

Base: masterHead: workaround-draw-collections


📝 Commits (2)

  • d4606c5 workaround for off-screen draw bug in xf4.5+
  • 7e41a78 check cols even if orgId is present

📊 Changes

3 files changed (+29 additions, -3 deletions)

View changed files

📝 src/App/Pages/Vault/AddEditPage.xaml (+4 -1)
📝 src/App/Pages/Vault/AddEditPage.xaml.cs (+2 -0)
📝 src/App/Pages/Vault/AddEditPageViewModel.cs (+23 -2)

📄 Description

An issue where a BindableLayout that is modified off-screen isn't re-drawn to reflect the modification (Xamarin Forms 4.5+) broke the way we render organization & collection selection when adding new vault items. This PR works around that in an interesting way.

  • HasCollections is set to true in order to make the layout visible before modifying the content
  • After Collections is updated with the new content, it is set to a new instance of ExtendedObservableCollection containing the values already established in ResetWithRange (which must still occur or this has no effect)
  • Upon scrolling the screen, the collections RepeaterView.ItemsSource is repeatedly set to Collections (limited by a timer to prevent scroll events from max'ing out the thread pool)

Things to consider:

  • All of these seemingly useless steps are required to force collections to draw like they did before we updated to Forms 5.x. A lot of whittling took place to narrow this down.
  • Android exhibits this bug far more consistently than iOS, but I didn't restrict the workaround since I witnessed it happen a few times in iOS.
  • When the owner is changed to an organization and you begin to scroll, you may experience an initial lag in the scroll action as the workaround does its "magic".

Note to my future self: Please for the love of ham, revert this when that bug is fixed


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/bitwarden/android/pull/1447 **Author:** [@mpbw2](https://github.com/mpbw2) **Created:** 6/30/2021 **Status:** ✅ Merged **Merged:** 6/30/2021 **Merged by:** [@mpbw2](https://github.com/mpbw2) **Base:** `master` ← **Head:** `workaround-draw-collections` --- ### 📝 Commits (2) - [`d4606c5`](https://github.com/bitwarden/android/commit/d4606c58ce47338effa8c95a6501e3e81c3c3c32) workaround for off-screen draw bug in xf4.5+ - [`7e41a78`](https://github.com/bitwarden/android/commit/7e41a781e4e4ee44c012b16ffb17f06be4c6b91f) check cols even if orgId is present ### 📊 Changes **3 files changed** (+29 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/App/Pages/Vault/AddEditPage.xaml` (+4 -1) 📝 `src/App/Pages/Vault/AddEditPage.xaml.cs` (+2 -0) 📝 `src/App/Pages/Vault/AddEditPageViewModel.cs` (+23 -2) </details> ### 📄 Description An issue where a BindableLayout that is modified off-screen isn't re-drawn to reflect the modification (Xamarin Forms 4.5+) broke the way we render organization & collection selection when adding new vault items. This PR works around that in an _interesting_ way. - `HasCollections` is set to `true` in order to make the layout visible before modifying the content - After `Collections` is updated with the new content, it is set to a new instance of `ExtendedObservableCollection` containing the values already established in `ResetWithRange` (which must still occur or this has no effect) - Upon scrolling the screen, the collections `RepeaterView.ItemsSource` is repeatedly set to `Collections` (limited by a timer to prevent scroll events from max'ing out the thread pool) Things to consider: - All of these seemingly useless steps are required to force collections to draw like they did before we updated to Forms 5.x. A lot of whittling took place to narrow this down. - Android exhibits this bug far more consistently than iOS, but I didn't restrict the workaround since I witnessed it happen a few times in iOS. - When the owner is changed to an organization and you begin to scroll, you may experience an initial lag in the scroll action as the workaround does its "magic". Note to my future self: Please for the love of ham, revert this when that bug is fixed --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-26 23:25:37 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#2896