From b0d6891978d72d8997dcd35acf6b3e3af75871cc Mon Sep 17 00:00:00 2001 From: l Date: Fri, 5 Feb 2021 11:22:21 +0800 Subject: [PATCH 01/14] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=BC=AB=E7=94=BB?= =?UTF-8?q?=E6=BA=90=20=E4=BC=98=E9=85=B7=E6=BC=AB=E7=94=BB=20Add=20New=20?= =?UTF-8?q?Source=20www.ykmh.com?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hiroshi/cimoc/helper/UpdateHelper.java | 40 +++- .../hiroshi/cimoc/manager/SourceManager.java | 44 ++++- .../java/com/hiroshi/cimoc/soup/Node.java | 10 + .../java/com/hiroshi/cimoc/source/YKMH.java | 183 ++++++++++++++++++ 4 files changed, 275 insertions(+), 2 deletions(-) create mode 100644 app/src/main/java/com/hiroshi/cimoc/source/YKMH.java diff --git a/app/src/main/java/com/hiroshi/cimoc/helper/UpdateHelper.java b/app/src/main/java/com/hiroshi/cimoc/helper/UpdateHelper.java index 8356cf4a..79df6200 100644 --- a/app/src/main/java/com/hiroshi/cimoc/helper/UpdateHelper.java +++ b/app/src/main/java/com/hiroshi/cimoc/helper/UpdateHelper.java @@ -6,8 +6,45 @@ import com.hiroshi.cimoc.model.ComicDao; import com.hiroshi.cimoc.model.DaoSession; import com.hiroshi.cimoc.model.Source; -import com.hiroshi.cimoc.source.*; +import com.hiroshi.cimoc.source.Animx2; +import com.hiroshi.cimoc.source.BaiNian; +import com.hiroshi.cimoc.source.BuKa; +import com.hiroshi.cimoc.source.CCMH; +import com.hiroshi.cimoc.source.CCTuku; +import com.hiroshi.cimoc.source.Cartoonmad; +import com.hiroshi.cimoc.source.ChuiXue; +import com.hiroshi.cimoc.source.CopyMH; +import com.hiroshi.cimoc.source.DM5; +import com.hiroshi.cimoc.source.Dmzj; +import com.hiroshi.cimoc.source.Dmzjv2; +import com.hiroshi.cimoc.source.EHentai; +import com.hiroshi.cimoc.source.GuFeng; +import com.hiroshi.cimoc.source.HHAAZZ; +import com.hiroshi.cimoc.source.Hhxxee; +import com.hiroshi.cimoc.source.IKanman; +import com.hiroshi.cimoc.source.JMTT; +import com.hiroshi.cimoc.source.MH160; +import com.hiroshi.cimoc.source.MH50; +import com.hiroshi.cimoc.source.MH517; +import com.hiroshi.cimoc.source.MH57; +import com.hiroshi.cimoc.source.MHLove; +import com.hiroshi.cimoc.source.ManHuaDB; +import com.hiroshi.cimoc.source.MangaBZ; +import com.hiroshi.cimoc.source.MangaNel; +import com.hiroshi.cimoc.source.Mangakakalot; +import com.hiroshi.cimoc.source.Manhuatai; +import com.hiroshi.cimoc.source.MiGu; +import com.hiroshi.cimoc.source.Ohmanhua; +import com.hiroshi.cimoc.source.PuFei; +import com.hiroshi.cimoc.source.QiManWu; +import com.hiroshi.cimoc.source.QiMiaoMH; +import com.hiroshi.cimoc.source.Tencent; +import com.hiroshi.cimoc.source.TuHao; +import com.hiroshi.cimoc.source.U17; +import com.hiroshi.cimoc.source.Webtoon; import com.hiroshi.cimoc.source.WebtoonDongManManHua; +import com.hiroshi.cimoc.source.YKMH; +import com.hiroshi.cimoc.source.YYLS; import java.util.ArrayList; import java.util.List; @@ -96,6 +133,7 @@ private static void initSource(DaoSession session) { list.add(WebtoonDongManManHua.getDefaultSource()); list.add(MH160.getDefaultSource()); list.add(QiMiaoMH.getDefaultSource()); + list.add(YKMH.getDefaultSource()); session.getSourceDao().insertOrReplaceInTx(list); } } diff --git a/app/src/main/java/com/hiroshi/cimoc/manager/SourceManager.java b/app/src/main/java/com/hiroshi/cimoc/manager/SourceManager.java index 13c98dbb..43ffe47e 100644 --- a/app/src/main/java/com/hiroshi/cimoc/manager/SourceManager.java +++ b/app/src/main/java/com/hiroshi/cimoc/manager/SourceManager.java @@ -7,8 +7,47 @@ import com.hiroshi.cimoc.model.SourceDao; import com.hiroshi.cimoc.model.SourceDao.Properties; import com.hiroshi.cimoc.parser.Parser; -import com.hiroshi.cimoc.source.*; +import com.hiroshi.cimoc.source.Animx2; +import com.hiroshi.cimoc.source.BaiNian; +import com.hiroshi.cimoc.source.BuKa; +import com.hiroshi.cimoc.source.CCMH; +import com.hiroshi.cimoc.source.CCTuku; +import com.hiroshi.cimoc.source.Cartoonmad; +import com.hiroshi.cimoc.source.ChuiXue; +import com.hiroshi.cimoc.source.CopyMH; +import com.hiroshi.cimoc.source.DM5; +import com.hiroshi.cimoc.source.Dmzj; +import com.hiroshi.cimoc.source.Dmzjv2; +import com.hiroshi.cimoc.source.EHentai; +import com.hiroshi.cimoc.source.GuFeng; +import com.hiroshi.cimoc.source.HHAAZZ; +import com.hiroshi.cimoc.source.Hhxxee; +import com.hiroshi.cimoc.source.IKanman; +import com.hiroshi.cimoc.source.JMTT; +import com.hiroshi.cimoc.source.Locality; +import com.hiroshi.cimoc.source.MH160; +import com.hiroshi.cimoc.source.MH50; +import com.hiroshi.cimoc.source.MH517; +import com.hiroshi.cimoc.source.MH57; +import com.hiroshi.cimoc.source.MHLove; +import com.hiroshi.cimoc.source.ManHuaDB; +import com.hiroshi.cimoc.source.MangaBZ; +import com.hiroshi.cimoc.source.MangaNel; +import com.hiroshi.cimoc.source.Mangakakalot; +import com.hiroshi.cimoc.source.Manhuatai; +import com.hiroshi.cimoc.source.MiGu; +import com.hiroshi.cimoc.source.Null; +import com.hiroshi.cimoc.source.Ohmanhua; +import com.hiroshi.cimoc.source.PuFei; +import com.hiroshi.cimoc.source.QiManWu; +import com.hiroshi.cimoc.source.QiMiaoMH; +import com.hiroshi.cimoc.source.Tencent; +import com.hiroshi.cimoc.source.TuHao; +import com.hiroshi.cimoc.source.U17; +import com.hiroshi.cimoc.source.Webtoon; import com.hiroshi.cimoc.source.WebtoonDongManManHua; +import com.hiroshi.cimoc.source.YKMH; +import com.hiroshi.cimoc.source.YYLS; import java.util.List; @@ -205,6 +244,9 @@ public Parser getParser(int type) { case QiMiaoMH.TYPE: parser = new QiMiaoMH(source); break; + case YKMH.TYPE: + parser = new YKMH(source); + break; default: parser = new Null(); break; diff --git a/app/src/main/java/com/hiroshi/cimoc/soup/Node.java b/app/src/main/java/com/hiroshi/cimoc/soup/Node.java index c81cb330..df7ec07e 100755 --- a/app/src/main/java/com/hiroshi/cimoc/soup/Node.java +++ b/app/src/main/java/com/hiroshi/cimoc/soup/Node.java @@ -28,6 +28,10 @@ public Node id(String id) { return new Node(element.getElementById(id)); } + public Node getParent(String cssQuery) { + return new Node(get().select(cssQuery).first().parent()); + } + public Node getChild(String cssQuery) { return new Node(get().select(cssQuery).first()); } @@ -73,6 +77,12 @@ public String textWithSubstring(String cssQuery, int start) { return textWithSubstring(cssQuery, start, -1); } + public String hrefWithLastSplit() { + String string = href(); + String[] arr = string.split("/"); + return arr[arr.length - 1]; + } + public String textWithSplit(String cssQuery, String regex, int index) { return StringUtils.split(text(cssQuery), regex, index); } diff --git a/app/src/main/java/com/hiroshi/cimoc/source/YKMH.java b/app/src/main/java/com/hiroshi/cimoc/source/YKMH.java new file mode 100644 index 00000000..0b8e0ab8 --- /dev/null +++ b/app/src/main/java/com/hiroshi/cimoc/source/YKMH.java @@ -0,0 +1,183 @@ +package com.hiroshi.cimoc.source; + +import android.util.Log; + +import com.hiroshi.cimoc.core.Manga; +import com.hiroshi.cimoc.model.Chapter; +import com.hiroshi.cimoc.model.Comic; +import com.hiroshi.cimoc.model.ImageUrl; +import com.hiroshi.cimoc.model.Source; +import com.hiroshi.cimoc.parser.MangaParser; +import com.hiroshi.cimoc.parser.NodeIterator; +import com.hiroshi.cimoc.parser.SearchIterator; +import com.hiroshi.cimoc.soup.Node; +import com.hiroshi.cimoc.utils.StringUtils; + +import org.json.JSONArray; +import org.json.JSONException; + +import java.io.UnsupportedEncodingException; +import java.util.LinkedList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import okhttp3.Headers; +import okhttp3.Request; + +public class YKMH extends MangaParser { + public static final int TYPE = 91; + public static final String DEFAULT_TITLE = "优酷漫画"; + public final String Host = "https://www.ykmh.com/"; + public final String mHost = "https://m.ykmh.com/"; + + public YKMH(Source source) { + init(source, null); + } + + public static Source getDefaultSource() { + return new Source(null, DEFAULT_TITLE, TYPE, true); + } + + @Override + public Request getSearchRequest(String keyword, int page) throws UnsupportedEncodingException { + Log.d("SourceSearch:", String.valueOf(keyword)); + + return new Request.Builder().url(mHost + "search/?keywords=" + keyword + "&page=" + page).addHeader("referer", "https://m.ykmh.com/search").addHeader("user-agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36") + .build(); + } + + @Override + public SearchIterator getSearchIterator(String html, int page) throws JSONException { + Node body = new Node(html); + return new NodeIterator(body.list("#update_list > div.UpdateList > div")) { + @Override + protected Comic parse(Node node) { + Node titleN = node.getChild("div.itemTxt > a"); + String cid = titleN.hrefWithLastSplit(); + String title = titleN.text(); + String cover = node.attr("div.itemImg > a > img", "src"); + String Update = node.text("p.txtItme > span.date"); + String Author = node.text("p > a"); + return new Comic(TYPE, cid, title, cover, Update, Author); + } + }; + } + + @Override + public String getUrl(String cid) { + return StringUtils.format("%smanhua/%s", mHost, cid); + } + + @Override + public Headers getHeader() { + return Headers.of("Referer", "https://m.ykmh.com/search/", "user-agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36"); + } + + @Override + public Request getInfoRequest(String cid) { + Log.d("SourceInfo:", String.valueOf(cid)); + + return new Request.Builder().url(mHost.concat("manhua/").concat(cid).concat("/")).addHeader("referer", "https://m.ykmh.com/search").addHeader("user-agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36") + .build(); + + } + + @Override + public Comic parseInfo(String html, Comic comic) throws UnsupportedEncodingException { + Node body = new Node(html); + Node info = body.getChild("div.Introduct_Sub"); + String title = body.text("div#comicName"); + String cover = info.getChild("div#Cover > *").src(); + String update = info.text("p.txtItme > span.date"); + String author = info.getParent("p.txtItme > span.icon01").text(); + String intro = body.getParent("p#full-des #showmore-des").text(); + String isFinish = info.getParent("p.txtItme > span.icon01").text(); + boolean finish = false; + if (isFinish.contains("完结")) finish = true; + comic.setInfo(title, cover, update, intro, author, finish); + + + return comic; + } + + @Override + public List parseChapter(String html) { + List list = new LinkedList<>(); + Node body = new Node(html); + for (Node node : body.list("div.chapter-warp ul.Drama > li > a")) { + String title = node.text(); +// String path = StringUtils.split(node.href(), "/", 3); + String path = node.hrefWithSubString(1); + list.add(new Chapter(title, path)); + } + return list; + } + + @Override + public List parseChapter(String html, Comic comic, Long sourceComic) throws JSONException { + List list = new LinkedList<>(); + Node body = new Node(html); + int i = 0; + for (Node node : body.list("div.chapter-warp ul.Drama > li > a")) { + String title = node.text(); +// String path = StringUtils.split(node.href(), "/", 3); + String path = node.hrefWithSubString(1); + list.add(new Chapter(Long.parseLong(sourceComic + "000" + i++), sourceComic, title, path)); + } + return list; + } + + @Override + public Request getImagesRequest(String cid, String path) { + Log.d("SourceImage:", String.valueOf(path)); + + return new Request.Builder().url(mHost.concat(path)).addHeader("referer", "https://m.ykmh.com/search").addHeader("user-agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36") + .build(); + } + + + @Override + public List parseImages(String html, Chapter chapter) throws Manga.NetworkErrorException, JSONException { + List list = new LinkedList<>(); + Matcher matcher = Pattern.compile("var chapterImages\\s*=\\s*\\[(.+?)]").matcher(html); + if (!matcher.find()) { + return null; + } + String CDATA = String.format("[%s]", matcher.group(1)); + JSONArray array = null; + try { + array = new JSONArray(CDATA); + for (int i = 0; i < array.length(); i++) { + String url = StringUtils.format("https://pic.w1fl.com%s", array.getString(i)); + Long comicChapter = chapter.getId(); + Long id = Long.parseLong(comicChapter + "000" + i + 1); + list.add(new ImageUrl(id, comicChapter, i + 1, url, false)); + + } + + } catch (JSONException e) { + e.printStackTrace(); + Log.e("parseImages", "parseImages Error", e); + return null; + + } + + return list; + } + + @Override + public Request getCheckRequest(String cid) { + return getInfoRequest(cid); + } + + @Override + public String parseCheck(String html) { + return new Node(html).text("p.txtItme > span.date"); + } + + @Override + public String getTitle() { + return DEFAULT_TITLE; + } +} From 220564690e732ccb723537b347bd2425f4c30cef Mon Sep 17 00:00:00 2001 From: l Date: Fri, 5 Feb 2021 11:29:08 +0800 Subject: [PATCH 02/14] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=BC=AB=E7=94=BB?= =?UTF-8?q?=E6=BA=90=20=E4=BC=98=E9=85=B7=E6=BC=AB=E7=94=BB=20Add=20New=20?= =?UTF-8?q?Source=20www.ykmh.com?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hiroshi/cimoc/helper/UpdateHelper.java | 39 +----------------- .../hiroshi/cimoc/manager/SourceManager.java | 41 +------------------ 2 files changed, 2 insertions(+), 78 deletions(-) diff --git a/app/src/main/java/com/hiroshi/cimoc/helper/UpdateHelper.java b/app/src/main/java/com/hiroshi/cimoc/helper/UpdateHelper.java index 79df6200..d925659f 100644 --- a/app/src/main/java/com/hiroshi/cimoc/helper/UpdateHelper.java +++ b/app/src/main/java/com/hiroshi/cimoc/helper/UpdateHelper.java @@ -6,45 +6,8 @@ import com.hiroshi.cimoc.model.ComicDao; import com.hiroshi.cimoc.model.DaoSession; import com.hiroshi.cimoc.model.Source; -import com.hiroshi.cimoc.source.Animx2; -import com.hiroshi.cimoc.source.BaiNian; -import com.hiroshi.cimoc.source.BuKa; -import com.hiroshi.cimoc.source.CCMH; -import com.hiroshi.cimoc.source.CCTuku; -import com.hiroshi.cimoc.source.Cartoonmad; -import com.hiroshi.cimoc.source.ChuiXue; -import com.hiroshi.cimoc.source.CopyMH; -import com.hiroshi.cimoc.source.DM5; -import com.hiroshi.cimoc.source.Dmzj; -import com.hiroshi.cimoc.source.Dmzjv2; -import com.hiroshi.cimoc.source.EHentai; -import com.hiroshi.cimoc.source.GuFeng; -import com.hiroshi.cimoc.source.HHAAZZ; -import com.hiroshi.cimoc.source.Hhxxee; -import com.hiroshi.cimoc.source.IKanman; -import com.hiroshi.cimoc.source.JMTT; -import com.hiroshi.cimoc.source.MH160; -import com.hiroshi.cimoc.source.MH50; -import com.hiroshi.cimoc.source.MH517; -import com.hiroshi.cimoc.source.MH57; -import com.hiroshi.cimoc.source.MHLove; -import com.hiroshi.cimoc.source.ManHuaDB; -import com.hiroshi.cimoc.source.MangaBZ; -import com.hiroshi.cimoc.source.MangaNel; -import com.hiroshi.cimoc.source.Mangakakalot; -import com.hiroshi.cimoc.source.Manhuatai; -import com.hiroshi.cimoc.source.MiGu; -import com.hiroshi.cimoc.source.Ohmanhua; -import com.hiroshi.cimoc.source.PuFei; -import com.hiroshi.cimoc.source.QiManWu; -import com.hiroshi.cimoc.source.QiMiaoMH; -import com.hiroshi.cimoc.source.Tencent; -import com.hiroshi.cimoc.source.TuHao; -import com.hiroshi.cimoc.source.U17; -import com.hiroshi.cimoc.source.Webtoon; +import com.hiroshi.cimoc.source.*; import com.hiroshi.cimoc.source.WebtoonDongManManHua; -import com.hiroshi.cimoc.source.YKMH; -import com.hiroshi.cimoc.source.YYLS; import java.util.ArrayList; import java.util.List; diff --git a/app/src/main/java/com/hiroshi/cimoc/manager/SourceManager.java b/app/src/main/java/com/hiroshi/cimoc/manager/SourceManager.java index 43ffe47e..d67ad405 100644 --- a/app/src/main/java/com/hiroshi/cimoc/manager/SourceManager.java +++ b/app/src/main/java/com/hiroshi/cimoc/manager/SourceManager.java @@ -7,47 +7,8 @@ import com.hiroshi.cimoc.model.SourceDao; import com.hiroshi.cimoc.model.SourceDao.Properties; import com.hiroshi.cimoc.parser.Parser; -import com.hiroshi.cimoc.source.Animx2; -import com.hiroshi.cimoc.source.BaiNian; -import com.hiroshi.cimoc.source.BuKa; -import com.hiroshi.cimoc.source.CCMH; -import com.hiroshi.cimoc.source.CCTuku; -import com.hiroshi.cimoc.source.Cartoonmad; -import com.hiroshi.cimoc.source.ChuiXue; -import com.hiroshi.cimoc.source.CopyMH; -import com.hiroshi.cimoc.source.DM5; -import com.hiroshi.cimoc.source.Dmzj; -import com.hiroshi.cimoc.source.Dmzjv2; -import com.hiroshi.cimoc.source.EHentai; -import com.hiroshi.cimoc.source.GuFeng; -import com.hiroshi.cimoc.source.HHAAZZ; -import com.hiroshi.cimoc.source.Hhxxee; -import com.hiroshi.cimoc.source.IKanman; -import com.hiroshi.cimoc.source.JMTT; -import com.hiroshi.cimoc.source.Locality; -import com.hiroshi.cimoc.source.MH160; -import com.hiroshi.cimoc.source.MH50; -import com.hiroshi.cimoc.source.MH517; -import com.hiroshi.cimoc.source.MH57; -import com.hiroshi.cimoc.source.MHLove; -import com.hiroshi.cimoc.source.ManHuaDB; -import com.hiroshi.cimoc.source.MangaBZ; -import com.hiroshi.cimoc.source.MangaNel; -import com.hiroshi.cimoc.source.Mangakakalot; -import com.hiroshi.cimoc.source.Manhuatai; -import com.hiroshi.cimoc.source.MiGu; -import com.hiroshi.cimoc.source.Null; -import com.hiroshi.cimoc.source.Ohmanhua; -import com.hiroshi.cimoc.source.PuFei; -import com.hiroshi.cimoc.source.QiManWu; -import com.hiroshi.cimoc.source.QiMiaoMH; -import com.hiroshi.cimoc.source.Tencent; -import com.hiroshi.cimoc.source.TuHao; -import com.hiroshi.cimoc.source.U17; -import com.hiroshi.cimoc.source.Webtoon; +import com.hiroshi.cimoc.source.*; import com.hiroshi.cimoc.source.WebtoonDongManManHua; -import com.hiroshi.cimoc.source.YKMH; -import com.hiroshi.cimoc.source.YYLS; import java.util.List; From ca2b547bf54ad815e9241b78847b6e594bc10641 Mon Sep 17 00:00:00 2001 From: l Date: Fri, 5 Feb 2021 12:17:53 +0800 Subject: [PATCH 03/14] =?UTF-8?q?=E9=98=B2=E6=AD=A2=20MIUI=20=E5=AF=B9=20P?= =?UTF-8?q?ageReaderActivity=20=E8=BF=9B=E8=A1=8C=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E5=8F=8D=E8=89=B2=20Fix=20DarkMode=20Related=20Bug=20For=20MIU?= =?UTF-8?q?I?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/AndroidManifest.xml | 2 ++ .../cimoc/ui/activity/PageReaderActivity.java | 5 +++++ .../hiroshi/cimoc/ui/activity/ReaderActivity.java | 7 +++++++ app/src/main/res/values-v29/styles.xml | 8 ++++++++ app/src/main/res/values/styles.xml | 12 ++++++++++-- 5 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 app/src/main/res/values-v29/styles.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index e0ba0ce5..3c5998e8 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -77,6 +77,8 @@ android:configChanges="orientation|keyboardHidden|screenSize" /> = Build.VERSION_CODES.Q) { + mRecyclerView.setForceDarkAllowed(false); + } ((RecyclerViewPager) mRecyclerView).setOnPageChangedListener(this); mRecyclerView.setItemAnimator(null); mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { diff --git a/app/src/main/java/com/hiroshi/cimoc/ui/activity/ReaderActivity.java b/app/src/main/java/com/hiroshi/cimoc/ui/activity/ReaderActivity.java index 1fd0a2e8..13e57136 100644 --- a/app/src/main/java/com/hiroshi/cimoc/ui/activity/ReaderActivity.java +++ b/app/src/main/java/com/hiroshi/cimoc/ui/activity/ReaderActivity.java @@ -160,6 +160,7 @@ protected void initTheme() { protected BasePresenter initPresenter() { mPresenter = new ReaderPresenter(); mPresenter.attachView(this); + return mPresenter; } @@ -168,6 +169,8 @@ protected void initView() { mHideInfo = mPreference.getBoolean(PreferenceManager.PREF_READER_HIDE_INFO, false); mControllerTrigThreshold = mPreference.getInt(PreferenceManager.PREF_READER_CONTROLLER_TRIG_THRESHOLD, 30) * 0.01f; mInfoLayout.setVisibility(mHideInfo ? View.INVISIBLE : View.VISIBLE); + // 防止miui及其他魔改ROM启用反色 + setTheme(R.style.AppThemeNoDark); String key = mode == PreferenceManager.READER_MODE_PAGE ? PreferenceManager.PREF_READER_PAGE_TURN : PreferenceManager.PREF_READER_STREAM_TURN; turn = mPreference.getInt(key, PreferenceManager.READER_TURN_LTR); @@ -175,11 +178,14 @@ protected void initView() { mReaderBox.setBackgroundResource(R.color.white); } initSeekBar(); + initLayoutManager(); initReaderAdapter(); mRecyclerView.setItemAnimator(null); mRecyclerView.setLayoutManager(mLayoutManager); mRecyclerView.setAdapter(mReaderAdapter); + + mRecyclerView.setItemViewCacheSize(2); mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override @@ -239,6 +245,7 @@ private void initLayoutManager() { mLayoutManager.setOrientation(turn == PreferenceManager.READER_TURN_ATB ? LinearLayoutManager.VERTICAL : LinearLayoutManager.HORIZONTAL); mLayoutManager.setReverseLayout(turn == PreferenceManager.READER_TURN_RTL); mLayoutManager.setExtraSpace(2); + } @Override diff --git a/app/src/main/res/values-v29/styles.xml b/app/src/main/res/values-v29/styles.xml new file mode 100644 index 00000000..0371e019 --- /dev/null +++ b/app/src/main/res/values-v29/styles.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index c21a1b1e..356a9f0b 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -1,7 +1,15 @@ - + - + + +