Fix JsExtensions' timeFormat function

master^2
fengyuecanzhu 2 years ago
parent 72cb6bf89c
commit 2b2999eff7
No known key found for this signature in database
GPG Key ID: 04B78AD06A9D6E6C
  1. 7
      app/src/main/java/xyz/fycz/myreader/common/APPCONST.java
  2. 3
      app/src/main/java/xyz/fycz/myreader/model/third3/analyzeRule/JsExtensions.kt

@ -18,6 +18,7 @@
package xyz.fycz.myreader.common; package xyz.fycz.myreader.common;
import android.annotation.SuppressLint;
import android.os.Environment; import android.os.Environment;
import android.provider.Settings; import android.provider.Settings;
@ -31,13 +32,15 @@ import xyz.fycz.myreader.util.utils.FileUtils;
import java.io.File; import java.io.File;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Map; import java.util.Map;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import javax.script.ScriptEngine; import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager; import javax.script.ScriptEngineManager;
@SuppressLint("SimpleDateFormat")
public class APPCONST { public class APPCONST {
public static String publicKey = "fyds2.0";//服务端公钥 public static String publicKey = "fyds2.0";//服务端公钥
@ -163,6 +166,8 @@ public class APPCONST {
public static final String androidId = getAndroidId(); public static final String androidId = getAndroidId();
public static final DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm");
public static String getAndroidId() { public static String getAndroidId() {
return Settings.System.getString(App.getmContext().getContentResolver(), Settings.Secure.ANDROID_ID); return Settings.System.getString(App.getmContext().getContentResolver(), Settings.Secure.ANDROID_ID);
} }

@ -29,6 +29,7 @@ import org.jsoup.Connection
import org.jsoup.Jsoup import org.jsoup.Jsoup
import xyz.fycz.myreader.application.App import xyz.fycz.myreader.application.App
import xyz.fycz.myreader.common.APPCONST 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.CacheManager
import xyz.fycz.myreader.greendao.service.CookieStore import xyz.fycz.myreader.greendao.service.CookieStore
import xyz.fycz.myreader.model.third3.BaseSource import xyz.fycz.myreader.model.third3.BaseSource
@ -265,7 +266,7 @@ interface JsExtensions {
* 时间格式化 * 时间格式化
*/ */
fun timeFormat(time: Long): String { fun timeFormat(time: Long): String {
return SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()).format(Date(time)) return dateFormat.format(Date(time))
} }
/** /**

Loading…
Cancel
Save