Commit 4984fd26 authored by mengcuiguang's avatar mengcuiguang

Merge branch 'dev_wangzhuan_0906' of...

Merge branch 'dev_wangzhuan_0906' of http://gitlab.mints-id.com/android/android_vedio into dev_wangzhuan_0906
parents 135a70ad 3a9fde89
...@@ -151,7 +151,16 @@ class MsgAdapter : BaseMultiItemQuickAdapter<MSGMultiItemEntity, BaseViewHolder> ...@@ -151,7 +151,16 @@ class MsgAdapter : BaseMultiItemQuickAdapter<MSGMultiItemEntity, BaseViewHolder>
} }
fun setRedpkgBgForPostition(position: Int) { fun setRedpkgBgForPostition(position: Int) {
// 重置状态
data[position].data.isGetRedpkg = true 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() notifyDataSetChanged()
} }
......
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;
}
}
}
...@@ -35,10 +35,9 @@ import com.duben.dayplaylet.mvp.views.VideoView ...@@ -35,10 +35,9 @@ import com.duben.dayplaylet.mvp.views.VideoView
import com.duben.dayplaylet.ui.activitys.base.BaseActivity import com.duben.dayplaylet.ui.activitys.base.BaseActivity
import com.duben.dayplaylet.ui.adapter.VideoEpisodeAdapter import com.duben.dayplaylet.ui.adapter.VideoEpisodeAdapter
import com.duben.dayplaylet.ui.widgets.* import com.duben.dayplaylet.ui.widgets.*
import com.duben.dayplaylet.utils.ForegroundOrBackground import com.duben.dayplaylet.ui.widgets.countdowntimer.CountDownTimerSupport
import com.duben.dayplaylet.utils.FormatUtil import com.duben.dayplaylet.ui.widgets.countdowntimer.OnCountDownTimerListener
import com.duben.dayplaylet.utils.SoundPoolUtil import com.duben.dayplaylet.utils.*
import com.duben.dayplaylet.utils.SpanUtils
import com.duben.library.utils.nodoubleclick.AntiShake import com.duben.library.utils.nodoubleclick.AntiShake
import kotlinx.android.synthetic.main.drama_activity_api_detail.* import kotlinx.android.synthetic.main.drama_activity_api_detail.*
import kotlinx.android.synthetic.main.layout_draw_header.* import kotlinx.android.synthetic.main.layout_draw_header.*
...@@ -58,6 +57,8 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic ...@@ -58,6 +57,8 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
var outerDrama: DPDrama? = null var outerDrama: DPDrama? = null
} }
private var mTimer: CountDownTimerSupport? = null
private var rope: YoYo.YoYoString? = null private var rope: YoYo.YoYoString? = null
private val videoPresenter by lazy { VideoPresenter() } private val videoPresenter by lazy { VideoPresenter() }
...@@ -453,9 +454,14 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic ...@@ -453,9 +454,14 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
cl_red_box.setOnClickListener { cl_red_box.setOnClickListener {
if (!cdvv.isOver) return@setOnClickListener if (!cdvv.isOver) return@setOnClickListener
if (mTimer != null) {
mTimer?.stop()
mTimer = null
} else {
dpWidget?.fragment?.onPause() dpWidget?.fragment?.onPause()
showRedboxDialog() showRedboxDialog()
} }
}
} else { } else {
cl_red_box.visibility = View.GONE cl_red_box.visibility = View.GONE
} }
...@@ -471,6 +477,8 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic ...@@ -471,6 +477,8 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
override fun onLoadingFinish() { override fun onLoadingFinish() {
tv_tips.visibility = View.VISIBLE tv_tips.visibility = View.VISIBLE
triangle.visibility = View.VISIBLE triangle.visibility = View.VISIBLE
startAutoPop()
} }
override fun onClick(v: View?) { override fun onClick(v: View?) {
...@@ -523,6 +531,8 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic ...@@ -523,6 +531,8 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
} }
private fun showRedboxDialog() { private fun showRedboxDialog() {
SoundPool2Util.getInstance().getHongbaoVoice()
mVideoRewardDialog = VideoRewardDialog( mVideoRewardDialog = VideoRewardDialog(
this, this,
FormatUtil.getCashFormaet(mCash).toFloat(), FormatUtil.getCashFormaet(mCash).toFloat(),
...@@ -822,4 +832,18 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic ...@@ -822,4 +832,18 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
override fun onAnimationRepeat(animation: Animator) {} 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
<?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
...@@ -9,13 +9,12 @@ ...@@ -9,13 +9,12 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignEnd="@id/ll" android:layout_alignEnd="@id/ll"
android:layout_marginEnd="30dp"
android:background="@mipmap/ic_close_circle" /> android:background="@mipmap/ic_close_circle" />
<RelativeLayout <RelativeLayout
android:id="@+id/ll" android:id="@+id/ll"
android:layout_width="340dp" android:layout_width="300dp"
android:layout_height="340dp" android:layout_height="370dp"
android:layout_below="@id/ib_close" android:layout_below="@id/ib_close"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:background="@mipmap/bg_circle_red"> android:background="@mipmap/bg_circle_red">
...@@ -29,11 +28,12 @@ ...@@ -29,11 +28,12 @@
android:src="@mipmap/ic_launcher_main" /> android:src="@mipmap/ic_launcher_main" />
<ImageView <ImageView
android:layout_width="12dp" android:layout_width="wrap_content"
android:layout_height="12dp" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginBottom="58dp" android:layout_marginBottom="70dp"
android:paddingEnd="8dp"
android:src="@mipmap/ic_envelope_video" /> android:src="@mipmap/ic_envelope_video" />
<com.airbnb.lottie.LottieAnimationView <com.airbnb.lottie.LottieAnimationView
...@@ -41,24 +41,26 @@ ...@@ -41,24 +41,26 @@
android:layout_width="80dp" android:layout_width="80dp"
android:layout_height="80dp" android:layout_height="80dp"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_marginStart="160dp" /> android:layout_marginStart="160dp"
android:layout_marginBottom="20dp" />
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
android:layout_width="260dp" android:layout_width="310dp"
android:layout_height="70dp" android:layout_height="80dp"
android:layout_below="@id/ll" android:layout_below="@id/ll"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginTop="10dp" android:layout_marginTop="16dp"
android:background="@drawable/shape_banner_write" android:background="@drawable/shape_banner_write"
android:elevation="2dp"
android:padding="@dimen/dp_10"> android:padding="@dimen/dp_10">
<TextView <TextView
android:id="@+id/tv_progress_info" android:id="@+id/tv_progress_info"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="2dp" android:layout_marginTop="6dp"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="14sp" /> android:textSize="14sp" />
...@@ -66,11 +68,13 @@ ...@@ -66,11 +68,13 @@
android:id="@+id/pb" android:id="@+id/pb"
style="@android:style/Widget.ProgressBar.Horizontal" style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="16dp" android:layout_height="18dp"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_marginEnd="46dp" android:layout_marginEnd="46dp"
android:layout_marginBottom="2dp" android:layout_marginBottom="2dp"
android:background="@drawable/shape_redpkg_video"
android:max="100" android:max="100"
android:padding="1dp"
android:progress="50" android:progress="50"
android:progressDrawable="@drawable/progressbar_versus_vedio_bg" /> android:progressDrawable="@drawable/progressbar_versus_vedio_bg" />
...@@ -90,6 +94,7 @@ ...@@ -90,6 +94,7 @@
android:layout_width="51dp" android:layout_width="51dp"
android:layout_height="60dp" android:layout_height="60dp"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:src="@mipmap/ic_redpkg" /> android:src="@mipmap/ic_redpkg" />
</RelativeLayout> </RelativeLayout>
......
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