Merge pull request #70 from hugomg/relative-times
Use human-readable relative times in LoadGameActivity.
This commit is contained in:
commit
21c2f567ee
1 changed files with 6 additions and 6 deletions
|
@ -26,6 +26,7 @@ import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
import android.text.format.DateUtils;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -260,12 +261,11 @@ public class LoadGameActivity extends BaseActivity implements IDeleteDialogFragm
|
||||||
h = (hours< 10)? "0"+String.valueOf(hours):String.valueOf(hours);
|
h = (hours< 10)? "0"+String.valueOf(hours):String.valueOf(hours);
|
||||||
playedTime.setText(h + ":" + m + ":" + s);
|
playedTime.setText(h + ":" + m + ":" + s);
|
||||||
|
|
||||||
Date lastTimePlayedDate = gic.getLastTimePlayed();
|
long now = System.currentTimeMillis();
|
||||||
|
long lastTimePlayedTimestamp = gic.getLastTimePlayed().getTime();
|
||||||
DateFormat format = DateFormat.getDateTimeInstance();
|
CharSequence humanReadableRelativeTime = DateUtils.getRelativeTimeSpanString(
|
||||||
format.setTimeZone(TimeZone.getDefault());
|
lastTimePlayedTimestamp, now, DateUtils.MINUTE_IN_MILLIS);
|
||||||
|
lastTimePlayed.setText(humanReadableRelativeTime);
|
||||||
lastTimePlayed.setText(format.format(lastTimePlayedDate));
|
|
||||||
|
|
||||||
return convertView;
|
return convertView;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue