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
eb827a45
Commit
eb827a45
authored
Jun 01, 2021
by
Mygod
Committed by
Mygod
Jun 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only show progress for connecting
parent
262fa7e1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
mobile/src/main/java/com/github/shadowsocks/widget/ServiceButton.kt
.../main/java/com/github/shadowsocks/widget/ServiceButton.kt
+9
-7
No files found.
mobile/src/main/java/com/github/shadowsocks/widget/ServiceButton.kt
View file @
eb827a45
...
...
@@ -59,11 +59,7 @@ class ServiceButton @JvmOverloads constructor(context: Context, attrs: Attribute
}
private
inner
class
AnimatedState
(
@DrawableRes
resId
:
Int
,
private
val
onStart
:
BaseProgressIndicator
<
*
>.()
->
Unit
=
{
hide
()
isIndeterminate
=
true
show
()
})
{
private
val
onStart
:
BaseProgressIndicator
<
*
>.()
->
Unit
=
{
hide
()
})
{
val
icon
:
AnimatedVectorDrawableCompat
=
AnimatedVectorDrawableCompat
.
create
(
context
,
resId
)
!!
.
apply
{
registerAnimationCallback
(
this
@ServiceButton
.
callback
)
}
...
...
@@ -75,8 +71,14 @@ class ServiceButton @JvmOverloads constructor(context: Context, attrs: Attribute
fun
stop
()
=
icon
.
stop
()
}
private
val
iconStopped
by
lazy
{
AnimatedState
(
R
.
drawable
.
ic_service_stopped
)
{
hide
()
}
}
private
val
iconConnecting
by
lazy
{
AnimatedState
(
R
.
drawable
.
ic_service_connecting
)
}
private
val
iconStopped
by
lazy
{
AnimatedState
(
R
.
drawable
.
ic_service_stopped
)
}
private
val
iconConnecting
by
lazy
{
AnimatedState
(
R
.
drawable
.
ic_service_connecting
)
{
hide
()
isIndeterminate
=
true
show
()
}
}
private
val
iconConnected
by
lazy
{
AnimatedState
(
R
.
drawable
.
ic_service_connected
)
{
setProgressCompat
(
1
,
true
)
}
}
private
val
iconStopping
by
lazy
{
AnimatedState
(
R
.
drawable
.
ic_service_stopping
)
}
private
val
animationQueue
=
ArrayDeque
<
AnimatedState
>()
...
...
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