mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 17:46:37 +03:00
layouting changes so file list, local list and uploader list look the same
This commit is contained in:
parent
8c863a642b
commit
0db0ab1fd5
5 changed files with 62 additions and 18 deletions
|
@ -19,7 +19,7 @@
|
||||||
-->
|
-->
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="56dp"
|
android:layout_height="72dp"
|
||||||
android:background="@drawable/list_selector"
|
android:background="@drawable/list_selector"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="72dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_marginLeft="4dp"
|
android:layout_marginLeft="0dp"
|
||||||
android:layout_marginRight="4dp"
|
android:layout_marginRight="4dp"
|
||||||
android:ellipsize="middle"
|
android:ellipsize="middle"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
|
@ -51,15 +51,40 @@
|
||||||
android:textColor="@color/textColor"
|
android:textColor="@color/textColor"
|
||||||
android:textSize="16dip" />
|
android:textSize="16dip" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="0dp"
|
||||||
|
android:layout_marginRight="4dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/file_size"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Size MB"
|
||||||
|
android:textColor="@color/list_item_lastmod_and_filesize_text"
|
||||||
|
android:textSize="@dimen/two_line_secondary_text_size"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/file_separator"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="right"
|
||||||
|
android:text=", "
|
||||||
|
android:textColor="@color/list_item_lastmod_and_filesize_text"
|
||||||
|
android:textSize="@dimen/two_line_secondary_text_size"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/last_mod"
|
android:id="@+id/last_mod"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="4dp"
|
android:gravity="right"
|
||||||
android:layout_marginRight="4dp"
|
android:text="Mod Date"
|
||||||
android:text="TextView"
|
|
||||||
android:textColor="@color/list_item_lastmod_and_filesize_text"
|
android:textColor="@color/list_item_lastmod_and_filesize_text"
|
||||||
android:textSize="12dip" />
|
android:textSize="@dimen/two_line_secondary_text_size"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -191,7 +191,7 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
|
||||||
ImageView checkBoxV = (ImageView) view.findViewById(R.id.custom_checkbox);
|
ImageView checkBoxV = (ImageView) view.findViewById(R.id.custom_checkbox);
|
||||||
|
|
||||||
lastModV.setVisibility(View.VISIBLE);
|
lastModV.setVisibility(View.VISIBLE);
|
||||||
lastModV.setText(DisplayUtils.getRelativeTimestamp(mContext, file));
|
lastModV.setText(DisplayUtils.getRelativeTimestamp(mContext, file.getModificationTimestamp()));
|
||||||
|
|
||||||
checkBoxV.setVisibility(View.GONE);
|
checkBoxV.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
|
|
@ -124,13 +124,14 @@ public class LocalFileListAdapter extends BaseAdapter implements ListAdapter {
|
||||||
TextView fileSizeSeparatorV = (TextView) view.findViewById(R.id.file_separator);
|
TextView fileSizeSeparatorV = (TextView) view.findViewById(R.id.file_separator);
|
||||||
TextView lastModV = (TextView) view.findViewById(R.id.last_mod);
|
TextView lastModV = (TextView) view.findViewById(R.id.last_mod);
|
||||||
ImageView checkBoxV = (ImageView) view.findViewById(R.id.custom_checkbox);
|
ImageView checkBoxV = (ImageView) view.findViewById(R.id.custom_checkbox);
|
||||||
|
lastModV.setVisibility(View.VISIBLE);
|
||||||
|
lastModV.setText(DisplayUtils.getRelativeTimestamp(mContext, file.lastModified()));
|
||||||
|
|
||||||
if (!file.isDirectory()) {
|
if (!file.isDirectory()) {
|
||||||
fileSizeSeparatorV.setVisibility(View.VISIBLE);
|
fileSizeSeparatorV.setVisibility(View.VISIBLE);
|
||||||
fileSizeV.setVisibility(View.VISIBLE);
|
fileSizeV.setVisibility(View.VISIBLE);
|
||||||
fileSizeV.setText(DisplayUtils.bytesToHumanReadable(file.length()));
|
fileSizeV.setText(DisplayUtils.bytesToHumanReadable(file.length()));
|
||||||
|
|
||||||
lastModV.setVisibility(View.VISIBLE);
|
|
||||||
lastModV.setText(DisplayUtils.unixTimeToHumanReadable(file.lastModified()));
|
|
||||||
ListView parentList = (ListView) parent;
|
ListView parentList = (ListView) parent;
|
||||||
if (parentList.getChoiceMode() == ListView.CHOICE_MODE_NONE) {
|
if (parentList.getChoiceMode() == ListView.CHOICE_MODE_NONE) {
|
||||||
checkBoxV.setVisibility(View.GONE);
|
checkBoxV.setVisibility(View.GONE);
|
||||||
|
@ -179,7 +180,6 @@ public class LocalFileListAdapter extends BaseAdapter implements ListAdapter {
|
||||||
} else {
|
} else {
|
||||||
fileSizeSeparatorV.setVisibility(View.GONE);
|
fileSizeSeparatorV.setVisibility(View.GONE);
|
||||||
fileSizeV.setVisibility(View.GONE);
|
fileSizeV.setVisibility(View.GONE);
|
||||||
lastModV.setVisibility(View.GONE);
|
|
||||||
checkBoxV.setVisibility(View.GONE);
|
checkBoxV.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,19 @@ public class UploaderAdapter extends SimpleAdapter {
|
||||||
fileIcon.setTag(file.getFileId());
|
fileIcon.setTag(file.getFileId());
|
||||||
|
|
||||||
TextView lastModV = (TextView) vi.findViewById(R.id.last_mod);
|
TextView lastModV = (TextView) vi.findViewById(R.id.last_mod);
|
||||||
lastModV.setText(DisplayUtils.getRelativeTimestamp(mContext, file));
|
lastModV.setText(DisplayUtils.getRelativeTimestamp(mContext, file.getModificationTimestamp()));
|
||||||
|
|
||||||
|
TextView fileSizeV = (TextView) vi.findViewById(R.id.file_size);
|
||||||
|
TextView fileSizeSeparatorV = (TextView) vi.findViewById(R.id.file_separator);
|
||||||
|
|
||||||
|
if(!file.isFolder()) {
|
||||||
|
fileSizeV.setVisibility(View.VISIBLE);
|
||||||
|
fileSizeSeparatorV.setVisibility(View.VISIBLE);
|
||||||
|
fileSizeV.setText(DisplayUtils.bytesToHumanReadable(file.getFileLength()));
|
||||||
|
} else {
|
||||||
|
fileSizeV.setVisibility(View.GONE);
|
||||||
|
fileSizeSeparatorV.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
// get Thumbnail if file is image
|
// get Thumbnail if file is image
|
||||||
if (file.isImage() && file.getRemoteId() != null){
|
if (file.isImage() && file.getRemoteId() != null){
|
||||||
|
|
|
@ -172,9 +172,16 @@ public class DisplayUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CharSequence getRelativeTimestamp(Context context, OCFile file) {
|
/**
|
||||||
return getRelativeDateTimeString(context, file.getModificationTimestamp(),
|
* calculates the relative time string based on the given modificaion timestamp.
|
||||||
DateUtils.SECOND_IN_MILLIS, DateUtils.WEEK_IN_MILLIS, 0);
|
*
|
||||||
|
* @param context the app's context
|
||||||
|
* @param modificationTimestamp the UNIX timestamp of the file modification time.
|
||||||
|
* @return a relative time string
|
||||||
|
*/
|
||||||
|
public static CharSequence getRelativeTimestamp(Context context, long modificationTimestamp) {
|
||||||
|
return getRelativeDateTimeString(context, modificationTimestamp, DateUtils.SECOND_IN_MILLIS,
|
||||||
|
DateUtils.WEEK_IN_MILLIS, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
|
|
Loading…
Reference in a new issue