|
|
|
@ -29,12 +29,15 @@ class SearchMenu @JvmOverloads constructor( |
|
|
|
|
private val callBack: CallBack get() = activity as CallBack |
|
|
|
|
private val binding = ViewSearchMenuBinding.inflate(LayoutInflater.from(context), this, true) |
|
|
|
|
|
|
|
|
|
private val menuBottomIn: Animation = AnimationUtilsSupport.loadAnimation(context, R.anim.anim_readbook_bottom_in) |
|
|
|
|
private val menuBottomOut: Animation = AnimationUtilsSupport.loadAnimation(context, R.anim.anim_readbook_bottom_out) |
|
|
|
|
private val menuBottomIn: Animation = |
|
|
|
|
AnimationUtilsSupport.loadAnimation(context, R.anim.anim_readbook_bottom_in) |
|
|
|
|
private val menuBottomOut: Animation = |
|
|
|
|
AnimationUtilsSupport.loadAnimation(context, R.anim.anim_readbook_bottom_out) |
|
|
|
|
private val bgColor: Int = context.bottomBackground |
|
|
|
|
private val textColor: Int = context.getPrimaryTextColor(ColorUtils.isColorLight(bgColor)) |
|
|
|
|
private val bottomBackgroundList: ColorStateList = |
|
|
|
|
Selector.colorBuild().setDefaultColor(bgColor).setPressedColor(ColorUtils.darkenColor(bgColor)).create() |
|
|
|
|
Selector.colorBuild().setDefaultColor(bgColor) |
|
|
|
|
.setPressedColor(ColorUtils.darkenColor(bgColor)).create() |
|
|
|
|
private var onMenuOutEnd: (() -> Unit)? = null |
|
|
|
|
|
|
|
|
|
private val searchResultList: MutableList<SearchResult> = mutableListOf() |
|
|
|
@ -104,9 +107,11 @@ class SearchMenu @JvmOverloads constructor( |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@SuppressLint("SetTextI18n") |
|
|
|
|
fun updateSearchInfo() { |
|
|
|
|
ReadBook.curTextChapter?.let { |
|
|
|
|
binding.tvCurrentSearchInfo.text = context.getString(R.string.search_content_size) + ": ${searchResultList.size} / 当前章节: ${it.title}" |
|
|
|
|
binding.tvCurrentSearchInfo.text = |
|
|
|
|
"""${context.getString(R.string.search_content_size)}: ${searchResultList.size} / 当前章节: ${it.title}""" |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -143,13 +148,6 @@ class SearchMenu @JvmOverloads constructor( |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//设置 |
|
|
|
|
// llSetting.setOnClickListener { |
|
|
|
|
// runMenuOut { |
|
|
|
|
// callBack.showSearchSetting() |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
fabLeft.setOnClickListener { |
|
|
|
|
updateSearchResultIndex(currentSearchResultIndex - 1) |
|
|
|
|
callBack.navigateToSearch(searchResultList[currentSearchResultIndex]) |
|
|
|
|