kunfei 4 лет назад
Родитель
Сommit
ccfe52ff7c

+ 2 - 6
app/src/main/java/io/legado/app/ui/main/explore/ExploreAdapter.kt

@@ -10,12 +10,10 @@ import com.google.android.flexbox.FlexboxLayout
 import io.legado.app.R
 import io.legado.app.base.adapter.ItemViewHolder
 import io.legado.app.base.adapter.RecyclerAdapter
-import io.legado.app.data.appDb
 import io.legado.app.data.entities.BookSource
 import io.legado.app.data.entities.rule.ExploreKind
 import io.legado.app.databinding.ItemFilletTextBinding
 import io.legado.app.databinding.ItemFindBookBinding
-import io.legado.app.help.config.SourceConfig
 import io.legado.app.help.coroutine.Coroutine
 import io.legado.app.lib.theme.accentColor
 import io.legado.app.ui.login.SourceLoginActivity
@@ -173,10 +171,7 @@ class ExploreAdapter(context: Context, val callBack: CallBack) :
                 }.onSuccess {
                     callBack.refreshData()
                 }
-                R.id.menu_del -> Coroutine.async(callBack.scope) {
-                    appDb.bookSourceDao.delete(source)
-                    SourceConfig.removeSource(source.bookSourceUrl)
-                }
+                R.id.menu_del -> callBack.deleteSource(source)
             }
             true
         }
@@ -191,5 +186,6 @@ class ExploreAdapter(context: Context, val callBack: CallBack) :
         fun openExplore(sourceUrl: String, title: String, exploreUrl: String?)
         fun editSource(sourceUrl: String)
         fun toTop(source: BookSource)
+        fun deleteSource(source: BookSource)
     }
 }

+ 11 - 0
app/src/main/java/io/legado/app/ui/main/explore/ExploreFragment.kt

@@ -18,6 +18,7 @@ import io.legado.app.data.appDb
 import io.legado.app.data.entities.BookSource
 import io.legado.app.databinding.FragmentExploreBinding
 import io.legado.app.help.config.AppConfig
+import io.legado.app.lib.dialogs.alert
 import io.legado.app.lib.theme.primaryColor
 import io.legado.app.lib.theme.primaryTextColor
 import io.legado.app.ui.book.explore.ExploreShowActivity
@@ -183,6 +184,16 @@ class ExploreFragment : VMBaseFragment<ExploreViewModel>(R.layout.fragment_explo
         viewModel.topSource(source)
     }
 
+    override fun deleteSource(source: BookSource) {
+        alert(R.string.draw) {
+            setMessage(getString(R.string.sure_del) + "\n" + source.bookSourceName)
+            noButton()
+            yesButton {
+                viewModel.deleteSource(source)
+            }
+        }
+    }
+
     fun compressExplore() {
         if (!adapter.compressExplore()) {
             if (AppConfig.isEInkMode) {

+ 8 - 0
app/src/main/java/io/legado/app/ui/main/explore/ExploreViewModel.kt

@@ -4,6 +4,7 @@ import android.app.Application
 import io.legado.app.base.BaseViewModel
 import io.legado.app.data.appDb
 import io.legado.app.data.entities.BookSource
+import io.legado.app.help.config.SourceConfig
 
 class ExploreViewModel(application: Application) : BaseViewModel(application) {
 
@@ -15,4 +16,11 @@ class ExploreViewModel(application: Application) : BaseViewModel(application) {
         }
     }
 
+    fun deleteSource(source: BookSource) {
+        execute {
+            appDb.bookSourceDao.delete(source)
+            SourceConfig.removeSource(source.bookSourceUrl)
+        }
+    }
+
 }

+ 2 - 0
app/src/main/res/layout/item_change_source.xml

@@ -14,6 +14,7 @@
         android:layout_marginTop="5dp"
         android:padding="5dp"
         android:src="@drawable/ic_praise"
+        android:contentDescription="赞"
         app:layout_constraintBottom_toTopOf="@+id/iv_bad"
         app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintTop_toTopOf="parent"
@@ -27,6 +28,7 @@
         android:padding="5dp"
         android:rotationX="180"
         android:src="@drawable/ic_praise"
+        android:contentDescription="踩"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/iv_good"

+ 2 - 2
app/src/main/res/values-es-rES/strings.xml

@@ -1016,8 +1016,8 @@
     <string name="rule_review_content">段评内容(contentRule)</string>
     <string name="rule_review_quote">段评回复URL(reviewQuoteUrl)</string>
     <string name="rule_post_time">段评发布时间(postTimeRule)</string>
-    <string name="review_vote_down">点踩URL(voteUpUrl)</string>
-    <string name="review_vote_up">点赞URL(voteDownUrl)</string>
+    <string name="review_vote_down">点踩URL(voteDownUrl)</string>
+    <string name="review_vote_up">点赞URL(voteUpUrl)</string>
     <string name="post_review_url">发送回复URL(postReviewUrl)</string>
     <string name="post_quote_url">发送回复段评URL(postQuoteUrl)</string>
     <string name="delete_review_url">删除段评URL(deleteUrl)</string>

+ 2 - 2
app/src/main/res/values-ja-rJP/strings.xml

@@ -1019,8 +1019,8 @@
     <string name="rule_review_content">段评内容(contentRule)</string>
     <string name="rule_post_time">段评发布时间(postTimeRule)</string>
     <string name="rule_review_quote">段评回复URL(reviewQuoteUrl)</string>
-    <string name="review_vote_down">点踩URL(voteUpUrl)</string>
-    <string name="review_vote_up">点赞URL(voteDownUrl)</string>
+    <string name="review_vote_down">点踩URL(voteDownUrl)</string>
+    <string name="review_vote_up">点赞URL(voteUpUrl)</string>
     <string name="post_review_url">发送回复URL(postReviewUrl)</string>
     <string name="post_quote_url">发送回复段评URL(postQuoteUrl)</string>
     <string name="delete_review_url">删除段评URL(deleteUrl)</string>

+ 2 - 2
app/src/main/res/values-pt-rBR/strings.xml

@@ -1019,8 +1019,8 @@
     <string name="rule_review_content">段评内容(contentRule)</string>
     <string name="rule_post_time">段评发布时间(postTimeRule)</string>
     <string name="rule_review_quote">段评回复URL(reviewQuoteUrl)</string>
-    <string name="review_vote_down">点踩URL(voteUpUrl)</string>
-    <string name="review_vote_up">点赞URL(voteDownUrl)</string>
+    <string name="review_vote_down">点踩URL(voteDownUrl)</string>
+    <string name="review_vote_up">点赞URL(voteUpUrl)</string>
     <string name="post_review_url">发送回复URL(postReviewUrl)</string>
     <string name="post_quote_url">发送回复段评URL(postQuoteUrl)</string>
     <string name="delete_review_url">删除段评URL(deleteUrl)</string>

+ 2 - 2
app/src/main/res/values-zh-rHK/strings.xml

@@ -1016,8 +1016,8 @@
     <string name="rule_review_content">段评内容(contentRule)</string>
     <string name="rule_post_time">段评发布时间(postTimeRule)</string>
     <string name="rule_review_quote">段评回复URL(reviewQuoteUrl)</string>
-    <string name="review_vote_down">点踩URL(voteUpUrl)</string>
-    <string name="review_vote_up">点赞URL(voteDownUrl)</string>
+    <string name="review_vote_down">点踩URL(voteDownUrl)</string>
+    <string name="review_vote_up">点赞URL(voteUpUrl)</string>
     <string name="post_review_url">发送回复URL(postReviewUrl)</string>
     <string name="post_quote_url">发送回复段评URL(postQuoteUrl)</string>
     <string name="delete_review_url">删除段评URL(deleteUrl)</string>

+ 2 - 2
app/src/main/res/values-zh-rTW/strings.xml

@@ -1018,8 +1018,8 @@
     <string name="rule_review_content">段评内容(contentRule)</string>
     <string name="rule_post_time">段评发布时间(postTimeRule)</string>
     <string name="rule_review_quote">段评回复URL(reviewQuoteUrl)</string>
-    <string name="review_vote_down">点踩URL(voteUpUrl)</string>
-    <string name="review_vote_up">点赞URL(voteDownUrl)</string>
+    <string name="review_vote_down">点踩URL(voteDownUrl)</string>
+    <string name="review_vote_up">点赞URL(voteUpUrl)</string>
     <string name="post_review_url">发送回复URL(postReviewUrl)</string>
     <string name="post_quote_url">发送回复段评URL(postQuoteUrl)</string>
     <string name="delete_review_url">删除段评URL(deleteUrl)</string>

+ 2 - 2
app/src/main/res/values-zh/strings.xml

@@ -1018,8 +1018,8 @@
     <string name="rule_review_content">段评内容(contentRule)</string>
     <string name="rule_post_time">段评发布时间(postTimeRule)</string>
     <string name="rule_review_quote">段评回复URL(reviewQuoteUrl)</string>
-    <string name="review_vote_down">点踩URL(voteUpUrl)</string>
-    <string name="review_vote_up">点赞URL(voteDownUrl)</string>
+    <string name="review_vote_down">点踩URL(voteDownUrl)</string>
+    <string name="review_vote_up">点赞URL(voteUpUrl)</string>
     <string name="post_review_url">发送回复URL(postReviewUrl)</string>
     <string name="post_quote_url">发送回复段评URL(postQuoteUrl)</string>
     <string name="delete_review_url">删除段评URL(deleteUrl)</string>

+ 2 - 2
app/src/main/res/values/strings.xml

@@ -1019,8 +1019,8 @@
     <string name="rule_review_content">段评内容(contentRule)</string>
     <string name="rule_post_time">段评发布时间(postTimeRule)</string>
     <string name="rule_review_quote">段评回复URL(reviewQuoteUrl)</string>
-    <string name="review_vote_down">点踩URL(voteUpUrl)</string>
-    <string name="review_vote_up">点赞URL(voteDownUrl)</string>
+    <string name="review_vote_down">点踩URL(voteDownUrl)</string>
+    <string name="review_vote_up">点赞URL(voteUpUrl)</string>
     <string name="post_review_url">发送回复URL(postReviewUrl)</string>
     <string name="post_quote_url">发送回复段评URL(postQuoteUrl)</string>
     <string name="delete_review_url">删除段评URL(deleteUrl)</string>