Merge "Eliminate dialog mode from DocumentsUI."

This commit is contained in:
Steve McKay
2015-12-17 18:29:08 +00:00
committed by Android (Google) Code Review
8 changed files with 14 additions and 112 deletions

View File

@@ -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">

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -34,7 +34,6 @@ import android.content.ContentValues;
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;
@@ -45,7 +44,6 @@ import android.util.Log;
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;
@@ -64,8 +62,6 @@ public class DocumentsActivity extends BaseActivity {
private static final int CODE_FORWARD = 42;
private static final String TAG = "DocumentsActivity";
private boolean mShowAsDialog;
private Toolbar mToolbar;
private Spinner mToolbarStack;
@@ -83,29 +79,8 @@ public class DocumentsActivity extends BaseActivity {
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();
@@ -267,15 +242,16 @@ public class DocumentsActivity extends BaseActivity {
}
}
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);
@@ -306,10 +282,7 @@ public class DocumentsActivity extends BaseActivity {
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;
}