DocumentsUI: Stop to override fixed size of dialog in CreateDirectoryDialog.

Previously CreateDirectoryDialog overrides fixed size defined in the application
theme. As a result, the dialog is shown as vertically long.

The CL specifies explicitly specifies the default theme for dialog when creating
the dialog to stop override the application theme.

BUG=20239384
Change-Id: I7227bd91705c32f5196b666bbe94ff32b5cb4af8
This commit is contained in:
Daichi Hirono
2015-04-16 20:17:35 +09:00
parent c1d5487307
commit 517577ea96
5 changed files with 11 additions and 20 deletions

View File

@@ -18,11 +18,9 @@
<bool name="show_as_dialog">true</bool>
<item type="dimen" name="dialog_width">85%</item>
<item type="dimen" name="dialog_height">90%</item>
<dimen name="grid_padding_horiz">24dp</dimen>
<dimen name="grid_padding_vert">16dp</dimen>
<dimen name="grid_item_padding">8dp</dimen>
</resources>

View File

@@ -16,6 +16,11 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="DialogWhenReallyLarge" parent="@*android:style/Theme.Material.DayNight.Dialog.FixedSize" />
<style name="DialogWhenReallyLarge" parent="@*android:style/Theme.Material.DayNight.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

@@ -33,13 +33,6 @@
<item name="android:windowActionModeOverlay">true</item>
<item name="android:windowNoTitle">true</item>
<item name="*android:windowFixedWidthMajor">@null</item>
<item name="*android:windowFixedWidthMinor">@null</item>
<item name="*android:windowMinWidthMajor">@null</item>
<item name="*android:windowMinWidthMinor">@null</item>
<item name="*android:windowFixedHeightMajor">80%</item>
<item name="*android:windowFixedHeightMinor">90%</item>
<item name="android:windowSoftInputMode">stateUnspecified|adjustUnspecified</item>
</style>

View File

@@ -56,7 +56,11 @@ public class CreateDirectoryFragment extends DialogFragment {
final Context context = getActivity();
final ContentResolver resolver = context.getContentResolver();
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
// We need to specify android.R.style.Theme_DeviceDefault_Dialog explicitly,
// because the application theme 'DialogWhenReallyLarge' has
// fixed window size properties for large screen devices.
final AlertDialog.Builder builder = new AlertDialog.Builder(
context, AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
final LayoutInflater dialogInflater = LayoutInflater.from(builder.getContext());
final View view = dialogInflater.inflate(R.layout.dialog_create_dir, null, false);

View File

@@ -80,15 +80,6 @@ public class StandaloneActivity extends BaseActivity {
final Context context = this;
// Strongly define our horizontal dimension; we leave vertical as
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);
mDirectoryContainer = (DirectoryContainerView) findViewById(R.id.container_directory);
mState = (icicle != null)