浏览代码

Improve appearance of addresses in ImageDetailFragment

Signed-off-by: ZetaTom <70907959+ZetaTom@users.noreply.github.com>
ZetaTom 1 年之前
父节点
当前提交
7212b092d6

+ 2 - 2
app/src/main/java/com/nextcloud/ui/ImageDetailFragment.kt

@@ -130,7 +130,7 @@ class ImageDetailFragment : Fragment(), Injectable {
 
         // detailed file information
         val fileInformation = mutableListOf<String>()
-        if (metadata.length != null && metadata.width != null && metadata.length!! > 0 && metadata.width!! > 0) {
+        if ((metadata.length ?: 0) > 0 && (metadata.width ?: 0) > 0) {
             try {
                 @Suppress("MagicNumber")
                 val pxlCount = when (val res = metadata.length!! * metadata.width!!.toLong()) {
@@ -291,7 +291,7 @@ class ImageDetailFragment : Fragment(), Injectable {
             }
 
             // determine size if not contained in exif data
-            if (width == null || length == null || width <= 0 || length <= 0) {
+            if ((width ?: 0) <= 0 || (length ?: 0) <= 0) {
                 val res = BitmapUtils.getImageResolution(file.storagePath)
                 width = res[0]
                 length = res[1]

+ 6 - 3
app/src/main/res/layout/preview_image_details_fragment.xml

@@ -136,10 +136,13 @@
 
                 <TextView
                     android:id="@+id/imageLocation_text"
-                    android:layout_width="wrap_content"
+                    android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:layout_gravity="center"
-                    android:padding="6dp"
+                    android:ellipsize="end"
+                    android:maxLines="2"
+                    android:paddingHorizontal="12dp"
+                    android:paddingVertical="6dp"
+                    android:textAlignment="center"
                     android:textStyle="bold"
                     android:visibility="gone"
                     tools:text="Mitte, Berlin, Germany"