mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
详情页下拉刷新 close #2912
This commit is contained in:
@@ -25,6 +25,7 @@ import io.legado.app.help.config.AppConfig
|
||||
import io.legado.app.help.config.LocalConfig
|
||||
import io.legado.app.lib.dialogs.alert
|
||||
import io.legado.app.lib.dialogs.selector
|
||||
import io.legado.app.lib.theme.accentColor
|
||||
import io.legado.app.lib.theme.backgroundColor
|
||||
import io.legado.app.lib.theme.bottomBackground
|
||||
import io.legado.app.lib.theme.getPrimaryTextColor
|
||||
@@ -111,6 +112,11 @@ class BookInfoActivity :
|
||||
@SuppressLint("PrivateResource")
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
binding.titleBar.setBackgroundResource(R.color.transparent)
|
||||
binding.refreshLayout.setColorSchemeColors(accentColor)
|
||||
binding.refreshLayout.setOnRefreshListener {
|
||||
binding.refreshLayout.isRefreshing = false
|
||||
refreshBook()
|
||||
}
|
||||
binding.arcView.setBgColor(backgroundColor)
|
||||
binding.llInfo.setBackgroundColor(backgroundColor)
|
||||
binding.scrollView.setBackgroundColor(backgroundColor)
|
||||
@@ -169,10 +175,7 @@ class BookInfoActivity :
|
||||
}
|
||||
}
|
||||
R.id.menu_refresh -> {
|
||||
upLoading(true)
|
||||
viewModel.getBook()?.let {
|
||||
viewModel.refreshBook(it)
|
||||
}
|
||||
refreshBook()
|
||||
}
|
||||
R.id.menu_login -> viewModel.bookSource?.let {
|
||||
startActivity<SourceLoginActivity> {
|
||||
@@ -236,6 +239,13 @@ class BookInfoActivity :
|
||||
}
|
||||
}
|
||||
|
||||
private fun refreshBook() {
|
||||
upLoading(true)
|
||||
viewModel.getBook()?.let {
|
||||
viewModel.refreshBook(it)
|
||||
}
|
||||
}
|
||||
|
||||
private fun upLoadBook(
|
||||
book: Book,
|
||||
bookWebDav: RemoteBookWebDav? = AppWebDav.defaultBookWebDav
|
||||
|
||||
@@ -29,39 +29,48 @@
|
||||
app:title="@string/book_info"
|
||||
app:themeMode="dark" />
|
||||
|
||||
<RelativeLayout
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/refresh_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp">
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/title_bar"
|
||||
app:layout_constraintBottom_toBottomOf="parent">
|
||||
|
||||
<io.legado.app.ui.widget.image.ArcView
|
||||
android:id="@+id/arc_view"
|
||||
android:layout_marginTop="90dp"
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="78dp"
|
||||
app:arcDirectionTop="true"
|
||||
app:arcHeight="36dp"
|
||||
app:bgColor="@color/background" />
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_margin="3dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="5dp"
|
||||
app:cardElevation="8dp">
|
||||
android:layout_marginTop="8dp">
|
||||
|
||||
<io.legado.app.ui.widget.image.CoverImageView
|
||||
android:id="@+id/iv_cover"
|
||||
android:layout_width="110dp"
|
||||
android:layout_height="160dp"
|
||||
android:contentDescription="@string/img_cover"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/image_cover_default" />
|
||||
<io.legado.app.ui.widget.image.ArcView
|
||||
android:id="@+id/arc_view"
|
||||
android:layout_marginTop="90dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="78dp"
|
||||
app:arcDirectionTop="true"
|
||||
app:arcHeight="36dp"
|
||||
app:bgColor="@color/background" />
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_margin="3dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="5dp"
|
||||
app:cardElevation="8dp">
|
||||
|
||||
</RelativeLayout>
|
||||
<io.legado.app.ui.widget.image.CoverImageView
|
||||
android:id="@+id/iv_cover"
|
||||
android:layout_width="110dp"
|
||||
android:layout_height="160dp"
|
||||
android:contentDescription="@string/img_cover"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/image_cover_default" />
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scroll_view"
|
||||
|
||||
Reference in New Issue
Block a user