From 2b2999eff7922dae9604bee3ead1a7515374aee8 Mon Sep 17 00:00:00 2001 From: fengyuecanzhu <1021300691@qq.com> Date: Wed, 3 Aug 2022 13:26:05 +0800 Subject: [PATCH] Fix JsExtensions' timeFormat function --- app/src/main/java/xyz/fycz/myreader/common/APPCONST.java | 7 ++++++- .../fycz/myreader/model/third3/analyzeRule/JsExtensions.kt | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/xyz/fycz/myreader/common/APPCONST.java b/app/src/main/java/xyz/fycz/myreader/common/APPCONST.java index 0250f26..28f3340 100644 --- a/app/src/main/java/xyz/fycz/myreader/common/APPCONST.java +++ b/app/src/main/java/xyz/fycz/myreader/common/APPCONST.java @@ -18,6 +18,7 @@ package xyz.fycz.myreader.common; +import android.annotation.SuppressLint; import android.os.Environment; import android.provider.Settings; @@ -31,13 +32,15 @@ import xyz.fycz.myreader.util.utils.FileUtils; import java.io.File; import java.lang.reflect.Type; +import java.text.DateFormat; +import java.text.SimpleDateFormat; import java.util.Map; import java.util.regex.Pattern; import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; - +@SuppressLint("SimpleDateFormat") public class APPCONST { public static String publicKey = "fyds2.0";//服务端公钥 @@ -163,6 +166,8 @@ public class APPCONST { public static final String androidId = getAndroidId(); + public static final DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm"); + public static String getAndroidId() { return Settings.System.getString(App.getmContext().getContentResolver(), Settings.Secure.ANDROID_ID); } diff --git a/app/src/main/java/xyz/fycz/myreader/model/third3/analyzeRule/JsExtensions.kt b/app/src/main/java/xyz/fycz/myreader/model/third3/analyzeRule/JsExtensions.kt index 4080c7c..948c090 100644 --- a/app/src/main/java/xyz/fycz/myreader/model/third3/analyzeRule/JsExtensions.kt +++ b/app/src/main/java/xyz/fycz/myreader/model/third3/analyzeRule/JsExtensions.kt @@ -29,6 +29,7 @@ import org.jsoup.Connection import org.jsoup.Jsoup import xyz.fycz.myreader.application.App import xyz.fycz.myreader.common.APPCONST +import xyz.fycz.myreader.common.APPCONST.dateFormat import xyz.fycz.myreader.greendao.service.CacheManager import xyz.fycz.myreader.greendao.service.CookieStore import xyz.fycz.myreader.model.third3.BaseSource @@ -265,7 +266,7 @@ interface JsExtensions { * 时间格式化 */ fun timeFormat(time: Long): String { - return SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()).format(Date(time)) + return dateFormat.format(Date(time)) } /**