Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_vedio
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
android
android_vedio
Commits
1021429d
Commit
1021429d
authored
Oct 07, 2023
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
ec43d9df
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
97 additions
and
51 deletions
+97
-51
NineActivity.kt
...in/java/com/duben/dayplaylet/ui/activitys/NineActivity.kt
+12
-11
MusicFragment.kt
...in/java/com/duben/dayplaylet/ui/fragment/MusicFragment.kt
+72
-39
RxBus.java
...o/app/src/main/java/com/duben/dayplaylet/utils/RxBus.java
+13
-1
No files found.
video/app/src/main/java/com/duben/dayplaylet/ui/activitys/NineActivity.kt
View file @
1021429d
...
...
@@ -32,7 +32,6 @@ import com.duben.dayplaylet.utils.rxutil.RxjavaUtil
import
com.duben.library.net.neterror.BaseSubscriber
import
com.duben.library.net.neterror.Throwable
import
com.duben.library.utils.nodoubleclick.AntiShake
import
kotlinx.android.synthetic.main.activity_hint.*
import
kotlinx.android.synthetic.main.activity_nine.*
/**
...
...
@@ -94,10 +93,10 @@ class NineActivity : BaseActivity(), View.OnClickListener {
when
(
v
.
id
)
{
R
.
id
.
iv_nine_back
->
{
AppConfig
.
mainMusicRefresh
=
true
AppConfig
.
mainMusicRefresh
=
true
refreshTaskCount
()
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
if
(
isFinishing
)
return
@postDelayed
if
(
isFinishing
)
return
@postDelayed
finish
()
},
500
)
...
...
@@ -116,7 +115,7 @@ class NineActivity : BaseActivity(), View.OnClickListener {
}
override
fun
authFail
(
resultStatus
:
String
)
{
showToast
(
"支付宝授权失败
"
+
resultStatus
)
showToast
(
"支付宝授权失败
$resultStatus"
)
}
})
return
...
...
@@ -174,14 +173,14 @@ class NineActivity : BaseActivity(), View.OnClickListener {
*/
private
fun
adCloseNext
(
carrierType
:
String
)
{
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
if
(
isFinishing
)
return
@postDelayed
if
(
isFinishing
)
return
@postDelayed
startNine
()
},
500
)
}
fun
startNine
()
{
private
fun
startNine
()
{
if
(!
lucky_panel2
.
isGameRunning
)
{
lucky_panel2
.
startGame
()
...
...
@@ -198,19 +197,21 @@ class NineActivity : BaseActivity(), View.OnClickListener {
lucky_panel2
.
tryToStop
(
5
)
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
if
(
isFinishing
)
return
@postDelayed
if
(
isFinishing
)
return
@postDelayed
showWithdrawSucDialog
(
0.0
)
showWithdrawSucDialog
(
cash
)
},
2000
)
}
})
}
}
private
fun
showWithdrawSucDialog
(
cash
:
Double
)
{
private
fun
showWithdrawSucDialog
(
cash
:
String
)
{
if
(
mWithDrawSucDialog
!=
null
&&
mWithDrawSucDialog
!!
.
isShowing
)
return
TrackManager
.
getInstance
().
addCashoutReq
(
drawId
)
mWithDrawSucDialog
=
WithDrawSucDialog
(
context
,
cash
.
toString
()
,
object
:
DialogListener
()
{
WithDrawSucDialog
(
context
,
cash
,
object
:
DialogListener
()
{
override
fun
onClick
(
dialog
:
Dialog
?,
v
:
View
?)
{
super
.
onClick
(
dialog
,
v
)
dialog
?.
dismiss
()
...
...
@@ -282,7 +283,7 @@ class NineActivity : BaseActivity(), View.OnClickListener {
}
override
fun
authFail
(
resultStatus
:
String
)
{
showToast
(
"支付宝授权失败
"
+
resultStatus
)
showToast
(
"支付宝授权失败
$resultStatus"
)
}
})
return
...
...
video/app/src/main/java/com/duben/dayplaylet/ui/fragment/MusicFragment.kt
View file @
1021429d
...
...
@@ -124,7 +124,7 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView, View.OnClickListener {
if
(
AppConfig
.
mainMusicRefresh
)
{
AppConfig
.
mainMusicRefresh
=
false
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
if
(!
isAdded
)
return
@postDelayed
if
(!
isAdded
)
return
@postDelayed
musicPresenter
.
rdSongMsg
()
},
1500
)
...
...
@@ -184,10 +184,11 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView, View.OnClickListener {
if
(
map
==
null
)
{
return
}
mPos
=
position
RxBus
.
getDefault
().
post
(
MsgEvent
(
""
+
map
[
"group_id"
]))
RxBus
.
getDefault
()
.
postSticky
(
MsgEvent
(
""
+
map
[
"group_id"
],
position
))
mPos
=
position
LogUtil
.
d
(
TAG
,
"onDPPageChange: $position, map = $map"
)
}
...
...
@@ -244,23 +245,23 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView, View.OnClickListener {
quizTvPop
.
visibility
=
View
.
GONE
finger
.
visibility
=
View
.
GONE
mainHandler
.
postDelayed
({
if
(!
isAdded
)
return
@postDelayed
// 点击过后不展示
if
(!
rlOption0
.
isClickable
)
return
@postDelayed
val
ls
=
finger
.
layoutParams
as
RelativeLayout
.
LayoutParams
val
ls2
=
quizLLPop
.
layoutParams
as
RelativeLayout
.
LayoutParams
if
(
answer
==
0
)
{
ls
.
addRule
(
RelativeLayout
.
ALIGN_TOP
,
R
.
id
.
rl_option0
)
ls2
.
addRule
(
RelativeLayout
.
ALIGN_TOP
,
R
.
id
.
rl_option0
)
}
else
{
ls
.
addRule
(
RelativeLayout
.
ALIGN_TOP
,
R
.
id
.
rl_option1
)
ls2
.
addRule
(
RelativeLayout
.
ALIGN_TOP
,
R
.
id
.
rl_option1
)
}
playFingerAnim
(
finger
)
},
5000
)
//
mainHandler.postDelayed({
// if
(!isAdded) return@postDelayed
//
//
// 点击过后不展示
// if (!rlOption0.isClickable || !rlOption1
.isClickable) return@postDelayed
//
//
val ls = finger.layoutParams as RelativeLayout.LayoutParams
//
val ls2 = quizLLPop.layoutParams as RelativeLayout.LayoutParams
//
if (answer == 0) {
//
ls.addRule(RelativeLayout.ALIGN_TOP, R.id.rl_option0)
//
ls2.addRule(RelativeLayout.ALIGN_TOP, R.id.rl_option0)
//
} else {
//
ls.addRule(RelativeLayout.ALIGN_TOP, R.id.rl_option1)
//
ls2.addRule(RelativeLayout.ALIGN_TOP, R.id.rl_option1)
//
}
//
playFingerAnim(finger)
//
}, 5000)
for
(
i
in
optionsList
.
indices
)
{
val
right
=
answer
==
i
...
...
@@ -334,7 +335,7 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView, View.OnClickListener {
}
mainHandler
.
postDelayed
({
if
(!
isAdded
)
return
@postDelayed
if
(!
isAdded
)
return
@postDelayed
quizIv
.
visibility
=
View
.
GONE
},
1000
)
...
...
@@ -356,7 +357,7 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView, View.OnClickListener {
}
}
RxBus
.
getDefault
().
t
oObservable
(
MsgEvent
::
class
.
java
)
RxBus
.
getDefault
().
t
ObservableStick
(
MsgEvent
::
class
.
java
)
.
subscribe
(
object
:
Observer
<
MsgEvent
>
{
override
fun
onSubscribe
(
d
:
Disposable
)
{
}
...
...
@@ -364,14 +365,45 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView, View.OnClickListener {
override
fun
onNext
(
t
:
MsgEvent
)
{
// if (!t.msg.equals(feedParamsForCallback["group_id"])) return
if
(
t
.
position
!=
mPos
)
return
LogUtil
.
d
(
TAG
,
"answer -> "
+
answer
+
"nextIsAd -> "
+
mMusicBean
?.
nextIsAd
)
finger
.
setImageDrawable
(
null
)
mainHandler
.
postDelayed
({
if
(!
isAdded
)
return
@postDelayed
// 点击过后不展示
if
(!
rlOption0
.
isClickable
||
!
rlOption1
.
isClickable
)
return
@postDelayed
val
ls
=
finger
.
layoutParams
as
RelativeLayout
.
LayoutParams
val
ls2
=
quizLLPop
.
layoutParams
as
RelativeLayout
.
LayoutParams
if
(
answer
==
0
)
{
ls
.
addRule
(
RelativeLayout
.
ALIGN_TOP
,
R
.
id
.
rl_option0
)
ls2
.
addRule
(
RelativeLayout
.
ALIGN_TOP
,
R
.
id
.
rl_option0
)
}
else
{
ls
.
addRule
(
RelativeLayout
.
ALIGN_TOP
,
R
.
id
.
rl_option1
)
ls2
.
addRule
(
RelativeLayout
.
ALIGN_TOP
,
R
.
id
.
rl_option1
)
}
playFingerAnim
(
finger
)
},
5000
)
// 重置状态
// finger.visibility = View.GONE
// quizLLPop.visibility = View.GONE
// quizTvPop.visibility = View.GONE
for
(
i
in
optionsList
.
indices
)
{
val
right
=
answer
==
i
quizIvRedbox0
.
visibility
=
View
.
GONE
quizIvRedbox1
.
visibility
=
View
.
GONE
if
(
right
)
{
mMusicBean
?.
let
{
if
(
it
.
nextIsAd
&&
optionsList
[
i
].
isClickable
)
{
quizIvRedbox0
.
visibility
=
View
.
GONE
quizIvRedbox1
.
visibility
=
View
.
GONE
if
(
i
==
0
)
{
quizIvRedbox0
.
visibility
=
View
.
VISIBLE
...
...
@@ -384,6 +416,7 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView, View.OnClickListener {
quizIvRedbox0
.
visibility
=
View
.
GONE
}
}
break
}
}
}
...
...
@@ -581,7 +614,7 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView, View.OnClickListener {
if
(!
isNineFlag
)
{
isNineFlag
=
true
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
if
(!
isAdded
)
return
@postDelayed
if
(!
isAdded
)
return
@postDelayed
val
bundle
=
Bundle
()
bundle
.
putString
(
NineActivity
.
DRAW_ID
,
it
.
unitId
)
...
...
@@ -637,26 +670,26 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView, View.OnClickListener {
}
else
{
tv_cash_reward
.
text
=
"+$cashReward"
mainHandler
.
postDelayed
({
if
(!
isAdded
)
return
@postDelayed
if
(!
isAdded
)
return
@postDelayed
addAnimation
(
iv_cash_reward
,
iv_cash
)
mainHandler
.
postDelayed
({
if
(!
isAdded
)
return
@postDelayed
if
(!
isAdded
)
return
@postDelayed
addAnimation
(
iv_cash_reward
,
iv_cash
)
},
200
)
mainHandler
.
postDelayed
({
if
(!
isAdded
)
return
@postDelayed
if
(!
isAdded
)
return
@postDelayed
addAnimation
(
iv_cash_reward
,
iv_cash
)
},
400
)
mainHandler
.
postDelayed
({
if
(!
isAdded
)
return
@postDelayed
if
(!
isAdded
)
return
@postDelayed
addAnimation
(
iv_cash_reward
,
iv_cash
)
},
800
)
mainHandler
.
postDelayed
({
if
(!
isAdded
)
return
@postDelayed
if
(!
isAdded
)
return
@postDelayed
rope
=
null
rope
=
YoYo
.
with
(
Techniques
.
Pulse
).
duration
(
300
).
playOn
(
rl_cash
)
},
1
0
00
)
},
1
2
00
)
},
100
)
}
...
...
@@ -666,31 +699,31 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView, View.OnClickListener {
}
else
{
tv_gold_reward
.
text
=
"+$goldReward"
mainHandler
.
postDelayed
({
if
(!
isAdded
)
return
@postDelayed
if
(!
isAdded
)
return
@postDelayed
addAnimation
(
iv_gold_reward
,
iv_gold
)
mainHandler
.
postDelayed
({
if
(!
isAdded
)
return
@postDelayed
if
(!
isAdded
)
return
@postDelayed
addAnimation
(
iv_gold_reward
,
iv_gold
)
},
200
)
mainHandler
.
postDelayed
({
if
(!
isAdded
)
return
@postDelayed
if
(!
isAdded
)
return
@postDelayed
addAnimation
(
iv_gold_reward
,
iv_gold
)
},
400
)
mainHandler
.
postDelayed
({
if
(!
isAdded
)
return
@postDelayed
if
(!
isAdded
)
return
@postDelayed
addAnimation
(
iv_gold_reward
,
iv_gold
)
},
800
)
mainHandler
.
postDelayed
({
if
(!
isAdded
)
return
@postDelayed
if
(!
isAdded
)
return
@postDelayed
rope
=
null
rope
=
YoYo
.
with
(
Techniques
.
Pulse
).
duration
(
300
).
playOn
(
rl_gold
)
},
1
0
00
)
},
1
2
00
)
},
100
)
}
mainHandler
.
postDelayed
({
if
(!
isAdded
)
return
@postDelayed
if
(!
isAdded
)
return
@postDelayed
cl_reward
.
visibility
=
View
.
GONE
},
1500
)
}
...
...
@@ -807,7 +840,7 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView, View.OnClickListener {
})
mTimer
?.
start
()
mainHandler
.
postDelayed
({
if
(!
isAdded
)
return
@postDelayed
if
(!
isAdded
)
return
@postDelayed
rope
=
null
rope
=
YoYo
.
with
(
Techniques
.
Pulse
).
duration
(
1000
).
repeat
(-
1
)
.
playOn
(
quizLLPop
)
...
...
video/app/src/main/java/com/duben/dayplaylet/utils/RxBus.java
View file @
1021429d
...
...
@@ -93,10 +93,14 @@ public class RxBus {
}
public
static
class
MsgEvent
{
private
int
position
;
private
String
msg
;
public
MsgEvent
(
String
msg
)
{
public
MsgEvent
(
String
msg
,
int
position
)
{
this
.
msg
=
msg
;
this
.
position
=
position
;
}
public
String
getMsg
()
{
...
...
@@ -106,5 +110,13 @@ public class RxBus {
public
void
setMsg
(
String
msg
)
{
this
.
msg
=
msg
;
}
public
int
getPosition
()
{
return
position
;
}
public
void
setPosition
(
int
position
)
{
this
.
position
=
position
;
}
}
}
\ No newline at end of file
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