Show proper time of repo updates

This commit is contained in:
topjohnwu 2018-08-02 01:21:16 +08:00
parent 9ac71ff8af
commit 27e0d1641a
2 changed files with 9 additions and 4 deletions

View File

@ -31,6 +31,7 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.TimeZone;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -40,9 +41,15 @@ public class UpdateRepos {
private static final int CHECK_ETAG = 0; private static final int CHECK_ETAG = 0;
private static final int LOAD_NEXT = 1; private static final int LOAD_NEXT = 1;
private static final int LOAD_PREV = 2; private static final int LOAD_PREV = 2;
private static final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US);
private static final int CPU_COUNT = Runtime.getRuntime().availableProcessors(); private static final int CPU_COUNT = Runtime.getRuntime().availableProcessors();
private static final int CORE_POOL_SIZE = Math.max(2, CPU_COUNT - 1); private static final int CORE_POOL_SIZE = Math.max(2, CPU_COUNT - 1);
private static final DateFormat dateFormat;
static {
dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US);
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
}
private MagiskManager mm; private MagiskManager mm;
private List<String> etags, newEtags; private List<String> etags, newEtags;

View File

@ -4,7 +4,6 @@ import android.content.ContentValues;
import android.database.Cursor; import android.database.Cursor;
import com.topjohnwu.magisk.Const; import com.topjohnwu.magisk.Const;
import com.topjohnwu.magisk.utils.LocaleManager;
import com.topjohnwu.magisk.utils.Logger; import com.topjohnwu.magisk.utils.Logger;
import com.topjohnwu.magisk.utils.Utils; import com.topjohnwu.magisk.utils.Utils;
import com.topjohnwu.magisk.utils.WebService; import com.topjohnwu.magisk.utils.WebService;
@ -76,8 +75,7 @@ public class Repo extends BaseModule {
} }
public String getLastUpdateString() { public String getLastUpdateString() {
return DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, return DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM).format(mLastUpdate);
LocaleManager.locale).format(mLastUpdate);
} }
public Date getLastUpdate() { public Date getLastUpdate() {