Merge branch 'last-repo-update' of https://gitlab.com/relan/fdroidclient

This commit is contained in:
Daniel Martí 2015-10-07 10:10:27 +02:00
commit cebf82e7e3
2 changed files with 12 additions and 4 deletions

View File

@ -75,7 +75,8 @@ public final class Utils {
// The date format used for storing dates (e.g. lastupdated, added) in the
// database.
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH);
private static final SimpleDateFormat DATE_FORMAT =
new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss", Locale.ENGLISH);
private static final String[] FRIENDLY_SIZE_FORMAT = {
"%.0f B", "%.0f KiB", "%.1f MiB", "%.2f GiB" };

View File

@ -16,6 +16,7 @@ import android.support.v4.app.NavUtils;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.AlertDialog;
import android.text.format.DateUtils;
import android.text.TextUtils;
import android.view.Menu;
import android.view.MenuItem;
@ -303,9 +304,15 @@ public class RepoDetailsActivity extends ActionBarActivity {
// Repos that existed before this feature was supported will have an
// "Unknown" last update until next time they update...
String lastUpdate = repo.lastUpdated != null
? repo.lastUpdated.toString() : getString(R.string.unknown);
lastUpdated.setText(lastUpdate);
if (repo.lastUpdated == null) {
lastUpdated.setText(R.string.unknown);
} else {
int format = DateUtils.isToday(repo.lastUpdated.getTime()) ?
DateUtils.FORMAT_SHOW_TIME :
DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE;
lastUpdated.setText(DateUtils.formatDateTime(this,
repo.lastUpdated.getTime(), format));
}
}
private void promptForDelete() {