868 Commits

Author SHA1 Message Date
Ben Kwa
2f6553f0f0 Merge "Fix various band select instabilities." 2015-12-23 01:11:33 +00:00
Ben Kwa
a108e7e426 Merge "Update grid items to look more like the mocks." 2015-12-23 01:11:12 +00:00
Ben Kwa
20887030e8 Fix various band select instabilities.
- 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
2015-12-22 15:27:14 -08:00
Ben Kwa
f8a51f6fcb Update grid items to look more like the mocks.
- 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
2015-12-22 14:40:21 -08:00
Aga Wronska
43551a2a2f Merge "Pressing back button clears search" 2015-12-22 22:08:08 +00:00
Aga Wronska
43f20493d0 Pressing back button clears search
Bug:26143308
Change-Id: Iaa02d39a6ee1fd1a0c7d4d07453a481af97c7664
2015-12-22 13:24:52 -08:00
Ben Kwa
c1f9e7c487 Merge "Refactor DocumentHolder." 2015-12-21 23:35:39 +00:00
Ben Kwa
d839149843 Refactor DocumentHolder.
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
2015-12-21 15:31:15 -08:00
Ben Kwa
af55a15196 Merge "Implement bucketed sorting in DocumentsUI." 2015-12-18 23:06:13 +00:00
Ben Kwa
c72a2cb899 Implement bucketed sorting in DocumentsUI.
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
2015-12-18 15:04:26 -08:00
Tomasz Mikolajewski
c7ec678d7c Cleanup StubProvider a little.
Change-Id: I1d9f1c978850f466ff204bff97a152ba7919a096
2015-12-18 11:29:48 +09:00
Steve McKay
c75fa4a5bc Merge "Eliminate dialog mode from DocumentsUI." 2015-12-17 18:29:08 +00:00
Steve McKay
a8f03a2d81 Eliminate dialog mode from DocumentsUI.
DocumentsActivity to Use standard drawer layout at all display resolutions.

Bug: 26208032
Change-Id: I3b93c81bf97045744074a299e92cdea4aae7628d
2015-12-17 09:44:57 -08:00
Tomasz Mikolajewski
f65fdebddb Add tests for copying virtual typed files.
Bug: 26147488
Change-Id: I44cfae518f4b6dfceed5b9f50b132e2acf161b3f
2015-12-17 17:02:42 +09:00
Tomasz Mikolajewski
cca31ebb0e Add support to virtual and typed files in StubProvider.
Bug: 26147488
Change-Id: I40a75547ff16bb7d45f36843c29692268b4291b6
2015-12-17 15:06:29 +09:00
Tomasz Mikolajewski
5fc0240bf5 Append a correct extension in case of copying virtual files.
Bug: 26147488
Change-Id: I3e310c102e7c819ea16b47dfe7902d389cfc9d00
2015-12-17 11:27:24 +09:00
Tomasz Mikolajewski
bf0bbc8742 Merge "Fix CopyService after recent refactoring." 2015-12-17 02:04:22 +00:00
Tomasz Mikolajewski
f03ba80ebf Fix CopyService after recent refactoring.
My recent CL broke tests badly. This time double checked.

Bug: 26218041
Bug: 26176231
Change-Id: Ia1f68d7cff83ec9c3cfb9bccb9c91ff092b25ced
2015-12-17 11:03:10 +09:00
Ben Kwa
79aa087811 Merge changes from topic 'directoryfragment-stable-ids'
* 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.
2015-12-16 22:53:13 +00:00
Ben Kwa
fcb54d8be7 Wrap up the stable ID refactor.
- 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
2015-12-16 14:04:24 -08:00
Ben Kwa
862b9641e3 Re-enable sorting in the DirectoryFragment.
- 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
2015-12-16 13:54:01 -08:00
Geoff Mendal
73b9db9fef Import translations. DO NOT MERGE
Change-Id: I35c5aad9721b849884eff1945406f0ad7af6b0a6
Auto-generated-cl: translation import
2015-12-16 05:28:12 -08:00
Tomasz Mikolajewski
3def94866e Merge "Add support for copying virtual files in DocumentsUI." 2015-12-15 05:06:45 +00:00
Tomasz Mikolajewski
470a3dbc5d Add support for copying virtual files in DocumentsUI.
Bug: 26147488
Change-Id: I09cf010de7267fbdba6e3fcd0f300b0ecce19d10
2015-12-15 11:21:04 +09:00
Tomasz Mikolajewski
970bf27531 Merge "Simplify CopyService in DocumentsUI." 2015-12-15 00:55:44 +00:00
Ben Kwa
db65cd5e48 Fix file deletion after the move to Model IDs.
- 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
2015-12-14 11:47:27 -08:00
Ben Kwa
743c7c2f0f Transition selection to use Model IDs.
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
2015-12-14 11:47:27 -08:00
Ben Kwa
003a999db6 Switch DirectoryFragment code to use model IDs.
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
2015-12-14 11:47:27 -08:00
Steve McKay
3ab0c4c43e Merge "Load Home directory by default." 2015-12-14 18:18:02 +00:00
Steve McKay
b67bfbf975 Load Home directory by default.
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
2015-12-14 18:17:16 +00:00
Tomasz Mikolajewski
29d1ddd4c0 Simplify CopyService in DocumentsUI.
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
2015-12-14 17:07:17 +09:00
Geoff Mendal
7b74e9635e Import translations. DO NOT MERGE
Change-Id: I705d74f3ded09c9279ffafcb82560ca2ddf70bdd
Auto-generated-cl: translation import
2015-12-11 18:30:44 -08:00
Ben Kwa
696f6da4a1 Merge "Fix selection highlights." 2015-12-10 17:21:55 +00:00
Ben Kwa
8903eb0d19 Fix selection highlights.
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
2015-12-09 14:48:59 -08:00
Geoff Mendal
7a0a29aa89 Import translations. DO NOT MERGE
Change-Id: Idad1f411e8a8e621ad7c1886ae8eaa03b0d3eb17
Auto-generated-cl: translation import
2015-12-09 05:19:19 -08:00
Steve McKay
402fa3bca8 Merge "Don't try to copy empty selection to clipboard." 2015-12-08 17:27:01 +00:00
Steve McKay
d28c5c3b7b Don't try to copy empty selection to clipboard.
Bug: 25374244
Change-Id: Ia33d3fda909dc59f65adcc20839563a9f5885047
2015-12-08 17:26:25 +00:00
Geoff Mendal
512c15b8bd Import translations. DO NOT MERGE
Change-Id: If997fb074dbecdcf11d89cb44046be3abf617203
Auto-generated-cl: translation import
2015-12-07 05:17:15 -08:00
Tomasz Mikolajewski
39acff5a36 Wire support for archives to DocumentsUI.
Bug: 20176812
Change-Id: I8220afa2f53b07aa842bf6ac24fcc62afd4e2617
2015-12-07 11:34:03 +09:00
Steve McKay
5a24749237 Merge "Fix broken copy after recent copy related chagnes." 2015-12-04 22:29:43 +00:00
Steve McKay
8fd086a18d Fix broken copy after recent copy related chagnes.
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
2015-12-04 14:24:48 -08:00
Steve McKay
21217af63b Merge "Followup changes to ag/810782." 2015-12-04 20:14:34 +00:00
Steve McKay
27fd7c6727 Followup changes to ag/810782.
Note, one of the requested changes already happened.

Change-Id: I253cbc2b3b7f2091ca80f43c90e951263fc50ad2
2015-12-04 12:13:25 -08:00
Jeff Sharkey
a1fbe28218 Bring along the rest of the change too.
Change-Id: Ic1ca033e7f4003f7c7d10d3a47de00006f18fe02
2015-12-03 20:12:45 -07:00
Jeff Sharkey
28b41a3bd6 Grr, fix build from a skipped merge.
Change-Id: Id5961399c6057b8d721ad2a858aa91d107b0ab94
2015-12-03 20:06:46 -07:00
Steve McKay
362ab0dd68 Merge "Add DownloadsActivity functional test." 2015-12-02 23:06:35 +00:00
Steve McKay
dbdaa49be4 Add DownloadsActivity functional test.
Bug: 25809806
Change-Id: I43ceaf3a99715a57e3d349bee60f2edf7f6666bd
2015-12-02 14:11:47 -08:00
Steve McKay
ad133298f0 Merge "Don't deselect files after copy." 2015-12-02 19:24:58 +00:00
Steve McKay
c2b4b3dcda Don't deselect files after copy.
Bug: 5419032
Change-Id: Ib00e232c81b6400583cb4091882e5874decd0be2
2015-12-02 10:24:30 -08:00
Steve McKay
02794193c9 Show share button in downloads.
Also, rename "ManagerRootActivity" to "DownloadsActivity"
    since because...well, it is almost always Downloads
    and is specialized for this case.

Bug: 25809806
Change-Id: I496d34393d269d2120c8e214413cb87df8bf171d
2015-12-01 16:21:34 -08:00