Make the service operation agnostic, so we can also move delete operations to it.
In a followup change we'll see about adding support for multiple concurrent
operations. We'll need to evaluate how to do this in IntentService (which
serializes requests....a major limitation).
Change-Id: I03eca9c1ecaba519af42d88edffeb0dce78bd1da
To be compatible with ContentProvider, DocumentsProvider should not
require checking for a flag before calling openTypedAssetFile.
This CL removes the flag, and makes the default implementation throw
FileNotFoundException instead.
Bug: 26222645
Change-Id: I3492f05804e39583ebb8584109c7017b3082846e
We were bouncing calls out to the adapter pulled from RecyclerView,
but the adapter is easy to write a test double for and
we can readily inject the adapter when needed at runtime.
Eliminates unnecessary indirection.
Also, protect against failure when documents can't be loaded for delete.
Change-Id: Ief6585bf2e3e4fd407d801d485a9d7cd888b8500
This fixes:
- UI to show selection which was broken in ag/838866
- Delete undo, which throws IOB exception
when undoing a a full delete of all entries.
Change-Id: Idbb43510974e130d283313602a71ac15ad10aadf
Move section break support into a separate wrapper class.
Fix issue where intermediate directory updates were briefly showing hidden files.
Add a rudimentary test for ModelBackedDocumentsAdapter.
Bug: 26293561, 26383237, 26293561, 26309025
Change-Id: I1fa489b110754d8801091b2009caebe9d2278701
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
- 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