DocumentsUI tablet support.

Shows as a faux dialog on larger tablets, since the normal dialog
themes from framework don't support action bars.  Instead, this hacks
itself to look like a dialog with an InsetDrawable.  Detects touches
in dim area to dismiss dialog.

Show all action bar icons on tablets, and roots panel is always
visible with a different shadow. Show settings in dialog. Allow mode
switches in recents.

Bug: 10329832
Change-Id: Id02982ce7b0d4694962d32f8d5286fdfcc207208
diff --git a/res/drawable/item_root.xml b/res/drawable/item_root.xml
index 183d273..6f201cc 100644
--- a/res/drawable/item_root.xml
+++ b/res/drawable/item_root.xml
@@ -18,5 +18,5 @@
     <item android:state_pressed="true" android:drawable="@color/item_root_activated" />
     <item android:state_activated="true" android:drawable="@color/item_root_activated" />
     <item android:state_focused="true" android:drawable="@color/item_root_activated" />
-    <item android:drawable="@android:color/white" />
+    <item android:drawable="@android:color/transparent" />
 </selector>
diff --git a/res/layout-sw720dp-land/item_doc_list.xml b/res/layout-sw720dp-land/item_doc_list.xml
new file mode 100644
index 0000000..3bea166
--- /dev/null
+++ b/res/layout-sw720dp-land/item_doc_list.xml
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="@drawable/item_background"
+    android:minHeight="?android:attr/listPreferredItemHeight"
+    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+    android:paddingTop="8dip"
+    android:paddingBottom="8dip"
+    android:orientation="horizontal">
+
+    <FrameLayout
+        android:id="@android:id/icon"
+        android:layout_width="@dimen/icon_size"
+        android:layout_height="@dimen/icon_size"
+        android:layout_marginStart="12dp"
+        android:layout_marginEnd="20dp"
+        android:layout_gravity="center_vertical">
+
+        <ImageView
+            android:id="@+id/icon_mime"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:scaleType="centerInside"
+            android:contentDescription="@null" />
+
+        <ImageView
+            android:id="@+id/icon_thumb"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:scaleType="centerCrop"
+            android:contentDescription="@null" />
+
+    </FrameLayout>
+
+    <LinearLayout
+        android:layout_width="0dip"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:layout_gravity="center_vertical"
+        android:orientation="horizontal">
+
+        <TextView
+            android:id="@android:id/title"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="0.5"
+            android:layout_marginEnd="12dp"
+            android:singleLine="true"
+            android:ellipsize="marquee"
+            android:textAlignment="viewStart"
+            style="@style/TextAppearance.Medium" />
+
+        <ImageView
+            android:id="@android:id/icon1"
+            android:layout_width="@dimen/root_icon_size"
+            android:layout_height="@dimen/root_icon_size"
+            android:layout_marginEnd="8dp"
+            android:scaleType="centerInside"
+            android:contentDescription="@null" />
+
+        <TextView
+            android:id="@android:id/summary"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="0.25"
+            android:layout_marginEnd="12dp"
+            android:singleLine="true"
+            android:ellipsize="marquee"
+            android:textAlignment="viewStart"
+            style="@style/TextAppearance.Small" />
+
+        <TextView
+            android:id="@+id/size"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="0.125"
+            android:layout_marginEnd="12dp"
+            android:minWidth="70dp"
+            android:singleLine="true"
+            android:ellipsize="marquee"
+            android:textAlignment="viewEnd"
+            style="@style/TextAppearance.Small" />
+
+        <TextView
+            android:id="@+id/date"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="0.125"
+            android:layout_marginEnd="12dp"
+            android:minWidth="70dp"
+            android:singleLine="true"
+            android:ellipsize="marquee"
+            android:textAlignment="viewEnd"
+            style="@style/TextAppearance.Small" />
+
+    </LinearLayout>
+
+</LinearLayout>
diff --git a/res/layout-sw720dp/activity.xml b/res/layout-sw720dp/activity.xml
new file mode 100644
index 0000000..584a44d
--- /dev/null
+++ b/res/layout-sw720dp/activity.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="horizontal">
+
+    <FrameLayout
+        android:layout_width="wrap_content"
+        android:layout_height="match_parent"
+        android:id="@+id/dialog_roots">
+
+        <FrameLayout
+            android:id="@+id/container_roots"
+            android:layout_width="250dp"
+            android:layout_height="match_parent" />
+
+        <ImageView
+            android:layout_width="wrap_content"
+            android:layout_height="match_parent"
+            android:layout_gravity="end"
+            android:scaleType="fitXY"
+            android:src="@drawable/ic_drawer_shadow_tablet" />
+
+    </FrameLayout>
+
+    <LinearLayout
+        android:layout_width="0dp"
+        android:layout_height="match_parent"
+        android:layout_weight="1"
+        android:orientation="vertical">
+
+        <FrameLayout
+            android:id="@+id/container_directory"
+            android:layout_width="match_parent"
+            android:layout_height="0dip"
+            android:layout_weight="1" />
+
+        <FrameLayout
+            android:id="@+id/container_save"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content" />
+
+    </LinearLayout>
+
+</LinearLayout>
diff --git a/res/layout/item_doc_grid.xml b/res/layout/item_doc_grid.xml
index eea90b5..3cfae64 100644
--- a/res/layout/item_doc_grid.xml
+++ b/res/layout/item_doc_grid.xml
@@ -121,18 +121,6 @@
                 android:textAlignment="viewStart"
                 style="@style/TextAppearance.Small" />
 
-            <TextView
-                android:id="@android:id/summary"
-                android:layout_width="0dp"
-                android:layout_height="wrap_content"
-                android:layout_weight="1"
-                android:layout_gravity="center_vertical"
-                android:layout_marginStart="8dp"
-                android:singleLine="true"
-                android:ellipsize="marquee"
-                android:textAlignment="viewStart"
-                style="@style/TextAppearance.Small" />
-
         </LinearLayout>
 
     </LinearLayout>
diff --git a/res/values-sw720dp-land/dimens.xml b/res/values-sw720dp-land/dimens.xml
new file mode 100644
index 0000000..961608c
--- /dev/null
+++ b/res/values-sw720dp-land/dimens.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<resources>
+    <bool name="always_show_summary">true</bool>
+</resources>
diff --git a/res/values-sw720dp/dimens.xml b/res/values-sw720dp/dimens.xml
new file mode 100644
index 0000000..3be243a
--- /dev/null
+++ b/res/values-sw720dp/dimens.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<resources>
+    <bool name="show_as_dialog">true</bool>
+
+    <item type="dimen" name="dialog_width">85%</item>
+    <item type="dimen" name="dialog_height">90%</item>
+</resources>
diff --git a/res/values-sw720dp/styles.xml b/res/values-sw720dp/styles.xml
new file mode 100644
index 0000000..4ff1c60
--- /dev/null
+++ b/res/values-sw720dp/styles.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android">
+    <style name="Theme" parent="@android:style/Theme.Holo.Light">
+        <item name="android:windowBackground">@*android:drawable/dialog_full_holo_light</item>
+        <item name="android:colorBackgroundCacheHint">@null</item>
+        <item name="android:windowIsTranslucent">true</item>
+    </style>
+</resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index e5b5b4e..25b0f84 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -19,4 +19,7 @@
     <dimen name="root_icon_size">24dp</dimen>
     <dimen name="grid_width">180dp</dimen>
     <dimen name="grid_height">180dp</dimen>
+
+    <bool name="show_as_dialog">false</bool>
+    <bool name="always_show_summary">false</bool>
 </resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 59fbd6f..945e7ae 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -14,7 +14,7 @@
      limitations under the License.
 -->
 
-<resources>
+<resources xmlns:android="http://schemas.android.com/apk/res/android">
     <style name="TextAppearance" />
 
     <style name="TextAppearance.Medium">
@@ -26,4 +26,8 @@
         <item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
         <item name="android:textColor">?android:attr/textColorTertiary</item>
     </style>
+
+    <!-- Normally just a redirection, but this is used to make ourselves a
+         dialog on large tablets -->
+    <style name="Theme" parent="@android:style/Theme.Holo.Light" />
 </resources>