Open rangerzhou opened 4 years ago
------------ app/src/main/assets/booksource/DefaultBookSources.txt ------------ new file mode 100644 index 000000000..60ce48a45 @@ -0,0 +1,4 @@ +https://gitee.com/gekunfei/web/raw/master/myBookshelf/xc1772006 +https://gedoor.github.io/MyBookshelf/bookSource.json +https://bookSources.github.io +https://blackholep.github.io/20190815set1 \ No newline at end of file ------------------ app/src/main/assets/booksource/URLList.txt ------------------ new file mode 100644 index 000000000..401e94dc1 @@ -0,0 +1 @@ +https://moonbegonia.github.io/Source/ \ No newline at end of file - app/src/main/java/com/kunfei/bookshelf/view/activity/BookSourceActivity.java - index c1e0d56ce..d30994bc1 100644 @@ -42,6 +42,9 @@ import com.kunfei.bookshelf.view.adapter.BookSourceAdapter; import com.kunfei.bookshelf.widget.filepicker.picker.FilePicker; import com.kunfei.bookshelf.widget.modialog.InputDialog; +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -292,6 +295,9 @@ public class BookSourceActivity extends MBaseActivity<BookSourceContract.Present case R.id.action_import_book_source_rwm: scanBookSource(); break; + case R.id.action_import_book_source_default: + importBookSourceDefault(); + break; case R.id.action_revert_selection: revertSelection(); break; @@ -423,6 +429,20 @@ public class BookSourceActivity extends MBaseActivity<BookSourceContract.Present }).show(); } + private void importBookSourceDefault() { + try { + String line; + InputStream open = this.getResources().getAssets().open("booksource/DefaultBookSources.txt"); + InputStreamReader inputStreamReader = new InputStreamReader(open); + BufferedReader bufferedReader = new BufferedReader(inputStreamReader); + while ((line = bufferedReader.readLine()) != null && line.length() > 0) { + mPresenter.importBookSource(line); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + private void selectFileSys() { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.addCategory(Intent.CATEGORY_OPENABLE);