Bläddra i källkod

Add contentDescription to image editor controls

- reduce bottom margin of image editor control strip

Signed-off-by: ZetaTom <70907959+ZetaTom@users.noreply.github.com>
ZetaTom 2 år sedan
förälder
incheckning
f8430b34a0

+ 9 - 4
app/src/main/java/com/nextcloud/client/editimage/EditImageActivity.kt

@@ -22,6 +22,7 @@ package com.nextcloud.client.editimage
 
 import android.graphics.Bitmap
 import android.net.Uri
+import android.os.Build
 import android.os.Bundle
 import android.view.Menu
 import android.view.MenuItem
@@ -126,11 +127,15 @@ class EditImageActivity: FileActivity(),
 
     override fun onCreateOptionsMenu(menu: Menu?): Boolean {
         menuInflater.inflate(R.menu.custom_menu_placeholder, menu)
-        val saveIcon = AppCompatResources.getDrawable(this, R.drawable.ic_check)
-        if (saveIcon != null) {
-            DrawableCompat.setTint(saveIcon, resources.getColor(R.color.white, theme))
+        val saveIcon = AppCompatResources.getDrawable(this, R.drawable.ic_check)?.also {
+            DrawableCompat.setTint(it, resources.getColor(R.color.white, theme))
+        }
+        menu?.findItem(R.id.custom_menu_placeholder_item)?.apply {
+            icon = saveIcon
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+                contentDescription = getString(R.string.common_save)
+            }
         }
-        menu?.findItem(R.id.custom_menu_placeholder_item)?.setIcon(saveIcon)
         return true
     }
 

+ 5 - 1
app/src/main/res/layout/activity_edit_image.xml

@@ -47,7 +47,7 @@
     <LinearLayout
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_marginBottom="24dp"
+        android:layout_marginBottom="16dp"
         android:background="@drawable/rounded_rect"
         android:elevation="4dp"
         android:orientation="horizontal"
@@ -63,6 +63,7 @@
             android:layout_height="48dp"
             android:layout_weight="1"
             android:background="?android:selectableItemBackgroundBorderless"
+            android:contentDescription="@string/image_editor_rotate_ccw"
             android:paddingLeft="8dp"
             android:paddingRight="8dp"
             app:srcCompat="@drawable/outline_rotate_90_degrees_ccw_24"
@@ -74,6 +75,7 @@
             android:layout_height="48dp"
             android:layout_weight="1"
             android:background="?android:selectableItemBackgroundBorderless"
+            android:contentDescription="@string/image_editor_rotate_cw"
             android:paddingLeft="8dp"
             android:paddingRight="8dp"
             android:rotationY="-180"
@@ -86,6 +88,7 @@
             android:layout_height="48dp"
             android:layout_weight="1"
             android:background="?android:selectableItemBackgroundBorderless"
+            android:contentDescription="@string/image_editor_flip_vertical"
             android:paddingLeft="8dp"
             android:paddingRight="8dp"
             android:rotation="90"
@@ -98,6 +101,7 @@
             android:layout_height="48dp"
             android:layout_weight="1"
             android:background="?android:selectableItemBackgroundBorderless"
+            android:contentDescription="@string/image_editor_flip_horizontal"
             android:paddingLeft="8dp"
             android:paddingRight="8dp"
             app:srcCompat="@drawable/outline_flip_24"

+ 4 - 0
app/src/main/res/values/strings.xml

@@ -1082,4 +1082,8 @@
     <string name="drawer_item_groupfolders">Groupfolders</string>
     <string name="tags_more" translatable="false">+%1$d</string>
     <string name="pdf_password_protected">Unable to open password-protected PDF. Please use an external PDF viewer.</string>
+    <string name="image_editor_rotate_cw">Rotate clockwise</string>
+    <string name="image_editor_rotate_ccw">Rotate anti-clockwise</string>
+    <string name="image_editor_flip_horizontal">Flip horizontally</string>
+    <string name="image_editor_flip_vertical">Flip vertically</string>
 </resources>