Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
com.ccwangluo.accelerator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sheteng
com.ccwangluo.accelerator
Commits
cd104a8c
Commit
cd104a8c
authored
Jul 11, 2022
by
sheteng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
registerListener
parent
a05db8c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
+51
-0
app/src/main/java/com/ccwangluo/accelerator/ui/gameList/GameListFragment.kt
...com/ccwangluo/accelerator/ui/gameList/GameListFragment.kt
+51
-0
No files found.
app/src/main/java/com/ccwangluo/accelerator/ui/gameList/GameListFragment.kt
View file @
cd104a8c
...
...
@@ -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
{
fun
newInstance
():
GameListFragment
{
val
fragment
=
GameListFragment
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment