Browse Source

Bugfix für Lollipop AlertDialog Bug (see styles), moved away from android referenced icon to self-shipped version for design consistency

Andy Scherzinger 9 years ago
parent
commit
a257935b8c

BIN
res/drawable-hdpi/ic_warning.png


BIN
res/drawable-xhdpi/ic_warning.png


BIN
res/drawable-xxhdpi/ic_warning.png


+ 1 - 1
res/values-de-rDE/strings.xml

@@ -202,7 +202,7 @@
   <string name="confirmation_remove_local">Nur lokal</string>
   <string name="confirmation_remove_folder_local">Nur lokale Inhalte</string>
   <string name="confirmation_remove_remote">Vom Server entfernen</string>
-  <string name="confirmation_remove_remote_and_local">Lokal und auf dem Server</string>
+  <string name="confirmation_remove_remote_and_local">Lokal und auf Server</string>
   <string name="remove_success_msg">Erfolgreich gelöscht</string>
   <string name="remove_fail_msg">Der Löschvorgang konnte nicht beendet werden</string>
   <string name="rename_dialog_title">Geben Sie einen neuen Namen ein</string>

+ 1 - 1
res/values-de/strings.xml

@@ -202,7 +202,7 @@
   <string name="confirmation_remove_local">Nur lokal</string>
   <string name="confirmation_remove_folder_local">Nur lokale Inhalte</string>
   <string name="confirmation_remove_remote">Vom Server entfernen</string>
-  <string name="confirmation_remove_remote_and_local">Lokal und auf dem Server</string>
+  <string name="confirmation_remove_remote_and_local">Lokal und auf Server</string>
   <string name="remove_success_msg">Erfolgreich gelöscht</string>
   <string name="remove_fail_msg">Der Löschvorgang konnte nicht beendet werden</string>
   <string name="rename_dialog_title">Gib einen neuen Namen ein</string>

+ 26 - 0
res/values/styles.xml

@@ -28,6 +28,7 @@
 		<item name="colorPrimary">@color/primary</item>
 		<item name="colorPrimaryDark">@color/primary_dark</item>
 		<item name="colorAccent">@color/color_accent</item>
+		<item name="android:alertDialogTheme">@style/Theme.ownCloud.Dialog</item>
 	</style>
 	
 	<style name="Theme.ownCloud.noActionBar" parent="style/Theme.AppCompat.Light.DarkActionBar">
@@ -37,6 +38,7 @@
 		<item name="colorPrimary">@color/primary</item>
 		<item name="colorPrimaryDark">@color/primary_dark</item>
 		<item name="colorAccent">@color/color_accent</item>
+		<item name="android:alertDialogTheme">@style/Theme.ownCloud.Dialog</item>
     </style>
 
 	<!-- Progress bar -->
@@ -65,6 +67,30 @@
 	<style name="Theme.ownCloud.Dialog" parent="style/Theme.AppCompat.Light.Dialog.Alert">
 		<item name="windowNoTitle">false</item>
 		<item name="colorAccent">@color/owncloud_blue_accent</item>
+		<item name="buttonBarButtonStyle">@style/Theme.ownCloud.Dialog.ButtonBar.Button</item>
+		<item name="buttonBarStyle">@style/Theme.ownCloud.Dialog.ButtonBar</item>
+	</style>
+
+	<!-- Button Bar hack due to Lollipop bug:
+		https://code.google.com/p/android/issues/detail?id=78302
+	fix see:
+		http://stackoverflow.com/questions/27187353/dialog-buttons-with-long-text-not-wrapping-squeezed-out-material-theme-on-an
+	 -->
+	<style name="Theme.ownCloud.Dialog.ButtonBar" parent="style/Widget.AppCompat.Button.ButtonBar.AlertDialog">
+		<!-- Making sure, the button bar uses parent width and is not restricted in height -->
+		<item name="android:layout_width">match_parent</item>
+		<item name="android:layout_height">wrap_content</item>
+		<item name="android:height">@null</item>
+		<item name="android:minHeight">@null</item>
+	</style>
+
+	<style name="Theme.ownCloud.Dialog.ButtonBar.Button" parent="style/Widget.AppCompat.Button.Borderless.Colored">
+		<!-- Setting the weight as follows should result in equally wide buttons filling the alert dialog width,
+            but instead they span further out of the dialog, breaking in multiple lines though -->
+		<item name="android:layout_width">0dp</item>
+		<item name="android:layout_weight">1</item>
+		<!-- setting a fixed width as follows results in narrow buttons with line breaks, but of course this is not a solution -->
+		<!-- <item name="android:width">100dp</item> -->
 	</style>
 	
 	<!-- PopDownMenu -->

+ 1 - 1
src/com/owncloud/android/ui/dialog/ConfirmationDialogFragment.java

@@ -83,7 +83,7 @@ public class ConfirmationDialogFragment extends DialogFragment {
         }
 
         AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.Theme_ownCloud_Dialog)
-            .setIcon(android.R.drawable.ic_dialog_alert)
+            .setIcon(R.drawable.ic_warning)
             .setMessage(String.format(getString(resourceId), confirmationTarget))
             .setTitle(android.R.string.dialog_alert_title);
         if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {