feat: 样式组件优化汇总—客户端 https://jira.shanqu.cc/browse/GHZSCY-6866
This commit is contained in:
@ -109,7 +109,9 @@ class CustomHomeGameItemViewHolder(
|
||||
item.linkColumn?.id ?: ""
|
||||
)
|
||||
}
|
||||
binding.gameBrief.text = game.recommendText
|
||||
binding.gameBrief.goneIf(game.recommendText.isEmpty()) {
|
||||
binding.gameBrief.text = game.recommendText
|
||||
}
|
||||
binding.gameImage.visibleIf(game.showImage) {
|
||||
if (game.isWechatMiniGame()) {
|
||||
ImageUtils.display(binding.gameImage, game.banner)
|
||||
|
||||
@ -43,6 +43,8 @@ import com.gh.gamecenter.common.entity.LinkEntity
|
||||
import com.gh.gamecenter.common.eventbus.EBReuse
|
||||
import com.gh.gamecenter.common.exposure.ExposureSource
|
||||
import com.gh.gamecenter.common.json.json
|
||||
import com.gh.gamecenter.common.observer.MuteCallback
|
||||
import com.gh.gamecenter.common.observer.VolumeObserver
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.common.view.TabIndicatorView
|
||||
import com.gh.gamecenter.core.iinterface.IScrollable
|
||||
@ -162,6 +164,20 @@ class SearchToolbarTabWrapperFragment : BaseTabWrapperFragment(), ISearchToolbar
|
||||
private val twoLinesTabToolbarHeight = 48F.dip2px()
|
||||
|
||||
private var autoVideoView: AutomaticVideoView? = null
|
||||
private val volumeObserver by lazy {
|
||||
VolumeObserver(object : MuteCallback {
|
||||
override fun onMute(isMute: Boolean) {
|
||||
if (::binding.isInitialized) {
|
||||
binding.muteIv.setImageResource(if (isMute) R.drawable.ic_basic_offsound else R.drawable.ic_basic_onsound)
|
||||
}
|
||||
if (isMute) {
|
||||
autoVideoView?.mute()
|
||||
} else {
|
||||
autoVideoView?.unMute()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private var searchStyle: BottomTab.SearchStyle? = null
|
||||
set(value) {
|
||||
@ -1033,6 +1049,7 @@ class SearchToolbarTabWrapperFragment : BaseTabWrapperFragment(), ISearchToolbar
|
||||
ImageUtils.display(gameImageIv, imgUrl)
|
||||
}
|
||||
autoVideoView?.onVideoReset()
|
||||
muteIv.isVisible = video != null
|
||||
autoVideoView?.goneIf(video == null) {
|
||||
if (autoVideoView?.isInPlayingState == false) {
|
||||
GSYVideoOptionBuilder()
|
||||
@ -1051,6 +1068,17 @@ class SearchToolbarTabWrapperFragment : BaseTabWrapperFragment(), ISearchToolbar
|
||||
headerContainer.performClick()
|
||||
}
|
||||
}
|
||||
var videoVoiceStatus = SPUtils.getBoolean(Constants.SP_VIDEO_PLAY_MUTE, true)
|
||||
muteIv.setImageResource(if (videoVoiceStatus) R.drawable.ic_basic_offsound else R.drawable.ic_basic_onsound)
|
||||
muteIv.setDebouncedClickListener {
|
||||
videoVoiceStatus = !videoVoiceStatus
|
||||
muteIv.setImageResource(if (videoVoiceStatus) R.drawable.ic_basic_offsound else R.drawable.ic_basic_onsound)
|
||||
if (videoVoiceStatus) {
|
||||
autoVideoView?.mute()
|
||||
} else {
|
||||
autoVideoView?.unMute()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1065,6 +1093,19 @@ class SearchToolbarTabWrapperFragment : BaseTabWrapperFragment(), ISearchToolbar
|
||||
pullDownPushHandler?.doPreProcess(this as? ISmartRefresh, popupPush)
|
||||
}
|
||||
|
||||
private fun observeVolume() {
|
||||
context?.applicationContext?.contentResolver?.registerContentObserver(
|
||||
android.provider.Settings.System.CONTENT_URI,
|
||||
true,
|
||||
volumeObserver
|
||||
)
|
||||
}
|
||||
|
||||
private fun unObserveVolume() {
|
||||
context?.applicationContext?.contentResolver?.unregisterContentObserver(volumeObserver)
|
||||
}
|
||||
|
||||
|
||||
private fun updateRefreshHeaderStyle(force: Boolean = false) {
|
||||
if (lightRefreshHeaderStyle == isDisplayingLightContent && !force) return
|
||||
lightRefreshHeaderStyle = isDisplayingLightContent
|
||||
@ -1109,6 +1150,7 @@ class SearchToolbarTabWrapperFragment : BaseTabWrapperFragment(), ISearchToolbar
|
||||
} else {
|
||||
resumePullDownPushVideo()
|
||||
}
|
||||
observeVolume()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1122,6 +1164,7 @@ class SearchToolbarTabWrapperFragment : BaseTabWrapperFragment(), ISearchToolbar
|
||||
if (!videoUrl.isNullOrEmpty()) {
|
||||
ScrollCalculatorHelper.savePlaySchedule(MD5Utils.getContentMD5(videoUrl), currentPosition)
|
||||
}
|
||||
unObserveVolume()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,6 +41,8 @@ import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
import com.gh.gamecenter.common.eventbus.EBReuse
|
||||
import com.gh.gamecenter.common.exposure.ExposureSource
|
||||
import com.gh.gamecenter.common.json.json
|
||||
import com.gh.gamecenter.common.observer.MuteCallback
|
||||
import com.gh.gamecenter.common.observer.VolumeObserver
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils
|
||||
import com.gh.gamecenter.core.utils.MD5Utils
|
||||
@ -108,6 +110,20 @@ class ToolbarWrapperFragment : LazyFragment(), ToolbarController, ISmartRefresh,
|
||||
private var mLightToolbar = false
|
||||
private var mAutoFinishTwoLevelHandler: Handler? = null
|
||||
private var mAutoFinishTwoLevelCallback: (() -> Unit)? = null
|
||||
private val mVolumeObserver by lazy {
|
||||
VolumeObserver(object : MuteCallback {
|
||||
override fun onMute(isMute: Boolean) {
|
||||
if (::mBinding.isInitialized) {
|
||||
mBinding.muteIv.setImageResource(if (isMute) R.drawable.ic_basic_offsound else R.drawable.ic_basic_onsound)
|
||||
if (isMute) {
|
||||
mBinding.autoVideoView.mute()
|
||||
} else {
|
||||
mBinding.autoVideoView.unMute()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private lateinit var mElapsedHelper: TimeElapsedHelper
|
||||
|
||||
@ -227,6 +243,7 @@ class ToolbarWrapperFragment : LazyFragment(), ToolbarController, ISmartRefresh,
|
||||
gameImageIv.goneIf(video != null) {
|
||||
ImageUtils.display(gameImageIv, imgUrl)
|
||||
}
|
||||
muteIv.isVisible = video != null
|
||||
autoVideoView.goneIf(video == null) {
|
||||
if (!autoVideoView.isInPlayingState) {
|
||||
GSYVideoOptionBuilder()
|
||||
@ -258,6 +275,17 @@ class ToolbarWrapperFragment : LazyFragment(), ToolbarController, ISmartRefresh,
|
||||
headerContainer.performClick()
|
||||
}
|
||||
}
|
||||
var videoVoiceStatus = SPUtils.getBoolean(Constants.SP_VIDEO_PLAY_MUTE, true)
|
||||
muteIv.setImageResource(if (videoVoiceStatus) R.drawable.ic_basic_offsound else R.drawable.ic_basic_onsound)
|
||||
muteIv.setDebouncedClickListener {
|
||||
videoVoiceStatus = !videoVoiceStatus
|
||||
muteIv.setImageResource(if (videoVoiceStatus) R.drawable.ic_basic_offsound else R.drawable.ic_basic_onsound)
|
||||
if (videoVoiceStatus) {
|
||||
autoVideoView.mute()
|
||||
} else {
|
||||
autoVideoView.unMute()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -271,6 +299,18 @@ class ToolbarWrapperFragment : LazyFragment(), ToolbarController, ISmartRefresh,
|
||||
pullDownPushHandler?.doPreProcess(this as? ISmartRefresh, popupPush)
|
||||
}
|
||||
|
||||
private fun observeVolume() {
|
||||
context?.applicationContext?.contentResolver?.registerContentObserver(
|
||||
android.provider.Settings.System.CONTENT_URI,
|
||||
true,
|
||||
mVolumeObserver
|
||||
)
|
||||
}
|
||||
|
||||
private fun unObserveVolume() {
|
||||
context?.applicationContext?.contentResolver?.unregisterContentObserver(mVolumeObserver)
|
||||
}
|
||||
|
||||
override fun onFragmentPause() {
|
||||
super.onFragmentPause()
|
||||
DownloadManager.getInstance().removeObserver(mDataWatcher)
|
||||
@ -739,6 +779,7 @@ class ToolbarWrapperFragment : LazyFragment(), ToolbarController, ISmartRefresh,
|
||||
} else {
|
||||
resumePullDownPushVideo()
|
||||
}
|
||||
observeVolume()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -752,6 +793,7 @@ class ToolbarWrapperFragment : LazyFragment(), ToolbarController, ISmartRefresh,
|
||||
if (videoUrl.isNotEmpty()) {
|
||||
ScrollCalculatorHelper.savePlaySchedule(MD5Utils.getContentMD5(videoUrl), currentPosition)
|
||||
}
|
||||
unObserveVolume()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user