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