Commit cd104a8c authored by sheteng's avatar sheteng

registerListener

parent a05db8c9
...@@ -244,6 +244,57 @@ class GameListFragment : XPageFragment() { ...@@ -244,6 +244,57 @@ class GameListFragment : XPageFragment() {
}) })
} }
protected fun isSlideToBottom(recyclerView: RecyclerView?): Boolean {
if (recyclerView == null) return false
return if (recyclerView.computeVerticalScrollExtent() + recyclerView.computeVerticalScrollOffset() >= recyclerView.computeVerticalScrollRange()) true else false
}
override fun onHiddenChanged(hidden: Boolean) {
super.onHiddenChanged(hidden)
if (!hidden) {
registerListener()
_binding.gameList.adapter?.notifyDataSetChanged()
}
}
fun registerListener() {
AcceleratorUtils.registerStateListener { state, l, net ->
acctime = l
if (state == BaseService.State.Connected) {
Handler(Looper.getMainLooper()).post {
_binding.gameList.adapter?.notifyItemChanged(
dataList.indexOf(
AcceleratorUtils.game
)
)
}
}
}
}
fun download(itemData: GameInfo) {
activity?.let {
if (itemData.downloadUrl.endsWith(".apk")) {
GameDownloadDialog(
itemData,
this@GameListFragment
).show<GameDownloadDialog>().download();
} else {
CommonDialog(it)
.setContent("TT不提供下载功能,有需要浏览游戏资讯,可前往Qooapp等途径获取。")
.setBtnLeft("取消") {
}.setBtnRight("去找找") {
val intent = Intent(
Intent.ACTION_VIEW,
Uri.parse(itemData.downloadUrl)
)
startActivity(intent)
}.show<CommonDialog>()
}
}
}
companion object { companion object {
fun newInstance(): GameListFragment { fun newInstance(): GameListFragment {
val fragment = GameListFragment() val fragment = GameListFragment()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment