show modification timestamp and size of file

This commit is contained in:
Bartek Przybylski 2012-05-26 14:56:30 +02:00
parent edd38b807d
commit e759addf42
2 changed files with 40 additions and 2 deletions

View file

@ -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>

View file

@ -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;