summaryrefslogtreecommitdiffstats
path: root/packages/DocumentsUI/src/com/android/documentsui/model
Commit message (Collapse)AuthorAgeFilesLines
* Enable apps to exclude their own roots from the DocumentsUI roots list.Ben Kwa2015-06-101-2/+0
| | | | | | | | | | - 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
* Show copy destination when clicking on the copy notification in Documents UI.Tomasz Mikolajewski2015-04-132-3/+28
| | | | Change-Id: I3d955595bc46903c134c0633a6d32663cc2d0c05
* Final pass at Material DocumentsUI.Jeff Sharkey2014-08-291-2/+10
| | | | | | | | | Now with treatment for disabled and selected grid items. Inverts text and icons in selected drawer items. Follows upstream color changes to accent color. Disables some verbose logging. Bug: 15836082, 17281688 Change-Id: I97a1c055a2f1a537388a8f5669147618e9698870
* Make sure we're obtaining themed drawables correctlyAlan Viverette2014-08-141-1/+1
| | | | Change-Id: I446a3492f7bf5a897c5d698e61327af4b7840d85
* More material updates to DocumentsUI.Jeff Sharkey2014-08-081-20/+19
| | | | | | | | All assets cut as alpha variants so we apply desired tinting at runtime. Small script to automatically generate XML resources. Bug: 15836082, 16658537 Change-Id: I803b3f0bf6f121194a5445fd1c6600fabaf28f60
* Use system collator for display names.Jeff Sharkey2014-08-061-3/+33
| | | | | | | | Continue sorting directory names first, but use system collator in case-insensitive ordering. Bug: 13545569 Change-Id: I24b314c9ef42f397bc96f474d9593bdefc0061d1
* Light icons for DocumentsUI.Jeff Sharkey2014-07-301-0/+19
| | | | | | | | In some cases we want to show light variants. Also tweak drawer sizes and grid padding. Bug: 15836082 Change-Id: Ic6459ff0533a7d346c03db5d7deb3d6da42e7649
* First pass at Materializing DocumentsUI!Jeff Sharkey2014-07-281-5/+5
| | | | | | | | | | | | | | | Initial Material asset drop, which still needs some tweaking. Moved back to framework list item selectors, giving us ripples. Using accent color overlay for activated items. Align all items to new Material grid, including insetting list divider and resizing list items on wide screens. Fix obscure RTL drawing bug. Still lots of work left. Bug: 15836082 Change-Id: I729cc7dcb0271ee62b55d1e036fc28427fc0dd3d
* Detect wedged ContentProviders, treat as ANR.Jeff Sharkey2013-10-011-4/+6
| | | | | | | | | | | | | All ContentProvider calls are currently blocking, making it hard for an app to recover when a remote provider is wedged. This change adds hidden support to ContentProviderClient to timeout remote calls, treating them as ANRs. This behavior is disabled by default. Update DocumentsUI to use a 20 second timeout whenever interacting with a storage provider. Bug: 10993301, 10819461, 10852518 Change-Id: I10fa3c425c6a7225fff9cb7a0a07659028230cd3
* New roots UX, async, performance, docs.Jeff Sharkey2013-09-272-24/+58
| | | | | | | | | | | | | | | | | | | | | | | | Yet another iteration from UX on how roots should be ordered. Since we no longer categorize by type, remove from public API. Updated asset drop with new dividers. Update public API docs to be explicit about required columns. Hide flags and columns that aren't required for third-party apps. Move remainder of potentially blocking work to AsyncTasks, including creating directories, picked root resolution, and creation of new documents once picked. Improve performance of layouts by removing baseline alignment and reduce hierarchy depth. Set alpha on ImageViews directly to avoid offscreen rendering hit. Limit returned recents to 45 days. Show load in recents when still waiting for backends. Show empty message when no recents stacks to create from. Use unique key when saving recent stacks. Bug: 10941423, 10819454, 10964412, 10960718 Change-Id: I08cf589dcda7e203acf67928f4d30322ae36ee94
* Handle null stacks gracefully.Jeff Sharkey2013-09-251-0/+1
| | | | | Bug: 10928395 Change-Id: Ie7c3f7e0eb068ece0cf678a5d6346f18a413856b
* Freshen restored stacks, more UX bug fixes.Jeff Sharkey2013-09-242-18/+63
| | | | | | | | | | | | | | | | | | | | | | | When restoring a persisted stack, such as last location or a location where save occurred, freshen the DocumentStack to get the latest details from backend, and ensure the path is still valid. Filter Recent directories in create mode based on roots allowed by incoming request. Remember when user last picked an external app, and open drawer next time user launches for GET_CONTENT. Fix state list drawable ordering, and avoid clobbering Drawable callback when wrapping in InsetDrawable; tricksy hobbitses! Make grid items smaller to always fit two columns on phones. Draw grid items all the way to screen edge; don't clip to padding. Better error message when folder creation failed. Show Recents in grid mode when picking any visual content, not just images. Bug: 10846100, 10903211, 10898993, 10892808, 10892058, 10892009, 10885012 Change-Id: Ia0f88d911abc6ea03645d6fd3e04271c21d5936a
* Create unique files, root ordering, UI bugs.Jeff Sharkey2013-09-212-2/+2
| | | | | | | | | | | | | | | | | | | | | | When a file already exists on disk, try adding a counter suffix to make a unique name. Move services near top of roots list, just below recents. Remove "Documents" root. Increase number of recents allowed from single provider, and add more logging to diagnose wedged loaders. When launching GET_CONTENT apps, wait for successful result before relaying result; canceled requests now return to DocumentsUI. Add CloseGuard to ContentProviderClients, since leaked instances can keep the remote process alive. Fix UI bug around trailing breadcrumbs. Fix bug that dropped Recents from roots list. Add up action to Settings activity. Give our activity a default icon while waiting for async roots to load. Bug: 10818683, 10819461, 10819461, 10819196, 10860199 Change-Id: I7b9e26b1cf8353dd3175458b23da2b4bda6c5831
* Load RootInfo in background, invalidation.Jeff Sharkey2013-09-191-0/+2
| | | | | | | | | | | | | | | | | Move all RootInfo queries to background threads to avoid janking the UI. Update passes happen on spawed task, which swaps out updated cache results when finished. Support partial updates when only a single package/authority has changed. Watch for change notifications for roots, since flags can change over time. Ignore stopped packages when in background, but query them for roots when launching any picker UI. Optimize management launches by treating as one-shot requests that don't need to wait for all RootInfo. Bug: 10600454, 10745490 Change-Id: Ibc7b15688ef6b41bd7e9dd0d7564b501e60e49a9
* More UX updates around picking images.Jeff Sharkey2013-09-131-0/+4
| | | | | | | | | | | | | | | | When picking images or videos, hide the titles in recents, since the thumbnails should speak for themselves. Also respect new flag that allows a directory to request their titles be hidden. Show directory icon hint in grid mode when showing a thumbnail, to remind user it's a directory. Filter directories out of recents. Hide most action bar icons on phones, even when room. Only show drawer on first launch. Hide most drawer headers to match spec. Bug: 10710331 Change-Id: I0ef1973ddd62750f57345336388366eda1449720
* Move search to roots; Documents root; hide empty.Jeff Sharkey2013-09-132-7/+9
| | | | | | | | | | | | | Documents searches now happen root-wide, instead of only under a subdirectory. Updates abstract class and flags to match. Add flag for a root to indicate it's empty, and hide empty roots in UI unless creating. Define "Documents" public directory and storage backend to contain files. Bug: 10712057, 10710865, 10710758 Change-Id: I8716367568969f9cb1d83927b2bf5a7013809350
* More UX work for thumbnails, search, management.Jeff Sharkey2013-09-101-1/+2
| | | | | | | | | | | | | | | | | | | | | | | Hide non-finished downloads from normal picker UI, but keep them around in management mode. Uses a Uri query parameter and a hidden API on DocumentsProvider. Scale thumbnails to fit viewport, always show MIME icon while waiting on thumbnails, and crossfade between them. Cancel thumbnail tasks when views are recycled. Filter directories out of search results for now. Also leave sort ordering from backend intact, since it's custom ranking. Fix SearchView interaction to dismiss properly and restore across orientation and drawer state changes. Hide most actions when drawer is open. Invalidate RootInfo cache when locale changes. Apply sort ordering when showing recent create directories. Hide recent summary string when icon is enough for user to disambiguate. Bug: 10667184, 10665663 Change-Id: I331d3272a08c497f88dc659d9e112231cb35aa69
* Remember mode and sort on per-directory basis.Jeff Sharkey2013-09-093-76/+197
| | | | | | | | | | | | | | | | | Persist the last user-selected list/grid mode and sort order for each directory. Remembered user choice always overrides provider hinting. Filter out recent documents that don't match requested MIME type, and show recents in grid mode when picking images. Hide mode and sort order in recents. Add hinting flag for backend to indicate a directory would like to be sorted by last modified. Include explicit root in DocumentStack and clearly mark derived fields. Bug: 10392047, 10608506 Change-Id: I2dd3a0e4112852ebf87e7dbb08b3781c86587dcf
* Another asset drop, provider icons, tests.Jeff Sharkey2013-09-061-1/+22
| | | | | | | | | Latest asset update, including provider icons which are treated as special cases for now instead of checking into separate apps. Add tests for MIME type matching of roots. Remove unused XML. Bug: 10510022 Change-Id: Id567a9e06ba241f60ac011823e550253c6c797fb
* Filter roots based on supported MIME types.Jeff Sharkey2013-09-051-5/+3
| | | | | | | | Using flags to indicate supported types isn't very extensible, so use newline-separated MIME types instead. Bug: 10514613 Change-Id: I45641fc20b423b2a0bb2df7457c274f42aa6861a
* Asset drop, icons for common MIME types.Jeff Sharkey2013-09-042-24/+3
| | | | | | | | Bring in latest assets from UX. Map common MIME types to specific icons. Bug: 10510022 Change-Id: I01ea8749ca5515a04efcbc15eb0c8cbb43e5e7ad
* Fix document management permission enforcement.Jeff Sharkey2013-09-041-0/+7
| | | | | | | | | | | | | | Allow both explicit holders of the MANAGE_DOCUMENTS permission and those holding Uri grants to perform management tasks. Extend grants for newly created documents when caller doesn't have permission. Revoke grants when deleting documents. Test now writes actual content into picked file. Workaround updated flags for Drive app. Bug: 10623211 Change-Id: Ia8e90b33e0fac8294b2cacb96d083c43fdf75aab
* Updated documents UX around action bar.Jeff Sharkey2013-09-032-33/+9
| | | | | | | | | | | | | | | Change action bar to match current design; drawer is always available and navigation dropdown is used to interact with current traversal path in hierarchy. On first launch, show recents with drawer expanded. On subsequent launches, resume from last location with drawer closed. If last location root isn't applicable, then behave like initial launch. Move sort order into action bar submenu. Delete documents using contract. Use unstable provider when inflating DocumentInfo from Uri. Bug: 10330219, 10510851 Change-Id: I6e94637d70ebca156a6c5d50272e878156d0dd62
* New recents behavior to match spec.Jeff Sharkey2013-09-022-2/+24
| | | | | | | | | | | | | | | Updated behavior queries each documents root for recently modified documents. It uses a new variant of DirectoryLoader which limits the maximum number of parallel queries to relieve memory pressure. When first started, it waits up to 500ms for everyone to finish, then publishes whatever results are ready, and then refreshes results as each straggler finishes. New RootCursorWrapper that always blends in authority and rootId columns, which are used for binding root details from blended cursors. Bug: 10593596, 10329994 Change-Id: Icc0d4a2f1b6166edc72f78a4c88f444eeba6f2f0
* Instance state, fix sharing, Durable objects.Jeff Sharkey2013-09-014-41/+222
| | | | | | | | | | | | | | | | | | | Remember instance state across configuration changes, and enable rotation. This remembers current modes and in-progress traversals. Always finish action modes after launching an action. Fix sharing by always putting Uris in extras, and always wrap in a chooser. Find common MIME types when sharing multiple documents. Fix downloads launching by following directory MIME type change. Introduce "Durable" which is like Parcelable, but can be used for both byte[] storage and Parcel transport. Make both DocumentInfo and DocumentStack durable. Disable recents until new behavior is implemented. Bug: 10460236, 10446265, 10533674, 10456344, 10456702 Change-Id: I4eaf2b0b4cde611c69a1e7b5f1586f6b02019b27
* Use Cursors directly when binding documents.Jeff Sharkey2013-08-312-57/+66
| | | | | | | | | | | | | | | Instead of creating a DocumentInfo for every list item, bind the adapter against Cursor directly. Create new SortingCursorWrapper which performs sorting at query time and keeps a O(1) mapping from sorted to unsorted positions in the underlying Cursor. Suppress extra loader passes that had been kicked off. Use unstable provider when querying to guard against broken providers. Bug: 10567506, 10510851 Change-Id: I535814da6b17c38de04a1175e0afcc78c6b966ce
* Refactoring of DocumentsContract.Jeff Sharkey2013-08-313-53/+123
| | | | | | | | | | | | | | | | | | | | | | Combines related columns and constants onto the same class so they are easier to discover. Move back to surfacing roots with columns so they are consistent with documents. Advanced roots are represented with a flag instead of distinct types. Flags to indicate supporting of well-known media types, instead of arbitrary an MIME filter. Reintroduce well-formed rootId to support recents. Always use the expanded version of "documents" in constants, methods, and argument names. Refactor DocumentProvider method names to clearly distinguish if a single item or multiple could be returned, and of which type. Add documentation to clearly define which methods have already been overridden. Bug: 10567506, 10567557 Change-Id: I981f26ab82f2b520a19aa1ce66f659de50d7fac0
* Stronger DocumentsProvider contract.Jeff Sharkey2013-08-284-254/+28
| | | | | | | | | | | | | | | | | | | Using a contract class requires that a provider implement it exactly with little help. This change introduces a DocumentsProvider abstract class that provides a client-side implementation of the contract that greatly reduces developer burden, and improves correctness. This also moves to first-class DocumentRoot objects, and moves calls with complex side effects to be ContentProvider.call() invocations, offering more granular permission control over Uri operations that shouldn't be available through Uri grants. This new design also relaxes the requirement that root information be burned into every Uri. Migrate ExternalDocumentsProvider and DocumentsUI to adopt new API. Bug: 10497206 Change-Id: I6f2b3f519bfd62a9d693223ea5628a971ce2e743
* Management actions, invalidate caches.Jeff Sharkey2013-08-181-0/+8
| | | | | | | | | | | | | | In manage mode, touching launches a VIEW intent for the file. Also adds actions for sharing and deleting. Move roots and thumbnail caches into Application object, and flush cache when thumbnail size changes. Listen for package changes and broadcasts that should invalidate our roots cache. Pick default grid/list mode based on provider hint. Bug: 10329983, 10330210, 10378834, 10330069 Change-Id: I75afb1c58ab71bb9d55852b1059da7257a376248
* Documents management mode; API adjustment.Jeff Sharkey2013-08-152-8/+21
| | | | | | | | | | | | | | | Create documents manage mode to support Downloads and transient storage devices. Locks user into requested backend root, and forces file sizes on and sorting by last modified. Separate API constants for Documents versus Roots, and give concrete MIME types for roots. Treat null sizes as unknown. Documents are always enabled in list so that divider is drawn. Mark external storage file as writable. Bug: 10329983, 10332993, 10332952 Change-Id: I05f4fdf5b04041a38e1ba7fb30202a3b0c615bf6
* Better handling of broken storage providers.Jeff Sharkey2013-08-072-12/+35
| | | | | | | | Begin throwing FNFE when storage provider doesn't know about document or when it's having trouble. Treat all provider errors as FNFE and avoid crashing our UI. Change-Id: I946f1ae4125791999464dc4ce494853d5d1c0629
* Settings, replace files, sorting by size, tweaks.Jeff Sharkey2013-08-073-11/+21
| | | | | | | | | | | | | | | | Add settings to show file sizes and advanced storage devices, both disabled by default. Add sorting by size when enabled in settings. Always show all documents, but only allow selection when they match MIME filter. When creating, select entire filename on focus. When creating, treat selected documents as replacement targets using that exact Uri unless display name is changed. Show available bytes for device roots. Show empty text label in empty directories. Split grid backend and details into two separate lines. Fix path label ordering when rendering recent directories. Change-Id: I44c62e8adb8ca7d4355510a13d1ba975196a2d29
* Recents in create, uniform item layouts.Jeff Sharkey2013-08-063-30/+99
| | | | | | | | | | | | | Show recent directories in a separate fragment, and save as serialized versions of new DirectoryStack. Cleaner behavior around recents and search, instead of treating them as pseudo-Documents. More uniform item layouts between list and grid, including both date and size information, and originating storage root in recents. Avoid clashing directory loaders by assigning unique numbers. Promote list/grid switching up into activity. Change-Id: I9a93460b896067ca036d7e772eeabde31face2e1
* Storage roots in fragment, sectioned.Jeff Sharkey2013-08-062-1/+21
| | | | | | | | | | Move storage roots into a fragment, since it's not a drawer on tablets. Cluster and sort roots when displaying. SectionedListAdapter to make clustered roots easier to manage. Add docs for root types. Move roots cache into separate class to make it easier to share. Change-Id: Ia0b92eade059e816324641f600c08026c0e268c9
* More recents work; filtering and sorting.Jeff Sharkey2013-08-053-0/+382
Update DirectoryFragment to render List<Document>, making it more general purpose. Feed it documents either from a backend Cursor or after resolving fields from a recents Cursor. Start in recents when no persisted stack available. Synthesize a root for recents. Local directory filtering and sorting using predicates and comparators, all performed on background thread. Introduce UriDerivativeLoader which handles ContentObserver updates while producing a derivative work of a Cursor. Split data model classes into separate files. Change-Id: Idb88b4ee22c58c8e508328e678877f7e4c978533