修复json格式书源无法导入的bug

master
fengyuecanzhu 3 years ago
parent 548fa8993f
commit 211ad560e9
  1. 5
      app/release.md
  2. 5
      app/src/main/assets/updatelog.fy
  3. 4
      app/src/main/java/xyz/fycz/myreader/model/SearchWordEngine.kt
  4. 2
      app/src/main/java/xyz/fycz/myreader/ui/fragment/DIYSourceFragment.java
  5. 1
      app/src/main/java/xyz/fycz/myreader/widget/page/PageLoader.java

@ -1,3 +1,2 @@
* 1、新增书籍内容搜索(阅读界面菜单) * 1、优化内容搜索结果显示
* 2、修复内容替换bug * 2、修复v2.2.4版本json格式书源无法导入的bug
* 3、修复书源导入bug

@ -1,4 +1,9 @@
2021.12.06 2021.12.06
风月读书v2.2.5
更新内容:
1、优化内容搜索结果显示
2、修复v2.2.4版本json格式书源无法导入的bug
风月读书v2.2.4 风月读书v2.2.4
更新内容: 更新内容:
1、新增书籍内容搜索(阅读界面菜单) 1、新增书籍内容搜索(阅读界面菜单)

@ -133,8 +133,8 @@ class SearchWordEngine(
leftI = index - 20 leftI = index - 20
leftS = "..." leftS = "..."
} }
if (rightI > index + 20) { if (rightI > index + keyword.length + 20) {
rightI = index + 20 rightI = index + keyword.length + 20
rightS = "..." rightS = "..."
} }
val str = leftS + it.substring(leftI, rightI) + rightS val str = leftS + it.substring(leftI, rightI) + rightS

@ -327,7 +327,7 @@ public class DIYSourceFragment extends BaseFragment {
Single.create((SingleOnSubscribe<String>) emitter -> { Single.create((SingleOnSubscribe<String>) emitter -> {
// String json = FileUtils.readInStream(DocumentUtil.getFileInputSteam(getContext(), data.getData())); // String json = FileUtils.readInStream(DocumentUtil.getFileInputSteam(getContext(), data.getData()));
DocumentFile file = DocumentFile.fromSingleUri(getContext(), data.getData()); DocumentFile file = DocumentFile.fromSingleUri(getContext(), data.getData());
if (!file.getName().endsWith(".txt") && !file.getType().equals(".json")) { if (!file.getName().endsWith(".txt") && !file.getType().endsWith(".json")) {
emitter.onError(new Throwable("文件格式错误")); emitter.onError(new Throwable("文件格式错误"));
return; return;
} }

@ -2221,6 +2221,7 @@ public abstract class PageLoader {
charIndex2 = charIndex + keyword.length() - currentLine.length() - 1; charIndex2 = charIndex + keyword.length() - currentLine.length() - 1;
} }
if (charIndex2 < 0) charIndex = 0; if (charIndex2 < 0) charIndex = 0;
if (charIndex2 >= currentLine.length()) charIndex2 = currentLine.length() - 1;
return new int[]{pageIndex, lineIndex, charIndex, addLine, charIndex2}; return new int[]{pageIndex, lineIndex, charIndex, addLine, charIndex2};
} }

Loading…
Cancel
Save