diff --git a/app/src/main/java/xyz/fycz/myreader/backup/BackupAndRestore.java b/app/src/main/java/xyz/fycz/myreader/backup/BackupAndRestore.java index 05698c1..b53a1a4 100644 --- a/app/src/main/java/xyz/fycz/myreader/backup/BackupAndRestore.java +++ b/app/src/main/java/xyz/fycz/myreader/backup/BackupAndRestore.java @@ -5,6 +5,7 @@ import xyz.fycz.myreader.common.APPCONST; import xyz.fycz.myreader.entity.Setting; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.service.BookService; +import xyz.fycz.myreader.util.IOUtils; import xyz.fycz.myreader.util.utils.FileUtils; import java.io.*; import java.util.ArrayList; @@ -119,20 +120,7 @@ public class BackupAndRestore { e.printStackTrace(); return false; } finally { - if (br != null) { - try { - br.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - if (ois != null) { - try { - ois.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } + IOUtils.close(br, ois); } } } \ 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 4d679bc..b399d81 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 = "";//服务端公钥 + public static String publicKey = "fyds1.0";//服务端公钥 public static String privateKey;//app私钥 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"; 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 25fa1e6..4282c19 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 @@ -538,14 +538,11 @@ public class BookcasePresenter implements BasePresenter { (dialogInterface, i) -> { dialogInterface.dismiss(); if (UserService.isLogin()) { - new Thread(new Runnable() { - @Override - public void run() { - if (mBackupAndRestore.backup("localBackup") & UserService.webBackup()) { - DialogCreator.createTipDialog(mMainActivity, "备份(本地和网络)成功,本地备份文件路径:" + APPCONST.BACKUP_FILE_DIR); - } else { - DialogCreator.createTipDialog(mMainActivity, "未登录或未给予储存权限,备份失败!"); - } + new Thread(() -> { + if (mBackupAndRestore.backup("localBackup") & UserService.webBackup()) { + DialogCreator.createTipDialog(mMainActivity, "备份(本地和网络)成功,本地备份文件路径:" + APPCONST.BACKUP_FILE_DIR); + } else { + DialogCreator.createTipDialog(mMainActivity, "未登录或未给予储存权限,备份失败!"); } }).start(); } else { @@ -615,13 +612,10 @@ public class BookcasePresenter implements BasePresenter { continue; } isDownloadFinish = false; - Thread downloadThread = new Thread(new Runnable() { - @Override - public void run() { - ArrayList chapters = (ArrayList) mChapterService.findBookAllChapterByBookId(book.getId()); - addDownload(book, chapters, - book.getHisttoryChapterNum(), chapters.size()); - } + Thread downloadThread = new Thread(() -> { + ArrayList chapters = (ArrayList) mChapterService.findBookAllChapterByBookId(book.getId()); + addDownload(book, chapters, + book.getHisttoryChapterNum(), chapters.size()); }); es.submit(downloadThread); do { diff --git a/img/12.png b/img/12.png index 146983e..22a4b52 100644 Binary files a/img/12.png and b/img/12.png differ