mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
换源添加到快速跳转到当前源
This commit is contained in:
@@ -66,6 +66,7 @@ class ChangeBookSourceDialog() : BaseDialogFragment(R.layout.dialog_book_change_
|
||||
initMenu()
|
||||
initRecyclerView()
|
||||
initSearchView()
|
||||
initBottomBar()
|
||||
initLiveData()
|
||||
}
|
||||
|
||||
@@ -127,6 +128,19 @@ class ChangeBookSourceDialog() : BaseDialogFragment(R.layout.dialog_book_change_
|
||||
})
|
||||
}
|
||||
|
||||
private fun initBottomBar() {
|
||||
binding.tvDur.text = callBack?.oldBook?.originName
|
||||
binding.tvDur.setOnClickListener {
|
||||
scrollToDurSource()
|
||||
}
|
||||
binding.ivTop.setOnClickListener {
|
||||
binding.recyclerView.scrollToPosition(0)
|
||||
}
|
||||
binding.ivBottom.setOnClickListener {
|
||||
binding.recyclerView.scrollToPosition(adapter.itemCount - 1)
|
||||
}
|
||||
}
|
||||
|
||||
private fun initLiveData() {
|
||||
viewModel.searchStateData.observe(viewLifecycleOwner) {
|
||||
binding.refreshProgressBar.isAutoLoading = it
|
||||
@@ -165,7 +179,6 @@ class ChangeBookSourceDialog() : BaseDialogFragment(R.layout.dialog_book_change_
|
||||
|
||||
override fun onMenuItemClick(item: MenuItem?): Boolean {
|
||||
when (item?.itemId) {
|
||||
R.id.menu_scroll_to_dur -> scrollToDurSource()
|
||||
R.id.menu_check_author -> {
|
||||
AppConfig.changeSourceCheckAuthor = !item.isChecked
|
||||
item.isChecked = !item.isChecked
|
||||
|
||||
@@ -93,6 +93,7 @@ class ChangeChapterSourceDialog() : BaseDialogFragment(R.layout.dialog_chapter_c
|
||||
initView()
|
||||
initRecyclerView()
|
||||
initSearchView()
|
||||
initBottomBar()
|
||||
initLiveData()
|
||||
}
|
||||
|
||||
@@ -161,6 +162,19 @@ class ChangeChapterSourceDialog() : BaseDialogFragment(R.layout.dialog_chapter_c
|
||||
})
|
||||
}
|
||||
|
||||
private fun initBottomBar() {
|
||||
binding.tvDur.text = callBack?.oldBook?.originName
|
||||
binding.tvDur.setOnClickListener {
|
||||
scrollToDurSource()
|
||||
}
|
||||
binding.ivTop.setOnClickListener {
|
||||
binding.recyclerView.scrollToPosition(0)
|
||||
}
|
||||
binding.ivBottom.setOnClickListener {
|
||||
binding.recyclerView.scrollToPosition(searchBookAdapter.itemCount - 1)
|
||||
}
|
||||
}
|
||||
|
||||
private fun initLiveData() {
|
||||
viewModel.searchStateData.observe(viewLifecycleOwner) {
|
||||
binding.refreshProgressBar.isAutoLoading = it
|
||||
@@ -199,7 +213,6 @@ class ChangeChapterSourceDialog() : BaseDialogFragment(R.layout.dialog_chapter_c
|
||||
|
||||
override fun onMenuItemClick(item: MenuItem?): Boolean {
|
||||
when (item?.itemId) {
|
||||
R.id.menu_scroll_to_dur -> scrollToDurSource()
|
||||
R.id.menu_check_author -> {
|
||||
AppConfig.changeSourceCheckAuthor = !item.isChecked
|
||||
item.isChecked = !item.isChecked
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/background"
|
||||
android:orientation="vertical">
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:background="@color/background">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/tool_bar"
|
||||
@@ -13,6 +13,7 @@
|
||||
android:background="@color/background_menu"
|
||||
android:elevation="5dp"
|
||||
android:theme="?attr/actionBarStyle"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:displayHomeAsUp="false"
|
||||
app:fitStatusBar="false"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay"
|
||||
@@ -21,12 +22,64 @@
|
||||
<io.legado.app.ui.widget.anima.RefreshProgressBar
|
||||
android:id="@+id/refresh_progress_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp" />
|
||||
android:layout_height="2dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tool_bar" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
<io.legado.app.ui.widget.recycler.scroller.FastScrollRecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/refresh_progress_bar"
|
||||
app:layout_constraintBottom_toTopOf="@+id/ll_bottom_bar"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
|
||||
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_bottom_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="36dp"
|
||||
android:background="@color/background"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toBottomOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_dur"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:ellipsize="middle"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:singleLine="true"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="@color/primaryText"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_top"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/go_to_top"
|
||||
android:src="@drawable/ic_arrow_drop_up"
|
||||
android:tooltipText="@string/go_to_top"
|
||||
app:tint="@color/primaryText"
|
||||
tools:ignore="UnusedAttribute" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_bottom"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/go_to_bottom"
|
||||
android:src="@drawable/ic_arrow_drop_down"
|
||||
android:tooltipText="@string/go_to_bottom"
|
||||
app:tint="@color/primaryText"
|
||||
tools:ignore="UnusedAttribute" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/background"
|
||||
android:orientation="vertical">
|
||||
android:background="@color/background">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/tool_bar"
|
||||
@@ -25,14 +25,62 @@
|
||||
android:layout_height="2dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tool_bar" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
<io.legado.app.ui.widget.recycler.scroller.FastScrollRecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@+id/ll_bottom_bar"
|
||||
app:layout_constraintTop_toBottomOf="@+id/refresh_progress_bar" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_bottom_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="36dp"
|
||||
android:background="@color/background"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_dur"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:ellipsize="middle"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/primaryText"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_top"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/go_to_top"
|
||||
android:src="@drawable/ic_arrow_drop_up"
|
||||
android:tooltipText="@string/go_to_top"
|
||||
app:tint="@color/primaryText"
|
||||
tools:ignore="UnusedAttribute" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_bottom"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/go_to_bottom"
|
||||
android:src="@drawable/ic_arrow_drop_down"
|
||||
android:tooltipText="@string/go_to_bottom"
|
||||
app:tint="@color/primaryText"
|
||||
tools:ignore="UnusedAttribute" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_toc"
|
||||
android:layout_width="match_parent"
|
||||
@@ -54,8 +102,8 @@
|
||||
android:id="@+id/iv_hide_toc"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="36dp"
|
||||
android:src="@drawable/ic_arrow_down"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:src="@drawable/ic_arrow_down"
|
||||
app:tint="@color/primaryText" />
|
||||
|
||||
</FrameLayout>
|
||||
@@ -73,10 +121,10 @@
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintTop_toTopOf="@+id/recycler_view_toc"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/recycler_view_toc"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/recycler_view_toc"
|
||||
app:layout_constraintRight_toRightOf="@+id/recycler_view_toc"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/recycler_view_toc" />
|
||||
app:layout_constraintTop_toTopOf="@+id/recycler_view_toc" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
@@ -18,11 +18,6 @@
|
||||
app:showAsAction="always"
|
||||
tools:ignore="AlwaysShowAction" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_scroll_to_dur"
|
||||
android:title="@string/scroll_to_dur_source"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_source_manage"
|
||||
android:title="@string/book_source_manage"
|
||||
|
||||
Reference in New Issue
Block a user