Bugfix für Lollipop AlertDialog Bug (see styles), moved away from android referenced...
authorAndy Scherzinger <info@andy-scherzinger.de>
Thu, 6 Aug 2015 15:13:00 +0000 (17:13 +0200)
committerAndy Scherzinger <info@andy-scherzinger.de>
Thu, 6 Aug 2015 15:13:00 +0000 (17:13 +0200)
res/drawable-hdpi/ic_warning.png [new file with mode: 0644]
res/drawable-xhdpi/ic_warning.png [new file with mode: 0644]
res/drawable-xxhdpi/ic_warning.png [new file with mode: 0644]
res/values-de-rDE/strings.xml
res/values-de/strings.xml
res/values/styles.xml
src/com/owncloud/android/ui/dialog/ConfirmationDialogFragment.java

diff --git a/res/drawable-hdpi/ic_warning.png b/res/drawable-hdpi/ic_warning.png
new file mode 100644 (file)
index 0000000..14590e5
Binary files /dev/null and b/res/drawable-hdpi/ic_warning.png differ
diff --git a/res/drawable-xhdpi/ic_warning.png b/res/drawable-xhdpi/ic_warning.png
new file mode 100644 (file)
index 0000000..08177e7
Binary files /dev/null and b/res/drawable-xhdpi/ic_warning.png differ
diff --git a/res/drawable-xxhdpi/ic_warning.png b/res/drawable-xxhdpi/ic_warning.png
new file mode 100644 (file)
index 0000000..dc007ee
Binary files /dev/null and b/res/drawable-xxhdpi/ic_warning.png differ
index f22872e..88ee94d 100644 (file)
   <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>
index c9defa9..3ce2b69 100644 (file)
   <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>
index 3282a8d..564278e 100644 (file)
@@ -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 -->
        <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 -->
index 81561b3..1be319f 100644 (file)
@@ -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) {