- 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
Minimally deform CopyService such that we can listen
to the completion of operations in the test.
Add test coverage.
Add equals and hashcode to DocumentInfo...so we can compare
the heck out of 'em. + a test.
WIP: Expose (@hide style) DocumentsProvider.isChildDocument via
DocumentsContract. Use that to check for recusive copies.
Bug: 25794511
Change-Id: I05bb329eb10b43540c6806d634e5b96a753e8178
Update FilesActivityUiTests to verify Home is present
and that clicking a root sets the title accordingly.
Guard addition of WRITABLE flag with a volume test.
Bug: 25147243
Change-Id: Ic20372737cae08a82af0aade0c0dbbd8c22d5f34
Add a "UiBot" class for driving the UI from tests.
Add a "DocumentsProviderHelper" class for convenient test doc setup.
Update FilesActivityUiTest to use "TargetContext" which is
necessary in order to perform ContentProvider
operations.
Fix a bug where CopyTest relied on implicit order of roots.
Don't include guava in tests...since it breaks functional tests (incompatible class def).
Add test coverage for:
- basic roots list.
- basic files list.
- Live updates to files list.
- basic delete operations.
Bug: 24988170
Change-Id: I2ec01a5e1a474314cb33efb6e92df0f61dfcc1da
NOTE: This is currently broken at the point I try to init files in the stub roots.
Adds a bare bones test provider with dummy data.
This is basically just the bones of a test at this point.
Has just one simple test...switch list/grid modes.
Will add more tests (like manipulating the dummy data) in future CLs.
Bug: 24988170
Change-Id: Icc25718a416bc804874835c74a6d7862a52c9861
Also, apply delete in reverse order to placate RecyclerView.
TODO: Refactor this whole stack...needs some love.
Bug: 25091323, 24749296
Change-Id: I84e21c16423048bd50cd988eb1e2a36dc62b9d16
DirectoryFragment now uses an independent gesture detector.
Move early event-handling logic out of listener into the handler class.
Change-Id: Ie8a01b1507c8a8aa74355ead38feb7b802029540
- Move the key listener from BaseActivity into DirectoryFragment, where it
belongs.
- Add code to detect the shift key during keyboard navigation, and
extend the selection in that case.
BUG=20859059
Change-Id: Ia7d3c7d4343f0185873deeaf1a35028a716b6e19
- Move all unit tests to be run under the android framework.
- Add a unit test for ag/776629
- Make DirectoryFragment.Model tests properly simulate finalization conditions.
Change-Id: Ie33d097154d464149fd8c0c24bf66ada677db4ad
EXTRA_STACK support was already in place (from CopyService).
Add "isRootUri" to DocumentsContract.
Bug: 24410611
Change-Id: Ia380030216323d1272ef247280582e4b55b83c42
- Add a material-style horizontal progress bar to DocumentsUI. This
replaces the old loading footer.
- Restore the view-switching code that displayed a dedicated "empty"
view when displaying an empty directory.
- Fix tests.
Change-Id: Ifecb867f6edecbdeb37b8607d87d9797879a589d
- Rework unit tests to eliminate some null checks from production code.
- Fix some flakiness in the tests resulting from a coupling between
DirectoryFragment.Model and the application View.
Change-Id: I6b23774a5b4897f33d8641e677bda9e66d86cb96
Masks an issue in band controller resulting in index out of bounds exceptions.
Eliminate the need to cast helper when constructing BandController.
Improve naming of Band related classes for clarity of purpose.
Normalize some "helper" class method names.
Rename BandSelectModelTest to match existing convention for tests on inner classes.
Bug: 23905473
Change-Id: Iaf7604fb729cf563a04dc92d78b24e2fe4812abe
Fix band selection to not start when crossing off of a grid item into empty space.
This CL also introduces a MotionEvent wrapper class, since MotionEvent
can't be used in tests.
Note that this CL works around several issues with b/23793622.
Bug: 23727363
Change-Id: I010a82db3363d99f2d804db2653a3a25d8cac940
This consists of:
1) Moving both BandSelect* classes into MultiSelectManager as nested
classes. This removes extra layers of indirection and makes code easier
to comprehend.
2) Fixing an issue where band selection could start within an item
instead of only within margins between items.
3) Adding "provisional selection" support to the Selection class. This
gives band select the ability to select some items "temporarily" such
that when the band select no longer covers those items, they are
deselected.
4) Adding glue code between the classes.
Bug: 23081429, 23083146, 20669231
Change-Id: I0dc57e2c0d2ccedb3e1218f0e496de637be227a2
Normalize use of Annotations like VisibleForTesting, Nullable and so on.
Also, fix a small issue where we were not doubling the marging on cells when calculating columns for grid view.
Change-Id: Ia02f683c2682fa8d0963d13f253a359911d27965
This is required for some of the intent invoked modes when the
"ALLOW_MULTI_SELECT" extra is not present.
Bug: 23155138
Change-Id: Ib92512c7f1c8e906ecca98d69ff727fc865fd53e
Double clicking an item opens it.
BandSelectManager tells MultiSelectManager where its selection begins
so Shift+Click behavior can be complimentary.
BandSelectManager more actively manages selection...so it doesn't
clear existing selection on mouse down.
Change-Id: Ibe65e793e84463d333a19f363dfb0d42c37480e3
Add MultiSelectMaanger class to manager selection on a RecyclerView instance.
There are several outstanding issues that still need to be addressed
surrounding Grid mode as the GridLayout manager doesn't support
automatic column count calculation.
Also, we're missing the puddle effect on touch...
And probably other stuff. But it all *mostly* works.
Oh, also. Footers are currently commented out.
Add traditional unit tests for MultiSelectManager.
BUG: 22225617
Change-Id: I3cd26a10683f42053556d463a5d2f0d2a0bbde84
- Add DocumentsContract.EXTRA_EXCLUDE_SELF (boolean extra)
- Add code to DocumentsActivity to cache the providers of the calling
app if EXTRA_EXCLUDE_SELF is set on incoming Intents.
- Add code to RootsCache to exclude roots from the calling app.
- Add code to allow only system apps to use EXTRA_PACKAGE_NAME.
Change-Id: Ia7cc2a1a297676c7b26f6e583042a4607d8c9a4e
Add a menu item (protected behind a system property) for moving files.
Add an extra to the copy intent for transfer mode (copy/move).
Add code to CopyService to delete files after copy when in move mode.
Add tests.
BUG=20559838
Change-Id: I983f57a528327d1e7a12982b599094aad2c856ed
Send copy errors to the destination provider.
Big overhaul of tests to make them simpler.
Test that errors during copying are detected and partial copies are
cleaned up.
Test that copying empty directories works properly.
Change-Id: I3fe0e73bdc92c2b6f522857ca5631f6d03d5a666
(cherry picked from commit dae8c378d6c680ae9efa8e1202d9bc92fb0dfb11)
Send copy errors to the destination provider.
Big overhaul of tests to make them simpler.
Test that errors during copying are detected and partial copies are
cleaned up.
Test that copying empty directories works properly.
Change-Id: I3fe0e73bdc92c2b6f522857ca5631f6d03d5a666