Fixed tablet edit dialog crashes and adjusted widths of dialogs for large screens

pull/14/head
Sam Bosley 14 years ago
parent bd5067ab0a
commit 941a85a86a

@ -155,7 +155,7 @@
<item name="android:windowExitAnimation">@anim/slide_right_out</item> <item name="android:windowExitAnimation">@anim/slide_right_out</item>
</style> </style>
<style name="Theme.TEA_Dialog"> <style name="TEA_Dialog" parent="@android:style/Theme.Dialog">
<item name="android:windowFrame">@null</item> <item name="android:windowFrame">@null</item>
<item name="android:windowTitleStyle">@style/TEA_DialogWindowTitle</item> <item name="android:windowTitleStyle">@style/TEA_DialogWindowTitle</item>
<item name="android:windowBackground">@drawable/task_edit_dialog_background</item> <item name="android:windowBackground">@drawable/task_edit_dialog_background</item>
@ -166,7 +166,7 @@
<item name="asTextColor">#ffffff</item> <item name="asTextColor">#ffffff</item>
</style> </style>
<style name="Theme.TEA_Dialog.White"> <style name="TEA_Dialog.White">
<item name="android:windowBackground">@drawable/task_edit_dialog_background_white</item> <item name="android:windowBackground">@drawable/task_edit_dialog_background_white</item>
<item name="asTextColor">#000000</item> <item name="asTextColor">#000000</item>
</style> </style>

@ -33,9 +33,9 @@ public class ThemeService {
int themeSetting = ThemeService.getTheme(); int themeSetting = ThemeService.getTheme();
int theme; int theme;
if (themeSetting == R.style.Theme || themeSetting == R.style.Theme_Transparent) { if (themeSetting == R.style.Theme || themeSetting == R.style.Theme_Transparent) {
theme = R.style.Theme_TEA_Dialog; theme = R.style.TEA_Dialog;
} else { } else {
theme = R.style.Theme_TEA_Dialog_White; theme = R.style.TEA_Dialog_White;
} }
return theme; return theme;
} }

@ -3,6 +3,8 @@ package com.todoroo.astrid.ui;
import android.app.Activity; import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.res.Configuration;
import android.util.DisplayMetrics;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
@ -11,6 +13,7 @@ import android.view.Window;
import android.widget.Button; import android.widget.Button;
import com.timsu.astrid.R; import com.timsu.astrid.R;
import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.DialogUtilities; import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.astrid.helper.TaskEditControlSet; import com.todoroo.astrid.helper.TaskEditControlSet;
import com.todoroo.astrid.service.ThemeService; import com.todoroo.astrid.service.ThemeService;
@ -77,9 +80,16 @@ public abstract class PopupControlSet extends TaskEditControlSet {
} }
}); });
} }
LayoutParams params = d.getWindow().getAttributes(); LayoutParams params = d.getWindow().getAttributes();
params.width = LayoutParams.FILL_PARENT; params.width = LayoutParams.FILL_PARENT;
params.height = LayoutParams.WRAP_CONTENT; params.height = LayoutParams.WRAP_CONTENT;
Configuration config = activity.getResources().getConfiguration();
int size = config.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
if (AndroidUtilities.getSdkVersion() >= 9 && size == Configuration.SCREENLAYOUT_SIZE_XLARGE) {
DisplayMetrics metrics = activity.getResources().getDisplayMetrics();
params.width = metrics.widthPixels / 2;
}
d.getWindow().setAttributes((android.view.WindowManager.LayoutParams) params); d.getWindow().setAttributes((android.view.WindowManager.LayoutParams) params);
d.setOnCancelListener(cancelListener); d.setOnCancelListener(cancelListener);

Loading…
Cancel
Save