Clarifying and stabilizing drag & drop
The existing Shelf DND crashes if profile or app removal happens while dragging from outside of shelf. This is because in this case shelf temporary adds a null placeholder enter to the model, and doesn’t check for nulls in user-removed and app-removed callbacks. Adding checking for nulls. In addition, since adding nulls muds the contract between the shelf view and its model, I’m getting rid of adding null entries to the model. Nulls are used on the view side, but never leak to the model. Because of that, the state of the view (which may have nulls) and the mode may not match each other during the drag, I introduce storing app data in views, as a tag. Null tag means a drag placeholder. Now that the state of the model doesn’t always follow the state of the shelf via add/remove operations, it makes sense to introduce set-all/get-all calls in the model, instead of add/remove/get(i) calls. Again, all these changes, even though relatively massive, add clarity into the view/model contract by eliminating strange states where the model can have nulls in certain positions. Also fixing a case when removing an app while dragging it happily creates an icon. Bug: 20024603 Change-Id: Ie4e617ccf9278708d64ee100265a4858d1227aed
Loading
Please register or sign in to comment