without a_moment_ago there is no need for a Converter method anymore
This commit is contained in:
parent
52dfc8a9b8
commit
ec1ff07702
|
@ -2,6 +2,7 @@ package de.danoeh.antennapod.adapter;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.text.format.DateUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -72,8 +73,9 @@ public class DefaultFeedItemlistAdapter extends BaseAdapter {
|
|||
holder.title.setText(item.getTitle());
|
||||
holder.published.setText(convertView.getResources().getString(
|
||||
R.string.published_prefix)
|
||||
+ Converter.getRelativeTimeSpanString(context,
|
||||
item.getPubDate().getTime()));
|
||||
+ DateUtils.getRelativeTimeSpanString(
|
||||
item.getPubDate().getTime(),
|
||||
System.currentTimeMillis(), 0, 0));
|
||||
if (item.getMedia() == null) {
|
||||
holder.type.setVisibility(View.GONE);
|
||||
holder.lenSize.setVisibility(View.GONE);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package de.danoeh.antennapod.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.format.DateUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -12,7 +13,6 @@ import de.danoeh.antennapod.feed.Feed;
|
|||
import de.danoeh.antennapod.feed.FeedImage;
|
||||
import de.danoeh.antennapod.feed.FeedManager;
|
||||
import de.danoeh.antennapod.feed.FeedMedia;
|
||||
import de.danoeh.antennapod.util.Converter;
|
||||
import de.danoeh.antennapod.util.DownloadError;
|
||||
|
||||
/** Displays a list of DownloadStatus entries. */
|
||||
|
@ -58,8 +58,9 @@ public class DownloadLogAdapter extends BaseAdapter {
|
|||
} else {
|
||||
holder.title.setText(R.string.download_log_title_unknown);
|
||||
}
|
||||
holder.date.setText(Converter.getRelativeTimeSpanString(context,
|
||||
status.getCompletionDate().getTime()));
|
||||
holder.date.setText(DateUtils.getRelativeTimeSpanString(
|
||||
status.getCompletionDate().getTime(),
|
||||
System.currentTimeMillis(), 0, 0));
|
||||
if (status.isSuccessful()) {
|
||||
holder.successful.setTextColor(convertView.getResources().getColor(
|
||||
R.color.download_success_green));
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package de.danoeh.antennapod.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.format.DateUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -12,7 +13,6 @@ import de.danoeh.antennapod.asynctask.ImageLoader;
|
|||
import de.danoeh.antennapod.feed.Feed;
|
||||
import de.danoeh.antennapod.feed.FeedManager;
|
||||
import de.danoeh.antennapod.storage.DownloadRequester;
|
||||
import de.danoeh.antennapod.util.Converter;
|
||||
import de.danoeh.antennapod.util.ThemeUtils;
|
||||
|
||||
public class FeedlistAdapter extends BaseAdapter {
|
||||
|
@ -82,8 +82,9 @@ public class FeedlistAdapter extends BaseAdapter {
|
|||
if (numOfItems > 0) {
|
||||
holder.lastUpdate.setText(convertView.getResources().getString(
|
||||
R.string.most_recent_prefix)
|
||||
+ Converter.getRelativeTimeSpanString(context,
|
||||
feed.getItemAtIndex(true, 0).getPubDate().getTime()));
|
||||
+ DateUtils.getRelativeTimeSpanString(
|
||||
feed.getItemAtIndex(true, 0).getPubDate().getTime(),
|
||||
System.currentTimeMillis(), 0, 0));
|
||||
}
|
||||
}
|
||||
holder.numberOfEpisodes.setText(numOfItems
|
||||
|
|
|
@ -2,6 +2,7 @@ package de.danoeh.antennapod.adapter;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.text.format.DateUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
|
@ -119,8 +120,9 @@ public class InternalFeedItemlistAdapter extends DefaultFeedItemlistAdapter {
|
|||
|
||||
holder.published.setText(convertView.getResources().getString(
|
||||
R.string.published_prefix)
|
||||
+ Converter.getRelativeTimeSpanString(getContext(),
|
||||
item.getPubDate().getTime()));
|
||||
+ DateUtils.getRelativeTimeSpanString(
|
||||
item.getPubDate().getTime(),
|
||||
System.currentTimeMillis(), 0, 0));
|
||||
|
||||
FeedMedia media = item.getMedia();
|
||||
if (media == null) {
|
||||
|
|
|
@ -3,6 +3,7 @@ package de.danoeh.antennapod.adapter;
|
|||
import java.util.List;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.format.DateUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -10,7 +11,6 @@ import android.widget.ArrayAdapter;
|
|||
import android.widget.TextView;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.miroguide.model.MiroGuideItem;
|
||||
import de.danoeh.antennapod.util.Converter;
|
||||
|
||||
public class MiroGuideItemlistAdapter extends ArrayAdapter<MiroGuideItem> {
|
||||
|
||||
|
@ -41,8 +41,8 @@ public class MiroGuideItemlistAdapter extends ArrayAdapter<MiroGuideItem> {
|
|||
|
||||
holder.title.setText(item.getName());
|
||||
if (item.getDate() != null) {
|
||||
holder.date.setText(Converter.getRelativeTimeSpanString(getContext(),
|
||||
item.getDate().getTime()));
|
||||
holder.date.setText(DateUtils.getRelativeTimeSpanString(
|
||||
item.getDate().getTime(), System.currentTimeMillis(), 0, 0));
|
||||
holder.date.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.date.setVisibility(View.GONE);
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package de.danoeh.antennapod.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.format.DateUtils;
|
||||
import android.util.Log;
|
||||
import de.danoeh.antennapod.R;
|
||||
|
||||
/** Provides methods for converting various units. */
|
||||
public final class Converter {
|
||||
|
@ -82,10 +79,4 @@ public final class Converter {
|
|||
return String.format("%02d:%02d", h, m);
|
||||
}
|
||||
|
||||
/** Converts milliseconds to a relative time span */
|
||||
public static String getRelativeTimeSpanString(Context context, long millis) {
|
||||
long now = System.currentTimeMillis();
|
||||
return DateUtils.getRelativeTimeSpanString(
|
||||
millis, now, 0, 0).toString();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue