Browse Source

fix upload list

Signed-off-by: tobiaskaminsky <tobias@kaminsky.me>
tobiaskaminsky 7 years ago
parent
commit
a2fac73af3

+ 6 - 2
src/main/java/com/owncloud/android/ui/adapter/UploadListAdapter.java

@@ -163,7 +163,7 @@ public class UploadListAdapter extends SectionedRecyclerViewAdapter<SectionedVie
             itemViewHolder.fileSize.setText("");
             itemViewHolder.fileSize.setText("");
         }
         }
 
 
-        //* upload date
+        // upload date
         long updateTime = item.getUploadEndTimestamp();
         long updateTime = item.getUploadEndTimestamp();
         CharSequence dateString = DisplayUtils.getRelativeDateTimeString(mParentActivity, updateTime,
         CharSequence dateString = DisplayUtils.getRelativeDateTimeString(mParentActivity, updateTime,
                 DateUtils.SECOND_IN_MILLIS, DateUtils.WEEK_IN_MILLIS, 0);
                 DateUtils.SECOND_IN_MILLIS, DateUtils.WEEK_IN_MILLIS, 0);
@@ -226,7 +226,11 @@ public class UploadListAdapter extends SectionedRecyclerViewAdapter<SectionedVie
                 itemViewHolder.progressBar.invalidate();
                 itemViewHolder.progressBar.invalidate();
                 break;
                 break;
 
 
-            default:
+            case UPLOAD_FAILED:
+                itemViewHolder.date.setVisibility(View.GONE);
+                break;
+
+            case UPLOAD_SUCCEEDED:
                 itemViewHolder.status.setVisibility(View.GONE);
                 itemViewHolder.status.setVisibility(View.GONE);
                 break;
                 break;
         }
         }

+ 1 - 1
src/main/java/com/owncloud/android/utils/DisplayUtils.java

@@ -283,7 +283,7 @@ public class DisplayUtils {
             fallbackString) {
             fallbackString) {
         try {
         try {
             return new OwnCloudAccount(savedAccount, context).getDisplayName()
             return new OwnCloudAccount(savedAccount, context).getDisplayName()
-                    + " @ "
+                    + "@"
                     + convertIdn(accountName.substring(accountName.lastIndexOf('@') + 1), false);
                     + convertIdn(accountName.substring(accountName.lastIndexOf('@') + 1), false);
         } catch (Exception e) {
         } catch (Exception e) {
             Log_OC.w(TAG, "Couldn't get display name for account, using old style");
             Log_OC.w(TAG, "Couldn't get display name for account, using old style");

+ 29 - 9
src/main/res/layout/upload_list_header.xml

@@ -1,16 +1,36 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  Nextcloud Android client application
+
+  Copyright (C) 2018 Tobias Kaminsky
+  Copyright (C) 2018 Nextcloud
+
+  This program is free software; you can redistribute it and/or
+  modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+  License as published by the Free Software Foundation; either
+  version 3 of the License, or any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+
+  You should have received a copy of the GNU Affero General Public
+  License along with this program.  If not, see <http://www.gnu.org/licenses/>.
+-->
+
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-              android:id="@+id/ListItemLayout"
-              android:layout_width="match_parent"
-              android:orientation="horizontal"
-              android:layout_height="wrap_content"
-              android:paddingTop="@dimen/standard_half_padding"
-              android:paddingBottom="@dimen/standard_half_padding"
-    >
+    android:id="@+id/ListItemLayout"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="horizontal"
+    android:paddingBottom="@dimen/standard_half_padding"
+    android:paddingTop="@dimen/standard_half_padding">
 
 
     <TextView
     <TextView
+        android:id="@+id/upload_list_title"
         android:layout_width="wrap_content"
         android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:id="@+id/upload_list_title"/>
+        android:layout_height="wrap_content" />
 
 
 </LinearLayout>
 </LinearLayout>

+ 55 - 32
src/main/res/layout/upload_list_item.xml

@@ -1,12 +1,32 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  Nextcloud Android client application
+
+  Copyright (C) 2018 Tobias Kaminsky
+  Copyright (C) 2018 Nextcloud
+
+  This program is free software; you can redistribute it and/or
+  modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+  License as published by the Free Software Foundation; either
+  version 3 of the License, or any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+
+  You should have received a copy of the GNU Affero General Public
+  License along with this program.  If not, see <http://www.gnu.org/licenses/>.
+-->
+
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-              android:id="@+id/upload_list_item_layout"
-              android:layout_width="match_parent"
-              android:orientation="horizontal"
-              android:layout_height="wrap_content"
-              android:paddingTop="@dimen/standard_half_padding"
-              android:paddingBottom="@dimen/standard_half_padding"
-    >
+    android:id="@+id/upload_list_item_layout"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="horizontal"
+    android:paddingBottom="@dimen/standard_half_padding"
+    android:paddingTop="@dimen/standard_half_padding">
 
 
     <FrameLayout
     <FrameLayout
         android:layout_width="@dimen/upload_list_item_frame_layout_width"
         android:layout_width="@dimen/upload_list_item_frame_layout_width"
@@ -19,18 +39,18 @@
             android:layout_width="@dimen/file_icon_size"
             android:layout_width="@dimen/file_icon_size"
             android:layout_height="@dimen/file_icon_size"
             android:layout_height="@dimen/file_icon_size"
             android:layout_gravity="center"
             android:layout_gravity="center"
-            android:src="@drawable/folder"
-            android:contentDescription="@string/thumbnail"/>
-  
+            android:contentDescription="@string/thumbnail"
+            android:src="@drawable/folder" />
+
     </FrameLayout>
     </FrameLayout>
 
 
     <LinearLayout
     <LinearLayout
         android:layout_width="0dp"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
         android:layout_height="wrap_content"
+        android:layout_gravity="center_vertical"
         android:layout_weight="1"
         android:layout_weight="1"
         android:gravity="center_vertical"
         android:gravity="center_vertical"
-        android:layout_gravity="center_vertical"
-        android:orientation="vertical" >
+        android:orientation="vertical">
 
 
         <TextView
         <TextView
             android:id="@+id/upload_name"
             android:id="@+id/upload_name"
@@ -39,40 +59,43 @@
             android:layout_gravity="center_vertical"
             android:layout_gravity="center_vertical"
             android:ellipsize="middle"
             android:ellipsize="middle"
             android:singleLine="true"
             android:singleLine="true"
-            android:textColor="@color/textColor"
             android:text="@string/placeholder_filename"
             android:text="@string/placeholder_filename"
+            android:textColor="@color/textColor"
             android:textSize="@dimen/two_line_primary_text_size" />
             android:textSize="@dimen/two_line_primary_text_size" />
 
 
 
 
         <LinearLayout
         <LinearLayout
             android:layout_width="match_parent"
             android:layout_width="match_parent"
             android:layout_height="wrap_content">
             android:layout_height="wrap_content">
+
             <TextView
             <TextView
                 android:id="@+id/upload_file_size"
                 android:id="@+id/upload_file_size"
                 android:layout_width="wrap_content"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_height="wrap_content"
-                android:gravity="start"
-                android:textColor="@color/list_item_lastmod_and_filesize_text"
                 android:ellipsize="middle"
                 android:ellipsize="middle"
+                android:gravity="start"
                 android:singleLine="true"
                 android:singleLine="true"
                 android:text="@string/placeholder_fileSize"
                 android:text="@string/placeholder_fileSize"
-                android:textSize="@dimen/upload_list_item_text_size"/>
+                android:textColor="@color/list_item_lastmod_and_filesize_text"
+                android:textSize="@dimen/upload_list_item_text_size" />
+
             <TextView
             <TextView
                 android:id="@+id/upload_date"
                 android:id="@+id/upload_date"
                 android:layout_width="wrap_content"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_height="wrap_content"
-                android:textColor="@color/list_item_lastmod_and_filesize_text"
-                android:layout_marginStart="@dimen/standard_quarter_margin"
                 android:layout_marginEnd="@dimen/standard_quarter_margin"
                 android:layout_marginEnd="@dimen/standard_quarter_margin"
+                android:layout_marginStart="@dimen/standard_quarter_margin"
                 android:text="@string/placeholder_timestamp"
                 android:text="@string/placeholder_timestamp"
-                android:textSize="@dimen/upload_list_item_text_size"/>
+                android:textColor="@color/list_item_lastmod_and_filesize_text"
+                android:textSize="@dimen/upload_list_item_text_size" />
+
             <TextView
             <TextView
                 android:id="@+id/upload_status"
                 android:id="@+id/upload_status"
                 android:layout_width="wrap_content"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_height="wrap_content"
-                android:textColor="@color/list_item_lastmod_and_filesize_text"
                 android:text="@string/uploads_view_upload_status_succeeded"
                 android:text="@string/uploads_view_upload_status_succeeded"
-                android:textSize="@dimen/upload_list_item_text_size"/>
+                android:textColor="@color/list_item_lastmod_and_filesize_text"
+                android:textSize="@dimen/upload_list_item_text_size" />
 
 
         </LinearLayout>
         </LinearLayout>
 
 
@@ -81,39 +104,39 @@
             style="?android:attr/progressBarStyleHorizontal"
             style="?android:attr/progressBarStyleHorizontal"
             android:layout_width="match_parent"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_height="wrap_content"
-            android:visibility="gone"/>
+            android:visibility="gone" />
 
 
         <TextView
         <TextView
             android:id="@+id/upload_account"
             android:id="@+id/upload_account"
             android:layout_width="wrap_content"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_height="wrap_content"
-            android:textColor="@color/list_item_lastmod_and_filesize_text"
             android:maxLines="1"
             android:maxLines="1"
             android:text="@string/auth_username"
             android:text="@string/auth_username"
-            android:textSize="@dimen/upload_list_item_text_size"/>
+            android:textColor="@color/list_item_lastmod_and_filesize_text"
+            android:textSize="@dimen/upload_list_item_text_size" />
 
 
         <TextView
         <TextView
             android:id="@+id/upload_remote_path"
             android:id="@+id/upload_remote_path"
             android:layout_width="wrap_content"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_height="wrap_content"
-            android:textColor="@color/list_item_lastmod_and_filesize_text"
             android:ellipsize="middle"
             android:ellipsize="middle"
             android:singleLine="true"
             android:singleLine="true"
             android:text="@string/instant_upload_path"
             android:text="@string/instant_upload_path"
-            android:textSize="@dimen/upload_list_item_text_size"/>
+            android:textColor="@color/list_item_lastmod_and_filesize_text"
+            android:textSize="@dimen/upload_list_item_text_size" />
 
 
     </LinearLayout>
     </LinearLayout>
-    
+
     <FrameLayout
     <FrameLayout
         android:layout_width="@dimen/min_list_item_size"
         android:layout_width="@dimen/min_list_item_size"
         android:layout_height="@dimen/standard_list_item_size"
         android:layout_height="@dimen/standard_list_item_size"
+        android:layout_gravity="center_vertical"
         android:focusable="false"
         android:focusable="false"
         android:focusableInTouchMode="false"
         android:focusableInTouchMode="false"
-        android:layout_gravity="center_vertical"
+        android:paddingEnd="@dimen/zero"
         android:paddingLeft="@dimen/standard_half_padding"
         android:paddingLeft="@dimen/standard_half_padding"
-        android:paddingStart="@dimen/standard_half_padding"
         android:paddingRight="@dimen/zero"
         android:paddingRight="@dimen/zero"
-        android:paddingEnd="@dimen/zero">
+        android:paddingStart="@dimen/standard_half_padding">
 
 
         <ImageButton
         <ImageButton
             android:id="@+id/upload_right_button"
             android:id="@+id/upload_right_button"
@@ -121,7 +144,7 @@
             android:layout_height="@dimen/upload_list_item_image_size"
             android:layout_height="@dimen/upload_list_item_image_size"
             android:layout_gravity="center"
             android:layout_gravity="center"
             android:background="@android:color/transparent"
             android:background="@android:color/transparent"
-            android:contentDescription="@string/upload_item_action_button"/>
-	</FrameLayout>
+            android:contentDescription="@string/upload_item_action_button" />
+    </FrameLayout>
 
 
 </LinearLayout>
 </LinearLayout>

+ 9 - 16
src/main/res/layout/upload_list_layout.xml

@@ -18,19 +18,18 @@
   -->
   -->
 <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
 <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
                                         xmlns:app="http://schemas.android.com/apk/res-auto"
                                         xmlns:app="http://schemas.android.com/apk/res-auto"
-                                        xmlns:tools="http://schemas.android.com/tools"
                                         android:id="@+id/drawer_layout"
                                         android:id="@+id/drawer_layout"
                                         android:layout_width="match_parent"
                                         android:layout_width="match_parent"
                                         android:layout_height="match_parent"
                                         android:layout_height="match_parent"
                                         android:clickable="true"
                                         android:clickable="true"
                                         android:fitsSystemWindows="true"
                                         android:fitsSystemWindows="true"
-                                        tools:openDrawer="start">
+    android:focusable="true">
 
 
-    <android.support.design.widget.CoordinatorLayout 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:layout_width="match_parent"
-                                                     android:layout_height="match_parent">
+    <!-- The main content view -->
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="vertical">
 
 
         <include
         <include
             android:id="@+id/navigation_bar"
             android:id="@+id/navigation_bar"
@@ -51,15 +50,9 @@
 
 
                 <com.owncloud.android.ui.EmptyRecyclerView
                 <com.owncloud.android.ui.EmptyRecyclerView
                     android:id="@android:id/list"
                     android:id="@android:id/list"
+                    android:padding="@dimen/standard_half_padding"
                     android:layout_width="match_parent"
                     android:layout_width="match_parent"
-                    android:layout_height="match_parent"
-                    android:layout_marginBottom="-3dp"
-                    android:layout_marginLeft="-3dp"
-                    android:layout_marginRight="-3dp"
-                    android:clipToPadding="false"
-                    android:scrollbarStyle="outsideOverlay"
-                    android:scrollbars="vertical"
-                    android:visibility="visible"/>
+                    android:layout_height="match_parent" />
 
 
             </android.support.v4.widget.SwipeRefreshLayout>
             </android.support.v4.widget.SwipeRefreshLayout>
 
 
@@ -78,7 +71,7 @@
             app:itemTextColor="@color/primary_button_text_color"
             app:itemTextColor="@color/primary_button_text_color"
             app:menu="@menu/navigation_bar_menu"/>
             app:menu="@menu/navigation_bar_menu"/>
 
 
-    </android.support.design.widget.CoordinatorLayout>
+    </RelativeLayout>
 
 
     <include
     <include
         layout="@layout/drawer"
         layout="@layout/drawer"