优化
This commit is contained in:
@@ -10,12 +10,10 @@ import com.google.android.flexbox.FlexboxLayout
|
|||||||
import io.legado.app.R
|
import io.legado.app.R
|
||||||
import io.legado.app.base.adapter.ItemViewHolder
|
import io.legado.app.base.adapter.ItemViewHolder
|
||||||
import io.legado.app.base.adapter.RecyclerAdapter
|
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.BookSource
|
||||||
import io.legado.app.data.entities.rule.ExploreKind
|
import io.legado.app.data.entities.rule.ExploreKind
|
||||||
import io.legado.app.databinding.ItemFilletTextBinding
|
import io.legado.app.databinding.ItemFilletTextBinding
|
||||||
import io.legado.app.databinding.ItemFindBookBinding
|
import io.legado.app.databinding.ItemFindBookBinding
|
||||||
import io.legado.app.help.config.SourceConfig
|
|
||||||
import io.legado.app.help.coroutine.Coroutine
|
import io.legado.app.help.coroutine.Coroutine
|
||||||
import io.legado.app.lib.theme.accentColor
|
import io.legado.app.lib.theme.accentColor
|
||||||
import io.legado.app.ui.login.SourceLoginActivity
|
import io.legado.app.ui.login.SourceLoginActivity
|
||||||
@@ -173,10 +171,7 @@ class ExploreAdapter(context: Context, val callBack: CallBack) :
|
|||||||
}.onSuccess {
|
}.onSuccess {
|
||||||
callBack.refreshData()
|
callBack.refreshData()
|
||||||
}
|
}
|
||||||
R.id.menu_del -> Coroutine.async(callBack.scope) {
|
R.id.menu_del -> callBack.deleteSource(source)
|
||||||
appDb.bookSourceDao.delete(source)
|
|
||||||
SourceConfig.removeSource(source.bookSourceUrl)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
@@ -191,5 +186,6 @@ class ExploreAdapter(context: Context, val callBack: CallBack) :
|
|||||||
fun openExplore(sourceUrl: String, title: String, exploreUrl: String?)
|
fun openExplore(sourceUrl: String, title: String, exploreUrl: String?)
|
||||||
fun editSource(sourceUrl: String)
|
fun editSource(sourceUrl: String)
|
||||||
fun toTop(source: BookSource)
|
fun toTop(source: BookSource)
|
||||||
|
fun deleteSource(source: BookSource)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -18,6 +18,7 @@ import io.legado.app.data.appDb
|
|||||||
import io.legado.app.data.entities.BookSource
|
import io.legado.app.data.entities.BookSource
|
||||||
import io.legado.app.databinding.FragmentExploreBinding
|
import io.legado.app.databinding.FragmentExploreBinding
|
||||||
import io.legado.app.help.config.AppConfig
|
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.primaryColor
|
||||||
import io.legado.app.lib.theme.primaryTextColor
|
import io.legado.app.lib.theme.primaryTextColor
|
||||||
import io.legado.app.ui.book.explore.ExploreShowActivity
|
import io.legado.app.ui.book.explore.ExploreShowActivity
|
||||||
@@ -183,6 +184,16 @@ class ExploreFragment : VMBaseFragment<ExploreViewModel>(R.layout.fragment_explo
|
|||||||
viewModel.topSource(source)
|
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() {
|
fun compressExplore() {
|
||||||
if (!adapter.compressExplore()) {
|
if (!adapter.compressExplore()) {
|
||||||
if (AppConfig.isEInkMode) {
|
if (AppConfig.isEInkMode) {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import android.app.Application
|
|||||||
import io.legado.app.base.BaseViewModel
|
import io.legado.app.base.BaseViewModel
|
||||||
import io.legado.app.data.appDb
|
import io.legado.app.data.appDb
|
||||||
import io.legado.app.data.entities.BookSource
|
import io.legado.app.data.entities.BookSource
|
||||||
|
import io.legado.app.help.config.SourceConfig
|
||||||
|
|
||||||
class ExploreViewModel(application: Application) : BaseViewModel(application) {
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:padding="5dp"
|
android:padding="5dp"
|
||||||
android:src="@drawable/ic_praise"
|
android:src="@drawable/ic_praise"
|
||||||
|
android:contentDescription="赞"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/iv_bad"
|
app:layout_constraintBottom_toTopOf="@+id/iv_bad"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
@@ -27,6 +28,7 @@
|
|||||||
android:padding="5dp"
|
android:padding="5dp"
|
||||||
android:rotationX="180"
|
android:rotationX="180"
|
||||||
android:src="@drawable/ic_praise"
|
android:src="@drawable/ic_praise"
|
||||||
|
android:contentDescription="踩"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/iv_good"
|
app:layout_constraintTop_toBottomOf="@+id/iv_good"
|
||||||
|
|||||||
@@ -1016,8 +1016,8 @@
|
|||||||
<string name="rule_review_content">段评内容(contentRule)</string>
|
<string name="rule_review_content">段评内容(contentRule)</string>
|
||||||
<string name="rule_review_quote">段评回复URL(reviewQuoteUrl)</string>
|
<string name="rule_review_quote">段评回复URL(reviewQuoteUrl)</string>
|
||||||
<string name="rule_post_time">段评发布时间(postTimeRule)</string>
|
<string name="rule_post_time">段评发布时间(postTimeRule)</string>
|
||||||
<string name="review_vote_down">点踩URL(voteUpUrl)</string>
|
<string name="review_vote_down">点踩URL(voteDownUrl)</string>
|
||||||
<string name="review_vote_up">点赞URL(voteDownUrl)</string>
|
<string name="review_vote_up">点赞URL(voteUpUrl)</string>
|
||||||
<string name="post_review_url">发送回复URL(postReviewUrl)</string>
|
<string name="post_review_url">发送回复URL(postReviewUrl)</string>
|
||||||
<string name="post_quote_url">发送回复段评URL(postQuoteUrl)</string>
|
<string name="post_quote_url">发送回复段评URL(postQuoteUrl)</string>
|
||||||
<string name="delete_review_url">删除段评URL(deleteUrl)</string>
|
<string name="delete_review_url">删除段评URL(deleteUrl)</string>
|
||||||
|
|||||||
@@ -1019,8 +1019,8 @@
|
|||||||
<string name="rule_review_content">段评内容(contentRule)</string>
|
<string name="rule_review_content">段评内容(contentRule)</string>
|
||||||
<string name="rule_post_time">段评发布时间(postTimeRule)</string>
|
<string name="rule_post_time">段评发布时间(postTimeRule)</string>
|
||||||
<string name="rule_review_quote">段评回复URL(reviewQuoteUrl)</string>
|
<string name="rule_review_quote">段评回复URL(reviewQuoteUrl)</string>
|
||||||
<string name="review_vote_down">点踩URL(voteUpUrl)</string>
|
<string name="review_vote_down">点踩URL(voteDownUrl)</string>
|
||||||
<string name="review_vote_up">点赞URL(voteDownUrl)</string>
|
<string name="review_vote_up">点赞URL(voteUpUrl)</string>
|
||||||
<string name="post_review_url">发送回复URL(postReviewUrl)</string>
|
<string name="post_review_url">发送回复URL(postReviewUrl)</string>
|
||||||
<string name="post_quote_url">发送回复段评URL(postQuoteUrl)</string>
|
<string name="post_quote_url">发送回复段评URL(postQuoteUrl)</string>
|
||||||
<string name="delete_review_url">删除段评URL(deleteUrl)</string>
|
<string name="delete_review_url">删除段评URL(deleteUrl)</string>
|
||||||
|
|||||||
@@ -1019,8 +1019,8 @@
|
|||||||
<string name="rule_review_content">段评内容(contentRule)</string>
|
<string name="rule_review_content">段评内容(contentRule)</string>
|
||||||
<string name="rule_post_time">段评发布时间(postTimeRule)</string>
|
<string name="rule_post_time">段评发布时间(postTimeRule)</string>
|
||||||
<string name="rule_review_quote">段评回复URL(reviewQuoteUrl)</string>
|
<string name="rule_review_quote">段评回复URL(reviewQuoteUrl)</string>
|
||||||
<string name="review_vote_down">点踩URL(voteUpUrl)</string>
|
<string name="review_vote_down">点踩URL(voteDownUrl)</string>
|
||||||
<string name="review_vote_up">点赞URL(voteDownUrl)</string>
|
<string name="review_vote_up">点赞URL(voteUpUrl)</string>
|
||||||
<string name="post_review_url">发送回复URL(postReviewUrl)</string>
|
<string name="post_review_url">发送回复URL(postReviewUrl)</string>
|
||||||
<string name="post_quote_url">发送回复段评URL(postQuoteUrl)</string>
|
<string name="post_quote_url">发送回复段评URL(postQuoteUrl)</string>
|
||||||
<string name="delete_review_url">删除段评URL(deleteUrl)</string>
|
<string name="delete_review_url">删除段评URL(deleteUrl)</string>
|
||||||
|
|||||||
@@ -1016,8 +1016,8 @@
|
|||||||
<string name="rule_review_content">段评内容(contentRule)</string>
|
<string name="rule_review_content">段评内容(contentRule)</string>
|
||||||
<string name="rule_post_time">段评发布时间(postTimeRule)</string>
|
<string name="rule_post_time">段评发布时间(postTimeRule)</string>
|
||||||
<string name="rule_review_quote">段评回复URL(reviewQuoteUrl)</string>
|
<string name="rule_review_quote">段评回复URL(reviewQuoteUrl)</string>
|
||||||
<string name="review_vote_down">点踩URL(voteUpUrl)</string>
|
<string name="review_vote_down">点踩URL(voteDownUrl)</string>
|
||||||
<string name="review_vote_up">点赞URL(voteDownUrl)</string>
|
<string name="review_vote_up">点赞URL(voteUpUrl)</string>
|
||||||
<string name="post_review_url">发送回复URL(postReviewUrl)</string>
|
<string name="post_review_url">发送回复URL(postReviewUrl)</string>
|
||||||
<string name="post_quote_url">发送回复段评URL(postQuoteUrl)</string>
|
<string name="post_quote_url">发送回复段评URL(postQuoteUrl)</string>
|
||||||
<string name="delete_review_url">删除段评URL(deleteUrl)</string>
|
<string name="delete_review_url">删除段评URL(deleteUrl)</string>
|
||||||
|
|||||||
@@ -1018,8 +1018,8 @@
|
|||||||
<string name="rule_review_content">段评内容(contentRule)</string>
|
<string name="rule_review_content">段评内容(contentRule)</string>
|
||||||
<string name="rule_post_time">段评发布时间(postTimeRule)</string>
|
<string name="rule_post_time">段评发布时间(postTimeRule)</string>
|
||||||
<string name="rule_review_quote">段评回复URL(reviewQuoteUrl)</string>
|
<string name="rule_review_quote">段评回复URL(reviewQuoteUrl)</string>
|
||||||
<string name="review_vote_down">点踩URL(voteUpUrl)</string>
|
<string name="review_vote_down">点踩URL(voteDownUrl)</string>
|
||||||
<string name="review_vote_up">点赞URL(voteDownUrl)</string>
|
<string name="review_vote_up">点赞URL(voteUpUrl)</string>
|
||||||
<string name="post_review_url">发送回复URL(postReviewUrl)</string>
|
<string name="post_review_url">发送回复URL(postReviewUrl)</string>
|
||||||
<string name="post_quote_url">发送回复段评URL(postQuoteUrl)</string>
|
<string name="post_quote_url">发送回复段评URL(postQuoteUrl)</string>
|
||||||
<string name="delete_review_url">删除段评URL(deleteUrl)</string>
|
<string name="delete_review_url">删除段评URL(deleteUrl)</string>
|
||||||
|
|||||||
@@ -1018,8 +1018,8 @@
|
|||||||
<string name="rule_review_content">段评内容(contentRule)</string>
|
<string name="rule_review_content">段评内容(contentRule)</string>
|
||||||
<string name="rule_post_time">段评发布时间(postTimeRule)</string>
|
<string name="rule_post_time">段评发布时间(postTimeRule)</string>
|
||||||
<string name="rule_review_quote">段评回复URL(reviewQuoteUrl)</string>
|
<string name="rule_review_quote">段评回复URL(reviewQuoteUrl)</string>
|
||||||
<string name="review_vote_down">点踩URL(voteUpUrl)</string>
|
<string name="review_vote_down">点踩URL(voteDownUrl)</string>
|
||||||
<string name="review_vote_up">点赞URL(voteDownUrl)</string>
|
<string name="review_vote_up">点赞URL(voteUpUrl)</string>
|
||||||
<string name="post_review_url">发送回复URL(postReviewUrl)</string>
|
<string name="post_review_url">发送回复URL(postReviewUrl)</string>
|
||||||
<string name="post_quote_url">发送回复段评URL(postQuoteUrl)</string>
|
<string name="post_quote_url">发送回复段评URL(postQuoteUrl)</string>
|
||||||
<string name="delete_review_url">删除段评URL(deleteUrl)</string>
|
<string name="delete_review_url">删除段评URL(deleteUrl)</string>
|
||||||
|
|||||||
@@ -1019,8 +1019,8 @@
|
|||||||
<string name="rule_review_content">段评内容(contentRule)</string>
|
<string name="rule_review_content">段评内容(contentRule)</string>
|
||||||
<string name="rule_post_time">段评发布时间(postTimeRule)</string>
|
<string name="rule_post_time">段评发布时间(postTimeRule)</string>
|
||||||
<string name="rule_review_quote">段评回复URL(reviewQuoteUrl)</string>
|
<string name="rule_review_quote">段评回复URL(reviewQuoteUrl)</string>
|
||||||
<string name="review_vote_down">点踩URL(voteUpUrl)</string>
|
<string name="review_vote_down">点踩URL(voteDownUrl)</string>
|
||||||
<string name="review_vote_up">点赞URL(voteDownUrl)</string>
|
<string name="review_vote_up">点赞URL(voteUpUrl)</string>
|
||||||
<string name="post_review_url">发送回复URL(postReviewUrl)</string>
|
<string name="post_review_url">发送回复URL(postReviewUrl)</string>
|
||||||
<string name="post_quote_url">发送回复段评URL(postQuoteUrl)</string>
|
<string name="post_quote_url">发送回复段评URL(postQuoteUrl)</string>
|
||||||
<string name="delete_review_url">删除段评URL(deleteUrl)</string>
|
<string name="delete_review_url">删除段评URL(deleteUrl)</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user