diff --git a/README.md b/README.md index c14e54f..64c035e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ - # FYReader-master 风月读书,一款免费、无广告的小说阅读软件。 @@ -25,16 +24,17 @@ 10、支持自动翻页 - -![Image](https://github.com/fengyuecanzhu/FYReader-marster/imgs/1.png) -![Image](https://github.com/fengyuecanzhu/FYReader-marster/imgs/2.png) -![Image](https://github.com/fengyuecanzhu/FYReader-marster/imgs/3.png) -![Image](https://github.com/fengyuecanzhu/FYReader-marster/imgs/4.png) -![Image](https://github.com/fengyuecanzhu/FYReader-marster/imgs/5.png) -![Image](https://github.com/fengyuecanzhu/FYReader-marster/imgs/6.png) -![Image](https://github.com/fengyuecanzhu/FYReader-marster/imgs/7.png) -![Image](https://github.com/fengyuecanzhu/FYReader-marster/imgs/8.png) -![Image](https://github.com/fengyuecanzhu/FYReader-marster/imgs/9.png) -![Image](https://github.com/fengyuecanzhu/FYReader-marster/imgs/10.png) -![Image](https://github.com/fengyuecanzhu/FYReader-marster/imgs/11.png) -![Image](https://github.com/fengyuecanzhu/FYReader-marster/imgs/12.png) \ No newline at end of file +demo下载:https://fycz.lanzoui.com/il7HPezefjc + +![Image](https://github.com/fengyuecanzhu/FYReader-master/blob/FYReader-master/img/1.png) +![Image](https://github.com/fengyuecanzhu/FYReader-master/blob/FYReader-master/img/2.png) +![Image](https://github.com/fengyuecanzhu/FYReader-master/blob/FYReader-master/img/3.png) +![Image](https://github.com/fengyuecanzhu/FYReader-master/blob/FYReader-master/img/4.png) +![Image](https://github.com/fengyuecanzhu/FYReader-master/blob/FYReader-master/img/5.png) +![Image](https://github.com/fengyuecanzhu/FYReader-master/blob/FYReader-master/img/6.png) +![Image](https://github.com/fengyuecanzhu/FYReader-master/blob/FYReader-master/img/7.png) +![Image](https://github.com/fengyuecanzhu/FYReader-master/blob/FYReader-master/img/8.png) +![Image](https://github.com/fengyuecanzhu/FYReader-master/blob/FYReader-master/img/9.png) +![Image](https://github.com/fengyuecanzhu/FYReader-master/blob/FYReader-master/img/10.png) +![Image](https://github.com/fengyuecanzhu/FYReader-master/blob/FYReader-master/img/11.png) +![Image](https://github.com/fengyuecanzhu/FYReader-master/blob/FYReader-master/img/12.png) \ No newline at end of file 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 b399d81..4d679bc 100644 --- a/app/src/main/java/xyz/fycz/myreader/common/APPCONST.java +++ b/app/src/main/java/xyz/fycz/myreader/common/APPCONST.java @@ -10,10 +10,10 @@ import java.io.File; public class APPCONST { - public static String publicKey = "fyds1.0";//服务端公钥 + public static String publicKey = "";//服务端公钥 public static String privateKey;//app私钥 public final static String s = "11940364935628058505"; - public static final String KEY = "readerByFengyue"; + public static final String KEY = ""; public static final String ALARM_SCHEDULE_MSG = "alarm_schedule_msg"; diff --git a/app/src/main/java/xyz/fycz/myreader/ui/home/bookcase/BookcasePresenter.java b/app/src/main/java/xyz/fycz/myreader/ui/home/bookcase/BookcasePresenter.java index 4282c19..e47e786 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/home/bookcase/BookcasePresenter.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/home/bookcase/BookcasePresenter.java @@ -24,7 +24,9 @@ import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.lang.reflect.Method; +import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Date; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -50,6 +52,8 @@ import xyz.fycz.myreader.greendao.service.BookService; import xyz.fycz.myreader.greendao.service.ChapterService; import xyz.fycz.myreader.ui.home.MainActivity; import xyz.fycz.myreader.ui.search.SearchBookActivity; +import xyz.fycz.myreader.util.SharedPreUtils; +import xyz.fycz.myreader.util.SharedPreferencesUtils; import xyz.fycz.myreader.util.StringHelper; import xyz.fycz.myreader.util.TextHelper; import xyz.fycz.myreader.util.utils.NetworkUtils; @@ -166,6 +170,7 @@ public class BookcasePresenter implements BasePresenter { if (mSetting.getBookcaseStyle() == null) { mSetting.setBookcaseStyle(BookcaseStyle.listMode); } + synBookcase(); getData(); //是否启用下拉刷新(默认启用) if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { @@ -340,7 +345,6 @@ public class BookcasePresenter implements BasePresenter { } } }); - } /** @@ -462,20 +466,17 @@ public class BookcasePresenter implements BasePresenter { .setTitle(mMainActivity.getResources().getString(R.string.menu_bookcase_backup)) .setAdapter(new ArrayAdapter<>(mMainActivity, android.R.layout.simple_list_item_1, menu), - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - switch (which) { - case 0: - mHandler.sendMessage(mHandler.obtainMessage(5)); - break; - case 1: - mHandler.sendMessage(mHandler.obtainMessage(6)); - break; - case 2: - webRestore(); - break; - } + (dialog, which) -> { + switch (which) { + case 0: + mHandler.sendMessage(mHandler.obtainMessage(5)); + break; + case 1: + mHandler.sendMessage(mHandler.obtainMessage(6)); + break; + case 2: + webRestore(); + break; } }) .setNegativeButton(null, null) @@ -538,13 +539,13 @@ public class BookcasePresenter implements BasePresenter { (dialogInterface, i) -> { dialogInterface.dismiss(); if (UserService.isLogin()) { - new Thread(() -> { + MyApplication.getApplication().newThread(() -> { if (mBackupAndRestore.backup("localBackup") & UserService.webBackup()) { DialogCreator.createTipDialog(mMainActivity, "备份(本地和网络)成功,本地备份文件路径:" + APPCONST.BACKUP_FILE_DIR); } else { DialogCreator.createTipDialog(mMainActivity, "未登录或未给予储存权限,备份失败!"); } - }).start(); + }); } else { if (mBackupAndRestore.backup("localBackup")) { DialogCreator.createTipDialog(mMainActivity, "备份成功,备份文件路径:" + APPCONST.BACKUP_FILE_DIR); @@ -581,7 +582,7 @@ public class BookcasePresenter implements BasePresenter { DialogCreator.createCommonDialog(mMainActivity, "确认恢复吗?", "恢复书架会覆盖原有书架!", true, (dialogInterface, i) -> { dialogInterface.dismiss(); - new Thread(() -> { + MyApplication.getApplication().newThread(() -> { if (UserService.webRestore()) { mHandler.sendMessage(mHandler.obtainMessage(7)); // DialogCreator.createTipDialog(mMainActivity, @@ -590,7 +591,7 @@ public class BookcasePresenter implements BasePresenter { } else { DialogCreator.createTipDialog(mMainActivity, "未找到备份文件,恢复失败!"); } - }).start(); + }); }, (dialogInterface, i) -> dialogInterface.dismiss()); } @@ -759,6 +760,25 @@ public class BookcasePresenter implements BasePresenter { init(); } + /** + * 同步书架 + */ + private void synBookcase(){ + if (UserService.isLogin()){ + Date nowTime = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd"); + String nowTimeStr = sdf.format(nowTime); + SharedPreUtils spb = SharedPreUtils.getInstance(); + String synTime = spb.getString("synTime"); + if (!nowTimeStr.equals(synTime)) { + MyApplication.getApplication().newThread(() -> { + if (UserService.webBackup()){ + spb.putString("synTime", nowTimeStr); + } + }); + } + } + } /*****************************************用于返回按钮判断*************************************/ /** diff --git a/app/src/main/java/xyz/fycz/myreader/ui/read/ReadPresenter.java b/app/src/main/java/xyz/fycz/myreader/ui/read/ReadPresenter.java index 34ee8bb..3df3d2d 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/read/ReadPresenter.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/read/ReadPresenter.java @@ -1121,6 +1121,9 @@ public class ReadPresenter implements BasePresenter { */ public void onDestroy() { mReadActivity.unregisterReceiver(mReceiver); + if (autoPage) { + autoPageStop(); + } for (int i = 0; i < 8; i++) { mHandler.removeMessages(i + 1); }