Эх сурвалжийг харах

Optimize layout for tags and allowing for tags-multi-line growth of the line item if needed

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Andy Scherzinger 2 жил өмнө
parent
commit
e88ed460e2

BIN
app/screenshots/gplay/debug/com.owncloud.android.ui.activity.UploadFilesActivityIT_localFolderPickerMode.png


BIN
app/screenshots/gplay/debug/com.owncloud.android.ui.activity.UploadFilesActivityIT_noneSelected.png


BIN
app/screenshots/gplay/debug/com.owncloud.android.ui.fragment.OCFileListFragmentStaticServerIT_showFiles.png


BIN
app/screenshots/gplay/debug/com.owncloud.android.ui.fragment.OCFileListFragmentStaticServerIT_showFolderTypes.png


BIN
app/screenshots/gplay/debug/com.owncloud.android.ui.fragment.OCFileListFragmentStaticServerIT_showRichWorkspace.png


BIN
app/screenshots/gplay/debug/com.owncloud.android.ui.fragment.OCFileListFragmentStaticServerIT_showSharedFiles.png


+ 51 - 27
app/src/main/res/layout/list_item.xml

@@ -1,8 +1,10 @@
-<?xml version="1.0" encoding="UTF-8"?><!--
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
   ownCloud Android client application
 
-  Copyright (C) 2012  Bartek Przybylski
   Copyright (C) 2015 ownCloud Inc.
+  Copyright (C) 2012 Bartek Przybylski
+  Copyright (C) 2023 Andy Scherzinger
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 2,
@@ -18,19 +20,22 @@
  -->
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
     android:id="@+id/ListItemLayout"
     android:layout_width="match_parent"
-    android:layout_height="@dimen/standard_list_item_size"
+    android:layout_height="wrap_content"
     android:baselineAligned="false"
     android:descendantFocusability="blocksDescendants"
-    android:orientation="horizontal">
+    android:minHeight="@dimen/standard_list_item_size"
+    android:orientation="horizontal"
+    android:paddingTop="@dimen/standard_half_padding"
+    android:paddingBottom="@dimen/standard_half_padding">
 
     <androidx.constraintlayout.widget.ConstraintLayout
-        android:layout_width="@dimen/standard_list_item_size"
-        android:layout_height="@dimen/standard_list_item_size"
+        android:layout_width="@dimen/min_list_item_size"
+        android:layout_height="@dimen/min_list_item_size"
         android:layout_marginStart="@dimen/zero"
-        android:layout_marginEnd="@dimen/standard_quarter_padding"
-        android:layout_marginBottom="@dimen/standard_padding">
+        android:layout_marginEnd="@dimen/standard_quarter_padding">
 
         <FrameLayout
             android:id="@+id/thumbnail_container"
@@ -73,11 +78,12 @@
 
     <LinearLayout
         android:layout_width="0dp"
-        android:layout_height="match_parent"
+        android:layout_height="wrap_content"
         android:layout_weight="1"
         android:gravity="top"
+        android:minHeight="@dimen/min_list_item_size"
         android:orientation="vertical"
-        android:paddingTop="@dimen/standard_padding">
+        android:paddingTop="@dimen/standard_half_padding">
 
         <TextView
             android:id="@+id/Filename"
@@ -86,9 +92,9 @@
             android:layout_gravity="center_vertical"
             android:ellipsize="middle"
             android:singleLine="true"
-            android:text="@string/placeholder_filename"
             android:textColor="@color/text_color"
-            android:textSize="@dimen/two_line_primary_text_size" />
+            android:textSize="@dimen/two_line_primary_text_size"
+            tools:text="@string/placeholder_filename" />
 
         <LinearLayout
             android:layout_width="match_parent"
@@ -99,43 +105,54 @@
                 android:id="@+id/tagsGroup"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                app:singleLine="true">
+                android:clickable="false"
+                android:paddingTop="@dimen/standard_quarter_padding"
+                app:chipSpacingVertical="@dimen/standard_quarter_padding">
 
                 <com.google.android.material.chip.Chip
                     android:id="@+id/firstTag"
                     android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
+                    android:layout_height="@dimen/tag_height"
                     android:checkable="false"
+                    android:clickable="false"
                     android:ellipsize="middle"
                     android:textColor="@color/list_item_lastmod_and_filesize_text"
                     android:textSize="@dimen/two_line_secondary_text_size"
                     app:chipBackgroundColor="@color/bg_default"
-                    app:chipEndPadding="@dimen/standard_eighth_margin"
-                    app:chipStartPadding="@dimen/standard_eighth_margin" />
+                    app:chipEndPadding="@dimen/zero"
+                    app:chipStartPadding="@dimen/zero"
+                    app:ensureMinTouchTargetSize="false"
+                    tools:text="tag1" />
 
                 <com.google.android.material.chip.Chip
                     android:id="@+id/secondTag"
                     android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
+                    android:layout_height="@dimen/tag_height"
                     android:checkable="false"
+                    android:clickable="false"
                     android:ellipsize="middle"
                     android:textColor="@color/list_item_lastmod_and_filesize_text"
                     android:textSize="@dimen/two_line_secondary_text_size"
                     app:chipBackgroundColor="@color/bg_default"
-                    app:chipEndPadding="@dimen/standard_eighth_margin"
-                    app:chipStartPadding="@dimen/standard_eighth_margin" />
+                    app:chipEndPadding="@dimen/zero"
+                    app:chipStartPadding="@dimen/zero"
+                    app:ensureMinTouchTargetSize="false"
+                    tools:text="tag2" />
 
                 <com.google.android.material.chip.Chip
                     android:id="@+id/tag_more"
                     android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
+                    android:layout_height="@dimen/tag_height"
                     android:checkable="false"
+                    android:clickable="false"
                     android:ellipsize="none"
                     android:textColor="@color/list_item_lastmod_and_filesize_text"
                     android:textSize="@dimen/two_line_secondary_text_size"
                     app:chipBackgroundColor="@color/bg_default"
-                    app:chipEndPadding="@dimen/standard_eighth_margin"
-                    app:chipStartPadding="@dimen/standard_eighth_margin" />
+                    app:chipEndPadding="@dimen/zero"
+                    app:chipStartPadding="@dimen/zero"
+                    app:ensureMinTouchTargetSize="false"
+                    tools:text="+3" />
 
             </com.google.android.material.chip.ChipGroup>
 
@@ -180,7 +197,7 @@
 
     <LinearLayout
         android:layout_width="wrap_content"
-        android:layout_height="match_parent"
+        android:layout_height="wrap_content"
         android:gravity="center_vertical|end"
         android:orientation="horizontal"
         android:paddingStart="@dimen/standard_half_padding"
@@ -201,10 +218,12 @@
         <ImageView
             android:id="@+id/sharedIcon"
             android:layout_width="48dp"
-            android:layout_height="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_gravity="top"
             android:clickable="true"
             android:contentDescription="@string/shared_icon_share"
             android:focusable="true"
+            android:minHeight="@dimen/min_list_item_size"
             android:paddingStart="@dimen/list_item_share_right_margin"
             android:paddingEnd="@dimen/list_item_share_right_margin"
             android:src="@drawable/ic_unshared" />
@@ -212,7 +231,8 @@
         <com.owncloud.android.ui.AvatarGroupLayout
             android:id="@+id/sharedAvatars"
             android:layout_width="100dp"
-            android:layout_height="@dimen/file_icon_size"
+            android:layout_height="@dimen/min_list_item_size"
+            android:layout_gravity="top"
             android:contentDescription="@string/shared_avatar_desc"
             android:gravity="center_vertical"
             android:visibility="visible" />
@@ -220,10 +240,12 @@
         <ImageView
             android:id="@+id/custom_checkbox"
             android:layout_width="wrap_content"
-            android:layout_height="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_gravity="top"
             android:clickable="false"
             android:contentDescription="@string/checkbox"
             android:focusable="false"
+            android:minHeight="@dimen/min_list_item_size"
             android:paddingStart="@dimen/standard_half_padding"
             android:paddingEnd="@dimen/alternate_padding"
             android:src="@drawable/ic_checkbox_blank_outline" />
@@ -231,10 +253,12 @@
         <ImageView
             android:id="@+id/overflow_menu"
             android:layout_width="48dp"
-            android:layout_height="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_gravity="top"
             android:clickable="true"
             android:contentDescription="@string/overflow_menu"
             android:focusable="true"
+            android:minHeight="@dimen/min_list_item_size"
             android:paddingStart="12dp"
             android:paddingEnd="12dp"
             android:src="@drawable/ic_dots_vertical" />

+ 1 - 0
app/src/main/res/values/dims.xml

@@ -151,4 +151,5 @@
     <!--Adaptive Icon size specified here:  https://developer.android.com/develop/ui/views/launch/icon_design_adaptive -->
     <dimen name="adaptive_icon_size">108dp</dimen>
     <dimen name="adaptive_icon_padding">18dp</dimen>
+    <dimen name="tag_height">18dp</dimen>
 </resources>