Browse Source

show modification timestamp and size of file

Bartek Przybylski 13 years ago
parent
commit
e759addf42

+ 30 - 2
res/layout/list_layout.xml

@@ -46,8 +46,10 @@
     </FrameLayout>
 
     <LinearLayout
-        android:layout_width="wrap_content"
-        android:layout_height="match_parent" >
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="vertical" 
+        android:gravity="center_vertical">
 
         <TextView
             android:id="@+id/Filename"
@@ -62,6 +64,32 @@
             android:textColor="#303030"
             android:textSize="16dip" />
 
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="4dp"
+            android:layout_marginRight="4dp"
+            android:weightSum="1">
+
+            <TextView
+                android:id="@+id/last_mod"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="TextView"
+                android:layout_weight=".5"
+                android:textSize="12dip"/>
+
+            <TextView
+                android:id="@+id/file_size"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:gravity="right"
+                android:text="TextView"
+                android:layout_weight=".5"
+                android:textSize="12dip"/>
+
+        </LinearLayout>
+
     </LinearLayout>
 
 </LinearLayout>

+ 10 - 0
src/eu/alefzero/owncloud/ui/adapter/FileListListAdapter.java

@@ -26,6 +26,7 @@ import eu.alefzero.owncloud.datamodel.OCFile;
 
 import android.content.Context;
 import android.database.DataSetObserver;
+import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -114,6 +115,15 @@ public class FileListListAdapter implements ListAdapter {
             else
                 down.setVisibility(View.INVISIBLE);
 
+            if (!file.isDirectory()) {
+                view.findViewById(R.id.file_size).setVisibility(View.VISIBLE);
+                view.findViewById(R.id.last_mod).setVisibility(View.VISIBLE);
+                ((TextView)view.findViewById(R.id.file_size)).setText(DisplayUtils.bytesToHumanReadable(file.getFileLength()));
+                ((TextView)view.findViewById(R.id.last_mod)).setText(DisplayUtils.unixTimeToHumanReadable(file.getModificationTimestamp()));
+            } else {
+               view.findViewById(R.id.file_size).setVisibility(View.GONE);
+               view.findViewById(R.id.last_mod).setVisibility(View.GONE);
+            }
         }
 
         return view;