mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 23:28:42 +03:00
fix scenario 1
This commit is contained in:
parent
56d9529b14
commit
39f7ee996a
1 changed files with 14 additions and 5 deletions
|
@ -47,6 +47,7 @@ import com.owncloud.android.datamodel.ThumbnailsCacheManager;
|
|||
import com.owncloud.android.datamodel.ThumbnailsCacheManager.AsyncDrawable;
|
||||
import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder;
|
||||
import com.owncloud.android.files.services.FileUploader.FileUploaderBinder;
|
||||
import com.owncloud.android.lib.common.utils.Log_OC;
|
||||
import com.owncloud.android.ui.activity.ComponentsGetter;
|
||||
import com.owncloud.android.utils.DisplayUtils;
|
||||
import com.owncloud.android.utils.FileStorageUtils;
|
||||
|
@ -182,8 +183,7 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
|
|||
fileSizeV.setVisibility(View.VISIBLE);
|
||||
fileSizeV.setText(DisplayUtils.bytesToHumanReadable(file.getFileLength()));
|
||||
lastModV.setVisibility(View.VISIBLE);
|
||||
lastModV.setText(DateUtils.getRelativeDateTimeString(mContext, file.getModificationTimestamp(),
|
||||
DateUtils.SECOND_IN_MILLIS, DateUtils.WEEK_IN_MILLIS, 0));
|
||||
lastModV.setText(showRelativeTimestamp(file));
|
||||
// this if-else is needed even thoe fav icon is visible by default
|
||||
// because android reuses views in listview
|
||||
if (!file.keepInSync()) {
|
||||
|
@ -251,8 +251,7 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
|
|||
// }
|
||||
|
||||
lastModV.setVisibility(View.VISIBLE);
|
||||
lastModV.setText(DateUtils.getRelativeDateTimeString(mContext, file.getModificationTimestamp(),
|
||||
DateUtils.SECOND_IN_MILLIS, DateUtils.WEEK_IN_MILLIS, 0));
|
||||
lastModV.setText(showRelativeTimestamp(file));
|
||||
checkBoxV.setVisibility(View.GONE);
|
||||
view.findViewById(R.id.imageView3).setVisibility(View.GONE);
|
||||
|
||||
|
@ -514,5 +513,15 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
|
|||
mSortAscending = ascending;
|
||||
|
||||
sortDirectory();
|
||||
}
|
||||
}
|
||||
|
||||
private CharSequence showRelativeTimestamp(OCFile file){
|
||||
Log_OC.d("Timestamp", "File: " + file.getModificationTimestamp() + " system: " + System.currentTimeMillis());
|
||||
if (file.getModificationTimestamp() > System.currentTimeMillis()){
|
||||
return DisplayUtils.unixTimeToHumanReadable(file.getModificationTimestamp());
|
||||
} else {
|
||||
return DateUtils.getRelativeDateTimeString(mContext, file.getModificationTimestamp(),
|
||||
DateUtils.SECOND_IN_MILLIS, DateUtils.WEEK_IN_MILLIS, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue