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 6c9623c..0544a47 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 @@ -478,45 +478,47 @@ public class BookcasePresenter implements BasePresenter { } public boolean onOptionsItemSelected(MenuItem item) { - switch (item.getItemId()) { - case R.id.action_change_group: - mBookcaseFragment.getmBookcasePresenter() - .showBookGroupMenu(mMainActivity.findViewById(R.id.action_change_group)); - return true; - case R.id.action_edit: - editBookcase(true); - return true; - case R.id.action_styleChange: - if (mSetting.getBookcaseStyle().equals(BookcaseStyle.listMode)) { - mSetting.setBookcaseStyle(BookcaseStyle.threePalaceMode); - ToastUtils.show("已切换为三列网格视图!"); - } else { - mSetting.setBookcaseStyle(BookcaseStyle.listMode); - ToastUtils.show("已切换为列表视图!"); - } - isBookcaseStyleChange = true; - SysManager.saveSetting(mSetting); - init(); - return true; - case R.id.action_group_man: - showGroupManDia(); - return true; - case R.id.action_addLocalBook: - addLocalBook(); - break; - case R.id.action_download_all: - if (!SharedPreUtils.getInstance().getBoolean(mMainActivity.getString(R.string.isReadDownloadAllTip), false)) { - DialogCreator.createCommonDialog(mMainActivity, "一键缓存", - mMainActivity.getString(R.string.all_cathe_tip), true, - (dialog, which) -> { - downloadAll(true, true); - SharedPreUtils.getInstance().putBoolean(mMainActivity.getString(R.string.isReadDownloadAllTip), true); - }, null); - } else { - downloadAll(true, true); - } - return true; + int itemId = item.getItemId(); + if (itemId == R.id.action_change_group) { + mBookcaseFragment.getmBookcasePresenter() + .showBookGroupMenu(mMainActivity.findViewById(R.id.action_change_group)); + return true; + } else if (itemId == R.id.action_edit) { + editBookcase(true); + return true; + } else if (itemId == R.id.action_styleChange) { + if (mSetting.getBookcaseStyle().equals(BookcaseStyle.listMode)) { + mSetting.setBookcaseStyle(BookcaseStyle.threePalaceMode); + ToastUtils.show("已切换为三列网格视图!"); + } else { + mSetting.setBookcaseStyle(BookcaseStyle.listMode); + ToastUtils.show("已切换为列表视图!"); + } + isBookcaseStyleChange = true; + SysManager.saveSetting(mSetting); + init(); + return true; + } else if (itemId == R.id.action_group_man) { + showGroupManDia(); + return true; + } else if (itemId == R.id.action_addLocalBook) { + addLocalBook(); + return true; + } else if (itemId == R.id.action_add_url) { + return true; + } else if (itemId == R.id.action_download_all) { + if (!SharedPreUtils.getInstance().getBoolean(mMainActivity.getString(R.string.isReadDownloadAllTip), false)) { + DialogCreator.createCommonDialog(mMainActivity, "一键缓存", + mMainActivity.getString(R.string.all_cathe_tip), true, + (dialog, which) -> { + downloadAll(true, true); + SharedPreUtils.getInstance().putBoolean(mMainActivity.getString(R.string.isReadDownloadAllTip), true); + }, null); + } else { + downloadAll(true, true); + } + return true; } return false; } @@ -1066,4 +1068,6 @@ public class BookcasePresenter implements BasePresenter { } } + /*****************************添加网址************************************/ + } diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/source/find/ThirdFindCrawler.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/source/find/ThirdFindCrawler.java index 9ff7c3a..f9e6e66 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/source/find/ThirdFindCrawler.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/source/find/ThirdFindCrawler.java @@ -67,22 +67,31 @@ public class ThirdFindCrawler extends BaseFindCrawler { kindA = findRule.split("(&&|\n)+"); List children = new ArrayList<>(); String groupName = getName(); + int nameCount = 0; for (String kindB : kindA) { - if (kindB.trim().isEmpty()) continue; + kindB = StringUtils.trim(kindB); + if (TextUtils.isEmpty(kindB)) continue; String[] kind = kindB.split("::"); - if (kind.length == 1){ + if (kind.length == 0) { + if (children.size() > 0) { + nameCount++; + kindsMap.put(groupName, children); + children = new ArrayList<>(); + } + groupName = getName() + "[" + nameCount + "]"; + } else if (kind.length == 1) { if (children.size() > 0) { kindsMap.put(groupName, children); children = new ArrayList<>(); } groupName = kind[0].replaceAll("\\s", ""); - continue; + } else { + FindKind findKindBean = new FindKind(); + findKindBean.setTag(source.getSourceUrl()); + findKindBean.setName(kind[0].replaceAll("\\s", "")); + findKindBean.setUrl(kind[1]); + children.add(findKindBean); } - FindKind findKindBean = new FindKind(); - findKindBean.setTag(source.getSourceUrl()); - findKindBean.setName(kind[0].replaceAll("\\s", "")); - findKindBean.setUrl(kind[1]); - children.add(findKindBean); } kindsMap.put(groupName, children); } diff --git a/app/src/main/res/menu/menu_book.xml b/app/src/main/res/menu/menu_book.xml index 480b1bb..62133d3 100644 --- a/app/src/main/res/menu/menu_book.xml +++ b/app/src/main/res/menu/menu_book.xml @@ -42,6 +42,13 @@ android:title="@string/menu_bookcase_add" app:showAsAction="never" /> + + 隐私政策 联系作者 浏览器 + 添加网址