风月读书v1.0

pull/5/head
fengyuecanzhu 4 years ago
parent be5b5df2d2
commit d40af794d4
  1. 16
      app/src/main/java/xyz/fycz/myreader/backup/BackupAndRestore.java
  2. 4
      app/src/main/java/xyz/fycz/myreader/common/APPCONST.java
  3. 10
      app/src/main/java/xyz/fycz/myreader/ui/home/bookcase/BookcasePresenter.java
  4. BIN
      img/12.png

@ -5,6 +5,7 @@ import xyz.fycz.myreader.common.APPCONST;
import xyz.fycz.myreader.entity.Setting; import xyz.fycz.myreader.entity.Setting;
import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Book;
import xyz.fycz.myreader.greendao.service.BookService; import xyz.fycz.myreader.greendao.service.BookService;
import xyz.fycz.myreader.util.IOUtils;
import xyz.fycz.myreader.util.utils.FileUtils; import xyz.fycz.myreader.util.utils.FileUtils;
import java.io.*; import java.io.*;
import java.util.ArrayList; import java.util.ArrayList;
@ -119,20 +120,7 @@ public class BackupAndRestore {
e.printStackTrace(); e.printStackTrace();
return false; return false;
} finally { } finally {
if (br != null) { IOUtils.close(br, ois);
try {
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (ois != null) {
try {
ois.close();
} catch (IOException e) {
e.printStackTrace();
}
}
} }
} }
} }

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

@ -538,15 +538,12 @@ public class BookcasePresenter implements BasePresenter {
(dialogInterface, i) -> { (dialogInterface, i) -> {
dialogInterface.dismiss(); dialogInterface.dismiss();
if (UserService.isLogin()) { if (UserService.isLogin()) {
new Thread(new Runnable() { new Thread(() -> {
@Override
public void run() {
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(); }).start();
} else { } else {
if (mBackupAndRestore.backup("localBackup")) { if (mBackupAndRestore.backup("localBackup")) {
@ -615,13 +612,10 @@ public class BookcasePresenter implements BasePresenter {
continue; continue;
} }
isDownloadFinish = false; isDownloadFinish = false;
Thread downloadThread = new Thread(new Runnable() { Thread downloadThread = new Thread(() -> {
@Override
public void run() {
ArrayList<Chapter> chapters = (ArrayList<Chapter>) mChapterService.findBookAllChapterByBookId(book.getId()); ArrayList<Chapter> chapters = (ArrayList<Chapter>) mChapterService.findBookAllChapterByBookId(book.getId());
addDownload(book, chapters, addDownload(book, chapters,
book.getHisttoryChapterNum(), chapters.size()); book.getHisttoryChapterNum(), chapters.size());
}
}); });
es.submit(downloadThread); es.submit(downloadThread);
do { do {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

After

Width:  |  Height:  |  Size: 81 KiB

Loading…
Cancel
Save