diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index 002ef3b..537dee3 100644 Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ diff --git a/README.md b/README.md index abace64..bf70ed6 100644 --- a/README.md +++ b/README.md @@ -2,16 +2,18 @@ 风月读书,一款开源、无广告的小说阅读软件。 -成品下载:[https://fycz.lanzoui.com/ib8ZJivckmd](https://fycz.lanzoui.com/ib8ZJivckmd) +成品下载:[https://fycz.lanzoui.com/iqvwqj3kr5e](https://fycz.lanzoui.com/iqvwqj3kr5e) #### 一、关于书源 -* 软件内置了20个书源如下: +* 软件内置了25个书源如下: - * 16个网络小说书源:天籁小说、笔趣阁44、品书网、笔趣阁、 + * 21个网络小说书源:天籁小说、笔趣阁44、品书网、笔趣阁、 全本小说、米趣小说、九桃小说、云中书库、 搜小说网、全小说网、奇奇小说、妙笔阁、 - 丹书铁券、小说旗、读一读网、飘天文学 + 丹书铁券、小说旗、读一读网、飘天文学、 + 老幺小说、星星小说、时光小说、峡谷文学、 + 红尘小说 * 4个实体书书源:超星图书·实体、作品集·实体、99藏书·实体、100本·实体 * 如何自行制作并添加书源. diff --git a/app/build.gradle b/app/build.gradle index 0134962..f49c48d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -21,7 +21,7 @@ def getVersionCode() { } return versionCode } else { - throw new GradleException("无法读取version_code.properties文件!") + throw new FileNotFoundException("无法读取version_code.properties文件!") } } def name = "风月读书" @@ -162,6 +162,11 @@ dependencies { //二维码 implementation 'cn.bingoogolapple:bga-qrcode-zxing:1.3.7' //Material Dialogs + + /*//email + implementation 'com.sun.mail:android-mail:1.6.2' + implementation 'com.sun.mail:android-activation:1.6.2'*/ + /*def dialog_version = '3.3.0' implementation "com.afollestad.material-dialogs:core:$dialog_version" implementation "com.afollestad.material-dialogs:input:$dialog_version" diff --git a/app/src/androidTest/java/xyz/fycz/myreader/ExampleInstrumentedTest.java b/app/src/androidTest/java/xyz/fycz/myreader/ExampleInstrumentedTest.java index 0b87f68..a1808f4 100644 --- a/app/src/androidTest/java/xyz/fycz/myreader/ExampleInstrumentedTest.java +++ b/app/src/androidTest/java/xyz/fycz/myreader/ExampleInstrumentedTest.java @@ -9,8 +9,6 @@ import org.junit.Test; import org.junit.runner.RunWith; -import xyz.fycz.myreader.model.audio.ReadService; - import static org.junit.Assert.assertEquals; /** @@ -29,7 +27,7 @@ public class ExampleInstrumentedTest { @Test public void test() { - ReadService readService = new ReadService(); + //ReadService readService = new ReadService(); //readService.initSynthesizer(); //readService.startSynthesizer("科幻电影是我们从小就爱看的电影题材,我们也都梦想过生活在那样的科幻世界里。科幻片,顾名思义即“科学幻想片”,是“以科学幻想为内容的故事片,其基本特点是从今天已知的科学原理和科学成就出发,对未来的世界或遥远的过去的情景作幻想式的描述。”"); } diff --git a/app/src/androidTest/java/xyz/fycz/myreader/TestAudioPlay.java b/app/src/androidTest/java/xyz/fycz/myreader/TestAudioPlay.java index fff9e7b..cc7819f 100644 --- a/app/src/androidTest/java/xyz/fycz/myreader/TestAudioPlay.java +++ b/app/src/androidTest/java/xyz/fycz/myreader/TestAudioPlay.java @@ -4,13 +4,11 @@ import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.runner.RunWith; -import xyz.fycz.myreader.model.audio.ReadService; - @RunWith(AndroidJUnit4.class) public class TestAudioPlay { public void test() { - ReadService readService = new ReadService(); + //ReadService readService = new ReadService(); //readService.initSynthesizer(); //readService.startSynthesizer("科幻电影是我们从小就爱看的电影题材,我们也都梦想过生活在那样的科幻世界里。科幻片,顾名思义即“科学幻想片”,是“以科学幻想为内容的故事片,其基本特点是从今天已知的科学原理和科学成就出发,对未来的世界或遥远的过去的情景作幻想式的描述。”"); } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3249073..4a0bd86 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -52,7 +52,6 @@ - @@ -106,7 +105,6 @@ - diff --git a/app/src/main/assets/updatelog.fy b/app/src/main/assets/updatelog.fy index c242fd9..7460a79 100644 --- a/app/src/main/assets/updatelog.fy +++ b/app/src/main/assets/updatelog.fy @@ -1,5 +1,9 @@ +2020.12.06 +风月读书v1.20.120612 1、新增书架排序设置 -2、新增书籍分享(以图片+二维码的形式分享)及扫一扫 +2、新增书籍分享(以图片+二维码的形式分享)及扫一扫(书架菜单) +3、新增书源:老幺小说、星星小说、时光小说、峡谷文学、红尘小说 +4、修复欢迎页图片概率性未完全加载的bug 2020.11.28 风月读书v1.20.112822 diff --git a/app/src/main/java/xyz/fycz/myreader/application/MyApplication.java b/app/src/main/java/xyz/fycz/myreader/application/MyApplication.java index 37b1def..4b61024 100644 --- a/app/src/main/java/xyz/fycz/myreader/application/MyApplication.java +++ b/app/src/main/java/xyz/fycz/myreader/application/MyApplication.java @@ -13,18 +13,16 @@ import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.graphics.Color; +import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Build; import android.os.Environment; import android.os.Handler; - import android.util.Log; -import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatDelegate; -import io.reactivex.internal.functions.Functions; -import io.reactivex.plugins.RxJavaPlugins; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; @@ -41,25 +39,28 @@ import javax.net.ssl.SSLSession; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; +import io.reactivex.internal.functions.Functions; +import io.reactivex.plugins.RxJavaPlugins; import xyz.fycz.myreader.R; import xyz.fycz.myreader.common.APPCONST; import xyz.fycz.myreader.common.URLCONST; -import xyz.fycz.myreader.model.backup.UserService; -import xyz.fycz.myreader.model.storage.Backup; -import xyz.fycz.myreader.ui.dialog.APPDownloadTip; -import xyz.fycz.myreader.ui.dialog.DialogCreator; import xyz.fycz.myreader.entity.Setting; -import xyz.fycz.myreader.entity.UpdateInfo; import xyz.fycz.myreader.ui.activity.MainActivity; +import xyz.fycz.myreader.ui.dialog.APPDownloadTip; +import xyz.fycz.myreader.ui.dialog.DialogCreator; import xyz.fycz.myreader.ui.fragment.BookcaseFragment; -import xyz.fycz.myreader.util.*; -import xyz.fycz.myreader.util.llog.LLog; +import xyz.fycz.myreader.util.HttpUtil; +import xyz.fycz.myreader.util.SharedPreUtils; +import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.ToastUtils; +import xyz.fycz.myreader.util.utils.FileUtils; import xyz.fycz.myreader.util.utils.NetworkUtils; -import xyz.fycz.myreader.webapi.callback.ResultCallback; +import xyz.fycz.myreader.util.utils.OkHttpUtils; public class MyApplication extends Application { + public static final String TAG = MyApplication.class.getSimpleName(); private static Handler handler = new Handler(); private static MyApplication application; private ExecutorService mFixedThreadPool; @@ -238,16 +239,18 @@ public class MyApplication extends Application { } /** - * 检查更新 + * 获取apk包的信息:版本号,名称,图标等 + * @param absPath apk包的绝对路径 */ - public static void checkVersion(AppCompatActivity activity) { - UpdateInfo updateInfo = (UpdateInfo) CacheHelper.readObject(APPCONST.FILE_NAME_UPDATE_INFO); - int versionCode = getVersionCode(); - if (updateInfo != null) { - if (updateInfo.getNewestVersionCode() > versionCode) { - //updateApp(activity, updateInfo.getDownLoadUrl(), versionCode); - } + public static int apkInfo(String absPath) { + PackageManager pm = application.getPackageManager(); + PackageInfo pkgInfo = pm.getPackageArchiveInfo(absPath, PackageManager.GET_ACTIVITIES); + if (pkgInfo != null) { + int versionCode = pkgInfo.versionCode; + Log.i(TAG, String.format("PkgInfo: %s", versionCode)); + return versionCode; } + return 0; } @@ -257,13 +260,13 @@ public class MyApplication extends Application { public static void checkVersionByServer(final AppCompatActivity activity, final boolean isManualCheck, final BookcaseFragment mBookcaseFragment) { MyApplication.getApplication().newThread(() -> { - Document doc = null; try { String url = "https://shimo.im/docs/cqkgjPRRydYYhQKt/read"; if (isApkInDebug(getmContext())) { url = "https://shimo.im/docs/zfzpda7MUGskOC9v/read"; } - doc = Jsoup.connect(url).get(); + String html = OkHttpUtils.getHtml(url); + Document doc = Jsoup.parse(html); String content = doc.getElementsByClass("ql-editor").text(); if (StringHelper.isEmpty(content)) { if (isManualCheck || NetworkUtils.isNetWorkAvailable()) { @@ -289,6 +292,7 @@ public class MyApplication extends Application { spu.putBoolean("needUdSI", !oldSplashTime.equals(newSplashTime)); spu.putString("splashTime", contents[5].substring(contents[5].indexOf(":") + 1)); spu.putString("splashImageUrl", contents[6].substring(contents[6].indexOf(":") + 1)); + spu.putString("splashImageMD5", contents[7].substring(contents[7].indexOf(":") + 1)); if (!StringHelper.isEmpty(downloadLink)) { spu.putString(getmContext().getString(R.string.downloadLink), downloadLink); @@ -354,6 +358,11 @@ public class MyApplication extends Application { if (activity instanceof MainActivity){ MainActivity mainActivity = (MainActivity) activity; mainActivity.getViewPagerMain().setCurrentItem(0); + String filePath = APPCONST.UPDATE_APK_FILE_DIR + "FYReader.apk"; + if (apkInfo(filePath) == versionCode){ + mainActivity.installApk(FileUtils.getFile(filePath), isForceUpdate); + return; + } } if (url == null || "".equals(url)) { ToastUtils.showError("获取链接失败,请前往浏览器下载!"); diff --git a/app/src/main/java/xyz/fycz/myreader/application/SysManager.java b/app/src/main/java/xyz/fycz/myreader/application/SysManager.java index fd80134..a951c07 100644 --- a/app/src/main/java/xyz/fycz/myreader/application/SysManager.java +++ b/app/src/main/java/xyz/fycz/myreader/application/SysManager.java @@ -1,5 +1,7 @@ package xyz.fycz.myreader.application; +import android.util.Log; + import xyz.fycz.myreader.common.APPCONST; import xyz.fycz.myreader.enums.BookSource; import xyz.fycz.myreader.enums.BookcaseStyle; @@ -27,19 +29,21 @@ public class SysManager { /** * 获取设置 + * * @return */ public static Setting getSetting() { - if (mSetting != null){ + if (mSetting != null) { return mSetting; } mSetting = (Setting) CacheHelper.readObject(APPCONST.FILE_NAME_SETTING); - if (mSetting == null){ + if (mSetting == null) { mSetting = getDefaultSetting(); saveSetting(mSetting); } return mSetting; } + public static Setting getNewSetting() { Setting setting = (Setting) CacheHelper.readObject(APPCONST.FILE_NAME_SETTING); if (setting == null) { @@ -50,10 +54,11 @@ public class SysManager { } - /** - * 保存设置 - * @param setting - */ + /** + * 保存设置 + * + * @param setting + */ public static void saveSetting(Setting setting) { CacheHelper.saveObject(setting, APPCONST.FILE_NAME_SETTING); } @@ -61,9 +66,10 @@ public class SysManager { /** * 默认设置 + * * @return */ - private static Setting getDefaultSetting(){ + private static Setting getDefaultSetting() { Setting setting = new Setting(); setting.setDayStyle(true); setting.setBookcaseStyle(BookcaseStyle.listMode); @@ -82,7 +88,7 @@ public class SysManager { return setting; } - public static void regetmSetting(){ + public static void regetmSetting() { mSetting = (Setting) CacheHelper.readObject(APPCONST.FILE_NAME_SETTING); } @@ -91,19 +97,36 @@ public class SysManager { * 重置设置 */ - public static void resetSetting(){ + public static void resetSetting() { Setting setting = getSetting(); - setting.initReadStyle(); - setting.setCurReadStyleIndex(1); - setting.setSharedLayout(true); + switch (setting.getSettingVersion()) { + case 10: + setting.initReadStyle(); + setting.setCurReadStyleIndex(1); + setting.setSharedLayout(true); + Log.d("SettingVersion", "" + 10); + case 11: + Log.d("SettingVersion", "" + 11); + case 12: + Log.d("SettingVersion", "" + 12); + } setting.setSettingVersion(APPCONST.SETTING_VERSION); saveSetting(setting); } - public static void resetSource(){ + public static void resetSource() { Setting setting = getSetting(); - ReadCrawlerUtil.addReadCrawler(BookSource.miaobi, BookSource.dstq, BookSource.xs7, BookSource.du1du,BookSource.paiotian); - ReadCrawlerUtil.removeReadCrawler("cangshu99"); + switch (setting.getSourceVersion()) { + case 0: + ReadCrawlerUtil.addReadCrawler(BookSource.miaobi, BookSource.dstq, BookSource.xs7, BookSource.du1du, BookSource.paiotian); + ReadCrawlerUtil.removeReadCrawler("cangshu99"); + Log.d("SourceVersion", "" + 0); + case 1: + ReadCrawlerUtil.addReadCrawler(BookSource.laoyao, BookSource.xingxing, BookSource.shiguang, BookSource.xiagu, BookSource.hongchen); + Log.d("SourceVersion", "" + 1); + case 2: + Log.d("SourceVersion", "" + 2); + } setting.setSourceVersion(APPCONST.SOURCE_VERSION); saveSetting(setting); } 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 7b95886..6df953b 100644 --- a/app/src/main/java/xyz/fycz/myreader/common/APPCONST.java +++ b/app/src/main/java/xyz/fycz/myreader/common/APPCONST.java @@ -92,7 +92,7 @@ public class APPCONST { //设置版本号 public static final int SETTING_VERSION = 11; - public static final int SOURCE_VERSION = 1; + public static final int SOURCE_VERSION = 2; public static final String FORMAT_FILE_DATE = "yyyy-MM-dd"; diff --git a/app/src/main/java/xyz/fycz/myreader/entity/ContactsTree.java b/app/src/main/java/xyz/fycz/myreader/entity/ContactsTree.java deleted file mode 100644 index 08c6437..0000000 --- a/app/src/main/java/xyz/fycz/myreader/entity/ContactsTree.java +++ /dev/null @@ -1,212 +0,0 @@ -package xyz.fycz.myreader.entity; - -import java.io.Serializable; -import java.util.ArrayList; - -/** - * Created by zhao on 2016/11/9. - * APP通迅录树结构 - * - */ - -public class ContactsTree implements Serializable { - - private static final long serialVersionUID = 7184368467231587092L; - - //根节点赋值字段(部门节点) - private String DepartId;//部门id - private String DepartName;//部门名 - private String orgCode; //部门编码 - private String departOrder; //部门排序 - private boolean select; - - //叶节点赋值字段(个人信息节点) - private String id; - private String userDepartId;//用户所属部门ID - private String userDepartName;//用户所属部门名 - private boolean moreDepartUser;// 用户是否多部门 true是 false不是 - private boolean transpondPerson;//是否转发人员 true是 false不是 - private String userName;//用户名 - private String realName;//姓名 - private String wholeSpellName;//姓名全拼 - private String firstLetterName;//拼音首字母 eg:hzh - private String mobilePhone;//手机 - private String sex;//性别 - private String email;//邮箱 - - private ArrayList children;//孩子节点 - - private ContactsTree parent;//父节点 - - public boolean isTranspondPerson() { - return transpondPerson; - } - - public void setTranspondPerson(boolean transpondPerson) { - this.transpondPerson = transpondPerson; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getDepartOrder() { - return departOrder; - } - - public String getOrgCode() { - return orgCode; - } - - public void setDepartOrder(String departOrder) { - this.departOrder = departOrder; - } - - public void setOrgCode(String orgCode) { - this.orgCode = orgCode; - } - - public boolean isMoreDepartUser() { - return moreDepartUser; - } - - public void setMoreDepartUser(boolean moreDepartUser) { - this.moreDepartUser = moreDepartUser; - } - - public String getUserDepartId() { - return userDepartId; - } - - public String getUserDepartName() { - return userDepartName; - } - - public void setUserDepartId(String userDepartId) { - this.userDepartId = userDepartId; - } - - public void setUserDepartName(String userDepartName) { - this.userDepartName = userDepartName; - } - - public boolean isSelect() { - return select; - } - - public void setSelect(boolean select) { - this.select = select; - } - - public ContactsTree getParent() { - return parent; - } - - public void setParent(ContactsTree parent) { - this.parent = parent; - } - - public ContactsTree(){ - children = new ArrayList<>(); - } - - public String getSex() { - return sex; - } - - public void setSex(String sex) { - this.sex = sex; - } - - public String getMobilePhone() { - return mobilePhone; - } - - public void setMobilePhone(String mobilePhone) { - this.mobilePhone = mobilePhone; - } - - public ArrayList getChildren() { - return children; - } - - public String getDepartId() { - return DepartId; - } - - public String getDepartName() { - return DepartName; - } - - public String getFirstLetterName() { - return firstLetterName; - } - - public String getRealName() { - return realName; - } - - public String getUserName() { - return userName; - } - - public String getWholeSpellName() { - return wholeSpellName; - } - - public void setChildren(ArrayList children) { - this.children = children; - } - - public void setDepartId(String departId) { - DepartId = departId; - } - - public void setDepartName(String departName) { - DepartName = departName; - } - - public void setFirstLetterName(String firstLetterName) { - this.firstLetterName = firstLetterName; - } - - public void setRealName(String realName) { - this.realName = realName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public void setWholeSpellName(String wholeSpellName) { - this.wholeSpellName = wholeSpellName; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - @Override - public String toString() { - return "ContactsTree{" + - "DepartId='" + DepartId + '\'' + - ", DepartName='" + DepartName + '\'' + - ", userName='" + userName + '\'' + - ", realName='" + realName + '\'' + - ", wholeSpellName='" + wholeSpellName + '\'' + - ", firstLetterName='" + firstLetterName + '\'' + - ", mobilePhone='" + mobilePhone + '\'' + - ", sex='" + sex + '\'' + - ", email='" + email + '\'' + - ", children=" + children + - '}'; - } -} diff --git a/app/src/main/java/xyz/fycz/myreader/entity/Custom.java b/app/src/main/java/xyz/fycz/myreader/entity/Custom.java deleted file mode 100644 index 8c4ffee..0000000 --- a/app/src/main/java/xyz/fycz/myreader/entity/Custom.java +++ /dev/null @@ -1,36 +0,0 @@ -package xyz.fycz.myreader.entity; - -import java.io.Serializable; - - -public class Custom implements Serializable { - - private static final long serialVersionUID = 5088810102696918656L; - - private String id; - private String type;//类型 - - public String getId() { - return id; - } - - public String getType() { - return type; - } - - public void setId(String id) { - this.id = id; - } - - public void setType(String type) { - this.type = type; - } - - @Override - public String toString() { - return "Custom{" + - "id='" + id + '\'' + - ", type='" + type + '\'' + - '}'; - } -} diff --git a/app/src/main/java/xyz/fycz/myreader/entity/Time.java b/app/src/main/java/xyz/fycz/myreader/entity/Time.java deleted file mode 100644 index b3eba78..0000000 --- a/app/src/main/java/xyz/fycz/myreader/entity/Time.java +++ /dev/null @@ -1,201 +0,0 @@ -package xyz.fycz.myreader.entity; - -import android.os.Parcel; -import android.os.Parcelable; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; - - - -public class Time implements Parcelable{ - private int year; - private int month; - private int date; - private int hour; - private int minute; - private int second; - - public long getLongTime(){ - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append(year); - if(month < 10){ - stringBuilder.append("0"+month); - }else { - stringBuilder.append(month); - } - if(date < 10){ - stringBuilder.append("0" + date); - }else { - stringBuilder.append(date); - } - if(hour < 10){ - stringBuilder.append("0" + hour); - }else { - stringBuilder.append(hour); - } - if(minute < 10){ - stringBuilder.append("0" + minute); - }else { - stringBuilder.append(minute); - } - if(second < 10){ - stringBuilder.append("0" + second); - }else { - stringBuilder.append(second); - } - SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); - java.util.Date date = null; - try { - date = sdf.parse(stringBuilder.toString()); - return date.getTime(); - } catch (ParseException e) { - e.printStackTrace(); - return 0; - } - } - - - public void init(Date date){ - year = date.getYear() + 1900; - month = date.getMonth() + 1; - this.date = date.getDate(); - hour = date.getHours(); - minute = date.getMinutes(); - second = 0; - } - - public void init(xyz.fycz.myreader.entity.Date date){ - Date date1 = new Date(); - year = date.getYear(); - month = date.getMonth(); - this.date = date.getDate(); - hour = date1.getHours(); - minute = date1.getMinutes(); - second = 0; - } - - public void setToDayZero(){ - hour = 0; - minute = 0; - second = 0; - } - - public void setToDayLast(){ - hour = 23; - minute = 59; - second = 59; - } - - public void lastMonth(){ - if(month == 1){ - month = 12; - year = year - 1; - }else { - month = month - 1; - } - } - - public void nextMonth(){ - if(month == 12){ - month = 1; - year = year + 1; - }else { - month = month + 1; - } - } - - public void init(long time){ - Date date = new Date(time); - init(date); - } - - - public int getDate() { - return date; - } - - public int getHour() { - return hour; - } - - public int getMinute() { - return minute; - } - - public int getMonth() { - return month; - } - - public int getSecond() { - return second; - } - - public int getYear() { - return year; - } - - public void setDate(int date) { - this.date = date; - } - - public void setHour(int hour) { - this.hour = hour; - } - - public void setMinute(int minute) { - this.minute = minute; - } - - public void setMonth(int month) { - this.month = month; - } - - public void setSecond(int second) { - this.second = second; - } - - public void setYear(int year) { - this.year = year; - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeInt(this.year); - dest.writeInt(this.month); - dest.writeInt(this.date); - dest.writeInt(this.hour); - dest.writeInt(this.minute); - dest.writeInt(this.second); - } - - public Time() { - } - - protected Time(Parcel in) { - this.year = in.readInt(); - this.month = in.readInt(); - this.date = in.readInt(); - this.hour = in.readInt(); - this.minute = in.readInt(); - this.second = in.readInt(); - } - - public static final Creator