mirror of
https://framagit.org/tom79/fedilab-tube
synced 2025-06-05 21:09:11 +02:00
Improve time for videos
This commit is contained in:
@ -90,7 +90,7 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
||||
Helper.loadGiF(context, peertube.getChannel(), holder.peertube_profile);
|
||||
}
|
||||
holder.peertube_title.setText(peertube.getName());
|
||||
holder.peertube_duration.setText(context.getString(R.string.duration_video, Helper.secondsToString(peertube.getDuration())));
|
||||
holder.peertube_duration.setText(Helper.secondsToString(peertube.getDuration()));
|
||||
holder.peertube_date.setText(String.format(" - %s", Helper.dateDiff(context, peertube.getCreated_at())));
|
||||
holder.peertube_views.setText(context.getString(R.string.number_view_video, Helper.withSuffix(peertube.getView())));
|
||||
|
||||
|
@ -361,12 +361,12 @@ public class Helper {
|
||||
long months = days / 30;
|
||||
long years = days / 365;
|
||||
|
||||
String format = DateFormat.getDateInstance(DateFormat.SHORT).format(dateToot);
|
||||
String format = DateFormat.getDateInstance(DateFormat.LONG).format(dateToot);
|
||||
if (years > 0) {
|
||||
return format;
|
||||
} else if (months > 0 || days > 7) {
|
||||
//Removes the year depending of the locale from DateFormat.SHORT format
|
||||
SimpleDateFormat df = (SimpleDateFormat) DateFormat.getDateInstance(DateFormat.SHORT, Locale.getDefault());
|
||||
SimpleDateFormat df = (SimpleDateFormat) DateFormat.getDateInstance(DateFormat.LONG, Locale.getDefault());
|
||||
df.applyPattern(df.toPattern().replaceAll("[^\\p{Alpha}]*y+[^\\p{Alpha}]*", ""));
|
||||
return df.format(dateToot);
|
||||
} else if (days > 0)
|
||||
|
Reference in New Issue
Block a user