Skip to content

Commit

Permalink
修复下载后解析失败的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Haleydu committed Jul 22, 2020
1 parent 2ee24a3 commit 27bd785
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
9 changes: 6 additions & 3 deletions app/src/main/java/com/hiroshi/cimoc/core/Download.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public static DocumentFile updateChapterIndex(ContentResolver resolver, Document
String jsonString = getJsonFromChapter(task.getTitle(), task.getPath());
DocumentFile dir1 = DocumentUtils.getOrCreateSubDirectory(root, DOWNLOAD);
DocumentFile dir2 = DocumentUtils.getOrCreateSubDirectory(dir1, String.valueOf(task.getSource()));
DocumentFile dir3 = DocumentUtils.getOrCreateSubDirectory(dir2, task.getCid());
DocumentFile dir3 = DocumentUtils.getOrCreateSubDirectory(dir2, task.getCid().replaceAll("/|\\?", ""));
DocumentFile dir4 = DocumentUtils.getOrCreateSubDirectory(dir3, DecryptionUtils.urlDecrypt(task.getPath().replaceAll("/|\\?", "-")));
if (dir4 != null) {
DocumentFile file = DocumentUtils.getOrCreateFile(dir4, FILE_INDEX);
Expand Down Expand Up @@ -222,8 +222,11 @@ private static List<String> readPathFromJson(String jsonString) throws JSONExcep
}

public static DocumentFile getChapterDir(DocumentFile root, Comic comic, Chapter chapter, String title) {
DocumentFile result = DocumentUtils.findFile(root, DOWNLOAD, String.valueOf(comic.getSource()),
comic.getCid(), DecryptionUtils.urlDecrypt(chapter.getPath().replaceAll("/|\\?", "-")));
DocumentFile result = DocumentUtils.findFile(root, DOWNLOAD,
String.valueOf(comic.getSource()),
comic.getCid().replaceAll("/|\\?", ""),
DecryptionUtils.urlDecrypt(chapter.getPath().replaceAll("/|\\?", "-"))
);
if (result == null) {
result = DocumentUtils.findFile(root, DOWNLOAD, title, comic.getTitle(), chapter.getTitle());
}
Expand Down
9 changes: 5 additions & 4 deletions app/src/main/res/menu/menu_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
android:checkable="true"
android:icon="@drawable/ic_import_contacts_black_24dp"
android:title="@string/drawer_comic" />
<item
android:id="@+id/drawer_comiclist"
android:icon="@drawable/ic_class_black_24dp"
android:title="@string/drawer_list"/>
<item
android:id="@+id/drawer_source"
android:checkable="true"
Expand Down Expand Up @@ -46,5 +42,10 @@
android:id="@+id/drawer_about"
android:icon="@drawable/ic_about_black_24dp"
android:title="@string/drawer_about" />
<item
android:visible="false"
android:id="@+id/drawer_comiclist"
android:icon="@drawable/ic_class_black_24dp"
android:title="@string/drawer_list"/>
</group>
</menu>

0 comments on commit 27bd785

Please sign in to comment.