diff --git a/.idea/misc.xml b/.idea/misc.xml
index a92f8ed..6f853a3 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -52,6 +52,7 @@
+
diff --git a/app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/BookSourceManager.java b/app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/BookSourceManager.java
index 2985c0c..606ecc6 100644
--- a/app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/BookSourceManager.java
+++ b/app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/BookSourceManager.java
@@ -189,6 +189,10 @@ public class BookSourceManager {
DbManager.getDaoSession().getBookSourceDao().deleteInTx(sources);
}
+ public static boolean isBookSourceExist(BookSource source){
+ if (source == null) return false;
+ return DbManager.getDaoSession().getBookSourceDao().load(source.getSourceUrl()) != null;
+ }
public static String getBookSourceSort() {
switch (SharedPreUtils.getInstance().getInt("SourceSort", 0)) {
diff --git a/app/src/main/java/xyz/fycz/myreader/ui/activity/SourceEditActivity.java b/app/src/main/java/xyz/fycz/myreader/ui/activity/SourceEditActivity.java
index 7dcd369..41efdee 100644
--- a/app/src/main/java/xyz/fycz/myreader/ui/activity/SourceEditActivity.java
+++ b/app/src/main/java/xyz/fycz/myreader/ui/activity/SourceEditActivity.java
@@ -182,6 +182,15 @@ public class SourceEditActivity extends BaseActivity {
} else if (item.getItemId() == R.id.action_clear_cookie) {
DbManager.getDaoSession().getCookieBeanDao().deleteByKey(getSource().getSourceUrl());
ToastUtils.showSuccess("Cookie清除成功");
+ } else if (item.getItemId() == R.id.action_delete) {
+ if (BookSourceManager.isBookSourceExist(source)) {
+ BookSourceManager.removeBookSource(source);
+ setResult(Activity.RESULT_OK);
+ ToastUtils.showSuccess("书源删除成功");
+ finish();
+ } else {
+ ToastUtils.showWarring("当前书源暂未保存,无法删除");
+ }
}
return super.onOptionsItemSelected(item);
}
diff --git a/app/src/main/res/layout/activity_search_book.xml b/app/src/main/res/layout/activity_search_book.xml
index 56bf83e..d9f2477 100644
--- a/app/src/main/res/layout/activity_search_book.xml
+++ b/app/src/main/res/layout/activity_search_book.xml
@@ -151,7 +151,7 @@
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingHorizontal="5dp"
- android:visibility="visible">
+ android:visibility="gone">
+
+
\ No newline at end of file