Eliminate dialog mode from DocumentsUI.
DocumentsActivity to Use standard drawer layout at all display resolutions.
Bug: 26208032
Change-Id: I3b93c81bf97045744074a299e92cdea4aae7628d
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 8cc79a4..5e634a4 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -40,7 +40,7 @@
<activity
android:name=".DownloadsActivity"
- android:theme="@style/DocumentsFullScreenTheme"
+ android:theme="@style/DocumentsTheme"
android:label="@string/downloads_label"
android:icon="@drawable/ic_doc_text">
<intent-filter>
@@ -64,7 +64,7 @@
<activity
android:name=".FilesActivity"
- android:theme="@style/DocumentsFullScreenTheme"
+ android:theme="@style/DocumentsTheme"
android:icon="@drawable/ic_files_app"
android:label="@string/files_label"
android:documentLaunchMode="intoExisting">
diff --git a/res/values-sw720dp/dimens.xml b/res/values-sw720dp/dimens.xml
index f393d88..83ceb55 100644
--- a/res/values-sw720dp/dimens.xml
+++ b/res/values-sw720dp/dimens.xml
@@ -15,10 +15,6 @@
-->
<resources>
- <bool name="show_as_dialog">true</bool>
-
- <item type="dimen" name="dialog_width">85%</item>
-
<dimen name="grid_padding_horiz">16dp</dimen>
<dimen name="grid_padding_vert">16dp</dimen>
diff --git a/res/values-sw720dp/layouts.xml b/res/values-sw720dp/layouts.xml
deleted file mode 100644
index 7d28f9c..0000000
--- a/res/values-sw720dp/layouts.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 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>
- <item name="docs_activity" type="layout">@layout/fixed_layout</item>
-</resources>
diff --git a/res/values-sw720dp/styles.xml b/res/values-sw720dp/styles.xml
deleted file mode 100644
index a8dcbb0..0000000
--- a/res/values-sw720dp/styles.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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="DocumentsBaseTheme" parent="@style/Theme.AppCompat.Light.Dialog">
- <!-- We do not specify width of window here because the max size of
- floating window specified by windowFixedWidthis is limited. -->
- <item name="*android:windowFixedHeightMajor">80%</item>
- <item name="*android:windowFixedHeightMinor">90%</item>
- </style>
-
-</resources>
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 0afc3a2..9e13001 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<resources>
- <declare-styleable name="DocumentsBaseTheme">
+ <declare-styleable name="DocumentsTheme">
<attr name="colorActionMode" format="color"/>
</declare-styleable>
</resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index f94a00e..060871d 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -35,7 +35,6 @@
<dimen name="list_divider_inset">72dp</dimen>
<bool name="list_divider_inset_left">true</bool>
- <bool name="show_as_dialog">false</bool>
<bool name="always_show_summary">false</bool>
<dimen name="dir_elevation">8dp</dimen>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 6712e2d..d14631d 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -16,31 +16,10 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android">
- <style name="DocumentsBaseTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar" />
<style name="ActionBarTheme" parent="@*android:style/ThemeOverlay.Material.Dark.ActionBar" />
<style name="ActionBarPopupTheme" parent="@*android:style/ThemeOverlay.Material.Light" />
- <style name="DocumentsTheme" parent="@style/DocumentsBaseTheme">
- <item name="actionBarWidgetTheme">@null</item>
- <item name="actionBarTheme">@style/ActionBarTheme</item>
- <item name="actionBarPopupTheme">@style/ActionBarPopupTheme</item>
-
- <item name="android:windowBackground">@color/window_background</item>
- <item name="android:colorPrimaryDark">@color/primary_dark</item>
- <item name="android:colorPrimary">@color/primary</item>
- <item name="android:colorAccent">@color/accent</item>
- <item name="colorActionMode">@color/action_mode</item>
-
- <item name="android:listDivider">@*android:drawable/list_divider_material</item>
-
- <item name="android:windowActionBar">false</item>
- <item name="android:windowActionModeOverlay">true</item>
- <item name="android:windowNoTitle">true</item>
-
- <item name="android:windowSoftInputMode">stateUnspecified|adjustUnspecified</item>
- </style>
-
- <style name="DocumentsFullScreenTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
+ <style name="DocumentsTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
<item name="actionBarWidgetTheme">@null</item>
<item name="actionBarTheme">@style/ActionBarTheme</item>
<item name="actionBarPopupTheme">@style/ActionBarPopupTheme</item>
diff --git a/src/com/android/documentsui/DocumentsActivity.java b/src/com/android/documentsui/DocumentsActivity.java
index 8754f68..bbe12ac 100644
--- a/src/com/android/documentsui/DocumentsActivity.java
+++ b/src/com/android/documentsui/DocumentsActivity.java
@@ -19,8 +19,8 @@
import static com.android.documentsui.State.ACTION_CREATE;
import static com.android.documentsui.State.ACTION_GET_CONTENT;
import static com.android.documentsui.State.ACTION_OPEN;
-import static com.android.documentsui.State.ACTION_PICK_COPY_DESTINATION;
import static com.android.documentsui.State.ACTION_OPEN_TREE;
+import static com.android.documentsui.State.ACTION_PICK_COPY_DESTINATION;
import static com.android.documentsui.dirlist.DirectoryFragment.ANIM_NONE;
import android.app.Activity;
@@ -31,11 +31,9 @@
import android.content.ContentProviderClient;
import android.content.ContentResolver;
import android.content.ContentValues;
-import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
-import android.graphics.Point;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
@@ -46,7 +44,6 @@
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
-import android.view.WindowManager;
import android.widget.BaseAdapter;
import android.widget.Spinner;
import android.widget.Toolbar;
@@ -65,8 +62,6 @@
private static final int CODE_FORWARD = 42;
private static final String TAG = "DocumentsActivity";
- private boolean mShowAsDialog;
-
private Toolbar mToolbar;
private Spinner mToolbarStack;
@@ -84,29 +79,8 @@
super.onCreate(icicle);
final Resources res = getResources();
- mShowAsDialog = res.getBoolean(R.bool.show_as_dialog);
- if (!mShowAsDialog) {
- setTheme(R.style.DocumentsFullScreenTheme);
- }
-
- if (mShowAsDialog) {
- mDrawer = DrawerController.createDummy();
-
- // Strongly define our horizontal dimension; we leave vertical as
- // WRAP_CONTENT so that system resizes us when IME is showing.
- final WindowManager.LayoutParams a = getWindow().getAttributes();
-
- final Point size = new Point();
- getWindowManager().getDefaultDisplay().getSize(size);
- a.width = (int) res.getFraction(R.dimen.dialog_width, size.x, size.x);
-
- getWindow().setAttributes(a);
-
- } else {
- mDrawer = DrawerController.create(this);
- }
-
+ mDrawer = DrawerController.create(this);
mToolbar = (Toolbar) findViewById(R.id.toolbar);
mStackAdapter = new StackAdapter();
@@ -268,15 +242,16 @@
}
}
- if (!mShowAsDialog && mDrawer.isUnlocked()) {
+ if (mDrawer.isUnlocked()) {
mToolbar.setNavigationIcon(R.drawable.ic_hamburger);
mToolbar.setNavigationContentDescription(R.string.drawer_open);
- mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- setRootsDrawerOpen(true);
- }
- });
+ mToolbar.setNavigationOnClickListener(
+ new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ setRootsDrawerOpen(true);
+ }
+ });
} else {
mToolbar.setNavigationIcon(null);
mToolbar.setNavigationContentDescription(R.string.drawer_open);
@@ -307,10 +282,7 @@
public boolean onCreateOptionsMenu(Menu menu) {
boolean showMenu = super.onCreateOptionsMenu(menu);
- // Most actions are visible when showing as dialog
- if (mShowAsDialog) {
- expandMenus(menu);
- }
+ expandMenus(menu);
return showMenu;
}