diff options
| author | Jeff Sharkey <jsharkey@android.com> | 2013-09-07 14:45:03 -0700 |
|---|---|---|
| committer | Jeff Sharkey <jsharkey@android.com> | 2013-09-09 09:16:09 -0700 |
| commit | d182bb641f228b2d28527a6aa86075f6358ab838 (patch) | |
| tree | 94eafb66067b4139a014a1f03320c4a9a5f32171 /packages/DocumentsUI/src/com/android/documentsui/model/DocumentStack.java | |
| parent | 0c58bd97384498be14aa9795be9188ca93110e00 (diff) | |
| download | frameworks_base-d182bb641f228b2d28527a6aa86075f6358ab838.zip frameworks_base-d182bb641f228b2d28527a6aa86075f6358ab838.tar.gz frameworks_base-d182bb641f228b2d28527a6aa86075f6358ab838.tar.bz2 | |
Remember mode and sort on per-directory basis.
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
Diffstat (limited to 'packages/DocumentsUI/src/com/android/documentsui/model/DocumentStack.java')
| -rw-r--r-- | packages/DocumentsUI/src/com/android/documentsui/model/DocumentStack.java | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/packages/DocumentsUI/src/com/android/documentsui/model/DocumentStack.java b/packages/DocumentsUI/src/com/android/documentsui/model/DocumentStack.java index 33a1376..2541440 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/model/DocumentStack.java +++ b/packages/DocumentsUI/src/com/android/documentsui/model/DocumentStack.java @@ -16,8 +16,6 @@ package com.android.documentsui.model; -import com.android.documentsui.RootsCache; - import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; @@ -30,14 +28,13 @@ import java.util.LinkedList; */ public class DocumentStack extends LinkedList<DocumentInfo> implements Durable { private static final int VERSION_INIT = 1; + private static final int VERSION_ADD_ROOT = 2; - public RootInfo getRoot(RootsCache roots) { - return roots.findRoot(getLast().uri); - } + public RootInfo root; - public String getTitle(RootsCache roots) { - if (size() == 1) { - return getRoot(roots).title; + public String getTitle() { + if (size() == 1 && root != null) { + return root.title; } else if (size() > 1) { return peek().displayName; } else { @@ -52,6 +49,7 @@ public class DocumentStack extends LinkedList<DocumentInfo> implements Durable { @Override public void reset() { clear(); + root = null; } @Override @@ -59,6 +57,12 @@ public class DocumentStack extends LinkedList<DocumentInfo> implements Durable { final int version = in.readInt(); switch (version) { case VERSION_INIT: + throw new ProtocolException("Ignored upgrade"); + case VERSION_ADD_ROOT: + if (in.readBoolean()) { + root = new RootInfo(); + root.read(in); + } final int size = in.readInt(); for (int i = 0; i < size; i++) { final DocumentInfo doc = new DocumentInfo(); @@ -73,7 +77,13 @@ public class DocumentStack extends LinkedList<DocumentInfo> implements Durable { @Override public void write(DataOutputStream out) throws IOException { - out.writeInt(VERSION_INIT); + out.writeInt(VERSION_ADD_ROOT); + if (root != null) { + out.writeBoolean(true); + root.write(out); + } else { + out.writeBoolean(false); + } final int size = size(); out.writeInt(size); for (int i = 0; i < size; i++) { |
