Merge branch 'dev-5.0.0' of git.ghzs.com:halo/android/assistant-android into dev-5.0.0
This commit is contained in:
@ -191,7 +191,6 @@ class SimulatorDownloadManager private constructor() {
|
||||
|
||||
private fun download(context: Context, simulator: SimulatorEntity?) {
|
||||
val apkEntity = simulator?.apk ?: return
|
||||
DownloadManager.getInstance(context).pauseAll()
|
||||
|
||||
val entity = DownloadManager.getInstance(context).getDownloadEntityByUrl(apkEntity.url)
|
||||
HaloApp.put(simulator.name, simulator)
|
||||
|
||||
@ -108,7 +108,11 @@ object PackageInstaller {
|
||||
@JvmStatic
|
||||
fun getInstallIntent(context: Context, path: String): Intent {
|
||||
var uri = Uri.fromFile(File(path))
|
||||
val installIntent = Intent(Intent.ACTION_VIEW)
|
||||
val installIntent = if (BrowserInstallHelper.isUseBrowserToInstallEnabledWithPackageMatched()) {
|
||||
Intent(Intent.ACTION_INSTALL_PACKAGE)
|
||||
} else {
|
||||
Intent(Intent.ACTION_VIEW)
|
||||
}
|
||||
if ("smartisan" == Build.MANUFACTURER) {
|
||||
installIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.gh.common.xapk
|
||||
|
||||
import android.os.Build
|
||||
import android.os.Environment
|
||||
import com.gh.common.util.debounceActionWithInterval
|
||||
import com.gh.common.util.getExtension
|
||||
@ -207,8 +208,15 @@ class XapkUnzipThread(private var mDownloadEntity: DownloadEntity,
|
||||
|
||||
private fun getUnzipSize(path: String): Long {
|
||||
var totalSize = 0L
|
||||
ZipFile(File(path)).use {
|
||||
for (entry in it.entries()) {
|
||||
// 这里安卓5.0以下使用use会报错闪退
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
ZipFile(File(path)).use {
|
||||
for (entry in it.entries()) {
|
||||
totalSize += entry.size
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (entry in ZipFile(File(path)).entries()) {
|
||||
totalSize += entry.size
|
||||
}
|
||||
}
|
||||
|
||||
@ -166,6 +166,28 @@ object BrowserInstallHelper {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 浏览器安装的后台开关 (返回仅包名匹配时的状态)
|
||||
*/
|
||||
@JvmStatic
|
||||
fun isUseBrowserToInstallEnabledWithPackageMatched(): Boolean {
|
||||
val settingsEntity = Config.getNewSettingsEntity()
|
||||
|
||||
if (settingsEntity == null) {
|
||||
return false
|
||||
} else {
|
||||
settingsEntity.installModel.packages?.let {
|
||||
for (packageName in it) {
|
||||
if (mAllInstalledPackageList.contains(packageName)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
fun onApkInstalled(path: String?) {
|
||||
path?.let {
|
||||
val fileName = path.substringAfterLast(File.separator).removeSuffix(DownloadServer.APK_SUFFIX)
|
||||
|
||||
@ -321,7 +321,11 @@ public class LibaoDetailActivity extends ToolBarActivity implements LibaoDetailA
|
||||
CheckLoginUtils.checkLogin(this, mEntrance, () ->
|
||||
mLibaoDetailRv.postDelayed(() -> {
|
||||
if (mAdapter.libaoDetailTopViewHolder != null) {
|
||||
mAdapter.libaoDetailTopViewHolder.libaoCopyBtn.performClick();
|
||||
try {
|
||||
mAdapter.libaoDetailTopViewHolder.libaoCopyBtn.performClick();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}, 200)
|
||||
);
|
||||
|
||||
@ -58,7 +58,7 @@ class CategoryV2ListFragment : ListFragment<GameEntity, CategoryV2ListViewModel>
|
||||
override fun provideListAdapter() = mAdapter
|
||||
?: CategoryV2ListAdapter(
|
||||
requireContext(),
|
||||
mListViewModel,
|
||||
mListViewModel ?: provideListViewModel(),
|
||||
mCategoryViewModel ?: viewModelProviderFromParent(CategoryV2ViewModel.Factory(mCategoryId, mCategoryTitle), mCategoryId),
|
||||
mEntrance).apply { mAdapter = this }
|
||||
|
||||
@ -80,7 +80,7 @@ class CategoryV2ListFragment : ListFragment<GameEntity, CategoryV2ListViewModel>
|
||||
|
||||
initFilterView()
|
||||
|
||||
mListViewModel.refresh.observeNonNull(viewLifecycleOwner) { onRefresh() }
|
||||
mListViewModel?.refresh?.observeNonNull(viewLifecycleOwner) { onRefresh() }
|
||||
mCategoryViewModel?.run {
|
||||
categoryPositionLiveData.observeNonNull(viewLifecycleOwner) {
|
||||
directories[it.first].data?.get(it.second)?.run {
|
||||
@ -122,11 +122,11 @@ class CategoryV2ListFragment : ListFragment<GameEntity, CategoryV2ListViewModel>
|
||||
|
||||
setOnConfigSetupListener(object : CategoryFilterView.OnCategoryFilterSetupListener {
|
||||
override fun onSetupSortSize(sortSize: SubjectSettingEntity.Size) {
|
||||
mListViewModel.updateSortConfig(sortSize = sortSize)
|
||||
mListViewModel?.updateSortConfig(sortSize = sortSize)
|
||||
}
|
||||
|
||||
override fun onSetupSortType(sortType: CategoryFilterView.SortType) {
|
||||
mListViewModel.updateSortConfig(sortType = sortType)
|
||||
mListViewModel?.updateSortConfig(sortType = sortType)
|
||||
}
|
||||
|
||||
override fun onSetupSortCategory() {
|
||||
@ -162,7 +162,7 @@ class CategoryV2ListFragment : ListFragment<GameEntity, CategoryV2ListViewModel>
|
||||
visibility = View.GONE
|
||||
}
|
||||
if (categoryId != null) mSubCategoryId = categoryId
|
||||
mListViewModel.updateSortConfig(categoryIds = mSubCategoryId)
|
||||
mListViewModel?.updateSortConfig(categoryIds = mSubCategoryId)
|
||||
}
|
||||
|
||||
private fun addCategory(entity: CategoryEntity) {
|
||||
@ -179,7 +179,7 @@ class CategoryV2ListFragment : ListFragment<GameEntity, CategoryV2ListViewModel>
|
||||
remove(entity)
|
||||
if (size == 0) {
|
||||
mBinding?.selectedCategoryContainer?.visibility = View.GONE
|
||||
mListViewModel.updateSortConfig(categoryIds = mSubCategoryId)
|
||||
mListViewModel?.updateSortConfig(categoryIds = mSubCategoryId)
|
||||
} else {
|
||||
updateCategoryGame()
|
||||
}
|
||||
@ -211,8 +211,11 @@ class CategoryV2ListFragment : ListFragment<GameEntity, CategoryV2ListViewModel>
|
||||
i = index
|
||||
}
|
||||
}
|
||||
mBinding?.selectedCategoryContainer?.removeView(mSelectedViewList[i])
|
||||
mSelectedViewList.removeAt(i)
|
||||
|
||||
if (i < mSelectedViewList.size) {
|
||||
mBinding?.selectedCategoryContainer?.removeView(mSelectedViewList[i])
|
||||
mSelectedViewList.removeAt(i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -238,7 +241,7 @@ class CategoryV2ListFragment : ListFragment<GameEntity, CategoryV2ListViewModel>
|
||||
categoryIds.append("-")
|
||||
}
|
||||
}
|
||||
mListViewModel.updateSortConfig(categoryIds = categoryIds.toString())
|
||||
mListViewModel?.updateSortConfig(categoryIds = categoryIds.toString())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -19,7 +19,8 @@ import com.shuyu.gsyvideoplayer.video.base.GSYBaseVideoPlayer
|
||||
|
||||
class ForumScrollCalculatorHelper(private val horizontalId: Int,
|
||||
private val verticalId: Int,
|
||||
private val rangeTop: Int) {
|
||||
private val rangeTop: Int,
|
||||
private val isUserHomePage: Boolean = false) {
|
||||
private var firstVisible = -1
|
||||
private var lastVisible = 0
|
||||
private var visibleCount = 0
|
||||
@ -46,6 +47,23 @@ class ForumScrollCalculatorHelper(private val horizontalId: Int,
|
||||
releaseIfNeeded()
|
||||
}
|
||||
|
||||
fun reset() {
|
||||
firstVisible = -1
|
||||
lastVisible = 0
|
||||
visibleCount = 0
|
||||
if (runnable != null) {
|
||||
playHandler.removeCallbacks(runnable!!)
|
||||
}
|
||||
runnable = null
|
||||
mItemData = null
|
||||
if (currentPlayer != null) {
|
||||
CustomManager.releaseAllVideos(currentPlayer?.getKey())
|
||||
}
|
||||
currentPlayer = null
|
||||
currentPosition = -1
|
||||
mListRv = null
|
||||
}
|
||||
|
||||
//判断player是否划出了屏幕,划出了屏幕则需要释放
|
||||
private fun releaseIfNeeded() {
|
||||
val rect = Rect()
|
||||
@ -101,13 +119,16 @@ class ForumScrollCalculatorHelper(private val horizontalId: Int,
|
||||
gsyBaseVideoPlayer.getLocationInWindow(screenPosition)
|
||||
val rangePosition = screenPosition[1]
|
||||
if (rangePosition >= rangeTop) {
|
||||
runnable = PlayRunnable(gsyBaseVideoPlayer)
|
||||
if (currentPlayer != null) {
|
||||
CustomManager.releaseAllVideos(currentPlayer?.getKey())
|
||||
// currentPlayer?.resetDetailMask()
|
||||
}
|
||||
currentPlayer = gsyBaseVideoPlayer
|
||||
currentPosition = i
|
||||
|
||||
if (isUserHomePage) break
|
||||
|
||||
runnable = PlayRunnable(gsyBaseVideoPlayer)
|
||||
//降低频率
|
||||
playHandler.postDelayed(runnable!!, 100)
|
||||
break
|
||||
|
||||
@ -63,11 +63,12 @@ class HomeSearchToolWrapperFragment : SearchToolWrapperFragment() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
mViewModel = viewModelProviderFromParent()
|
||||
savedInstanceState?.let { mDefaultSelectedTab = it.getInt(LAST_SELECTED_POSITION) }
|
||||
}
|
||||
|
||||
override fun onFragmentFirstVisible() {
|
||||
mViewModel = viewModelProviderFromParent()
|
||||
|
||||
mSearchToolbarFragment = childFragmentManager.findFragmentById(R.id.wrapper_toolbar) as SearchToolbarFragment?
|
||||
?: SearchToolbarFragment()
|
||||
setSearchHints()
|
||||
@ -84,7 +85,6 @@ class HomeSearchToolWrapperFragment : SearchToolWrapperFragment() {
|
||||
|
||||
updateAppBarStyle(Color.WHITE, false)
|
||||
|
||||
mViewModel?.getTabs()
|
||||
mViewModel?.tabs?.observe(viewLifecycleOwner, Observer {
|
||||
if (mDefaultSelectedTab == -1) {
|
||||
mDefaultSelectedTab = mViewModel?.defaultTabPosition ?: 0
|
||||
@ -174,8 +174,8 @@ class HomeSearchToolWrapperFragment : SearchToolWrapperFragment() {
|
||||
},
|
||||
onPageScrolled = { position, positionOffset, _ ->
|
||||
if (position + 1 != mTabTitleList.size) {
|
||||
val currentAppBarColor = tabList[position].primaryColor
|
||||
val incomingAppBarColor = tabList[position + 1].primaryColor
|
||||
val currentAppBarColor = tabList.safelyGetInRelease(position)?.primaryColor ?: Color.WHITE
|
||||
val incomingAppBarColor = tabList.safelyGetInRelease(position + 1)?.primaryColor ?: Color.WHITE
|
||||
|
||||
val proximatelySelectedPosition = if (positionOffset < 0.5) position else position + 1
|
||||
|
||||
@ -186,8 +186,8 @@ class HomeSearchToolWrapperFragment : SearchToolWrapperFragment() {
|
||||
}
|
||||
|
||||
// 颜色显示是否变更
|
||||
val isContentStyleChanged = tabList[proximatelySelectedPosition].useLightStyle != mIsDisplayingLightContent
|
||||
mIsDisplayingLightContent = tabList[proximatelySelectedPosition].useLightStyle
|
||||
val isContentStyleChanged = tabList.safelyGetInRelease(proximatelySelectedPosition)?.useLightStyle != mIsDisplayingLightContent
|
||||
mIsDisplayingLightContent = tabList.safelyGetInRelease(proximatelySelectedPosition)?.useLightStyle ?: false
|
||||
|
||||
mTabSelectedColor = if (mIsDisplayingLightContent) TAB_DEFAULT_COLOR_LIGHT else TAB_SELECTED_COLOR
|
||||
mTabDefaultColor = if (mIsDisplayingLightContent) TAB_DEFAULT_COLOR_LIGHT else TAB_DEFAULT_COLOR
|
||||
|
||||
@ -24,6 +24,10 @@ class HomeSearchToolWrapperViewModel(application: Application) : AndroidViewMode
|
||||
|
||||
var appBarOffset = 0
|
||||
|
||||
init {
|
||||
getTabs()
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
fun getTabs() {
|
||||
RetrofitManager.getInstance(getApplication()).api
|
||||
|
||||
@ -370,7 +370,6 @@ class GameDetailFragment : NormalFragment() {
|
||||
args.getString(EntranceUtils.KEY_GAMEID),
|
||||
args.getParcelable(GameEntity.TAG))
|
||||
mViewModel = viewModelProviderFromParent(factory)
|
||||
mViewModel.loadData()
|
||||
mPackageViewModel = viewModelProvider(PackageViewModel.Factory())
|
||||
mUserViewModel = viewModelProvider(UserViewModel.Factory(HaloApp.getInstance().application))
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@ import androidx.lifecycle.ViewModelProvider
|
||||
import com.gh.common.constant.Constants
|
||||
import com.gh.common.filter.RegionSettingHelper
|
||||
import com.gh.common.history.HistoryHelper
|
||||
import com.gh.common.runOnUiThread
|
||||
import com.gh.common.util.*
|
||||
import com.gh.gamecenter.entity.*
|
||||
import com.gh.gamecenter.gamedetail.entity.BigEvent
|
||||
@ -30,12 +31,17 @@ import io.reactivex.schedulers.Schedulers
|
||||
import retrofit2.HttpException
|
||||
import tv.danmaku.ijk.media.exo2.ExoSourceManager
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
class GameDetailViewModel(application: Application,
|
||||
var gameId: String?,
|
||||
var game: GameEntity?) : AndroidViewModel(application) {
|
||||
|
||||
init {
|
||||
runOnUiThread {
|
||||
loadData()
|
||||
}
|
||||
}
|
||||
|
||||
private val mApi = RetrofitManager.getInstance(getApplication()).api
|
||||
private val mSensitiveApi = RetrofitManager.getInstance(application).sensitiveApi
|
||||
|
||||
|
||||
@ -6,6 +6,9 @@ import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.gh.common.AppExecutor
|
||||
import com.gh.common.constant.Constants
|
||||
import com.gh.common.util.*
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.baselist.ListAdapter
|
||||
@ -15,6 +18,7 @@ import com.gh.gamecenter.entity.ForumVideoEntity
|
||||
import com.gh.gamecenter.entity.PersonalEntity
|
||||
import com.gh.gamecenter.entity.PersonalHistoryEntity
|
||||
import com.gh.gamecenter.entity.RatingComment
|
||||
import com.gh.gamecenter.forum.home.ForumScrollCalculatorHelper
|
||||
import com.gh.gamecenter.gamedetail.rating.RatingReplyActivity
|
||||
import com.gh.gamecenter.qa.answer.detail.AnswerDetailActivity
|
||||
import com.gh.gamecenter.qa.answer.detail.SimpleAnswerDetailActivity
|
||||
@ -33,9 +37,10 @@ class UserHistoryFragment : ListFragment<PersonalHistoryEntity, UserHistoryViewM
|
||||
private var mScene: UserHistoryViewModel.SCENE = UserHistoryViewModel.SCENE.COMMENT
|
||||
|
||||
private var mAdapter: UserHistoryAdapter? = null
|
||||
private lateinit var mViewModel: UserHistoryViewModel
|
||||
private var mViewModel: UserHistoryViewModel? = null
|
||||
private var mBinding: FragmentUserPublishBinding? = null
|
||||
private var mCurrentIndex = 0
|
||||
private var mScrollCalculatorHelper: ForumScrollCalculatorHelper? = null
|
||||
|
||||
override fun getLayoutId() = 0
|
||||
|
||||
@ -48,11 +53,84 @@ class UserHistoryFragment : ListFragment<PersonalHistoryEntity, UserHistoryViewM
|
||||
mCount = getParcelable(COUNT) ?: PersonalEntity.Count()
|
||||
}
|
||||
super.onCreate(savedInstanceState)
|
||||
mScrollCalculatorHelper = ForumScrollCalculatorHelper(R.id.horizontalVideoView, R.id.verticalVideoView, 0, true)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
initTypeView()
|
||||
|
||||
mListRv?.addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
||||
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
|
||||
super.onScrollStateChanged(recyclerView, newState)
|
||||
mScrollCalculatorHelper?.onScrollStateChanged(mListRv, newState)
|
||||
}
|
||||
|
||||
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
||||
scroll()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
resumeVideo()
|
||||
super.onResume()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
pauseVideo()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
mScrollCalculatorHelper?.currentPlayer?.release()
|
||||
}
|
||||
|
||||
private fun scroll() {
|
||||
val firstVisibleItem = mLayoutManager.findFirstVisibleItemPosition()
|
||||
val lastVisibleItem = mLayoutManager.findLastVisibleItemPosition()
|
||||
mScrollCalculatorHelper?.onScroll(mViewModel?.videoList, firstVisibleItem, lastVisibleItem)
|
||||
}
|
||||
|
||||
private fun resumeVideo() {
|
||||
mScrollCalculatorHelper?.run {
|
||||
if (currentPlayer != null) {
|
||||
val video = mViewModel?.videoList?.safelyGetInRelease(currentPosition)
|
||||
if (video != null) {
|
||||
val position = ForumScrollCalculatorHelper.getPlaySchedule(MD5Utils.getContentMD5(video.url))
|
||||
//这里必须要延迟操作,否则会白屏
|
||||
mBaseHandler.postDelayed({
|
||||
if (position != 0L) {
|
||||
currentPlayer?.seekTo(position)
|
||||
currentPlayer?.onVideoResume(false)
|
||||
val videoVoiceStatus = SPUtils.getBoolean(Constants.SP_VIDEO_PLAY_MUTE, true)
|
||||
if (videoVoiceStatus) {
|
||||
currentPlayer?.mute()
|
||||
} else {
|
||||
currentPlayer?.unMute()
|
||||
}
|
||||
} else {
|
||||
currentPlayer?.release()
|
||||
}
|
||||
|
||||
}, 50)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun pauseVideo() {
|
||||
mScrollCalculatorHelper?.run {
|
||||
if (currentPosition >= 0) {
|
||||
currentPlayer?.onVideoPause()
|
||||
val position = currentPlayer?.getCurrentPosition() ?: 0L
|
||||
val video = mViewModel?.videoList?.safelyGetInRelease(currentPosition)
|
||||
if (video != null) {
|
||||
ForumScrollCalculatorHelper.savePlaySchedule(MD5Utils.getContentMD5(video.url), position)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun initTypeView() {
|
||||
@ -67,35 +145,35 @@ class UserHistoryFragment : ListFragment<PersonalHistoryEntity, UserHistoryViewM
|
||||
if (mCurrentIndex == 0) return@setOnClickListener
|
||||
mCurrentIndex = 0
|
||||
updateTypeView(0)
|
||||
mViewModel.changeType(UserHistoryViewModel.TYPE.ALL)
|
||||
changeType(UserHistoryViewModel.TYPE.ALL)
|
||||
}
|
||||
|
||||
videoType.setOnClickListener {
|
||||
if (mCurrentIndex == 1) return@setOnClickListener
|
||||
mCurrentIndex = 1
|
||||
updateTypeView(1)
|
||||
mViewModel.changeType(UserHistoryViewModel.TYPE.VIDEO)
|
||||
changeType(UserHistoryViewModel.TYPE.VIDEO)
|
||||
}
|
||||
|
||||
articleType.setOnClickListener {
|
||||
if (mCurrentIndex == 2) return@setOnClickListener
|
||||
mCurrentIndex = 2
|
||||
updateTypeView(2)
|
||||
mViewModel.changeType(UserHistoryViewModel.TYPE.COMMUNITY_ARTICLE)
|
||||
changeType(UserHistoryViewModel.TYPE.COMMUNITY_ARTICLE)
|
||||
}
|
||||
|
||||
questionType.setOnClickListener {
|
||||
if (mCurrentIndex == 3) return@setOnClickListener
|
||||
mCurrentIndex = 3
|
||||
updateTypeView(3)
|
||||
mViewModel.changeType(UserHistoryViewModel.TYPE.QUESTION)
|
||||
changeType(UserHistoryViewModel.TYPE.QUESTION)
|
||||
}
|
||||
|
||||
answerType.setOnClickListener {
|
||||
if (mCurrentIndex == 4) return@setOnClickListener
|
||||
mCurrentIndex = 4
|
||||
updateTypeView(4)
|
||||
mViewModel.changeType(UserHistoryViewModel.TYPE.ANSWER)
|
||||
changeType(UserHistoryViewModel.TYPE.ANSWER)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -120,10 +198,16 @@ class UserHistoryFragment : ListFragment<PersonalHistoryEntity, UserHistoryViewM
|
||||
}
|
||||
}
|
||||
|
||||
private fun changeType(type: UserHistoryViewModel.TYPE) {
|
||||
mScrollCalculatorHelper?.currentPlayer?.release()
|
||||
mScrollCalculatorHelper?.reset()
|
||||
mViewModel?.changeType(type)
|
||||
}
|
||||
|
||||
override fun provideListViewModel(): UserHistoryViewModel {
|
||||
mViewModel = viewModelProvider(UserHistoryViewModel.Factory(HaloApp.getInstance().application, mUserId, mScene))
|
||||
|
||||
return mViewModel
|
||||
return mViewModel!!
|
||||
}
|
||||
|
||||
override fun provideListAdapter(): ListAdapter<*> {
|
||||
@ -155,13 +239,23 @@ class UserHistoryFragment : ListFragment<PersonalHistoryEntity, UserHistoryViewM
|
||||
|
||||
override fun getItemDecoration() = null
|
||||
|
||||
override fun onLoadDone() {
|
||||
super.onLoadDone()
|
||||
AppExecutor.uiExecutor.executeWithDelay(Runnable {
|
||||
tryCatchInRelease {
|
||||
scroll()
|
||||
mScrollCalculatorHelper?.onScrollStateChanged(mListRv, RecyclerView.SCROLL_STATE_IDLE)
|
||||
}
|
||||
}, 100)
|
||||
}
|
||||
|
||||
override fun onLoadEmpty() {
|
||||
super.onLoadEmpty()
|
||||
|
||||
// RecyclerView 被隐藏的话会导致不能 AppBar 不能滑动
|
||||
mListRv.visibility = View.VISIBLE
|
||||
|
||||
when (mViewModel.type) {
|
||||
when (mViewModel?.type) {
|
||||
UserHistoryViewModel.TYPE.ALL -> mBinding?.typeScrollView?.visibility = View.GONE
|
||||
else -> {
|
||||
mBinding?.typeScrollView?.visibility = View.VISIBLE
|
||||
@ -175,7 +269,6 @@ class UserHistoryFragment : ListFragment<PersonalHistoryEntity, UserHistoryViewM
|
||||
mListRv.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
if (data != null && resultCode == Activity.RESULT_OK) {
|
||||
|
||||
@ -7,6 +7,7 @@ import com.gh.common.util.*
|
||||
import com.gh.gamecenter.baselist.ListViewModel
|
||||
import com.gh.gamecenter.baselist.LoadType
|
||||
import com.gh.gamecenter.entity.ErrorEntity
|
||||
import com.gh.gamecenter.entity.ForumVideoEntity
|
||||
import com.gh.gamecenter.entity.PersonalHistoryEntity
|
||||
import com.gh.gamecenter.retrofit.Response
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
@ -25,13 +26,20 @@ class UserHistoryViewModel(application: Application, var userId: String, private
|
||||
|
||||
var type: TYPE = TYPE.ALL
|
||||
|
||||
var videoList = arrayListOf<ForumVideoEntity>()
|
||||
|
||||
override fun provideDataObservable(page: Int): Observable<MutableList<PersonalHistoryEntity>> {
|
||||
return mApi.getPersonalHistory(userId, page,
|
||||
HaloApp.getInstance().channel, getFilter())
|
||||
}
|
||||
|
||||
override fun mergeResultLiveData() {
|
||||
mResultLiveData.addSource(mListLiveData) { mResultLiveData.postValue(it) }
|
||||
mResultLiveData.addSource(mListLiveData) { list ->
|
||||
|
||||
videoList = ArrayList(list.map { it.transformForumVideoEntity() })
|
||||
|
||||
mResultLiveData.postValue(list)
|
||||
}
|
||||
}
|
||||
|
||||
fun voteComment(gameId: String, commentId: String, callback: () -> Unit) {
|
||||
|
||||
@ -1,17 +1,15 @@
|
||||
package com.gh.gamecenter.simulatorgame
|
||||
|
||||
import android.app.Dialog
|
||||
import android.graphics.Color
|
||||
import android.graphics.Paint
|
||||
import android.graphics.drawable.BitmapDrawable
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.os.Bundle
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.widget.*
|
||||
import androidx.core.content.ContextCompat
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.RelativeLayout
|
||||
import android.widget.TextView
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter
|
||||
@ -122,7 +120,7 @@ class SimulatorGameFragment : NormalFragment() {
|
||||
})
|
||||
mViewModel.simulatorGameLoadSuccess.observe(viewLifecycleOwner, Observer {
|
||||
AppExecutor.uiExecutor.executeWithDelay(Runnable {
|
||||
showSimulatorGuide(it)
|
||||
tryCatchInRelease { showSimulatorGuide(it) }
|
||||
},500)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user