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
3a9fde89
Commit
3a9fde89
authored
Sep 26, 2023
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
c6b27f97
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
127 additions
and
18 deletions
+127
-18
MsgAdapter.kt
...c/main/java/com/duben/dayplaylet/ui/adapter/MsgAdapter.kt
+9
-0
SoundPool2Util.java
.../main/java/com/duben/dayplaylet/utils/SoundPool2Util.java
+61
-0
DramaApiDetailActivity.kt
.../com/duben/dayplaylet/video/csj/DramaApiDetailActivity.kt
+30
-6
shape_redpkg_video.xml
video/app/src/main/res/drawable/shape_redpkg_video.xml
+10
-0
dialog_video_reward.xml
video/app/src/main/res/layout/dialog_video_reward.xml
+17
-12
bg_circle_red.png
video/app/src/main/res/mipmap-xhdpi/bg_circle_red.png
+0
-0
hongbao.wav
video/app/src/main/res/raw/hongbao.wav
+0
-0
No files found.
video/app/src/main/java/com/duben/dayplaylet/ui/adapter/MsgAdapter.kt
View file @
3a9fde89
...
...
@@ -151,7 +151,16 @@ class MsgAdapter : BaseMultiItemQuickAdapter<MSGMultiItemEntity, BaseViewHolder>
}
fun
setRedpkgBgForPostition
(
position
:
Int
)
{
// 重置状态
data
[
position
].
data
.
isGetRedpkg
=
true
data
[
position
].
data
.
showFinger
=
false
for
(
i
in
data
.
size
-
1
downTo
0
)
{
if
(
data
[
i
].
itemType
==
2
&&
!
data
[
i
].
data
.
isGetRedpkg
)
{
data
[
i
].
data
.
showFinger
=
true
break
}
}
notifyDataSetChanged
()
}
...
...
video/app/src/main/java/com/duben/dayplaylet/utils/SoundPool2Util.java
0 → 100644
View file @
3a9fde89
package
com
.
duben
.
dayplaylet
.
utils
;
import
android.annotation.SuppressLint
;
import
android.content.Context
;
import
android.media.MediaPlayer
;
import
android.media.SoundPool
;
import
com.duben.dayplaylet.MintsApplication
;
import
com.duben.dayplaylet.R
;
public
class
SoundPool2Util
{
private
static
SoundPool2Util
soundPoolUtil
;
private
static
Context
context
;
private
SoundPool
soundPool
;
private
MediaPlayer
player
;
//单例模式
public
static
SoundPool2Util
getInstance
()
{
SoundPool2Util
.
context
=
MintsApplication
.
getContext
();
if
(
soundPoolUtil
==
null
)
soundPoolUtil
=
new
SoundPool2Util
(
context
);
return
soundPoolUtil
;
}
@SuppressLint
(
"NewApi"
)
//这里初始化SoundPool的方法是安卓5.0以后提供的新方式
private
SoundPool2Util
(
Context
context
)
{
soundPool
=
new
SoundPool
.
Builder
().
build
();
//加载音频文件
soundPool
.
load
(
context
,
R
.
raw
.
hongbao
,
1
);
}
public
void
play
(
int
number
)
{
/**
* 播放音频
* params说明:
* //左耳道音量【0~1】
* //右耳道音量【0~1】
* //播放优先级【0表示最低优先级】
* //循环模式【0表示循环一次,-1表示一直循环,其他表示数字+1表示当前数字对应的循环次数】
* //播放速度【1是正常,范围从0~2】
*/
soundPool
.
play
(
number
,
1
,
1
,
0
,
0
,
1
);
}
public
void
getHongbaoVoice
()
{
player
=
MediaPlayer
.
create
(
context
,
R
.
raw
.
hongbao
);
if
(
player
!=
null
)
{
player
.
start
();
}
}
public
void
onDestory
()
{
if
(
player
!=
null
)
{
player
.
stop
();
player
.
release
();
player
=
null
;
}
}
}
video/app/src/main/java/com/duben/dayplaylet/video/csj/DramaApiDetailActivity.kt
View file @
3a9fde89
...
...
@@ -35,10 +35,9 @@ import com.duben.dayplaylet.mvp.views.VideoView
import
com.duben.dayplaylet.ui.activitys.base.BaseActivity
import
com.duben.dayplaylet.ui.adapter.VideoEpisodeAdapter
import
com.duben.dayplaylet.ui.widgets.*
import
com.duben.dayplaylet.utils.ForegroundOrBackground
import
com.duben.dayplaylet.utils.FormatUtil
import
com.duben.dayplaylet.utils.SoundPoolUtil
import
com.duben.dayplaylet.utils.SpanUtils
import
com.duben.dayplaylet.ui.widgets.countdowntimer.CountDownTimerSupport
import
com.duben.dayplaylet.ui.widgets.countdowntimer.OnCountDownTimerListener
import
com.duben.dayplaylet.utils.*
import
com.duben.library.utils.nodoubleclick.AntiShake
import
kotlinx.android.synthetic.main.drama_activity_api_detail.*
import
kotlinx.android.synthetic.main.layout_draw_header.*
...
...
@@ -58,6 +57,8 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
var
outerDrama
:
DPDrama
?
=
null
}
private
var
mTimer
:
CountDownTimerSupport
?
=
null
private
var
rope
:
YoYo
.
YoYoString
?
=
null
private
val
videoPresenter
by
lazy
{
VideoPresenter
()
}
...
...
@@ -453,9 +454,14 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
cl_red_box
.
setOnClickListener
{
if
(!
cdvv
.
isOver
)
return
@setOnClickListener
if
(
mTimer
!=
null
)
{
mTimer
?.
stop
()
mTimer
=
null
}
else
{
dpWidget
?.
fragment
?.
onPause
()
showRedboxDialog
()
}
}
}
else
{
cl_red_box
.
visibility
=
View
.
GONE
}
...
...
@@ -471,6 +477,8 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
override
fun
onLoadingFinish
()
{
tv_tips
.
visibility
=
View
.
VISIBLE
triangle
.
visibility
=
View
.
VISIBLE
startAutoPop
()
}
override
fun
onClick
(
v
:
View
?)
{
...
...
@@ -523,6 +531,8 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
}
private
fun
showRedboxDialog
()
{
SoundPool2Util
.
getInstance
().
getHongbaoVoice
()
mVideoRewardDialog
=
VideoRewardDialog
(
this
,
FormatUtil
.
getCashFormaet
(
mCash
).
toFloat
(),
...
...
@@ -822,4 +832,18 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
override
fun
onAnimationRepeat
(
animation
:
Animator
)
{}
})
}
private
fun
startAutoPop
()
{
mTimer
=
CountDownTimerSupport
(
5000
,
1000
)
mTimer
?.
setOnCountDownTimerListener
(
object
:
OnCountDownTimerListener
{
override
fun
onTick
(
millisUntilFinished
:
Long
)
{}
override
fun
onFinish
()
{
if
(!
cdvv
.
isOver
)
return
dpWidget
?.
fragment
?.
onPause
()
showRedboxDialog
()
}
})
mTimer
?.
start
()
}
}
\ No newline at end of file
video/app/src/main/res/drawable/shape_redpkg_video.xml
0 → 100644
View file @
3a9fde89
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<!-- 填充的颜色 -->
<solid
android:color=
"@color/color_A24240"
/>
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners
android:radius=
"1000dip"
/>
</shape>
\ No newline at end of file
video/app/src/main/res/layout/dialog_video_reward.xml
View file @
3a9fde89
...
...
@@ -9,13 +9,12 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignEnd=
"@id/ll"
android:layout_marginEnd=
"30dp"
android:background=
"@mipmap/ic_close_circle"
/>
<RelativeLayout
android:id=
"@+id/ll"
android:layout_width=
"3
4
0dp"
android:layout_height=
"3
4
0dp"
android:layout_width=
"3
0
0dp"
android:layout_height=
"3
7
0dp"
android:layout_below=
"@id/ib_close"
android:layout_centerHorizontal=
"true"
android:background=
"@mipmap/bg_circle_red"
>
...
...
@@ -29,11 +28,12 @@
android:src=
"@mipmap/ic_launcher_main"
/>
<ImageView
android:layout_width=
"
12dp
"
android:layout_height=
"
12dp
"
android:layout_width=
"
wrap_content
"
android:layout_height=
"
wrap_content
"
android:layout_alignParentBottom=
"true"
android:layout_centerHorizontal=
"true"
android:layout_marginBottom=
"58dp"
android:layout_marginBottom=
"70dp"
android:paddingEnd=
"8dp"
android:src=
"@mipmap/ic_envelope_video"
/>
<com.airbnb.lottie.LottieAnimationView
...
...
@@ -41,24 +41,26 @@
android:layout_width=
"80dp"
android:layout_height=
"80dp"
android:layout_alignParentBottom=
"true"
android:layout_marginStart=
"160dp"
/>
android:layout_marginStart=
"160dp"
android:layout_marginBottom=
"20dp"
/>
</RelativeLayout>
<RelativeLayout
android:layout_width=
"
26
0dp"
android:layout_height=
"
7
0dp"
android:layout_width=
"
31
0dp"
android:layout_height=
"
8
0dp"
android:layout_below=
"@id/ll"
android:layout_centerHorizontal=
"true"
android:layout_marginTop=
"1
0
dp"
android:layout_marginTop=
"1
6
dp"
android:background=
"@drawable/shape_banner_write"
android:elevation=
"2dp"
android:padding=
"@dimen/dp_10"
>
<TextView
android:id=
"@+id/tv_progress_info"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"
2
dp"
android:layout_marginTop=
"
6
dp"
android:textColor=
"@color/black"
android:textSize=
"14sp"
/>
...
...
@@ -66,11 +68,13 @@
android:id=
"@+id/pb"
style=
"@android:style/Widget.ProgressBar.Horizontal"
android:layout_width=
"match_parent"
android:layout_height=
"1
6
dp"
android:layout_height=
"1
8
dp"
android:layout_alignParentBottom=
"true"
android:layout_marginEnd=
"46dp"
android:layout_marginBottom=
"2dp"
android:background=
"@drawable/shape_redpkg_video"
android:max=
"100"
android:padding=
"1dp"
android:progress=
"50"
android:progressDrawable=
"@drawable/progressbar_versus_vedio_bg"
/>
...
...
@@ -90,6 +94,7 @@
android:layout_width=
"51dp"
android:layout_height=
"60dp"
android:layout_alignParentEnd=
"true"
android:layout_centerVertical=
"true"
android:src=
"@mipmap/ic_redpkg"
/>
</RelativeLayout>
...
...
video/app/src/main/res/mipmap-xhdpi/bg_circle_red.png
View replaced file @
c6b27f97
View file @
3a9fde89
416 KB
|
W:
|
H:
306 KB
|
W:
|
H:
2-up
Swipe
Onion skin
video/app/src/main/res/raw/hongbao.wav
0 → 100644
View file @
3a9fde89
File added
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