整理代码(首页游戏分包)
This commit is contained in:
@ -4,7 +4,7 @@ import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import android.support.v4.util.ArrayMap
|
||||
import com.gh.common.constant.Config
|
||||
import com.gh.gamecenter.game.GameSubjectData
|
||||
import com.gh.gamecenter.game.data.GameSubjectData
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import com.lightgame.download.DownloadEntity
|
||||
|
||||
|
||||
@ -15,6 +15,7 @@ import com.gh.gamecenter.baselist.LoadStatus
|
||||
import com.gh.gamecenter.databinding.FragmentGameBinding
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus
|
||||
import com.gh.gamecenter.eventbus.EBPackage
|
||||
import com.gh.gamecenter.game.data.ItemData
|
||||
import com.lightgame.download.DataWatcher
|
||||
import com.lightgame.download.DownloadEntity
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
@ -113,11 +114,7 @@ class GameFragment : BaseFragment<Any>() {
|
||||
fun onEventMainThread(busFour: EBPackage) {
|
||||
val data = mListAdapter?.getGameEntityByPackage(busFour.packageName)
|
||||
if (data != null) {
|
||||
if (data.position == 1) {
|
||||
mViewModel?.initPlugin() // 卸载是无法更新插件化模块
|
||||
} else {
|
||||
mListAdapter?.notifyItemChanged(data.position)
|
||||
}
|
||||
mListAdapter?.notifyItemChanged(data.position)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -23,6 +23,9 @@ import com.gh.gamecenter.baselist.LoadStatus
|
||||
import com.gh.gamecenter.databinding.*
|
||||
import com.gh.gamecenter.entity.GameEntity
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus
|
||||
import com.gh.gamecenter.game.data.ItemData
|
||||
import com.gh.gamecenter.game.horizontal.GameHorizontalAdapter
|
||||
import com.gh.gamecenter.game.horizontal.GameHorizontalListViewHolder
|
||||
import com.halo.assistant.fragment.game.GamePluginAdapter
|
||||
import com.halo.assistant.fragment.game.GamePluginViewHolder
|
||||
import com.lightgame.adapter.BaseRecyclerAdapter
|
||||
|
||||
@ -1,25 +0,0 @@
|
||||
package com.gh.gamecenter.game
|
||||
|
||||
import android.content.Context
|
||||
import android.view.ViewGroup
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.databinding.GameItemBinding
|
||||
import com.gh.gamecenter.entity.GameEntity
|
||||
import com.lightgame.adapter.BaseRecyclerAdapter
|
||||
|
||||
class GameSubjectAdapter(context: Context, gameList: List<GameEntity>) : BaseRecyclerAdapter<GameItemViewHolder>(context) {
|
||||
|
||||
private val mGameList = gameList
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): GameItemViewHolder? {
|
||||
return GameItemViewHolder(GameItemBinding.bind(mLayoutInflater.inflate(R.layout.game_item, parent, false)))
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: GameItemViewHolder, position: Int) {
|
||||
holder.binding.game = mGameList[position]
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return if (mGameList[0].id.isNullOrEmpty()) mGameList.size else mGameList.size - 1
|
||||
}
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
package com.gh.gamecenter.game
|
||||
|
||||
import com.gh.base.BaseRecyclerViewHolder
|
||||
import com.gh.gamecenter.databinding.GameSubjectItemBinding
|
||||
|
||||
class GameSubjectItemViewHolder(bind: GameSubjectItemBinding) : BaseRecyclerViewHolder<Any>(bind.root) {
|
||||
var binding = bind
|
||||
}
|
||||
@ -11,6 +11,8 @@ import com.gh.common.util.RandomUtils
|
||||
import com.gh.download.DownloadManager
|
||||
import com.gh.gamecenter.baselist.LoadStatus
|
||||
import com.gh.gamecenter.entity.*
|
||||
import com.gh.gamecenter.game.data.GameSubjectData
|
||||
import com.gh.gamecenter.game.data.ItemData
|
||||
import com.gh.gamecenter.manager.PackageManager
|
||||
import com.gh.gamecenter.retrofit.Response
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.gh.gamecenter.game
|
||||
package com.gh.gamecenter.game.data
|
||||
|
||||
import com.gh.gamecenter.entity.GameEntity
|
||||
import com.gh.gamecenter.entity.SlideEntity
|
||||
@ -1,3 +1,3 @@
|
||||
package com.gh.gamecenter.game
|
||||
package com.gh.gamecenter.game.data
|
||||
|
||||
data class GameSubjectData(val name: String?, val tag: String?, val position: Int?, val isOrder: Boolean)
|
||||
@ -1,4 +1,4 @@
|
||||
package com.gh.gamecenter.game
|
||||
package com.gh.gamecenter.game.horizontal
|
||||
|
||||
import android.content.Context
|
||||
import android.view.ViewGroup
|
||||
@ -1,4 +1,4 @@
|
||||
package com.gh.gamecenter.game
|
||||
package com.gh.gamecenter.game.horizontal
|
||||
|
||||
import com.gh.base.BaseRecyclerViewHolder
|
||||
import com.gh.gamecenter.databinding.GameHorizontalItemBinding
|
||||
@ -1,4 +1,4 @@
|
||||
package com.gh.gamecenter.game
|
||||
package com.gh.gamecenter.game.horizontal
|
||||
|
||||
import com.gh.base.BaseRecyclerViewHolder
|
||||
import com.gh.gamecenter.databinding.GameHorizontalListBinding
|
||||
@ -43,11 +43,11 @@
|
||||
//import com.gh.gamecenter.NewsDetailActivity;
|
||||
//import com.gh.gamecenter.R;
|
||||
//import com.gh.gamecenter.SubjectActivity;
|
||||
//import com.gh.gamecenter.game.GameHorizontalAdapter;
|
||||
//import com.gh.gamecenter.game.horizontal.GameHorizontalAdapter;
|
||||
//import com.gh.gamecenter.adapter.ImagePagerAdapter;
|
||||
//import com.gh.gamecenter.adapter.viewholder.FooterViewHolder;
|
||||
//import com.gh.gamecenter.adapter.viewholder.GameHeadViewHolder;
|
||||
//import com.gh.gamecenter.game.GameHorizontalListViewHolder;
|
||||
//import com.gh.gamecenter.game.horizontal.GameHorizontalListViewHolder;
|
||||
//import com.gh.gamecenter.adapter.viewholder.GameImageViewHolder;
|
||||
//import com.gh.gamecenter.adapter.viewholder.GameNormalViewHolder;
|
||||
//import com.gh.gamecenter.adapter.viewholder.GameTestViewHolder;
|
||||
|
||||
Reference in New Issue
Block a user