- Guard against OutOfBoundsExceptions by checking for
RecyclerView.NO_POSITION before attempting to retrieve model IDs in
various places.
- Fix a spot where the default return value of
SparseIntArray.get (i.e. 0) was causing item 0 to incorrectly get
selected.
BUGS=26249027,26309874
Change-Id: I08d2e8c90bdd40a4738bdcf357de31e8fe6ddecf
- Create a new layout for directory items, which have a different
layout (no thumbnail, size or mod_date).
- Add drop shadows.
Also refactor a few things in the DocumentHolder and child classes to
make things more efficient and cleaner.
BUG=24326989,26229570
Change-Id: I05df52b071667190d4c4c671f50d25498383cdaa
Primary goals of this refactor are to reduce DirectoryFragment bloat,
and to simplify the code (especially the binding code) for the different
layouts.
- Decouple DocumentHolder from DirectoryFragment.
- Move it into its own file.
- Move binding code from DirectoryFragment into DocumentHolder.
- Split DocumentHolder implementation into three separate subclasses,
for grid items, list items, and dividers.
BUG=24326989
Change-Id: I217bf4e5b8e1b33173b8b0275591a8c5d8e9161c
Change the sort code in the Model to bucket items into two separate
categories (folders and documents) and then sort the two buckets
separately.
Add code to the adapter to insert a visual break in the UI, between
folders and documents.
Change-Id: I759fedcef829aba9ad61554326489a9e62641cc7
* changes:
Wrap up the stable ID refactor.
Re-enable sorting in the DirectoryFragment.
Fix file deletion after the move to Model IDs.
Transition selection to use Model IDs.
Switch DirectoryFragment code to use model IDs.
- Rationalize band selection: make it internally a range selection
operation, that translates positions to IDs only when updating the
Selection.
- Clean up TODOs and comments.
- Fix selection adjustment when things are removed from the view.
Change-Id: If917eb9dd18e755c5a0ce83c84409902c4ef3d2e
- Move sorting from the back-end (using SortingCursorWrapper) to the the
front-end (in DocumentsAdapter). This makes it such that re-sorting
the directory contents doesn't necessitate a reload.
- Update DirectoryLoaders to just return unsorted results, and rely on
the UI to sort them.
- Remove the (now-unused) SortingCursorWrapper.
- Update Model tests to test sorting.
BUG=26024369
Change-Id: I871cc0e496267d381ae546e0309125d04649415a
- Add methods to the DocumentsAdatper to hide and unhide files. This
removes that burden from the Model.
- Remove clunky markForDeletion/finalizeDeletion and all related code
from the Model. Replace with a straight-up delete method.
- Modify deletion code in the DirectoryFragment. Deletion now looks
like:
- user presses delete
- DocumentsAdapter hides the deleted files
- If the user presses cancel, the DocumentsAdapter unhides the files.
- If the user doesn't cancel, Model.delete is called to delete the
files.
- Fix deletion-related Model tests.
BUG=26024369
Change-Id: I02e2131c1aff1ebcd0bdb93d374675fd157d7f51
This CL transitions the MultiSelectManager to (mostly) use Model IDs.
- Add the ability to retrieve all model IDs for the current directory,
from the model.
- Add a map in the DocumentsAdapter that maps from adapter position to
model ID.
- Make the adapter listen for model updates, and update its internal map
of positions to model IDs appropriately.
- Use the aforementioned map when binding ViewHolders.
- Get unit tests to compile; get as many tests passing as possible at
this point. Tests related to deleting things won't work right now.
Still to do:
- Add code to the adapter to sort and group items. After this is done,
SortingCursorWrapper will no longer be needed.
- Add code to the adapter to deal with item addition/removal. After
this is done, the pending-deletion code in the model can be removed.
- Rationalize position-based vs model-based selection. Some code in the
MSM (in particular, code dealing with range selection) is still
position-based. It's becoming clear that it doesn't make sense for
range selection to be ID-based, since "range" is a concept that only
makes sense in the context of items that are positioned in the UI.
Will need to iterate more on the position-based code to make sure it
makes sense.
BUG=26024369
Change-Id: I767cde2d888c101aaf83b59155b14634a236164b
A Model ID is a unique, stable identifier referring to a document.
The basic idea is to move away from doing everything using adapter
positions, and instead use model IDs.
This is the first in a line of CLs toward that goal. It does the
following:
- Introduce the concept of a Model ID, which is unique for each
document.
- Add a method to retrieve items from the Model using ID rather than
adapter position.
- Transition code in the DirectoryFragment to talk to the Model using
Model IDs rather than positions.
- Break the Model class out into a separate file of its own.
BUG=26024369
Change-Id: Ia5171f089d6b8a83855423ec05cf14dbfc7b6ba8
Don't update toolbar before first root load.
This was causing Recents > Home flicker due
to Recents being the default root returned from getCurrentRoot.
Revert change causing regression in selection highlight.
Bug: 26093756
Change-Id: I2c555aa38d68e9bf7962b1407f9fc75c800216a6
This CL simplified the logic by:
* Passing always DocumentInfo, instead Uri/DocumentInfo depending on method.
* Remove redundant logic by calling copy() recursively.
* Which also fixes efficient copy if only some of the files can be copied
efficiently.
Bug: 26176231
Change-Id: I4444077194d0bae3c149c9a012c325e068f946ed
Setting an item animator means the background color of the items needs
to be manually managed by the app code as well, otherwise recycled view
end up having the wrong background color.
BUG=26112851
Change-Id: If08f54eedf8da23abd4424159efa72f2f33def39
Also, add a label to Downloads app, and enabled drag and drop by default.
Cleanued up menu handling in BaseActivity (use switch statement).
Bug: 26033335
Change-Id: I3cef89a4a9f9e30b4e926411e94cf06bc2dc0f8d
Also, rename "ManagerRootActivity" to "DownloadsActivity"
since because...well, it is almost always Downloads
and is specialized for this case.
Bug: 25809806
Change-Id: I496d34393d269d2120c8e214413cb87df8bf171d