mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 23:28:42 +03:00
< 60 seconds -> "seconds ago"
This commit is contained in:
parent
39f7ee996a
commit
2117c024c4
3 changed files with 21 additions and 7 deletions
|
@ -60,6 +60,7 @@
|
|||
<string name="uploader_wrn_no_content_text">No content was received. Nothing to upload.</string>
|
||||
<string name="uploader_error_forbidden_content">%1$s is not allowed to access the shared content</string>
|
||||
<string name="uploader_info_uploading">Uploading</string>
|
||||
<string name="file_list_seconds_ago">seconds ago</string>
|
||||
<string name="file_list_empty">Nothing in here. Upload something!</string>
|
||||
<string name="file_list_loading">Loading...</string>
|
||||
<string name="local_file_list_empty">There are no files in this folder.</string>
|
||||
|
|
|
@ -516,12 +516,7 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
return DisplayUtils.getRelativeDateTimeString(mContext, file.getModificationTimestamp(),
|
||||
DateUtils.SECOND_IN_MILLIS, DateUtils.WEEK_IN_MILLIS, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
package com.owncloud.android.utils;
|
||||
|
||||
import java.sql.Time;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
@ -25,7 +27,12 @@ import java.util.HashMap;
|
|||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.format.DateFormat;
|
||||
import android.text.format.DateUtils;
|
||||
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.lib.common.utils.Log_OC;
|
||||
|
||||
/**
|
||||
* A helper class for some string operations.
|
||||
|
@ -235,4 +242,15 @@ public class DisplayUtils {
|
|||
return R.drawable.icon;
|
||||
}
|
||||
}
|
||||
|
||||
public static CharSequence getRelativeDateTimeString(Context c, long time, long minResolution, long transitionResolution, int flags){
|
||||
if (time > System.currentTimeMillis()){
|
||||
return DisplayUtils.unixTimeToHumanReadable(time);
|
||||
} else if ((System.currentTimeMillis() - time) < 60000) {
|
||||
return c.getString(R.string.file_list_seconds_ago) + ", " +
|
||||
DateFormat.getTimeFormat(c).format(new Date(time));
|
||||
} else {
|
||||
return DateUtils.getRelativeDateTimeString(c, time, minResolution, transitionResolution, flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue