update ui
This commit is contained in:
@@ -80,9 +80,9 @@ abstract class BaseActivity<VB : ViewBinding>(
|
||||
@SuppressLint("ObsoleteSdkInt")
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
window.decorView.disableAutoFill()
|
||||
initTheme()
|
||||
//initTheme()
|
||||
super.onCreate(savedInstanceState)
|
||||
setupSystemBar()
|
||||
//setupSystemBar()
|
||||
setContentView(binding.root)
|
||||
upBackgroundImage()
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
@@ -101,14 +101,14 @@ abstract class BaseActivity<VB : ViewBinding>(
|
||||
super.onMultiWindowModeChanged(isInMultiWindowMode, newConfig)
|
||||
// findViewById<TitleBar>(R.id.title_bar)
|
||||
// ?.onMultiWindowModeChanged(isInMultiWindowMode, fullScreen)
|
||||
setupSystemBar()
|
||||
//setupSystemBar()
|
||||
}
|
||||
|
||||
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||
super.onConfigurationChanged(newConfig)
|
||||
//findViewById<TitleBar>(R.id.title_bar)
|
||||
//?.onMultiWindowModeChanged(isInMultiWindow, fullScreen)
|
||||
setupSystemBar()
|
||||
//setupSystemBar()
|
||||
}
|
||||
|
||||
abstract fun onActivityCreated(savedInstanceState: Bundle?)
|
||||
@@ -174,20 +174,20 @@ abstract class BaseActivity<VB : ViewBinding>(
|
||||
}
|
||||
}
|
||||
|
||||
open fun setupSystemBar() {
|
||||
if (fullScreen && !isInMultiWindow) {
|
||||
fullScreen()
|
||||
}
|
||||
//val isTransparentStatusBar = AppConfig.isTransparentStatusBar
|
||||
//val statusBarColor = ThemeStore.statusBarColor(this, isTransparentStatusBar)
|
||||
//setStatusBarColorAuto(statusBarColor, isTransparentStatusBar, fullScreen)
|
||||
// if (toolBarTheme == Theme.Dark) {
|
||||
// setLightStatusBar(false)
|
||||
// } else if (toolBarTheme == Theme.Light) {
|
||||
// setLightStatusBar(true)
|
||||
// open fun setupSystemBar() {
|
||||
// if (fullScreen && !isInMultiWindow) {
|
||||
// fullScreen()
|
||||
// }
|
||||
upNavigationBarColor()
|
||||
}
|
||||
// //val isTransparentStatusBar = AppConfig.isTransparentStatusBar
|
||||
// //val statusBarColor = ThemeStore.statusBarColor(this, isTransparentStatusBar)
|
||||
// //setStatusBarColorAuto(statusBarColor, isTransparentStatusBar, fullScreen)
|
||||
//// if (toolBarTheme == Theme.Dark) {
|
||||
//// setLightStatusBar(false)
|
||||
//// } else if (toolBarTheme == Theme.Light) {
|
||||
//// setLightStatusBar(true)
|
||||
//// }
|
||||
// upNavigationBarColor()
|
||||
// }
|
||||
|
||||
open fun upNavigationBarColor() {
|
||||
// if (AppConfig.immNavigationBar) {
|
||||
|
||||
@@ -31,27 +31,27 @@ class PreferenceCategory(context: Context, attrs: AttributeSet) :
|
||||
//view.setTextColor(context.accentColor)
|
||||
view.isVisible = !title.isNullOrEmpty()
|
||||
|
||||
val da = holder.findViewById(R.id.preference_divider_above)
|
||||
val dividerColor = if (AppConfig.isNightTheme) {
|
||||
// ColorUtils.withAlpha(
|
||||
// ColorUtils.shiftColor(context.backgroundColor, 1.05f),
|
||||
// 0.5f
|
||||
// )
|
||||
} else {
|
||||
// ColorUtils.withAlpha(
|
||||
// ColorUtils.shiftColor(context.backgroundColor, 0.95f),
|
||||
// 0.5f
|
||||
// )
|
||||
}
|
||||
if (da is View) {
|
||||
//da.setBackgroundColor(dividerColor)
|
||||
da.isVisible = holder.isDividerAllowedAbove
|
||||
}
|
||||
val db = holder.findViewById(R.id.preference_divider_below)
|
||||
if (db is View) {
|
||||
//db.setBackgroundColor(dividerColor)
|
||||
db.isVisible = holder.isDividerAllowedBelow
|
||||
}
|
||||
// val da = holder.findViewById(R.id.preference_divider_above)
|
||||
// val dividerColor = if (AppConfig.isNightTheme) {
|
||||
//// ColorUtils.withAlpha(
|
||||
//// ColorUtils.shiftColor(context.backgroundColor, 1.05f),
|
||||
//// 0.5f
|
||||
//// )
|
||||
// } else {
|
||||
//// ColorUtils.withAlpha(
|
||||
//// ColorUtils.shiftColor(context.backgroundColor, 0.95f),
|
||||
//// 0.5f
|
||||
//// )
|
||||
// }
|
||||
// if (da is View) {
|
||||
// //da.setBackgroundColor(dividerColor)
|
||||
// da.isVisible = holder.isDividerAllowedAbove
|
||||
// }
|
||||
// val db = holder.findViewById(R.id.preference_divider_below)
|
||||
// if (db is View) {
|
||||
// //db.setBackgroundColor(dividerColor)
|
||||
// db.isVisible = holder.isDividerAllowedBelow
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -201,13 +201,13 @@ class SearchActivity : VMBaseActivity<ActivityBookSearchBinding, SearchViewModel
|
||||
return false
|
||||
}
|
||||
})
|
||||
searchView.setOnQueryTextFocusChangeListener { _, hasFocus ->
|
||||
if (binding.refreshProgressBar.isAutoLoading || (!hasFocus && adapter.isNotEmpty() && searchView.query.isNotBlank())) {
|
||||
visibleInputHelp(false)
|
||||
} else {
|
||||
visibleInputHelp(true)
|
||||
}
|
||||
}
|
||||
// searchView.setOnQueryTextFocusChangeListener { _, hasFocus ->
|
||||
// if (binding.refreshProgressBar.isAutoLoading || (!hasFocus && adapter.isNotEmpty() && searchView.query.isNotBlank())) {
|
||||
// visibleInputHelp(false)
|
||||
// } else {
|
||||
// visibleInputHelp(true)
|
||||
// }
|
||||
// }
|
||||
visibleInputHelp(true)
|
||||
}
|
||||
|
||||
@@ -264,16 +264,16 @@ class SearchActivity : VMBaseActivity<ActivityBookSearchBinding, SearchViewModel
|
||||
}
|
||||
|
||||
private fun initOtherView() {
|
||||
binding.fbStartStop.backgroundTintList =
|
||||
Selector.colorBuild()
|
||||
// binding.fbStartStop.backgroundTintList =
|
||||
// Selector.colorBuild()
|
||||
// .setDefaultColor(accentColor)
|
||||
// .setPressedColor(ColorUtils.darkenColor(accentColor))
|
||||
.create()
|
||||
// .create()
|
||||
binding.fbStartStop.setOnClickListener {
|
||||
if (viewModel.isSearchLiveData.value == true) {
|
||||
isManualStopSearch = true
|
||||
viewModel.stop()
|
||||
binding.refreshProgressBar.isAutoLoading = false
|
||||
//binding.refreshProgressBar.visibility = GONE
|
||||
} else {
|
||||
viewModel.search("")
|
||||
}
|
||||
@@ -395,7 +395,7 @@ class SearchActivity : VMBaseActivity<ActivityBookSearchBinding, SearchViewModel
|
||||
*/
|
||||
private fun startSearch() {
|
||||
binding.refreshProgressBar.visible()
|
||||
binding.refreshProgressBar.isAutoLoading = true
|
||||
//binding.refreshProgressBar.isAutoLoading = true
|
||||
binding.fbStartStop.setImageResource(R.drawable.ic_stop_black_24dp)
|
||||
binding.fbStartStop.visible()
|
||||
}
|
||||
@@ -404,7 +404,7 @@ class SearchActivity : VMBaseActivity<ActivityBookSearchBinding, SearchViewModel
|
||||
* 搜索结束
|
||||
*/
|
||||
private fun searchFinally() {
|
||||
binding.refreshProgressBar.isAutoLoading = false
|
||||
//binding.refreshProgressBar.isAutoLoading = false
|
||||
binding.refreshProgressBar.gone()
|
||||
if (!isManualStopSearch && viewModel.hasMore) {
|
||||
binding.fbStartStop.setImageResource(R.drawable.ic_play_24dp)
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.view.ViewGroup
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import io.legado.app.R
|
||||
import io.legado.app.base.BaseBottomSheetDialogFragment
|
||||
import io.legado.app.base.BaseDialogFragment
|
||||
import io.legado.app.base.adapter.ItemViewHolder
|
||||
import io.legado.app.base.adapter.RecyclerAdapter
|
||||
@@ -20,7 +21,7 @@ import io.legado.app.ui.widget.recycler.VerticalDivider
|
||||
import io.legado.app.utils.*
|
||||
import io.legado.app.utils.viewbindingdelegate.viewBinding
|
||||
|
||||
class ThemeListDialog : BaseDialogFragment(R.layout.dialog_recycler_view),
|
||||
class ThemeListDialog : BaseBottomSheetDialogFragment(R.layout.dialog_recycler_view),
|
||||
Toolbar.OnMenuItemClickListener {
|
||||
|
||||
private val binding by viewBinding(DialogRecyclerViewBinding::bind)
|
||||
|
||||
@@ -56,9 +56,8 @@ class ExploreAdapter(context: Context, val callBack: CallBack) :
|
||||
}
|
||||
|
||||
if (exIndex == holder.layoutPosition) {
|
||||
// 使用 MaterialButton 的 icon 属性和旋转动画
|
||||
ivStatus.icon = ContextCompat.getDrawable(context, R.drawable.ic_arrow_right)
|
||||
ivStatus.rotation = 90f // 直接设置90度旋转(向下箭头效果)
|
||||
ivStatus.rotation = 90f
|
||||
|
||||
if (scrollTo >= 0) {
|
||||
callBack.scrollTo(scrollTo)
|
||||
@@ -77,7 +76,7 @@ class ExploreAdapter(context: Context, val callBack: CallBack) :
|
||||
}
|
||||
} else {
|
||||
ivStatus.icon = ContextCompat.getDrawable(context, R.drawable.ic_arrow_right)
|
||||
ivStatus.rotation = 0f // 重置为0度(向右箭头)
|
||||
ivStatus.rotation = 0f
|
||||
recyclerFlexbox(flexbox)
|
||||
flexbox.gone()
|
||||
}
|
||||
|
||||
@@ -63,28 +63,21 @@ class ExploreFragment() : VMBaseFragment<ExploreViewModel>(R.layout.fragment_exp
|
||||
private val binding by viewBinding(FragmentExploreBinding::bind)
|
||||
private val adapter by lazy { ExploreAdapter(requireContext(), this) }
|
||||
private val linearLayoutManager by lazy { LinearLayoutManager(context) }
|
||||
private val searchView: SearchView by lazy {
|
||||
binding.titleBar.findViewById(R.id.search_view)
|
||||
}
|
||||
private val searchView: SearchView by lazy { binding.searchLayout.searchView }
|
||||
private val diffItemCallBack = ExploreDiffItemCallBack()
|
||||
private val groups = linkedSetOf<String>()
|
||||
private var exploreFlowJob: Job? = null
|
||||
private var groupsMenu: SubMenu? = null
|
||||
|
||||
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
|
||||
setSupportToolbar(binding.titleBar.toolbar)
|
||||
setSupportToolbar(binding.topBar)
|
||||
initSearchView()
|
||||
initRecyclerView()
|
||||
initGroupData()
|
||||
upExploreData()
|
||||
}
|
||||
|
||||
override fun onCompatCreateOptionsMenu(menu: Menu) {
|
||||
super.onCompatCreateOptionsMenu(menu)
|
||||
menuInflater.inflate(R.menu.main_explore, menu)
|
||||
groupsMenu = menu.findItem(R.id.menu_group)?.subMenu
|
||||
upGroupsMenu()
|
||||
}
|
||||
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
|
||||
@@ -53,7 +53,7 @@ class MyFragment() : BaseFragment(R.layout.fragment_my_config), MainFragmentInte
|
||||
private val binding by viewBinding(FragmentMyConfigBinding::bind)
|
||||
|
||||
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
|
||||
setSupportToolbar(binding.titleBar.toolbar)
|
||||
setSupportToolbar(binding.topBar)
|
||||
val fragmentTag = "prefFragment"
|
||||
var preferenceFragment = childFragmentManager.findFragmentByTag(fragmentTag)
|
||||
if (preferenceFragment == null) preferenceFragment = MyPreferenceFragment()
|
||||
|
||||
@@ -62,16 +62,14 @@ class RssFragment() : VMBaseFragment<RssViewModel>(R.layout.fragment_rss),
|
||||
private val adapter by lazy {
|
||||
RssAdapter(requireContext(), this, this, viewLifecycleOwner.lifecycle)
|
||||
}
|
||||
private val searchView: SearchView by lazy {
|
||||
binding.titleBar.findViewById(R.id.search_view)
|
||||
}
|
||||
private val searchView: SearchView by lazy { binding.searchLayout.searchView }
|
||||
private var groupsFlowJob: Job? = null
|
||||
private var rssFlowJob: Job? = null
|
||||
private val groups = linkedSetOf<String>()
|
||||
private var groupsMenu: SubMenu? = null
|
||||
|
||||
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
|
||||
setSupportToolbar(binding.titleBar.toolbar)
|
||||
setSupportToolbar(binding.topBar)
|
||||
initSearchView()
|
||||
initRecyclerView()
|
||||
initGroupData()
|
||||
|
||||
@@ -31,11 +31,11 @@ open class WelcomeActivity : BaseActivity<ActivityWelcomeBinding>() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun setupSystemBar() {
|
||||
fullScreen()
|
||||
//setStatusBarColorAuto(backgroundColor, true, fullScreen)
|
||||
upNavigationBarColor()
|
||||
}
|
||||
// override fun setupSystemBar() {
|
||||
// fullScreen()
|
||||
// //setStatusBarColorAuto(backgroundColor, true, fullScreen)
|
||||
// upNavigationBarColor()
|
||||
// }
|
||||
|
||||
override fun upBackgroundImage() {
|
||||
if (getPrefBoolean(PreferKey.customWelcome)) {
|
||||
|
||||
@@ -38,10 +38,10 @@ class SearchView @JvmOverloads constructor(
|
||||
try {
|
||||
if (textView == null) {
|
||||
textView = findViewById(androidx.appcompat.R.id.search_src_text)
|
||||
mSearchHintIcon = this.context.getDrawable(R.drawable.ic_search_hint)
|
||||
//mSearchHintIcon = this.context.getDrawable(R.drawable.ic_search_hint)
|
||||
}
|
||||
// 改变字体
|
||||
textView!!.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14f)
|
||||
//textView!!.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14f)
|
||||
textView!!.gravity = Gravity.CENTER_VERTICAL
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
|
||||
textView!!.isLocalePreferredLineHeightForMinimumUsed = false
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.util.AttributeSet
|
||||
import android.util.TypedValue
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@@ -288,7 +289,6 @@ class FastScroller : LinearLayout {
|
||||
visibility = if (enabled) View.VISIBLE else View.INVISIBLE
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
override fun onTouchEvent(event: MotionEvent): Boolean {
|
||||
when (event.action) {
|
||||
@@ -413,7 +413,7 @@ class FastScroller : LinearLayout {
|
||||
}
|
||||
|
||||
private fun isViewVisible(view: View?): Boolean {
|
||||
return view != null && view.visibility == View.VISIBLE
|
||||
return view != null && view.isVisible
|
||||
}
|
||||
|
||||
private fun cancelAnimation(animator: ViewPropertyAnimator?) {
|
||||
@@ -492,7 +492,7 @@ class FastScroller : LinearLayout {
|
||||
|
||||
private fun setHandleSelected(selected: Boolean) {
|
||||
mHandleView.isSelected = selected
|
||||
DrawableCompat.setTint(mHandleImage!!, if (selected) mBubbleColor else mHandleColor)
|
||||
DrawableCompat.setTint(mHandleImage!!, if (selected) mHandleColor else mHandleColor)
|
||||
}
|
||||
|
||||
private fun layout(context: Context, attrs: AttributeSet?) {
|
||||
@@ -503,21 +503,24 @@ class FastScroller : LinearLayout {
|
||||
mHandleView = findViewById(R.id.fastscroll_handle)
|
||||
mTrackView = findViewById(R.id.fastscroll_track)
|
||||
mScrollbar = findViewById(R.id.fastscroll_scrollbar)
|
||||
// @ColorInt var bubbleColor = ColorUtils.adjustAlpha(context.accentColor, 0.8f)
|
||||
// @ColorInt var handleColor = context.accentColor
|
||||
@ColorInt var trackColor = context.getCompatColor(R.color.transparent30)
|
||||
// @ColorInt var textColor =
|
||||
// if (ColorUtils.isColorLight(bubbleColor)) Color.BLACK else Color.WHITE
|
||||
mHandleImage = mHandleView.drawable?.mutate()
|
||||
val typedValue = TypedValue()
|
||||
context.theme.resolveAttribute(com.google.android.material.R.attr.colorPrimary, typedValue, true)
|
||||
val defaultColor = typedValue.data
|
||||
var bubbleColor = defaultColor
|
||||
var handleColor = defaultColor
|
||||
var trackColor = defaultColor
|
||||
var textColor = defaultColor
|
||||
var fadeScrollbar = true
|
||||
var showBubble = false
|
||||
var showTrack = true
|
||||
if (attrs != null) {
|
||||
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.FastScroller, 0, 0)
|
||||
try {
|
||||
// bubbleColor = typedArray.getColor(R.styleable.FastScroller_bubbleColor, bubbleColor)
|
||||
// handleColor = typedArray.getColor(R.styleable.FastScroller_handleColor, handleColor)
|
||||
bubbleColor = typedArray.getColor(R.styleable.FastScroller_bubbleColor, bubbleColor)
|
||||
handleColor = typedArray.getColor(R.styleable.FastScroller_handleColor, handleColor)
|
||||
trackColor = typedArray.getColor(R.styleable.FastScroller_trackColor, trackColor)
|
||||
// textColor = typedArray.getColor(R.styleable.FastScroller_bubbleTextColor, textColor)
|
||||
textColor = typedArray.getColor(R.styleable.FastScroller_bubbleTextColor, textColor)
|
||||
fadeScrollbar =
|
||||
typedArray.getBoolean(R.styleable.FastScroller_fadeScrollbar, fadeScrollbar)
|
||||
showBubble = typedArray.getBoolean(R.styleable.FastScroller_showBubble, showBubble)
|
||||
@@ -527,9 +530,9 @@ class FastScroller : LinearLayout {
|
||||
}
|
||||
}
|
||||
setTrackColor(trackColor)
|
||||
// setHandleColor(handleColor)
|
||||
// setBubbleColor(bubbleColor)
|
||||
// setBubbleTextColor(textColor)
|
||||
setHandleColor(handleColor)
|
||||
setBubbleColor(bubbleColor)
|
||||
setBubbleTextColor(textColor)
|
||||
setFadeScrollbar(fadeScrollbar)
|
||||
setBubbleVisible(showBubble)
|
||||
setTrackVisible(showTrack)
|
||||
|
||||
Reference in New Issue
Block a user