搜索崩溃
This commit is contained in:
3 files changed
+65
-165
No files matched your search
@@ -401,9 +401,10 @@ class ReadMenu @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
seekReadPage.addOnChangeListener { slider, value, fromUser ->
|
seekReadPage.addOnChangeListener { slider, value, fromUser ->
|
||||||
VibrationUtils.vibrate(context, 12)
|
if (fromUser) {
|
||||||
if (fromUser && AppConfig.progressBarBehavior == "page") {
|
if (AppConfig.progressBarBehavior == "page")
|
||||||
ReadBook.skipToPage(value.toInt() - 1)
|
ReadBook.skipToPage(value.toInt() - 1)
|
||||||
|
VibrationUtils.vibrate(context, 12)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -541,7 +542,7 @@ class ReadMenu @JvmOverloads constructor(
|
|||||||
id = "search",
|
id = "search",
|
||||||
iconRes = R.drawable.ic_search,
|
iconRes = R.drawable.ic_search,
|
||||||
description = context.getString(R.string.search_content),
|
description = context.getString(R.string.search_content),
|
||||||
onClick = { callBack.openSearchActivity(null) }
|
onClick = { runMenuOut{ callBack.openSearchActivity(null) } }
|
||||||
),
|
),
|
||||||
ToolButton(
|
ToolButton(
|
||||||
id = "auto_page",
|
id = "auto_page",
|
||||||
|
|||||||
@@ -105,7 +105,8 @@ class SearchMenu @JvmOverloads constructor(
|
|||||||
fun updateSearchInfo() {
|
fun updateSearchInfo() {
|
||||||
ReadBook.curTextChapter?.let {
|
ReadBook.curTextChapter?.let {
|
||||||
binding.tvCurrentSearchInfo.text =
|
binding.tvCurrentSearchInfo.text =
|
||||||
"""${context.getString(R.string.search_content_size)}: ${searchResultList.size} / 当前章节: ${it.title}"""
|
"${context.getString(R.string.search_content_size)}: ${searchResultList.size}"
|
||||||
|
binding.tvCurrentChapter.text = "当前章节: ${it.title}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,14 +121,14 @@ class SearchMenu @JvmOverloads constructor(
|
|||||||
|
|
||||||
private fun bindEvent() = binding.run {
|
private fun bindEvent() = binding.run {
|
||||||
//搜索结果
|
//搜索结果
|
||||||
llSearchResults.setOnClickListener {
|
ivSearchResults.setOnClickListener {
|
||||||
runMenuOut {
|
runMenuOut {
|
||||||
callBack.openSearchActivity(selectedSearchResult?.query)
|
callBack.openSearchActivity(selectedSearchResult?.query)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//主菜单
|
//主菜单
|
||||||
llMainMenu.setOnClickListener {
|
ivMainMenu.setOnClickListener {
|
||||||
runMenuOut {
|
runMenuOut {
|
||||||
callBack.cancelSelect()
|
callBack.cancelSelect()
|
||||||
callBack.showMenuBar()
|
callBack.showMenuBar()
|
||||||
@@ -136,7 +137,7 @@ class SearchMenu @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
//退出
|
//退出
|
||||||
llSearchExit.setOnClickListener {
|
ivSearchExit.setOnClickListener {
|
||||||
runMenuOut {
|
runMenuOut {
|
||||||
callBack.exitSearchMenu()
|
callBack.exitSearchMenu()
|
||||||
}
|
}
|
||||||
@@ -150,22 +151,6 @@ class SearchMenu @JvmOverloads constructor(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
ivSearchContentUp.setOnClickListener {
|
|
||||||
updateSearchResultIndex(currentSearchResultIndex - 1)
|
|
||||||
callBack.navigateToSearch(
|
|
||||||
searchResultList[currentSearchResultIndex],
|
|
||||||
currentSearchResultIndex
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
ivSearchContentDown.setOnClickListener {
|
|
||||||
updateSearchResultIndex(currentSearchResultIndex + 1)
|
|
||||||
callBack.navigateToSearch(
|
|
||||||
searchResultList[currentSearchResultIndex],
|
|
||||||
currentSearchResultIndex
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fabRight.setOnClickListener {
|
fabRight.setOnClickListener {
|
||||||
updateSearchResultIndex(currentSearchResultIndex + 1)
|
updateSearchResultIndex(currentSearchResultIndex + 1)
|
||||||
callBack.navigateToSearch(
|
callBack.navigateToSearch(
|
||||||
|
|||||||
@@ -55,59 +55,48 @@
|
|||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
app:layout_constraintBottom_toBottomOf="parent">
|
app:layout_constraintBottom_toBottomOf="parent">
|
||||||
|
|
||||||
<LinearLayout
|
<com.google.android.material.card.MaterialCardView
|
||||||
android:id="@+id/ll_search_base_info"
|
android:layout_width="wrap_content"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="36dp"
|
app:cardElevation="4dp"
|
||||||
android:gravity="center_vertical"
|
app:strokeWidth="0dp"
|
||||||
android:orientation="horizontal"
|
app:cardBackgroundColor="?attr/colorSecondaryContainer"
|
||||||
android:paddingLeft="10dp"
|
android:layout_marginHorizontal="16dp">
|
||||||
android:paddingRight="10dp">
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_current_search_info"
|
android:id="@+id/tv_current_search_info"
|
||||||
android:layout_width="0dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:textColor="?attr/colorOnSecondaryContainer"
|
||||||
android:background="?attr/selectableItemBackgroundBorderless"
|
android:padding="8dp"
|
||||||
android:ellipsize="middle"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:paddingLeft="10dp"
|
|
||||||
android:paddingRight="10dp"
|
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textSize="12sp" />
|
android:textSize="18sp" />
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
</com.google.android.material.card.MaterialCardView>
|
||||||
android:id="@+id/iv_search_content_up"
|
|
||||||
android:layout_width="36dp"
|
<com.google.android.material.card.MaterialCardView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:cardElevation="4dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
app:strokeWidth="0dp"
|
||||||
|
android:layout_marginHorizontal="16dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_current_chapter"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
style="@style/Widget.Material3Expressive.Button.IconButton.Tonal"
|
android:padding="8dp"
|
||||||
app:iconGravity="textStart"
|
android:singleLine="true"
|
||||||
android:contentDescription="@string/go_to_top"
|
android:textSize="14sp" />
|
||||||
app:icon="@drawable/ic_arrow_drop_up"
|
|
||||||
android:tooltipText="@string/go_to_top"
|
|
||||||
android:layout_marginEnd="8dp"
|
|
||||||
tools:ignore="UnusedAttribute" />
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
</com.google.android.material.card.MaterialCardView>
|
||||||
android:id="@+id/iv_search_content_down"
|
|
||||||
android:layout_width="36dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
style="@style/Widget.Material3Expressive.Button.IconButton.Tonal"
|
|
||||||
app:iconGravity="textStart"
|
|
||||||
android:contentDescription="@string/go_to_bottom"
|
|
||||||
app:icon="@drawable/ic_arrow_drop_down"
|
|
||||||
android:tooltipText="@string/go_to_bottom"
|
|
||||||
tools:ignore="UnusedAttribute" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/ll_bottom_bg"
|
android:id="@+id/ll_bottom_bg"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/colorSurface"
|
android:layout_marginTop="8dp"
|
||||||
android:baselineAligned="false"
|
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<View
|
<View
|
||||||
@@ -116,117 +105,42 @@
|
|||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:importantForAccessibility="no" />
|
android:importantForAccessibility="no" />
|
||||||
|
|
||||||
<!--结果按钮-->
|
<com.google.android.material.button.MaterialButton
|
||||||
<LinearLayout
|
android:id="@+id/iv_search_results"
|
||||||
android:id="@+id/ll_search_results"
|
android:layout_width="wrap_content"
|
||||||
android:layout_width="60dp"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/selectableItemBackgroundBorderless"
|
android:elevation="16dp"
|
||||||
android:clickable="true"
|
style="@style/Widget.Material3Expressive.Button.TonalButton"
|
||||||
android:contentDescription="结果"
|
android:text="@string/search_content_size"
|
||||||
android:focusable="true"
|
app:icon="@drawable/ic_toc" />
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingBottom="7dp">
|
|
||||||
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
|
||||||
android:id="@+id/iv_search_results"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:adjustViewBounds="true"
|
|
||||||
android:contentDescription="结果"
|
|
||||||
android:maxHeight="20dp"
|
|
||||||
android:src="@drawable/ic_toc"
|
|
||||||
tools:ignore="NestedWeights" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_search_results"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_marginTop="3dp"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:text="结果"
|
|
||||||
android:textSize="12sp" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="2" />
|
android:layout_weight="1" />
|
||||||
<!--调节按钮-->
|
|
||||||
<LinearLayout
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/ll_main_menu"
|
android:id="@+id/iv_main_menu"
|
||||||
android:layout_width="60dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/selectableItemBackgroundBorderless"
|
android:elevation="16dp"
|
||||||
android:clickable="true"
|
style="@style/Widget.Material3Expressive.Button.TonalButton"
|
||||||
android:contentDescription="@string/read_aloud"
|
android:text="@string/main_menu"
|
||||||
android:focusable="true"
|
app:icon="@drawable/ic_menu" />
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingBottom="7dp">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
|
||||||
android:id="@+id/iv_main_menu"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:adjustViewBounds="true"
|
|
||||||
android:contentDescription="@string/main_menu"
|
|
||||||
android:maxHeight="20dp"
|
|
||||||
android:src="@drawable/ic_menu"
|
|
||||||
tools:ignore="NestedWeights" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_main_menu"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_marginTop="3dp"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:text="@string/main_menu"
|
|
||||||
android:textSize="12sp" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="2" />
|
android:layout_weight="1" />
|
||||||
<!--界面按钮-->
|
|
||||||
<LinearLayout
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/ll_search_exit"
|
android:id="@+id/iv_search_exit"
|
||||||
android:layout_width="60dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/selectableItemBackgroundBorderless"
|
android:elevation="16dp"
|
||||||
android:clickable="true"
|
style="@style/Widget.Material3Expressive.Button.TonalButton"
|
||||||
android:contentDescription="@string/exit"
|
android:text="@string/exit"
|
||||||
android:focusable="true"
|
app:icon="@drawable/ic_auto_page_stop"
|
||||||
android:orientation="vertical"
|
tools:ignore="NestedWeights" />
|
||||||
android:paddingBottom="7dp">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
|
||||||
android:id="@+id/iv_search_exit"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:adjustViewBounds="true"
|
|
||||||
android:contentDescription="@string/exit"
|
|
||||||
android:maxHeight="20dp"
|
|
||||||
android:src="@drawable/ic_auto_page_stop"
|
|
||||||
tools:ignore="NestedWeights" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_search_exit"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_marginTop="3dp"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:text="@string/exit"
|
|
||||||
android:textSize="12sp" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<!-- <View-->
|
<!-- <View-->
|
||||||
<!-- android:layout_width="0dp"-->
|
<!-- android:layout_width="0dp"-->
|
||||||
|
|||||||
Reference in new issue
Block a user