风月读书v1.0

pull/5/head
fengyuecanzhu 4 years ago
parent d40af794d4
commit b3176fd4f1
  1. 28
      README.md
  2. 4
      app/src/main/java/xyz/fycz/myreader/common/APPCONST.java
  3. 58
      app/src/main/java/xyz/fycz/myreader/ui/home/bookcase/BookcasePresenter.java
  4. 3
      app/src/main/java/xyz/fycz/myreader/ui/read/ReadPresenter.java

@ -1,4 +1,3 @@
# FYReader-master # FYReader-master
风月读书,一款免费、无广告的小说阅读软件。 风月读书,一款免费、无广告的小说阅读软件。
@ -25,16 +24,17 @@
10、支持自动翻页 10、支持自动翻页
demo下载:https://fycz.lanzoui.com/il7HPezefjc
![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-master/blob/FYReader-master/img/1.png)
![Image](https://github.com/fengyuecanzhu/FYReader-marster/imgs/3.png) ![Image](https://github.com/fengyuecanzhu/FYReader-master/blob/FYReader-master/img/2.png)
![Image](https://github.com/fengyuecanzhu/FYReader-marster/imgs/4.png) ![Image](https://github.com/fengyuecanzhu/FYReader-master/blob/FYReader-master/img/3.png)
![Image](https://github.com/fengyuecanzhu/FYReader-marster/imgs/5.png) ![Image](https://github.com/fengyuecanzhu/FYReader-master/blob/FYReader-master/img/4.png)
![Image](https://github.com/fengyuecanzhu/FYReader-marster/imgs/6.png) ![Image](https://github.com/fengyuecanzhu/FYReader-master/blob/FYReader-master/img/5.png)
![Image](https://github.com/fengyuecanzhu/FYReader-marster/imgs/7.png) ![Image](https://github.com/fengyuecanzhu/FYReader-master/blob/FYReader-master/img/6.png)
![Image](https://github.com/fengyuecanzhu/FYReader-marster/imgs/8.png) ![Image](https://github.com/fengyuecanzhu/FYReader-master/blob/FYReader-master/img/7.png)
![Image](https://github.com/fengyuecanzhu/FYReader-marster/imgs/9.png) ![Image](https://github.com/fengyuecanzhu/FYReader-master/blob/FYReader-master/img/8.png)
![Image](https://github.com/fengyuecanzhu/FYReader-marster/imgs/10.png) ![Image](https://github.com/fengyuecanzhu/FYReader-master/blob/FYReader-master/img/9.png)
![Image](https://github.com/fengyuecanzhu/FYReader-marster/imgs/11.png) ![Image](https://github.com/fengyuecanzhu/FYReader-master/blob/FYReader-master/img/10.png)
![Image](https://github.com/fengyuecanzhu/FYReader-marster/imgs/12.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)

@ -10,10 +10,10 @@ import java.io.File;
public class APPCONST { public class APPCONST {
public static String publicKey = "fyds1.0";//服务端公钥 public static String publicKey = "";//服务端公钥
public static String privateKey;//app私钥 public static String privateKey;//app私钥
public final static String s = "11940364935628058505"; 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"; public static final String ALARM_SCHEDULE_MSG = "alarm_schedule_msg";

@ -24,7 +24,9 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; 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.greendao.service.ChapterService;
import xyz.fycz.myreader.ui.home.MainActivity; import xyz.fycz.myreader.ui.home.MainActivity;
import xyz.fycz.myreader.ui.search.SearchBookActivity; 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.StringHelper;
import xyz.fycz.myreader.util.TextHelper; import xyz.fycz.myreader.util.TextHelper;
import xyz.fycz.myreader.util.utils.NetworkUtils; import xyz.fycz.myreader.util.utils.NetworkUtils;
@ -166,6 +170,7 @@ public class BookcasePresenter implements BasePresenter {
if (mSetting.getBookcaseStyle() == null) { if (mSetting.getBookcaseStyle() == null) {
mSetting.setBookcaseStyle(BookcaseStyle.listMode); mSetting.setBookcaseStyle(BookcaseStyle.listMode);
} }
synBookcase();
getData(); getData();
//是否启用下拉刷新(默认启用) //是否启用下拉刷新(默认启用)
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { 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)) .setTitle(mMainActivity.getResources().getString(R.string.menu_bookcase_backup))
.setAdapter(new ArrayAdapter<>(mMainActivity, .setAdapter(new ArrayAdapter<>(mMainActivity,
android.R.layout.simple_list_item_1, menu), android.R.layout.simple_list_item_1, menu),
new DialogInterface.OnClickListener() { (dialog, which) -> {
@Override switch (which) {
public void onClick(DialogInterface dialog, int which) { case 0:
switch (which) { mHandler.sendMessage(mHandler.obtainMessage(5));
case 0: break;
mHandler.sendMessage(mHandler.obtainMessage(5)); case 1:
break; mHandler.sendMessage(mHandler.obtainMessage(6));
case 1: break;
mHandler.sendMessage(mHandler.obtainMessage(6)); case 2:
break; webRestore();
case 2: break;
webRestore();
break;
}
} }
}) })
.setNegativeButton(null, null) .setNegativeButton(null, null)
@ -538,13 +539,13 @@ public class BookcasePresenter implements BasePresenter {
(dialogInterface, i) -> { (dialogInterface, i) -> {
dialogInterface.dismiss(); dialogInterface.dismiss();
if (UserService.isLogin()) { if (UserService.isLogin()) {
new Thread(() -> { MyApplication.getApplication().newThread(() -> {
if (mBackupAndRestore.backup("localBackup") & UserService.webBackup()) { if (mBackupAndRestore.backup("localBackup") & UserService.webBackup()) {
DialogCreator.createTipDialog(mMainActivity, "备份(本地和网络)成功,本地备份文件路径:" + APPCONST.BACKUP_FILE_DIR); DialogCreator.createTipDialog(mMainActivity, "备份(本地和网络)成功,本地备份文件路径:" + APPCONST.BACKUP_FILE_DIR);
} else { } else {
DialogCreator.createTipDialog(mMainActivity, "未登录或未给予储存权限,备份失败!"); DialogCreator.createTipDialog(mMainActivity, "未登录或未给予储存权限,备份失败!");
} }
}).start(); });
} else { } else {
if (mBackupAndRestore.backup("localBackup")) { if (mBackupAndRestore.backup("localBackup")) {
DialogCreator.createTipDialog(mMainActivity, "备份成功,备份文件路径:" + APPCONST.BACKUP_FILE_DIR); DialogCreator.createTipDialog(mMainActivity, "备份成功,备份文件路径:" + APPCONST.BACKUP_FILE_DIR);
@ -581,7 +582,7 @@ public class BookcasePresenter implements BasePresenter {
DialogCreator.createCommonDialog(mMainActivity, "确认恢复吗?", "恢复书架会覆盖原有书架!", true, DialogCreator.createCommonDialog(mMainActivity, "确认恢复吗?", "恢复书架会覆盖原有书架!", true,
(dialogInterface, i) -> { (dialogInterface, i) -> {
dialogInterface.dismiss(); dialogInterface.dismiss();
new Thread(() -> { MyApplication.getApplication().newThread(() -> {
if (UserService.webRestore()) { if (UserService.webRestore()) {
mHandler.sendMessage(mHandler.obtainMessage(7)); mHandler.sendMessage(mHandler.obtainMessage(7));
// DialogCreator.createTipDialog(mMainActivity, // DialogCreator.createTipDialog(mMainActivity,
@ -590,7 +591,7 @@ public class BookcasePresenter implements BasePresenter {
} else { } else {
DialogCreator.createTipDialog(mMainActivity, "未找到备份文件,恢复失败!"); DialogCreator.createTipDialog(mMainActivity, "未找到备份文件,恢复失败!");
} }
}).start(); });
}, (dialogInterface, i) -> dialogInterface.dismiss()); }, (dialogInterface, i) -> dialogInterface.dismiss());
} }
@ -759,6 +760,25 @@ public class BookcasePresenter implements BasePresenter {
init(); 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);
}
});
}
}
}
/*****************************************用于返回按钮判断*************************************/ /*****************************************用于返回按钮判断*************************************/
/** /**

@ -1121,6 +1121,9 @@ public class ReadPresenter implements BasePresenter {
*/ */
public void onDestroy() { public void onDestroy() {
mReadActivity.unregisterReceiver(mReceiver); mReadActivity.unregisterReceiver(mReceiver);
if (autoPage) {
autoPageStop();
}
for (int i = 0; i < 8; i++) { for (int i = 0; i < 8; i++) {
mHandler.removeMessages(i + 1); mHandler.removeMessages(i + 1);
} }

Loading…
Cancel
Save