From e4da857c6798e74c5d1de10b430c89bd55508269 Mon Sep 17 00:00:00 2001 From: fengyuecanzhu <1021300691@qq.com> Date: Tue, 1 Jun 2021 21:38:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=98=85=E8=AF=BB=E8=AE=B0?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/assetWizardSettings.xml | 4 +- app/build.gradle | 2 +- app/src/main/AndroidManifest.xml | 1 + app/src/main/assets/updatelog.fy | 8 +- .../xyz/fycz/myreader/application/App.java | 2 +- .../java/xyz/fycz/myreader/entity/Date.java | 2 +- .../xyz/fycz/myreader/entity/Setting.java | 2 +- .../fycz/myreader/greendao/entity/Book.java | 1 - .../myreader/greendao/entity/ReadRecord.java | 84 +++++++ .../greendao/service/BookGroupService.java | 2 +- .../greendao/service/BookMarkService.java | 2 +- .../greendao/service/BookService.java | 1 + .../greendao/service/ChapterService.java | 2 +- .../greendao/service/ReadRecordService.java | 76 +++++++ .../service/SearchHistoryService.java | 4 +- .../greendao/util/MySQLiteOpenHelper.java | 2 +- .../model/sourceAnalyzer/BaseAnalyzer.java | 2 +- .../sourceAnalyzer/BookSourceManager.java | 4 +- .../sourceAnalyzer/JsonPathAnalyzer.java | 2 +- .../model/sourceAnalyzer/MatcherAnalyzer.java | 2 +- .../model/sourceAnalyzer/XpathAnalyzer.java | 2 +- .../fycz/myreader/model/storage/WebDavHelp.kt | 2 +- .../model/third2/analyzeRule/AnalyzeRule.java | 4 +- .../model/third2/analyzeRule/AnalyzeUrl.java | 2 +- .../ui/activity/AdSettingActivity.java | 3 +- .../ui/activity/BookDetailedActivity.java | 2 +- .../myreader/ui/activity/MainActivity.java | 2 +- .../ui/activity/QRCodeScanActivity.java | 2 +- .../myreader/ui/activity/ReadActivity.java | 79 +++++-- .../ui/activity/ReadRecordActivity.java | 206 ++++++++++++++++++ .../ui/activity/SearchBookActivity.java | 2 +- .../ui/activity/SourceEditActivity.java | 4 +- .../myreader/ui/activity/SplashActivity.java | 2 +- .../ui/adapter/BookcaseDetailedAdapter.java | 5 +- .../ui/adapter/BookcaseDragAdapter.java | 5 +- .../ui/adapter/LocalSourceAdapter.java | 2 - .../ui/adapter/ReplaceRuleAdapter.java | 2 +- .../ui/adapter/holder/BookSourceHolder.java | 2 +- .../adapter/holder/BookStoreBookHolder.java | 2 +- .../ui/adapter/holder/ReadRecordHolder.java | 74 +++++++ .../ui/adapter/holder/ReplaceRuleHolder.java | 2 +- .../ui/adapter/holder/SearchBookHolder.java | 2 +- .../myreader/ui/dialog/DialogCreator.java | 5 +- .../myreader/ui/dialog/MyAlertDialog.java | 3 +- .../myreader/ui/dialog/ReplaceDialog.java | 2 +- .../myreader/ui/fragment/FindFragment.java | 18 ++ .../myreader/ui/fragment/MineFragment.java | 15 +- .../myreader/ui/fragment/WebDavFragment.java | 3 +- .../ui/presenter/BookcasePresenter.java | 2 +- .../util/{ => help}/CalendarHelper.java | 2 +- .../myreader/util/{ => help}/DateHelper.java | 2 +- .../util/{ => help}/OpenFileHelper.java | 5 +- .../myreader/util/help/RelativeDateHelp.java | 96 ++++++++ .../util/{ => help}/StringHelper.java | 2 +- .../xyz/fycz/myreader/util/utils/AdUtils.java | 2 +- .../fycz/myreader/util/utils/FileUtils.java | 5 +- .../myreader/util/utils/NetworkUtils.java | 2 +- .../xyz/fycz/myreader/webapi/BookApi.java | 7 +- .../xyz/fycz/myreader/webapi/LanZousApi.java | 2 +- .../webapi/crawler/ReadCrawlerUtil.java | 2 +- .../crawler/base/BaseSourceCrawler.java | 2 +- .../webapi/crawler/find/QB5FindCrawler.java | 2 +- .../webapi/crawler/find/QiDianMobileRank.java | 2 +- .../crawler/read/BiQuGe44ReadCrawler.java | 2 +- .../crawler/read/BiQuGeReadCrawler.java | 2 +- .../crawler/read/EWenXueReadCrawler.java | 2 +- .../crawler/read/LuoQiuReadCrawler.java | 2 +- .../crawler/read/PinShuReadCrawler.java | 2 +- .../crawler/read/PinShuReadCrawler2.java | 2 +- .../crawler/read/ShuHaiGeReadCrawler.java | 2 +- .../crawler/read/TianLaiReadCrawler.java | 2 +- .../webapi/crawler/read/XS7ReadCrawler2.java | 2 +- .../webapi/crawler/read/ZW37ReadCrawler.java | 2 +- .../crawler/source/JsonPathCrawler.java | 2 +- .../webapi/crawler/source/MatcherCrawler.java | 2 +- .../webapi/crawler/source/ThirdCrawler.java | 3 +- .../webapi/crawler/source/XpathCrawler.java | 2 +- .../myreader/widget/page/LocalPageLoader.java | 2 +- .../myreader/widget/page/NetPageLoader.java | 2 +- app/src/main/res/drawable/ic_link.xml | 4 +- app/src/main/res/drawable/ic_more.xml | 15 ++ .../main/res/layout/activity_read_record.xml | 51 +++++ app/src/main/res/layout/fragment_find.xml | 53 +++++ app/src/main/res/layout/fragment_mine.xml | 30 ++- app/src/main/res/layout/item_read_record.xml | 113 ++++++++++ app/src/main/res/values/strings.xml | 3 + app/version_code.properties | 2 +- 87 files changed, 969 insertions(+), 129 deletions(-) create mode 100644 app/src/main/java/xyz/fycz/myreader/greendao/entity/ReadRecord.java create mode 100644 app/src/main/java/xyz/fycz/myreader/greendao/service/ReadRecordService.java create mode 100644 app/src/main/java/xyz/fycz/myreader/ui/activity/ReadRecordActivity.java create mode 100644 app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/ReadRecordHolder.java rename app/src/main/java/xyz/fycz/myreader/util/{ => help}/CalendarHelper.java (99%) rename app/src/main/java/xyz/fycz/myreader/util/{ => help}/DateHelper.java (99%) rename app/src/main/java/xyz/fycz/myreader/util/{ => help}/OpenFileHelper.java (97%) create mode 100644 app/src/main/java/xyz/fycz/myreader/util/help/RelativeDateHelp.java rename app/src/main/java/xyz/fycz/myreader/util/{ => help}/StringHelper.java (99%) create mode 100644 app/src/main/res/drawable/ic_more.xml create mode 100644 app/src/main/res/layout/activity_read_record.xml create mode 100644 app/src/main/res/layout/item_read_record.xml diff --git a/.idea/assetWizardSettings.xml b/.idea/assetWizardSettings.xml index e75312f..dade6b2 100644 --- a/.idea/assetWizardSettings.xml +++ b/.idea/assetWizardSettings.xml @@ -14,8 +14,8 @@ diff --git a/app/build.gradle b/app/build.gradle index e38170f..d4d5008 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -213,7 +213,7 @@ dependencies { } greendao { - schemaVersion 28 + schemaVersion 29 daoPackage 'xyz.fycz.myreader.greendao.gen' // targetGenDir 'src/main/java' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index aecd0ff..28d8283 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -136,6 +136,7 @@ + diff --git a/app/src/main/assets/updatelog.fy b/app/src/main/assets/updatelog.fy index 6acce41..1249864 100644 --- a/app/src/main/assets/updatelog.fy +++ b/app/src/main/assets/updatelog.fy @@ -1,5 +1,11 @@ 2021.06.01 -风月读书v2.0.2 +风月读书v2.0.5 +更新内容: +1、优化对话框 +2、新增阅读记录(记录上次阅读时间和时长) +3、新增友链 + +风月读书v2.0.4 更新内容: 1、修复部分机型概率性启动闪退的问题 diff --git a/app/src/main/java/xyz/fycz/myreader/application/App.java b/app/src/main/java/xyz/fycz/myreader/application/App.java index 6a78c00..91563d7 100644 --- a/app/src/main/java/xyz/fycz/myreader/application/App.java +++ b/app/src/main/java/xyz/fycz/myreader/application/App.java @@ -56,7 +56,7 @@ import xyz.fycz.myreader.ui.dialog.DialogCreator; import xyz.fycz.myreader.ui.fragment.BookcaseFragment; import xyz.fycz.myreader.util.help.SSLSocketClient; import xyz.fycz.myreader.util.SharedPreUtils; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.util.ToastUtils; import xyz.fycz.myreader.util.utils.FileUtils; import xyz.fycz.myreader.util.utils.NetworkUtils; diff --git a/app/src/main/java/xyz/fycz/myreader/entity/Date.java b/app/src/main/java/xyz/fycz/myreader/entity/Date.java index c75a59b..4d02d06 100644 --- a/app/src/main/java/xyz/fycz/myreader/entity/Date.java +++ b/app/src/main/java/xyz/fycz/myreader/entity/Date.java @@ -1,7 +1,7 @@ package xyz.fycz.myreader.entity; -import xyz.fycz.myreader.util.CalendarHelper; +import xyz.fycz.myreader.util.help.CalendarHelper; import java.io.Serializable; diff --git a/app/src/main/java/xyz/fycz/myreader/entity/Setting.java b/app/src/main/java/xyz/fycz/myreader/entity/Setting.java index c12a76c..682b02b 100644 --- a/app/src/main/java/xyz/fycz/myreader/entity/Setting.java +++ b/app/src/main/java/xyz/fycz/myreader/entity/Setting.java @@ -16,7 +16,7 @@ import xyz.fycz.myreader.common.APPCONST; import xyz.fycz.myreader.enums.BookcaseStyle; import xyz.fycz.myreader.enums.Font; import xyz.fycz.myreader.enums.Language; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.util.ZipUtils; import xyz.fycz.myreader.util.utils.BitmapUtil; import xyz.fycz.myreader.util.utils.FileUtils; diff --git a/app/src/main/java/xyz/fycz/myreader/greendao/entity/Book.java b/app/src/main/java/xyz/fycz/myreader/greendao/entity/Book.java index 2d2a43d..e6909fb 100644 --- a/app/src/main/java/xyz/fycz/myreader/greendao/entity/Book.java +++ b/app/src/main/java/xyz/fycz/myreader/greendao/entity/Book.java @@ -14,7 +14,6 @@ import org.greenrobot.greendao.annotation.Transient; import xyz.fycz.myreader.greendao.service.BookService; import xyz.fycz.myreader.util.SharedPreUtils; -import xyz.fycz.myreader.util.StringHelper; import java.io.Serializable; import java.util.HashMap; diff --git a/app/src/main/java/xyz/fycz/myreader/greendao/entity/ReadRecord.java b/app/src/main/java/xyz/fycz/myreader/greendao/entity/ReadRecord.java new file mode 100644 index 0000000..bbdb811 --- /dev/null +++ b/app/src/main/java/xyz/fycz/myreader/greendao/entity/ReadRecord.java @@ -0,0 +1,84 @@ +package xyz.fycz.myreader.greendao.entity; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * @author fengyue + * @date 2021/6/1 18:38 + */ +@Entity +public class ReadRecord { + @Id + private String id; + private String bookImg; + private String bookName; + private String bookAuthor; + private long readTime; + private long updateTime; + + + @Generated(hash = 1191129215) + public ReadRecord() { + } + + @Generated(hash = 381392552) + public ReadRecord(String id, String bookImg, String bookName, String bookAuthor, + long readTime, long updateTime) { + this.id = id; + this.bookImg = bookImg; + this.bookName = bookName; + this.bookAuthor = bookAuthor; + this.readTime = readTime; + this.updateTime = updateTime; + } + + public String getId() { + return this.id; + } + + public void setId(String id) { + this.id = id; + } + + public String getBookName() { + return this.bookName; + } + + public void setBookName(String bookName) { + this.bookName = bookName; + } + + public String getBookAuthor() { + return this.bookAuthor; + } + + public void setBookAuthor(String bookAuthor) { + this.bookAuthor = bookAuthor; + } + + public long getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(long updateTime) { + this.updateTime = updateTime; + } + + public String getBookImg() { + return this.bookImg; + } + + public void setBookImg(String bookImg) { + this.bookImg = bookImg; + } + + public long getReadTime() { + return this.readTime; + } + + public void setReadTime(long readTime) { + this.readTime = readTime; + } +} diff --git a/app/src/main/java/xyz/fycz/myreader/greendao/service/BookGroupService.java b/app/src/main/java/xyz/fycz/myreader/greendao/service/BookGroupService.java index de4212f..c90bb68 100644 --- a/app/src/main/java/xyz/fycz/myreader/greendao/service/BookGroupService.java +++ b/app/src/main/java/xyz/fycz/myreader/greendao/service/BookGroupService.java @@ -6,7 +6,7 @@ import xyz.fycz.myreader.greendao.DbManager; import xyz.fycz.myreader.greendao.entity.BookGroup; import xyz.fycz.myreader.greendao.gen.BookGroupDao; import xyz.fycz.myreader.util.SharedPreUtils; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import java.util.List; diff --git a/app/src/main/java/xyz/fycz/myreader/greendao/service/BookMarkService.java b/app/src/main/java/xyz/fycz/myreader/greendao/service/BookMarkService.java index 5bece16..3a8c64e 100644 --- a/app/src/main/java/xyz/fycz/myreader/greendao/service/BookMarkService.java +++ b/app/src/main/java/xyz/fycz/myreader/greendao/service/BookMarkService.java @@ -3,7 +3,7 @@ package xyz.fycz.myreader.greendao.service; import xyz.fycz.myreader.greendao.DbManager; import xyz.fycz.myreader.greendao.entity.BookMark; import xyz.fycz.myreader.greendao.gen.BookMarkDao; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import java.util.ArrayList; import java.util.List; diff --git a/app/src/main/java/xyz/fycz/myreader/greendao/service/BookService.java b/app/src/main/java/xyz/fycz/myreader/greendao/service/BookService.java index 76fdc93..064119a 100644 --- a/app/src/main/java/xyz/fycz/myreader/greendao/service/BookService.java +++ b/app/src/main/java/xyz/fycz/myreader/greendao/service/BookService.java @@ -15,6 +15,7 @@ import xyz.fycz.myreader.greendao.gen.BookDao; import xyz.fycz.myreader.util.*; import xyz.fycz.myreader.greendao.DbManager; import xyz.fycz.myreader.greendao.entity.Book; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.util.utils.FileUtils; import xyz.fycz.myreader.util.utils.StringUtils; diff --git a/app/src/main/java/xyz/fycz/myreader/greendao/service/ChapterService.java b/app/src/main/java/xyz/fycz/myreader/greendao/service/ChapterService.java index f0a3ea5..c9e8c0c 100644 --- a/app/src/main/java/xyz/fycz/myreader/greendao/service/ChapterService.java +++ b/app/src/main/java/xyz/fycz/myreader/greendao/service/ChapterService.java @@ -6,7 +6,7 @@ import xyz.fycz.myreader.common.APPCONST; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.greendao.gen.ChapterDao; import xyz.fycz.myreader.util.IOUtils; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.greendao.DbManager; import xyz.fycz.myreader.util.utils.FileUtils; diff --git a/app/src/main/java/xyz/fycz/myreader/greendao/service/ReadRecordService.java b/app/src/main/java/xyz/fycz/myreader/greendao/service/ReadRecordService.java new file mode 100644 index 0000000..736be87 --- /dev/null +++ b/app/src/main/java/xyz/fycz/myreader/greendao/service/ReadRecordService.java @@ -0,0 +1,76 @@ +package xyz.fycz.myreader.greendao.service; + +import java.util.List; + +import io.reactivex.Single; +import xyz.fycz.myreader.greendao.DbManager; +import xyz.fycz.myreader.greendao.entity.Book; +import xyz.fycz.myreader.greendao.entity.ReadRecord; +import xyz.fycz.myreader.greendao.gen.BookDao; +import xyz.fycz.myreader.greendao.gen.ReadRecordDao; + +/** + * @author fengyue + * @date 2021/6/1 19:09 + */ +public class ReadRecordService extends BaseService { + private static volatile ReadRecordService sInstance; + + public static ReadRecordService getInstance() { + if (sInstance == null) { + synchronized (ReadRecordService.class) { + if (sInstance == null) { + sInstance = new ReadRecordService(); + } + } + } + return sInstance; + } + + /** + * 获取所有书籍分组 + * + * @return + */ + public Single> getAllRecordsByTime() { + return Single.create(emitter -> emitter.onSuccess(DbManager.getDaoSession().getReadRecordDao() + .queryBuilder() + .orderDesc(ReadRecordDao.Properties.UpdateTime) + .list())); + } + + public Single removeAll() { + return Single.create(emitter -> { + DbManager.getDaoSession().getReadRecordDao().deleteAll(); + emitter.onSuccess(true); + }); + } + + public Single removeAllTime(List records) { + return Single.create(emitter -> { + for (ReadRecord record : records) { + record.setReadTime(0); + record.setUpdateTime(0); + } + DbManager.getDaoSession().getReadRecordDao().insertOrReplaceInTx(records); + emitter.onSuccess(true); + }); + } + + public ReadRecord get(String bookName, String bookAuthor) { + try { + return DbManager.getInstance().getSession().getReadRecordDao() + .queryBuilder() + .where(ReadRecordDao.Properties.BookName.eq(bookName), + ReadRecordDao.Properties.BookAuthor.eq(bookAuthor)) + .unique(); + } catch (Exception e) { + e.printStackTrace(); + return DbManager.getInstance().getSession().getReadRecordDao() + .queryBuilder() + .where(ReadRecordDao.Properties.BookName.eq(bookName), + ReadRecordDao.Properties.BookAuthor.eq(bookAuthor)) + .list().get(0); + } + } +} diff --git a/app/src/main/java/xyz/fycz/myreader/greendao/service/SearchHistoryService.java b/app/src/main/java/xyz/fycz/myreader/greendao/service/SearchHistoryService.java index b93012c..c8dac07 100644 --- a/app/src/main/java/xyz/fycz/myreader/greendao/service/SearchHistoryService.java +++ b/app/src/main/java/xyz/fycz/myreader/greendao/service/SearchHistoryService.java @@ -4,8 +4,8 @@ import android.database.Cursor; import xyz.fycz.myreader.greendao.entity.SearchHistory; import xyz.fycz.myreader.greendao.gen.SearchHistoryDao; -import xyz.fycz.myreader.util.DateHelper; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.DateHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.greendao.DbManager; import java.util.ArrayList; diff --git a/app/src/main/java/xyz/fycz/myreader/greendao/util/MySQLiteOpenHelper.java b/app/src/main/java/xyz/fycz/myreader/greendao/util/MySQLiteOpenHelper.java index 5c89b97..132aa0e 100644 --- a/app/src/main/java/xyz/fycz/myreader/greendao/util/MySQLiteOpenHelper.java +++ b/app/src/main/java/xyz/fycz/myreader/greendao/util/MySQLiteOpenHelper.java @@ -38,7 +38,7 @@ public class MySQLiteOpenHelper extends DaoMaster.OpenHelper { }, BookDao.class, ChapterDao.class, SearchHistoryDao.class, BookMarkDao.class, BookGroupDao.class, ReplaceRuleBeanDao.class, - BookSourceDao.class, CookieBeanDao.class + BookSourceDao.class, CookieBeanDao.class, ReadRecordDao.class ); } diff --git a/app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/BaseAnalyzer.java b/app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/BaseAnalyzer.java index 52b5fd8..01620f4 100644 --- a/app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/BaseAnalyzer.java +++ b/app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/BaseAnalyzer.java @@ -6,7 +6,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.util.utils.StringUtils; /** diff --git a/app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/BookSourceManager.java b/app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/BookSourceManager.java index 9c80f5e..492ad25 100644 --- a/app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/BookSourceManager.java +++ b/app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/BookSourceManager.java @@ -4,8 +4,6 @@ import android.database.Cursor; import android.text.TextUtils; import android.util.Log; -import androidx.annotation.Nullable; - import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -24,7 +22,7 @@ import xyz.fycz.myreader.greendao.DbManager; import xyz.fycz.myreader.greendao.entity.rule.BookSource; import xyz.fycz.myreader.greendao.gen.BookSourceDao; import xyz.fycz.myreader.util.SharedPreUtils; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.util.utils.FileUtils; import xyz.fycz.myreader.util.utils.GsonExtensionsKt; import xyz.fycz.myreader.util.utils.GsonUtils; diff --git a/app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/JsonPathAnalyzer.java b/app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/JsonPathAnalyzer.java index 7001d4d..1382696 100644 --- a/app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/JsonPathAnalyzer.java +++ b/app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/JsonPathAnalyzer.java @@ -12,7 +12,7 @@ import com.jayway.jsonpath.spi.json.GsonJsonProvider; import java.util.ArrayList; import java.util.List; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; /** * @author fengyue diff --git a/app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/MatcherAnalyzer.java b/app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/MatcherAnalyzer.java index d828e66..e2ce9b0 100644 --- a/app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/MatcherAnalyzer.java +++ b/app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/MatcherAnalyzer.java @@ -11,7 +11,7 @@ import xyz.fycz.myreader.greendao.entity.rule.ContentRule; import xyz.fycz.myreader.greendao.entity.rule.InfoRule; import xyz.fycz.myreader.greendao.entity.rule.SearchRule; import xyz.fycz.myreader.greendao.entity.rule.TocRule; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.util.utils.NetworkUtils; import xyz.fycz.myreader.util.utils.StringUtils; diff --git a/app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/XpathAnalyzer.java b/app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/XpathAnalyzer.java index 3c569c1..249099c 100644 --- a/app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/XpathAnalyzer.java +++ b/app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/XpathAnalyzer.java @@ -6,7 +6,7 @@ import org.seimicrawler.xpath.JXNode; import java.util.ArrayList; import java.util.List; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; /** * @author fengyue diff --git a/app/src/main/java/xyz/fycz/myreader/model/storage/WebDavHelp.kt b/app/src/main/java/xyz/fycz/myreader/model/storage/WebDavHelp.kt index 4c25536..7667c76 100644 --- a/app/src/main/java/xyz/fycz/myreader/model/storage/WebDavHelp.kt +++ b/app/src/main/java/xyz/fycz/myreader/model/storage/WebDavHelp.kt @@ -78,7 +78,7 @@ object WebDavHelp { }*/ BottomMenu.build().setTitle("选择恢复文件") .setMenuStringList(names) - .setOnMenuItemClickListener { dialog, text, which -> + .setOnMenuItemClickListener { _, _, which -> if (which in 0 until 30.coerceAtLeast(names.size)) { restoreWebDav(names[which], callBack) } diff --git a/app/src/main/java/xyz/fycz/myreader/model/third2/analyzeRule/AnalyzeRule.java b/app/src/main/java/xyz/fycz/myreader/model/third2/analyzeRule/AnalyzeRule.java index 1c65732..2cf42c8 100644 --- a/app/src/main/java/xyz/fycz/myreader/model/third2/analyzeRule/AnalyzeRule.java +++ b/app/src/main/java/xyz/fycz/myreader/model/third2/analyzeRule/AnalyzeRule.java @@ -19,7 +19,7 @@ import javax.script.SimpleBindings; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.service.CookieStore; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.util.help.JsExtensions; import xyz.fycz.myreader.util.utils.NetworkUtils; import xyz.fycz.myreader.util.utils.StringUtils; @@ -28,7 +28,7 @@ import static xyz.fycz.myreader.common.APPCONST.EXP_PATTERN; import static xyz.fycz.myreader.common.APPCONST.JS_PATTERN; import static xyz.fycz.myreader.common.APPCONST.MAP_STRING; import static xyz.fycz.myreader.common.APPCONST.SCRIPT_ENGINE; -import static xyz.fycz.myreader.util.StringHelper.isEmpty; +import static xyz.fycz.myreader.util.help.StringHelper.isEmpty; import static xyz.fycz.myreader.util.utils.NetworkUtils.headerPattern; diff --git a/app/src/main/java/xyz/fycz/myreader/model/third2/analyzeRule/AnalyzeUrl.java b/app/src/main/java/xyz/fycz/myreader/model/third2/analyzeRule/AnalyzeUrl.java index c51b4b1..2bd7c25 100644 --- a/app/src/main/java/xyz/fycz/myreader/model/third2/analyzeRule/AnalyzeUrl.java +++ b/app/src/main/java/xyz/fycz/myreader/model/third2/analyzeRule/AnalyzeUrl.java @@ -19,7 +19,7 @@ import java.util.regex.Pattern; import javax.script.SimpleBindings; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.util.help.JsExtensions; import xyz.fycz.myreader.util.utils.NetworkUtils; import xyz.fycz.myreader.util.utils.StringUtils; diff --git a/app/src/main/java/xyz/fycz/myreader/ui/activity/AdSettingActivity.java b/app/src/main/java/xyz/fycz/myreader/ui/activity/AdSettingActivity.java index cc6b1c3..f3c4dbc 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/activity/AdSettingActivity.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/activity/AdSettingActivity.java @@ -14,8 +14,7 @@ import xyz.fycz.myreader.base.BaseActivity; import xyz.fycz.myreader.base.observer.MySingleObserver; import xyz.fycz.myreader.databinding.ActivityAdSettingBinding; import xyz.fycz.myreader.ui.dialog.LoadingDialog; -import xyz.fycz.myreader.ui.dialog.MyAlertDialog; -import xyz.fycz.myreader.util.DateHelper; +import xyz.fycz.myreader.util.help.DateHelper; import xyz.fycz.myreader.util.SharedPreUtils; import xyz.fycz.myreader.util.ToastUtils; import xyz.fycz.myreader.util.utils.AdUtils; diff --git a/app/src/main/java/xyz/fycz/myreader/ui/activity/BookDetailedActivity.java b/app/src/main/java/xyz/fycz/myreader/ui/activity/BookDetailedActivity.java index e20b9cb..24575d3 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/activity/BookDetailedActivity.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/activity/BookDetailedActivity.java @@ -68,7 +68,7 @@ import xyz.fycz.myreader.ui.dialog.SourceExchangeDialog; import xyz.fycz.myreader.util.IOUtils; import xyz.fycz.myreader.util.ShareUtils; import xyz.fycz.myreader.util.SharedPreUtils; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.util.ToastUtils; import xyz.fycz.myreader.util.utils.AdUtils; import xyz.fycz.myreader.util.utils.BitmapUtil; diff --git a/app/src/main/java/xyz/fycz/myreader/ui/activity/MainActivity.java b/app/src/main/java/xyz/fycz/myreader/ui/activity/MainActivity.java index c2fb10e..47802c0 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/activity/MainActivity.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/activity/MainActivity.java @@ -44,7 +44,7 @@ import xyz.fycz.myreader.ui.fragment.BookcaseFragment; import xyz.fycz.myreader.ui.fragment.FindFragment; import xyz.fycz.myreader.ui.fragment.MineFragment; import xyz.fycz.myreader.util.SharedPreUtils; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.util.ToastUtils; import xyz.fycz.myreader.util.utils.AdUtils; import xyz.fycz.myreader.util.utils.GsonExtensionsKt; diff --git a/app/src/main/java/xyz/fycz/myreader/ui/activity/QRCodeScanActivity.java b/app/src/main/java/xyz/fycz/myreader/ui/activity/QRCodeScanActivity.java index 04a996a..343ef46 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/activity/QRCodeScanActivity.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/activity/QRCodeScanActivity.java @@ -23,7 +23,7 @@ import xyz.fycz.myreader.base.BaseActivity; import xyz.fycz.myreader.base.observer.MySingleObserver; import xyz.fycz.myreader.databinding.ActivityQrcodeCaptureBinding; import xyz.fycz.myreader.util.PermissionsChecker; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.util.ToastUtils; import xyz.fycz.myreader.util.utils.RxUtils; diff --git a/app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java b/app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java index 1b49512..8b95fb9 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java @@ -39,9 +39,7 @@ import androidx.core.content.ContextCompat; import com.gyf.immersionbar.ImmersionBar; import com.jaredrummler.android.colorpicker.ColorPickerDialogListener; -import com.kongzue.dialogx.dialogs.BottomDialog; import com.kongzue.dialogx.dialogs.BottomMenu; -import com.kongzue.dialogx.interfaces.OnDialogButtonClickListener; import com.kongzue.dialogx.interfaces.OnMenuItemSelectListener; import org.jetbrains.annotations.NotNull; @@ -52,6 +50,7 @@ import java.util.List; import java.util.Locale; import io.reactivex.Observable; +import io.reactivex.Single; import io.reactivex.schedulers.Schedulers; import xyz.fycz.myreader.ActivityManage; import xyz.fycz.myreader.R; @@ -66,22 +65,24 @@ import xyz.fycz.myreader.databinding.ActivityReadBinding; import xyz.fycz.myreader.entity.Setting; import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.enums.Font; +import xyz.fycz.myreader.greendao.DbManager; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.BookMark; import xyz.fycz.myreader.greendao.entity.Chapter; +import xyz.fycz.myreader.greendao.entity.ReadRecord; import xyz.fycz.myreader.greendao.entity.ReplaceRuleBean; import xyz.fycz.myreader.greendao.entity.rule.BookSource; import xyz.fycz.myreader.greendao.service.BookGroupService; import xyz.fycz.myreader.greendao.service.BookMarkService; import xyz.fycz.myreader.greendao.service.BookService; import xyz.fycz.myreader.greendao.service.ChapterService; +import xyz.fycz.myreader.greendao.service.ReadRecordService; import xyz.fycz.myreader.model.audio.ReadAloudService; import xyz.fycz.myreader.model.sourceAnalyzer.BookSourceManager; import xyz.fycz.myreader.model.storage.Backup; import xyz.fycz.myreader.ui.dialog.AudioPlayerDialog; import xyz.fycz.myreader.ui.dialog.CopyContentDialog; import xyz.fycz.myreader.ui.dialog.DialogCreator; -import xyz.fycz.myreader.ui.dialog.MyAlertDialog; import xyz.fycz.myreader.ui.dialog.ReplaceDialog; import xyz.fycz.myreader.ui.dialog.SourceExchangeDialog; import xyz.fycz.myreader.ui.popmenu.AutoPageMenu; @@ -90,10 +91,10 @@ import xyz.fycz.myreader.ui.popmenu.CustomizeComMenu; import xyz.fycz.myreader.ui.popmenu.CustomizeLayoutMenu; import xyz.fycz.myreader.ui.popmenu.ReadSettingMenu; import xyz.fycz.myreader.util.BrightUtil; -import xyz.fycz.myreader.util.DateHelper; +import xyz.fycz.myreader.util.help.DateHelper; import xyz.fycz.myreader.util.ShareUtils; import xyz.fycz.myreader.util.SharedPreUtils; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.util.SystemUtil; import xyz.fycz.myreader.util.ToastUtils; import xyz.fycz.myreader.util.notification.NotificationClickReceiver; @@ -137,6 +138,7 @@ public class ReadActivity extends BaseActivity implements ColorPickerDialogListe private BookMarkService mBookMarkService; private NotificationUtil notificationUtil; private Setting mSetting; + private ReadRecord record; private boolean isCollected = true;//是否在书架中 @@ -155,6 +157,7 @@ public class ReadActivity extends BaseActivity implements ColorPickerDialogListe private Runnable keepScreenRunnable;//息屏线程 private Runnable autoPageRunnable;//自动翻页 private Runnable sendDownloadNotification; + private static boolean isStopDownload = true; private int tempCacheChapterNum; @@ -163,8 +166,6 @@ public class ReadActivity extends BaseActivity implements ColorPickerDialogListe private ReadCrawler mReadCrawler; - private int upHpbInterval = 30;//更新翻页进度速度 - private int downloadInterval = 150; private SourceExchangeDialog mSourceDialog; @@ -182,6 +183,9 @@ public class ReadActivity extends BaseActivity implements ColorPickerDialogListe private Animation mBottomOutAnim; private int lastX, lastY; + private long lastRecordTime;//上次记录时间 + + // 接收电池信息和时间更新的广播 private BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override @@ -333,6 +337,7 @@ public class ReadActivity extends BaseActivity implements ColorPickerDialogListe if (aBooks != null) { mSourceDialog.setABooks(aBooks); } + lastRecordTime = System.currentTimeMillis(); } @Override @@ -411,6 +416,7 @@ public class ReadActivity extends BaseActivity implements ColorPickerDialogListe @Override public void onChapterChange(int pos) { mBook.setHistoryChapterId(mChapters.get(pos).getTitle()); + recordReadTime(); } @Override @@ -425,6 +431,7 @@ public class ReadActivity extends BaseActivity implements ColorPickerDialogListe @Override public void onPageChange(int pos, boolean resetRead) { mHandler.sendMessage(mHandler.obtainMessage(4)); + recordReadTime(); if (ReadAloudService.running) { if (mPageLoader.hasChapterData(mChapters.get(mPageLoader.getChapterPos()))) { if (resetRead) { @@ -1587,22 +1594,22 @@ public class ReadActivity extends BaseActivity implements ColorPickerDialogListe selectedIndex = which; } }).setOkButton("确定", (baseDialog, v) -> { - switch (selectedIndex) { - case 0: - addDownload(mPageLoader.getChapterPos(), mPageLoader.getChapterPos() + 50); - break; - case 1: - addDownload(mPageLoader.getChapterPos() - 50, mPageLoader.getChapterPos() + 50); - break; - case 2: - addDownload(mPageLoader.getChapterPos(), mChapters.size()); - break; - case 3: - addDownload(0, mChapters.size()); - break; - } - return false; - }).setCancelButton(R.string.cancel); + switch (selectedIndex) { + case 0: + addDownload(mPageLoader.getChapterPos(), mPageLoader.getChapterPos() + 50); + break; + case 1: + addDownload(mPageLoader.getChapterPos() - 50, mPageLoader.getChapterPos() + 50); + break; + case 2: + addDownload(mPageLoader.getChapterPos(), mChapters.size()); + break; + case 3: + addDownload(0, mChapters.size()); + break; + } + return false; + }).setCancelButton(R.string.cancel); }); } @@ -2086,4 +2093,30 @@ public class ReadActivity extends BaseActivity implements ColorPickerDialogListe textToSpeech.speak(text, TextToSpeech.QUEUE_ADD, null, "select_text"); lastText = ""; } + + /** + * 记录阅读时间 + */ + private void recordReadTime() { + Single.create(emitter -> { + if (mBook == null) return; + if (record == null) { + record = ReadRecordService.getInstance().get(mBook.getName(), mBook.getAuthor()); + if (record == null) { + record = new ReadRecord(); + record.setId(StringHelper.getStringRandom(25)); + record.setBookName(mBook.getName()); + record.setBookAuthor(mBook.getAuthor()); + record.setBookImg(NetworkUtils.getAbsoluteURL(mReadCrawler.getNameSpace(), + mBook.getImgUrl())); + } + } + long curTime = System.currentTimeMillis(); + long deltaTime = curTime - lastRecordTime; + lastRecordTime = curTime; + record.setUpdateTime(curTime); + record.setReadTime(record.getReadTime() + deltaTime); + DbManager.getDaoSession().getReadRecordDao().insertOrReplace(record); + }).subscribe(); + } } diff --git a/app/src/main/java/xyz/fycz/myreader/ui/activity/ReadRecordActivity.java b/app/src/main/java/xyz/fycz/myreader/ui/activity/ReadRecordActivity.java new file mode 100644 index 0000000..f87e7e9 --- /dev/null +++ b/app/src/main/java/xyz/fycz/myreader/ui/activity/ReadRecordActivity.java @@ -0,0 +1,206 @@ +package xyz.fycz.myreader.ui.activity; + +import android.content.Intent; +import android.os.Bundle; +import android.view.View; + +import androidx.appcompat.widget.Toolbar; +import androidx.recyclerview.widget.LinearLayoutManager; + +import com.kongzue.dialogx.dialogs.BottomMenu; +import com.kongzue.dialogx.interfaces.OnMenuItemClickListener; +import com.kongzue.dialogx.interfaces.OnMenuItemSelectListener; + +import org.jetbrains.annotations.NotNull; + +import java.util.List; + +import xyz.fycz.myreader.R; +import xyz.fycz.myreader.base.BaseActivity; +import xyz.fycz.myreader.base.BitIntentDataManager; +import xyz.fycz.myreader.base.adapter.BaseListAdapter; +import xyz.fycz.myreader.base.adapter.IViewHolder; +import xyz.fycz.myreader.base.observer.MySingleObserver; +import xyz.fycz.myreader.common.APPCONST; +import xyz.fycz.myreader.databinding.ActivityReadRecordBinding; +import xyz.fycz.myreader.greendao.DbManager; +import xyz.fycz.myreader.greendao.entity.Book; +import xyz.fycz.myreader.greendao.entity.ReadRecord; +import xyz.fycz.myreader.greendao.service.BookService; +import xyz.fycz.myreader.greendao.service.ReadRecordService; +import xyz.fycz.myreader.ui.adapter.holder.ReadRecordHolder; +import xyz.fycz.myreader.ui.dialog.DialogCreator; +import xyz.fycz.myreader.ui.dialog.SourceExchangeDialog; +import xyz.fycz.myreader.util.ToastUtils; +import xyz.fycz.myreader.util.help.RelativeDateHelp; +import xyz.fycz.myreader.util.utils.RxUtils; +import xyz.fycz.myreader.widget.DividerItemDecoration; + +/** + * @author fengyue + * @date 2021/6/1 19:07 + */ +public class ReadRecordActivity extends BaseActivity { + private ActivityReadRecordBinding binding; + private List records; + private long allTime; + private BaseListAdapter mAdapter; + private SourceExchangeDialog mSourceDia; + private ReadRecordService recordService; + + @Override + protected void bindView() { + binding = ActivityReadRecordBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); + } + + @Override + protected void setUpToolbar(Toolbar toolbar) { + super.setUpToolbar(toolbar); + setStatusBarColor(R.color.colorPrimary, true); + getSupportActionBar().setTitle(getString(R.string.read_record)); + } + + @Override + protected void initData(Bundle savedInstanceState) { + super.initData(savedInstanceState); + recordService = ReadRecordService.getInstance(); + recordService.getAllRecordsByTime().compose(RxUtils::toSimpleSingle) + .subscribe(new MySingleObserver>() { + @Override + public void onSuccess(@NotNull List readRecords) { + records = readRecords; + initRecords(); + } + + @Override + public void onError(Throwable e) { + ToastUtils.showError("数据加载失败\n" + e.getLocalizedMessage()); + } + }); + } + + private void initAllTime() { + allTime = 0; + for (ReadRecord record : records) { + allTime += record.getReadTime(); + } + binding.tvAllRecord.setText(getString(R.string.all_read_time, + RelativeDateHelp.formatDuring(allTime))); + } + + private void initRecords() { + initAllTime(); + mAdapter = new BaseListAdapter() { + @Override + protected IViewHolder createViewHolder(int viewType) { + return new ReadRecordHolder((itemPos, menuPos) -> { + ReadRecord record = records.get(itemPos); + switch (menuPos) { + case 0: + DbManager.getDaoSession().getReadRecordDao().delete(record); + records.remove(itemPos); + mAdapter.removeItem(record); + ToastUtils.showSuccess(String.format("《%s》阅读记录移除成功", record.getBookName())); + break; + case 1: + record.setReadTime(0); + record.setUpdateTime(0); + DbManager.getDaoSession().getReadRecordDao().insertOrReplace(record); + mAdapter.notifyDataSetChanged(); + ToastUtils.showSuccess(String.format("《%s》阅读时长已清空", record.getBookName())); + break; + } + initAllTime(); + }); + } + }; + + //设置布局 + binding.rvRecords.setLayoutManager(new LinearLayoutManager(this)); + binding.rvRecords.setAdapter(mAdapter); + + mAdapter.refreshItems(records); + mAdapter.setOnItemClickListener((view, pos) -> { + ReadRecord record = records.get(pos); + Book book = BookService.getInstance().findBookByAuthorAndName(record.getBookName(), record.getBookAuthor()); + if (book == null) { + DialogCreator.createCommonDialog(this, "搜索书籍", + "当前书籍未加入书架,是否重新搜索?", false, (dialog, which) -> { + Book newBook = new Book(); + newBook.setName(record.getBookName()); + newBook.setAuthor(record.getBookAuthor()); + newBook.setImgUrl(record.getBookImg()); + mSourceDia = new SourceExchangeDialog(this, newBook); + mSourceDia.setOnSourceChangeListener((bean, pos1) -> { + Intent intent = new Intent(this, BookDetailedActivity.class); + BitIntentDataManager.getInstance().putData(intent, mSourceDia.getaBooks()); + intent.putExtra(APPCONST.SOURCE_INDEX, pos1); + ReadRecordActivity.this.startActivity(intent); + mSourceDia.dismiss(); + }); + mSourceDia.show(); + }, null); + } else { + Intent intent = new Intent(this, BookDetailedActivity.class); + BitIntentDataManager.getInstance().putData(intent, book); + startActivity(intent); + } + }); + } + + @Override + protected void initClick() { + super.initClick(); + binding.ivMore.setOnClickListener(v -> { + String[] menu = new String[]{"移除所有记录", "清空阅读时长(不会删除记录)"}; + BottomMenu.show(menu) + .setTitle("总阅读记录") + .setOnMenuItemClickListener((dialog, text, which) -> { + if (records == null) { + ToastUtils.showWarring("数据未完成加载,无法进行操作!"); + return false; + } + switch (which) { + case 0: + recordService.removeAll().compose(RxUtils::toSimpleSingle) + .subscribe(new MySingleObserver() { + @Override + public void onSuccess(@NotNull Boolean aBoolean) { + ToastUtils.showSuccess("阅读记录已全部移除"); + records.clear(); + mAdapter.refreshItems(records); + initAllTime(); + } + + @Override + public void onError(Throwable e) { + super.onError(e); + ToastUtils.showError(e.getLocalizedMessage()); + } + }); + break; + case 1: + recordService.removeAllTime(records).compose(RxUtils::toSimpleSingle) + .subscribe(new MySingleObserver() { + @Override + public void onSuccess(@NotNull Boolean aBoolean) { + ToastUtils.showSuccess("阅读时长已全部清空"); + mAdapter.notifyDataSetChanged(); + initAllTime(); + } + + @Override + public void onError(Throwable e) { + super.onError(e); + ToastUtils.showError(e.getLocalizedMessage()); + } + }); + break; + } + return false; + }) + .setCancelButton(R.string.cancel); + }); + } +} diff --git a/app/src/main/java/xyz/fycz/myreader/ui/activity/SearchBookActivity.java b/app/src/main/java/xyz/fycz/myreader/ui/activity/SearchBookActivity.java index cca3b60..6688c7d 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/activity/SearchBookActivity.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/activity/SearchBookActivity.java @@ -56,7 +56,7 @@ import xyz.fycz.myreader.ui.adapter.SearchHistoryAdapter; import xyz.fycz.myreader.ui.dialog.DialogCreator; import xyz.fycz.myreader.ui.dialog.MultiChoiceDialog; import xyz.fycz.myreader.util.SharedPreUtils; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.util.ToastUtils; import xyz.fycz.myreader.util.utils.OkHttpUtils; import xyz.fycz.myreader.util.utils.RxUtils; diff --git a/app/src/main/java/xyz/fycz/myreader/ui/activity/SourceEditActivity.java b/app/src/main/java/xyz/fycz/myreader/ui/activity/SourceEditActivity.java index e283e95..049bb5f 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/activity/SourceEditActivity.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/activity/SourceEditActivity.java @@ -5,8 +5,6 @@ import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; -import android.view.View; -import android.widget.AdapterView; import android.widget.ArrayAdapter; import androidx.appcompat.widget.Toolbar; @@ -30,7 +28,7 @@ import xyz.fycz.myreader.model.sourceAnalyzer.BookSourceManager; import xyz.fycz.myreader.ui.adapter.SourceEditAdapter; import xyz.fycz.myreader.ui.dialog.DialogCreator; import xyz.fycz.myreader.ui.dialog.MyAlertDialog; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.util.ToastUtils; import xyz.fycz.myreader.webapi.crawler.source.MatcherCrawler; diff --git a/app/src/main/java/xyz/fycz/myreader/ui/activity/SplashActivity.java b/app/src/main/java/xyz/fycz/myreader/ui/activity/SplashActivity.java index 8ef07f4..6e191a1 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/activity/SplashActivity.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/activity/SplashActivity.java @@ -31,7 +31,7 @@ import xyz.fycz.myreader.common.APPCONST; import xyz.fycz.myreader.databinding.ActivitySplashBinding; import xyz.fycz.myreader.greendao.service.BookGroupService; import xyz.fycz.myreader.ui.dialog.MyAlertDialog; -import xyz.fycz.myreader.util.DateHelper; +import xyz.fycz.myreader.util.help.DateHelper; import xyz.fycz.myreader.util.IOUtils; import xyz.fycz.myreader.util.PermissionsChecker; import xyz.fycz.myreader.util.SharedPreUtils; diff --git a/app/src/main/java/xyz/fycz/myreader/ui/adapter/BookcaseDetailedAdapter.java b/app/src/main/java/xyz/fycz/myreader/ui/adapter/BookcaseDetailedAdapter.java index 9345cdc..92f506d 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/adapter/BookcaseDetailedAdapter.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/adapter/BookcaseDetailedAdapter.java @@ -8,8 +8,6 @@ import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.TextView; -import androidx.appcompat.app.AlertDialog; - import com.kongzue.dialogx.dialogs.BottomMenu; import java.io.IOException; @@ -21,11 +19,10 @@ import xyz.fycz.myreader.base.BitIntentDataManager; import xyz.fycz.myreader.common.APPCONST; import xyz.fycz.myreader.ui.activity.ReadActivity; import xyz.fycz.myreader.ui.dialog.DialogCreator; -import xyz.fycz.myreader.ui.dialog.MyAlertDialog; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.ui.activity.BookDetailedActivity; import xyz.fycz.myreader.ui.presenter.BookcasePresenter; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.util.ToastUtils; import xyz.fycz.myreader.util.utils.NetworkUtils; import xyz.fycz.myreader.webapi.crawler.ReadCrawlerUtil; diff --git a/app/src/main/java/xyz/fycz/myreader/ui/adapter/BookcaseDragAdapter.java b/app/src/main/java/xyz/fycz/myreader/ui/adapter/BookcaseDragAdapter.java index e2a52fe..d544855 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/adapter/BookcaseDragAdapter.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/adapter/BookcaseDragAdapter.java @@ -6,8 +6,6 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import androidx.appcompat.app.AlertDialog; - import com.kongzue.dialogx.dialogs.BottomMenu; import java.io.IOException; @@ -19,11 +17,10 @@ import xyz.fycz.myreader.base.BitIntentDataManager; import xyz.fycz.myreader.common.APPCONST; import xyz.fycz.myreader.ui.activity.ReadActivity; import xyz.fycz.myreader.ui.dialog.DialogCreator; -import xyz.fycz.myreader.ui.dialog.MyAlertDialog; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.ui.activity.BookDetailedActivity; import xyz.fycz.myreader.ui.presenter.BookcasePresenter; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.util.ToastUtils; import xyz.fycz.myreader.util.utils.NetworkUtils; import xyz.fycz.myreader.webapi.crawler.ReadCrawlerUtil; diff --git a/app/src/main/java/xyz/fycz/myreader/ui/adapter/LocalSourceAdapter.java b/app/src/main/java/xyz/fycz/myreader/ui/adapter/LocalSourceAdapter.java index 98195af..ae98af4 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/adapter/LocalSourceAdapter.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/adapter/LocalSourceAdapter.java @@ -7,10 +7,8 @@ import java.util.ArrayList; import java.util.List; import xyz.fycz.myreader.base.adapter.IViewHolder; -import xyz.fycz.myreader.greendao.entity.ReplaceRuleBean; import xyz.fycz.myreader.greendao.entity.rule.BookSource; import xyz.fycz.myreader.ui.adapter.holder.LocalSourceHolder; -import xyz.fycz.myreader.util.StringHelper; /** * @author fengyue diff --git a/app/src/main/java/xyz/fycz/myreader/ui/adapter/ReplaceRuleAdapter.java b/app/src/main/java/xyz/fycz/myreader/ui/adapter/ReplaceRuleAdapter.java index 9d6ecb3..22224d6 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/adapter/ReplaceRuleAdapter.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/adapter/ReplaceRuleAdapter.java @@ -12,7 +12,7 @@ import xyz.fycz.myreader.base.adapter.BaseListAdapter; import xyz.fycz.myreader.base.adapter.IViewHolder; import xyz.fycz.myreader.greendao.entity.ReplaceRuleBean; import xyz.fycz.myreader.ui.adapter.holder.ReplaceRuleHolder; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; /** * @author fengyue diff --git a/app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/BookSourceHolder.java b/app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/BookSourceHolder.java index 71450b8..b9eb580 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/BookSourceHolder.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/BookSourceHolder.java @@ -27,7 +27,7 @@ import xyz.fycz.myreader.model.sourceAnalyzer.BookSourceManager; import xyz.fycz.myreader.ui.activity.SourceEditActivity; import xyz.fycz.myreader.ui.adapter.BookSourceAdapter; import xyz.fycz.myreader.util.ShareUtils; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.util.ToastUtils; import xyz.fycz.myreader.util.utils.GsonExtensionsKt; import xyz.fycz.myreader.widget.swipemenu.SwipeMenuLayout; diff --git a/app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/BookStoreBookHolder.java b/app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/BookStoreBookHolder.java index 157d6f8..134b502 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/BookStoreBookHolder.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/BookStoreBookHolder.java @@ -10,7 +10,7 @@ import xyz.fycz.myreader.base.adapter.ViewHolderImpl; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.rule.BookSource; import xyz.fycz.myreader.model.sourceAnalyzer.BookSourceManager; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.util.utils.NetworkUtils; import xyz.fycz.myreader.webapi.crawler.ReadCrawlerUtil; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; diff --git a/app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/ReadRecordHolder.java b/app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/ReadRecordHolder.java new file mode 100644 index 0000000..0569e5f --- /dev/null +++ b/app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/ReadRecordHolder.java @@ -0,0 +1,74 @@ +package xyz.fycz.myreader.ui.adapter.holder; + +import android.app.Activity; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; + +import com.kongzue.dialogx.dialogs.BottomMenu; +import com.kongzue.dialogx.interfaces.OnMenuItemClickListener; + +import xyz.fycz.myreader.R; +import xyz.fycz.myreader.application.App; +import xyz.fycz.myreader.base.adapter.ViewHolderImpl; +import xyz.fycz.myreader.greendao.entity.ReadRecord; +import xyz.fycz.myreader.util.help.RelativeDateHelp; +import xyz.fycz.myreader.util.utils.NetworkUtils; +import xyz.fycz.myreader.widget.CoverImageView; + +/** + * @author fengyue + * @date 2021/6/1 19:31 + */ +public class ReadRecordHolder extends ViewHolderImpl { + private OnMenuItemClickListener onMenuItemClickListener; + private CoverImageView ivBookImg; + private TextView tvBookName; + private TextView tvBookAuthor; + private TextView tvRecord; + private ImageView ivMore; + private final String[] menu = new String[]{"移除此记录", "清空阅读时长(不会删除记录)"}; + + public ReadRecordHolder(OnMenuItemClickListener onMenuItemClickListener) { + this.onMenuItemClickListener = onMenuItemClickListener; + } + + @Override + protected int getItemLayoutId() { + return R.layout.item_read_record; + } + + @Override + public void initView() { + ivBookImg = findById(R.id.iv_book_img); + tvBookName = findById(R.id.tv_book_name); + tvBookAuthor = findById(R.id.tv_book_author); + tvRecord = findById(R.id.tv_book_read_record); + ivMore = findById(R.id.iv_more); + } + + @Override + public void onBind(ReadRecord data, int pos) { + if (!App.isDestroy((Activity) getContext())) { + ivBookImg.load(data.getBookImg(), data.getBookName(), data.getBookAuthor()); + } + tvBookName.setText(data.getBookName()); + tvBookAuthor.setText(data.getBookAuthor()); + String lastTime = data.getUpdateTime() == 0 ? "无记录" + : RelativeDateHelp.format(data.getUpdateTime()); + tvRecord.setText(String.format("%s · %s", lastTime, + RelativeDateHelp.formatDuring(data.getReadTime()))); + ivMore.setOnClickListener(v -> BottomMenu.show(menu) + .setTitle(data.getBookName()) + .setOnMenuItemClickListener((dialog, text, which) -> { + onMenuItemClickListener.onClick(pos, which); + return false; + }) + .setCancelButton(R.string.cancel)); + } + + public interface OnMenuItemClickListener{ + void onClick(int itemPos, int menuPos); + } +} diff --git a/app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/ReplaceRuleHolder.java b/app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/ReplaceRuleHolder.java index d029e4e..246bbd7 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/ReplaceRuleHolder.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/ReplaceRuleHolder.java @@ -26,7 +26,7 @@ import xyz.fycz.myreader.model.ReplaceRuleManager; import xyz.fycz.myreader.ui.adapter.ReplaceRuleAdapter; import xyz.fycz.myreader.ui.dialog.ReplaceDialog; import xyz.fycz.myreader.util.ShareUtils; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.util.ToastUtils; import xyz.fycz.myreader.util.utils.GsonExtensionsKt; import xyz.fycz.myreader.widget.swipemenu.SwipeMenuLayout; diff --git a/app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/SearchBookHolder.java b/app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/SearchBookHolder.java index afc24c1..435b572 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/SearchBookHolder.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/SearchBookHolder.java @@ -21,7 +21,7 @@ import xyz.fycz.myreader.model.mulvalmap.ConMVMap; import xyz.fycz.myreader.model.sourceAnalyzer.BookSourceManager; import xyz.fycz.myreader.ui.adapter.BookTagAdapter; import xyz.fycz.myreader.ui.adapter.SearchBookAdapter; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.util.utils.KeyWordUtils; import xyz.fycz.myreader.util.utils.NetworkUtils; import xyz.fycz.myreader.webapi.crawler.ReadCrawlerUtil; diff --git a/app/src/main/java/xyz/fycz/myreader/ui/dialog/DialogCreator.java b/app/src/main/java/xyz/fycz/myreader/ui/dialog/DialogCreator.java index 2a3c977..dcad054 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/dialog/DialogCreator.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/dialog/DialogCreator.java @@ -1,7 +1,6 @@ package xyz.fycz.myreader.ui.dialog; import android.app.Dialog; -import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.view.View; @@ -11,16 +10,14 @@ import android.widget.TextView; import androidx.appcompat.app.AlertDialog; import com.kongzue.dialogx.dialogs.BottomDialog; -import com.kongzue.dialogx.dialogs.MessageDialog; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; -import xyz.fycz.myreader.R; import xyz.fycz.myreader.application.App; import xyz.fycz.myreader.util.IOUtils; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; public class DialogCreator { diff --git a/app/src/main/java/xyz/fycz/myreader/ui/dialog/MyAlertDialog.java b/app/src/main/java/xyz/fycz/myreader/ui/dialog/MyAlertDialog.java index 83d7f65..e58ed7a 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/dialog/MyAlertDialog.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/dialog/MyAlertDialog.java @@ -18,7 +18,6 @@ import androidx.appcompat.app.AppCompatActivity; import com.google.android.material.textfield.TextInputLayout; import com.kongzue.dialogx.dialogs.BottomDialog; -import com.kongzue.dialogx.dialogs.CustomDialog; import com.kongzue.dialogx.interfaces.OnBindView; import xyz.fycz.myreader.R; @@ -27,7 +26,7 @@ import xyz.fycz.myreader.common.APPCONST; import xyz.fycz.myreader.greendao.service.BookGroupService; import xyz.fycz.myreader.util.CyptoUtils; import xyz.fycz.myreader.util.SharedPreUtils; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.util.ToastUtils; import xyz.fycz.myreader.util.utils.FingerprintUtils; diff --git a/app/src/main/java/xyz/fycz/myreader/ui/dialog/ReplaceDialog.java b/app/src/main/java/xyz/fycz/myreader/ui/dialog/ReplaceDialog.java index d4f90c1..e5903b8 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/dialog/ReplaceDialog.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/dialog/ReplaceDialog.java @@ -28,7 +28,7 @@ import xyz.fycz.myreader.greendao.entity.rule.BookSource; import xyz.fycz.myreader.greendao.service.BookService; import xyz.fycz.myreader.model.sourceAnalyzer.BookSourceManager; import xyz.fycz.myreader.model.ReplaceRuleManager; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.util.ToastUtils; /** diff --git a/app/src/main/java/xyz/fycz/myreader/ui/fragment/FindFragment.java b/app/src/main/java/xyz/fycz/myreader/ui/fragment/FindFragment.java index 037d9b9..1266be5 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/fragment/FindFragment.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/fragment/FindFragment.java @@ -1,14 +1,18 @@ package xyz.fycz.myreader.ui.fragment; import android.content.Intent; +import android.net.Uri; +import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import xyz.fycz.myreader.application.App; import xyz.fycz.myreader.base.BaseFragment; import xyz.fycz.myreader.common.APPCONST; import xyz.fycz.myreader.databinding.FragmentFindBinding; import xyz.fycz.myreader.ui.activity.BookstoreActivity; +import xyz.fycz.myreader.util.utils.ImageLoader; import xyz.fycz.myreader.webapi.crawler.base.FindCrawler; import xyz.fycz.myreader.webapi.crawler.find.Ben100FindCrawler; import xyz.fycz.myreader.webapi.crawler.find.MiaoBiFindCrawler; @@ -29,6 +33,20 @@ public class FindFragment extends BaseFragment { return binding.getRoot(); } + @Override + protected void initWidget(Bundle savedInstanceState) { + super.initWidget(savedInstanceState); + if (!App.isDestroy(getActivity())) { + ImageLoader.INSTANCE.load(getContext(), "http://yunjuw.cn/template/mytheme/statics/img/logo.png") + .into(binding.ivDyys); + } + binding.mineRlDyys.setOnClickListener(v -> { + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setData(Uri.parse("http://yunjuw.cn/")); + startActivity(intent); + }); + } + @Override protected void initClick() { super.initClick(); diff --git a/app/src/main/java/xyz/fycz/myreader/ui/fragment/MineFragment.java b/app/src/main/java/xyz/fycz/myreader/ui/fragment/MineFragment.java index 61d4ed7..e1176a0 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/fragment/MineFragment.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/fragment/MineFragment.java @@ -2,6 +2,7 @@ package xyz.fycz.myreader.ui.fragment; import android.annotation.SuppressLint; import android.content.Intent; +import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.os.Message; @@ -35,6 +36,7 @@ import xyz.fycz.myreader.common.APPCONST; import xyz.fycz.myreader.databinding.FragmentMineBinding; import xyz.fycz.myreader.entity.Setting; import xyz.fycz.myreader.greendao.entity.Book; +import xyz.fycz.myreader.greendao.entity.ReadRecord; import xyz.fycz.myreader.greendao.service.BookService; import xyz.fycz.myreader.model.backup.UserService; import xyz.fycz.myreader.model.storage.Backup; @@ -48,10 +50,13 @@ import xyz.fycz.myreader.ui.activity.DonateActivity; import xyz.fycz.myreader.ui.activity.FeedbackActivity; import xyz.fycz.myreader.ui.activity.MainActivity; import xyz.fycz.myreader.ui.activity.MoreSettingActivity; +import xyz.fycz.myreader.ui.activity.ReadRecordActivity; import xyz.fycz.myreader.ui.dialog.DialogCreator; import xyz.fycz.myreader.ui.dialog.MyAlertDialog; import xyz.fycz.myreader.util.SharedPreUtils; import xyz.fycz.myreader.util.ToastUtils; +import xyz.fycz.myreader.util.utils.GsonExtensionsKt; +import xyz.fycz.myreader.util.utils.ImageLoader; import xyz.fycz.myreader.util.utils.NetworkUtils; import xyz.fycz.myreader.webapi.ResultCallback; @@ -67,9 +72,9 @@ public class MineFragment extends BaseFragment { //private boolean isLogin; private Setting mSetting; -// private String[] webSynMenu; + // private String[] webSynMenu; private String[] backupMenu; -// private AlertDialog themeModeDia; + // private AlertDialog themeModeDia; private int themeMode; private String[] themeModeArr; @SuppressLint("HandlerLeak") @@ -159,7 +164,7 @@ public class MineFragment extends BaseFragment { binding.mineRlSyn.setOnClickListener(v -> { String account = SharedPreUtils.getInstance().getString("webdavAccount"); String password = SharedPreUtils.getInstance().getString("webdavPassword"); - if (TextUtils.isEmpty(account) || TextUtils.isEmpty(password)){ + if (TextUtils.isEmpty(account) || TextUtils.isEmpty(password)) { ToastUtils.showWarring("请先配置WebDav账户"); binding.mineRlWebdav.performClick(); return; @@ -267,6 +272,10 @@ public class MineFragment extends BaseFragment { .setPositiveButton(null, null) .show(); });*/ + + binding.mineRlReadRecord.setOnClickListener(v -> { + startActivity(new Intent(getContext(), ReadRecordActivity.class)); + }); binding.mineRlSetting.setOnClickListener(v -> { Intent settingIntent = new Intent(getActivity(), MoreSettingActivity.class); startActivity(settingIntent); diff --git a/app/src/main/java/xyz/fycz/myreader/ui/fragment/WebDavFragment.java b/app/src/main/java/xyz/fycz/myreader/ui/fragment/WebDavFragment.java index 0c9ed89..5b91e16 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/fragment/WebDavFragment.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/fragment/WebDavFragment.java @@ -22,13 +22,12 @@ import xyz.fycz.myreader.base.BaseFragment; import xyz.fycz.myreader.base.observer.MySingleObserver; import xyz.fycz.myreader.common.APPCONST; import xyz.fycz.myreader.databinding.FragmentWebdavSettingBinding; -import xyz.fycz.myreader.model.storage.BackupRestoreUi; import xyz.fycz.myreader.model.storage.Restore; import xyz.fycz.myreader.model.storage.WebDavHelp; import xyz.fycz.myreader.ui.activity.MainActivity; import xyz.fycz.myreader.ui.dialog.MyAlertDialog; import xyz.fycz.myreader.util.SharedPreUtils; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.util.ToastUtils; /** diff --git a/app/src/main/java/xyz/fycz/myreader/ui/presenter/BookcasePresenter.java b/app/src/main/java/xyz/fycz/myreader/ui/presenter/BookcasePresenter.java index 7fdb952..5634625 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/presenter/BookcasePresenter.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/presenter/BookcasePresenter.java @@ -38,10 +38,10 @@ import xyz.fycz.myreader.application.SysManager; import xyz.fycz.myreader.base.BasePresenter; import xyz.fycz.myreader.base.observer.MyObserver; import xyz.fycz.myreader.ui.dialog.BookGroupDialog; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.util.utils.RxUtils; import xyz.fycz.myreader.webapi.ResultCallback; import xyz.fycz.myreader.common.APPCONST; -import xyz.fycz.myreader.ui.dialog.MyAlertDialog; import xyz.fycz.myreader.greendao.entity.BookGroup; import xyz.fycz.myreader.greendao.service.BookGroupService; import xyz.fycz.myreader.model.backup.UserService; diff --git a/app/src/main/java/xyz/fycz/myreader/util/CalendarHelper.java b/app/src/main/java/xyz/fycz/myreader/util/help/CalendarHelper.java similarity index 99% rename from app/src/main/java/xyz/fycz/myreader/util/CalendarHelper.java rename to app/src/main/java/xyz/fycz/myreader/util/help/CalendarHelper.java index 8af5865..3cecd80 100644 --- a/app/src/main/java/xyz/fycz/myreader/util/CalendarHelper.java +++ b/app/src/main/java/xyz/fycz/myreader/util/help/CalendarHelper.java @@ -1,4 +1,4 @@ -package xyz.fycz.myreader.util; +package xyz.fycz.myreader.util.help; diff --git a/app/src/main/java/xyz/fycz/myreader/util/DateHelper.java b/app/src/main/java/xyz/fycz/myreader/util/help/DateHelper.java similarity index 99% rename from app/src/main/java/xyz/fycz/myreader/util/DateHelper.java rename to app/src/main/java/xyz/fycz/myreader/util/help/DateHelper.java index c7bb393..199d431 100644 --- a/app/src/main/java/xyz/fycz/myreader/util/DateHelper.java +++ b/app/src/main/java/xyz/fycz/myreader/util/help/DateHelper.java @@ -1,4 +1,4 @@ -package xyz.fycz.myreader.util; +package xyz.fycz.myreader.util.help; import java.sql.Timestamp; import java.text.DateFormat; diff --git a/app/src/main/java/xyz/fycz/myreader/util/OpenFileHelper.java b/app/src/main/java/xyz/fycz/myreader/util/help/OpenFileHelper.java similarity index 97% rename from app/src/main/java/xyz/fycz/myreader/util/OpenFileHelper.java rename to app/src/main/java/xyz/fycz/myreader/util/help/OpenFileHelper.java index 7ad0752..2bb15c3 100644 --- a/app/src/main/java/xyz/fycz/myreader/util/OpenFileHelper.java +++ b/app/src/main/java/xyz/fycz/myreader/util/help/OpenFileHelper.java @@ -1,10 +1,13 @@ -package xyz.fycz.myreader.util; +package xyz.fycz.myreader.util.help; import android.content.Context; import android.content.Intent; import java.io.File; +import xyz.fycz.myreader.util.ToastUtils; +import xyz.fycz.myreader.util.UriFileUtil; + public class OpenFileHelper { private final static String[][] MIME_MapTable = { diff --git a/app/src/main/java/xyz/fycz/myreader/util/help/RelativeDateHelp.java b/app/src/main/java/xyz/fycz/myreader/util/help/RelativeDateHelp.java new file mode 100644 index 0000000..20bcc95 --- /dev/null +++ b/app/src/main/java/xyz/fycz/myreader/util/help/RelativeDateHelp.java @@ -0,0 +1,96 @@ +package xyz.fycz.myreader.util.help; + +import android.text.TextUtils; + +import xyz.fycz.myreader.entity.Date; + +/** + * @author fengyue + * @date 2021/6/1 19:20 + */ +public class RelativeDateHelp { + private static final long ONE_MINUTE = 60000L; + private static final long ONE_HOUR = 3600000L; + private static final long ONE_DAY = 86400000L; + private static final long ONE_WEEK = 604800000L; + + private static final String ONE_SECOND_AGO = "秒前"; + private static final String ONE_MINUTE_AGO = "分钟前"; + private static final String ONE_HOUR_AGO = "小时前"; + private static final String ONE_DAY_AGO = "天前"; + private static final String ONE_MONTH_AGO = "月前"; + private static final String ONE_YEAR_AGO = "年前"; + + + //时间转换 + public static String format(long time) { + long delta = System.currentTimeMillis() - time; + if (delta < ONE_MINUTE) { + long seconds = toSeconds(delta); + return (seconds <= 0 ? 1 : seconds) + ONE_SECOND_AGO; + } + if (delta < 45L * ONE_MINUTE) { + long minutes = toMinutes(delta); + return (minutes <= 0 ? 1 : minutes) + ONE_MINUTE_AGO; + } + if (delta < 24L * ONE_HOUR) { + long hours = toHours(delta); + return (hours <= 0 ? 1 : hours) + ONE_HOUR_AGO; + } + if (delta < 48L * ONE_HOUR) { + return "昨天"; + } + if (delta < 30L * ONE_DAY) { + long days = toDays(delta); + return (days <= 0 ? 1 : days) + ONE_DAY_AGO; + } + if (delta < 12L * 4L * ONE_WEEK) { + long months = toMonths(delta); + return (months <= 0 ? 1 : months) + ONE_MONTH_AGO; + } else { + long years = toYears(delta); + return (years <= 0 ? 1 : years) + ONE_YEAR_AGO; + } + } + + private static long toSeconds(long date) { + return date / 1000L; + } + + private static long toMinutes(long date) { + return toSeconds(date) / 60L; + } + + private static long toHours(long date) { + return toMinutes(date) / 60L; + } + + private static long toDays(long date) { + return toHours(date) / 24L; + } + + private static long toMonths(long date) { + return toDays(date) / 30L; + } + + private static long toYears(long date) { + return toMonths(date) / 365L; + } + + public static String formatDuring(long time){ + long days = time / (1000 * 60 * 60 * 24); + long hours = time % (1000 * 60 * 60 * 24) / (1000 * 60 * 60); + long minutes = time % (1000 * 60 * 60) / (1000 * 60); + long seconds = time % (1000 * 60) / 1000; + String d = days > 0 ? days + "天" : ""; + String h = hours > 0 ? hours + "小时" : ""; + String m = minutes > 0 ? minutes + "分钟" : ""; + String s = seconds > 0 ? seconds + "秒" : ""; + String strTime = d + h + m + s; + if (TextUtils.isEmpty(strTime)) { + strTime = "0秒"; + } + return strTime; + } + +} diff --git a/app/src/main/java/xyz/fycz/myreader/util/StringHelper.java b/app/src/main/java/xyz/fycz/myreader/util/help/StringHelper.java similarity index 99% rename from app/src/main/java/xyz/fycz/myreader/util/StringHelper.java rename to app/src/main/java/xyz/fycz/myreader/util/help/StringHelper.java index f1bc149..b962a85 100644 --- a/app/src/main/java/xyz/fycz/myreader/util/StringHelper.java +++ b/app/src/main/java/xyz/fycz/myreader/util/help/StringHelper.java @@ -1,4 +1,4 @@ -package xyz.fycz.myreader.util; +package xyz.fycz.myreader.util.help; import xyz.fycz.myreader.util.utils.StringUtils; diff --git a/app/src/main/java/xyz/fycz/myreader/util/utils/AdUtils.java b/app/src/main/java/xyz/fycz/myreader/util/utils/AdUtils.java index 427b4f8..5497856 100644 --- a/app/src/main/java/xyz/fycz/myreader/util/utils/AdUtils.java +++ b/app/src/main/java/xyz/fycz/myreader/util/utils/AdUtils.java @@ -17,7 +17,7 @@ import xyz.fycz.myreader.application.App; import xyz.fycz.myreader.base.observer.MySingleObserver; import xyz.fycz.myreader.common.URLCONST; import xyz.fycz.myreader.model.backup.UserService; -import xyz.fycz.myreader.util.DateHelper; +import xyz.fycz.myreader.util.help.DateHelper; import xyz.fycz.myreader.util.SharedPreUtils; /** diff --git a/app/src/main/java/xyz/fycz/myreader/util/utils/FileUtils.java b/app/src/main/java/xyz/fycz/myreader/util/utils/FileUtils.java index bebd01a..393ea7e 100644 --- a/app/src/main/java/xyz/fycz/myreader/util/utils/FileUtils.java +++ b/app/src/main/java/xyz/fycz/myreader/util/utils/FileUtils.java @@ -13,7 +13,6 @@ import android.util.Log; import org.mozilla.universalchardet.UniversalDetector; -import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.File; @@ -35,10 +34,8 @@ import io.reactivex.Single; import io.reactivex.SingleEmitter; import io.reactivex.SingleOnSubscribe; import xyz.fycz.myreader.application.App; -import xyz.fycz.myreader.common.APPCONST; -import xyz.fycz.myreader.ui.dialog.DialogCreator; import xyz.fycz.myreader.util.IOUtils; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; public class FileUtils { diff --git a/app/src/main/java/xyz/fycz/myreader/util/utils/NetworkUtils.java b/app/src/main/java/xyz/fycz/myreader/util/utils/NetworkUtils.java index 353662f..99a4cc2 100644 --- a/app/src/main/java/xyz/fycz/myreader/util/utils/NetworkUtils.java +++ b/app/src/main/java/xyz/fycz/myreader/util/utils/NetworkUtils.java @@ -8,7 +8,7 @@ import android.net.NetworkInfo; import okhttp3.Response; import xyz.fycz.myreader.application.App; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import java.net.InetAddress; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/BookApi.java b/app/src/main/java/xyz/fycz/myreader/webapi/BookApi.java index c534803..f6a457d 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/BookApi.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/BookApi.java @@ -1,17 +1,12 @@ package xyz.fycz.myreader.webapi; -import org.jetbrains.annotations.NotNull; - import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.List; import java.util.Map; import io.reactivex.Observable; -import io.reactivex.ObservableEmitter; import io.reactivex.ObservableOnSubscribe; -import io.reactivex.ObservableSource; -import io.reactivex.functions.Function; import okhttp3.MediaType; import okhttp3.RequestBody; import xyz.fycz.myreader.entity.SearchBookBean; @@ -19,7 +14,7 @@ import xyz.fycz.myreader.entity.StrResponse; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConMVMap; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.util.utils.NetworkUtils; import xyz.fycz.myreader.util.utils.OkHttpUtils; import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/LanZousApi.java b/app/src/main/java/xyz/fycz/myreader/webapi/LanZousApi.java index 2dc685c..679c297 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/LanZousApi.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/LanZousApi.java @@ -16,7 +16,7 @@ import okhttp3.RequestBody; import xyz.fycz.myreader.application.App; import xyz.fycz.myreader.base.observer.MySingleObserver; import xyz.fycz.myreader.common.URLCONST; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.util.utils.OkHttpUtils; import xyz.fycz.myreader.util.utils.RxUtils; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/ReadCrawlerUtil.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/ReadCrawlerUtil.java index a875179..1a3b94a 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/ReadCrawlerUtil.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/ReadCrawlerUtil.java @@ -9,7 +9,7 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.rule.BookSource; import xyz.fycz.myreader.model.sourceAnalyzer.BookSourceManager; import xyz.fycz.myreader.util.SharedPreUtils; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.webapi.crawler.base.BaseSourceCrawler; import xyz.fycz.myreader.webapi.crawler.base.BaseSourceCrawlerNoInfo; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/base/BaseSourceCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/base/BaseSourceCrawler.java index bebb7bd..0ea1914 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/base/BaseSourceCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/base/BaseSourceCrawler.java @@ -22,7 +22,7 @@ import xyz.fycz.myreader.greendao.entity.rule.TocRule; import xyz.fycz.myreader.model.mulvalmap.ConMVMap; import xyz.fycz.myreader.model.sourceAnalyzer.BaseAnalyzer; import xyz.fycz.myreader.model.sourceAnalyzer.MatcherAnalyzer; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.util.utils.NetworkUtils; import xyz.fycz.myreader.util.utils.OkHttpUtils; import xyz.fycz.myreader.util.utils.StringUtils; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/find/QB5FindCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/find/QB5FindCrawler.java index bdd846b..1a8b7eb 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/find/QB5FindCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/find/QB5FindCrawler.java @@ -11,7 +11,7 @@ import java.util.List; import xyz.fycz.myreader.entity.bookstore.BookType; import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.webapi.crawler.base.FindCrawler; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/find/QiDianMobileRank.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/find/QiDianMobileRank.java index 5b41638..1307eb7 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/find/QiDianMobileRank.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/find/QiDianMobileRank.java @@ -22,7 +22,7 @@ import xyz.fycz.myreader.entity.bookstore.SortBook; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.util.IOUtils; import xyz.fycz.myreader.util.SharedPreUtils; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.webapi.crawler.base.FindCrawler; import java.io.BufferedReader; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/BiQuGe44ReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/BiQuGe44ReadCrawler.java index f0d3b4a..2a90323 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/BiQuGe44ReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/BiQuGe44ReadCrawler.java @@ -12,7 +12,7 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConMVMap; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.webapi.crawler.base.BaseReadCrawler; import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/BiQuGeReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/BiQuGeReadCrawler.java index 53e56f3..de23239 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/BiQuGeReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/BiQuGeReadCrawler.java @@ -11,7 +11,7 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConMVMap; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.webapi.crawler.base.BaseReadCrawler; import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/EWenXueReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/EWenXueReadCrawler.java index 7b11daa..5895a61 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/EWenXueReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/EWenXueReadCrawler.java @@ -14,7 +14,7 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConMVMap; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.webapi.crawler.base.BaseReadCrawler; import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/LuoQiuReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/LuoQiuReadCrawler.java index 78469ab..9c79ecd 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/LuoQiuReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/LuoQiuReadCrawler.java @@ -14,7 +14,7 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConMVMap; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.webapi.crawler.base.BaseReadCrawler; import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/PinShuReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/PinShuReadCrawler.java index 1331dc2..79c9964 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/PinShuReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/PinShuReadCrawler.java @@ -11,7 +11,7 @@ import xyz.fycz.myreader.entity.SearchBookBean; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConMVMap; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.webapi.crawler.base.BaseReadCrawler; import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/PinShuReadCrawler2.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/PinShuReadCrawler2.java index a979b70..f8ce402 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/PinShuReadCrawler2.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/PinShuReadCrawler2.java @@ -11,7 +11,7 @@ import xyz.fycz.myreader.entity.SearchBookBean; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConMVMap; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.webapi.crawler.base.BaseReadCrawler; import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ShuHaiGeReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ShuHaiGeReadCrawler.java index d1104b6..f7c977a 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ShuHaiGeReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ShuHaiGeReadCrawler.java @@ -17,7 +17,7 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConMVMap; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.util.utils.OkHttpUtils; import xyz.fycz.myreader.webapi.crawler.base.BaseReadCrawler; import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/TianLaiReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/TianLaiReadCrawler.java index af76380..e55f061 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/TianLaiReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/TianLaiReadCrawler.java @@ -12,7 +12,7 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConMVMap; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.webapi.crawler.base.BaseReadCrawler; import java.util.ArrayList; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/XS7ReadCrawler2.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/XS7ReadCrawler2.java index ec3dde8..44e6006 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/XS7ReadCrawler2.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/XS7ReadCrawler2.java @@ -14,7 +14,7 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConMVMap; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.webapi.crawler.base.BaseReadCrawler; import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ZW37ReadCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ZW37ReadCrawler.java index b196ba6..9a15b3d 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ZW37ReadCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/read/ZW37ReadCrawler.java @@ -14,7 +14,7 @@ import xyz.fycz.myreader.enums.LocalBookSource; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.model.mulvalmap.ConMVMap; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.webapi.crawler.base.BaseReadCrawler; import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/source/JsonPathCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/source/JsonPathCrawler.java index e82766d..1460424 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/source/JsonPathCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/source/JsonPathCrawler.java @@ -13,7 +13,7 @@ import xyz.fycz.myreader.greendao.entity.rule.BookSource; import xyz.fycz.myreader.greendao.entity.rule.SearchRule; import xyz.fycz.myreader.model.mulvalmap.ConMVMap; import xyz.fycz.myreader.model.sourceAnalyzer.JsonPathAnalyzer; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.webapi.crawler.base.BaseSourceCrawler; /** diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/source/MatcherCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/source/MatcherCrawler.java index be5279f..eb6f2b0 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/source/MatcherCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/source/MatcherCrawler.java @@ -9,7 +9,7 @@ import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.greendao.entity.rule.BookSource; import xyz.fycz.myreader.model.mulvalmap.ConMVMap; import xyz.fycz.myreader.model.sourceAnalyzer.MatcherAnalyzer; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.util.utils.NetworkUtils; import xyz.fycz.myreader.webapi.crawler.base.BaseSourceCrawler; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/source/ThirdCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/source/ThirdCrawler.java index e579d77..dcd752d 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/source/ThirdCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/source/ThirdCrawler.java @@ -1,13 +1,12 @@ package xyz.fycz.myreader.webapi.crawler.source; import java.util.List; -import java.util.Map; import xyz.fycz.myreader.entity.SearchBookBean; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.rule.BookSource; import xyz.fycz.myreader.model.mulvalmap.ConMVMap; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.webapi.crawler.base.BaseReadCrawler; import xyz.fycz.myreader.webapi.crawler.base.BookInfoCrawler; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/source/XpathCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/source/XpathCrawler.java index 458540b..50c8848 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/source/XpathCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/source/XpathCrawler.java @@ -12,7 +12,7 @@ import xyz.fycz.myreader.greendao.entity.rule.BookSource; import xyz.fycz.myreader.greendao.entity.rule.SearchRule; import xyz.fycz.myreader.model.mulvalmap.ConMVMap; import xyz.fycz.myreader.model.sourceAnalyzer.XpathAnalyzer; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.webapi.crawler.base.BaseSourceCrawler; /** diff --git a/app/src/main/java/xyz/fycz/myreader/widget/page/LocalPageLoader.java b/app/src/main/java/xyz/fycz/myreader/widget/page/LocalPageLoader.java index 79f4d6d..e42659e 100644 --- a/app/src/main/java/xyz/fycz/myreader/widget/page/LocalPageLoader.java +++ b/app/src/main/java/xyz/fycz/myreader/widget/page/LocalPageLoader.java @@ -10,7 +10,7 @@ import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.greendao.service.ChapterService; import xyz.fycz.myreader.util.IOUtils; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.util.utils.FileUtils; import xyz.fycz.myreader.util.utils.RxUtils; diff --git a/app/src/main/java/xyz/fycz/myreader/widget/page/NetPageLoader.java b/app/src/main/java/xyz/fycz/myreader/widget/page/NetPageLoader.java index 8440270..6c69aa7 100644 --- a/app/src/main/java/xyz/fycz/myreader/widget/page/NetPageLoader.java +++ b/app/src/main/java/xyz/fycz/myreader/widget/page/NetPageLoader.java @@ -19,7 +19,7 @@ import xyz.fycz.myreader.entity.Setting; import xyz.fycz.myreader.greendao.entity.Book; import xyz.fycz.myreader.greendao.entity.Chapter; import xyz.fycz.myreader.greendao.service.ChapterService; -import xyz.fycz.myreader.util.StringHelper; +import xyz.fycz.myreader.util.help.StringHelper; import xyz.fycz.myreader.util.utils.FileUtils; import xyz.fycz.myreader.util.utils.RxUtils; import xyz.fycz.myreader.webapi.BookApi; diff --git a/app/src/main/res/drawable/ic_link.xml b/app/src/main/res/drawable/ic_link.xml index 5951a45..35194a2 100644 --- a/app/src/main/res/drawable/ic_link.xml +++ b/app/src/main/res/drawable/ic_link.xml @@ -4,9 +4,9 @@ android:viewportWidth="1024" android:viewportHeight="1024"> diff --git a/app/src/main/res/drawable/ic_more.xml b/app/src/main/res/drawable/ic_more.xml new file mode 100644 index 0000000..926455d --- /dev/null +++ b/app/src/main/res/drawable/ic_more.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/app/src/main/res/layout/activity_read_record.xml b/app/src/main/res/layout/activity_read_record.xml new file mode 100644 index 0000000..3508456 --- /dev/null +++ b/app/src/main/res/layout/activity_read_record.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_find.xml b/app/src/main/res/layout/fragment_find.xml index 2bace40..ba6c558 100644 --- a/app/src/main/res/layout/fragment_find.xml +++ b/app/src/main/res/layout/fragment_find.xml @@ -7,6 +7,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:background="@color/colorBackground" android:scrollbars="vertical"> + --> + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_mine.xml b/app/src/main/res/layout/fragment_mine.xml index 2efd68b..47e6ba0 100644 --- a/app/src/main/res/layout/fragment_mine.xml +++ b/app/src/main/res/layout/fragment_mine.xml @@ -208,7 +208,35 @@ android:textSize="@dimen/text_normal_size" /> + + + + + + - - \ No newline at end of file diff --git a/app/src/main/res/layout/item_read_record.xml b/app/src/main/res/layout/item_read_record.xml new file mode 100644 index 0000000..85ef379 --- /dev/null +++ b/app/src/main/res/layout/item_read_record.xml @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c47156f..1e00796 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -489,6 +489,9 @@ 清除Cookie 编辑书源 适配英文排版 + 段友影视,超清无水印广告视频站 + 总阅读时间:%s + 阅读记录 diff --git a/app/version_code.properties b/app/version_code.properties index e073c3c..5170aff 100644 --- a/app/version_code.properties +++ b/app/version_code.properties @@ -1,2 +1,2 @@ -#Tue Jun 01 08:59:40 CST 2021 +#Tue Jun 01 18:16:41 CST 2021 VERSION_CODE=204