Commit c6b27f97 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent 22d3bb3d
...@@ -341,6 +341,12 @@ public interface LoanService { ...@@ -341,6 +341,12 @@ public interface LoanService {
@POST("api/user/reportAlipayMsg") @POST("api/user/reportAlipayMsg")
Observable<BaseResponse<Object>> reportAlipayMsg(@Body Map<String, Object> vo); Observable<BaseResponse<Object>> reportAlipayMsg(@Body Map<String, Object> vo);
/**
* 取消猜歌
*/
@POST("api/reward/refreshTaskCount")
Observable<BaseResponse<Object>> refreshTaskCount();
/** /**
* 默认http工厂 * 默认http工厂
*/ */
......
...@@ -9,6 +9,7 @@ import com.airbnb.lottie.LottieAnimationView ...@@ -9,6 +9,7 @@ import com.airbnb.lottie.LottieAnimationView
import com.airbnb.lottie.LottieComposition import com.airbnb.lottie.LottieComposition
import com.airbnb.lottie.LottieCompositionFactory import com.airbnb.lottie.LottieCompositionFactory
import com.airbnb.lottie.LottieDrawable import com.airbnb.lottie.LottieDrawable
import com.duben.dayplaylet.MintsApplication
import com.duben.dayplaylet.R import com.duben.dayplaylet.R
import com.duben.dayplaylet.ad.AdManager import com.duben.dayplaylet.ad.AdManager
import com.duben.dayplaylet.ad.AdStatusListener import com.duben.dayplaylet.ad.AdStatusListener
...@@ -16,8 +17,10 @@ import com.duben.dayplaylet.ad.NoPreAdManager ...@@ -16,8 +17,10 @@ import com.duben.dayplaylet.ad.NoPreAdManager
import com.duben.dayplaylet.ad.half.HalfScreenManager import com.duben.dayplaylet.ad.half.HalfScreenManager
import com.duben.dayplaylet.common.Constant import com.duben.dayplaylet.common.Constant
import com.duben.dayplaylet.manager.AlipayAuthManager import com.duben.dayplaylet.manager.AlipayAuthManager
import com.duben.dayplaylet.manager.AppHttpManager
import com.duben.dayplaylet.manager.TrackManager import com.duben.dayplaylet.manager.TrackManager
import com.duben.dayplaylet.manager.UserManager import com.duben.dayplaylet.manager.UserManager
import com.duben.dayplaylet.mvp.model.BaseResponse
import com.duben.dayplaylet.ui.activitys.base.BaseActivity import com.duben.dayplaylet.ui.activitys.base.BaseActivity
import com.duben.dayplaylet.ui.widgets.DialogListener import com.duben.dayplaylet.ui.widgets.DialogListener
import com.duben.dayplaylet.ui.widgets.WithDrawSucDialog import com.duben.dayplaylet.ui.widgets.WithDrawSucDialog
...@@ -25,6 +28,8 @@ import com.duben.dayplaylet.ui.widgets.countdowntimer.CountDownTimerSupport ...@@ -25,6 +28,8 @@ import com.duben.dayplaylet.ui.widgets.countdowntimer.CountDownTimerSupport
import com.duben.dayplaylet.ui.widgets.countdowntimer.OnCountDownTimerListener import com.duben.dayplaylet.ui.widgets.countdowntimer.OnCountDownTimerListener
import com.duben.dayplaylet.utils.rxutil.CommonRxTask import com.duben.dayplaylet.utils.rxutil.CommonRxTask
import com.duben.dayplaylet.utils.rxutil.RxjavaUtil 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 com.duben.library.utils.nodoubleclick.AntiShake
import kotlinx.android.synthetic.main.activity_hint.* import kotlinx.android.synthetic.main.activity_hint.*
import kotlinx.android.synthetic.main.activity_nine.* import kotlinx.android.synthetic.main.activity_nine.*
...@@ -88,6 +93,8 @@ class NineActivity : BaseActivity(), View.OnClickListener { ...@@ -88,6 +93,8 @@ class NineActivity : BaseActivity(), View.OnClickListener {
when (v.id) { when (v.id) {
R.id.iv_nine_back -> { R.id.iv_nine_back -> {
refreshTaskCount()
finish() finish()
} }
R.id.iv_nine_next -> { R.id.iv_nine_next -> {
...@@ -245,12 +252,14 @@ class NineActivity : BaseActivity(), View.OnClickListener { ...@@ -245,12 +252,14 @@ class NineActivity : BaseActivity(), View.OnClickListener {
mTimer?.setOnCountDownTimerListener(object : OnCountDownTimerListener { mTimer?.setOnCountDownTimerListener(object : OnCountDownTimerListener {
override fun onTick(millisUntilFinished: Long) { override fun onTick(millisUntilFinished: Long) {
if (!this@NineActivity.isFinishing) { if (!this@NineActivity.isFinishing) {
tv_nine_timer?.text = "${millisUntilFinished / 1000}秒后自动领取"
} }
} }
override fun onFinish() { override fun onFinish() {
if (!this@NineActivity.isFinishing) { if (!this@NineActivity.isFinishing) {
tv_nine_timer?.visibility = View.GONE
if (isClickFlag) return if (isClickFlag) return
if (!UserManager.getInstance().alipaySet) { if (!UserManager.getInstance().alipaySet) {
...@@ -280,4 +289,19 @@ class NineActivity : BaseActivity(), View.OnClickListener { ...@@ -280,4 +289,19 @@ class NineActivity : BaseActivity(), View.OnClickListener {
e.printStackTrace() e.printStackTrace()
} }
} }
private fun refreshTaskCount() {
val baseApplication = MintsApplication.getContext() as MintsApplication
AppHttpManager.getInstance(baseApplication)
.call(baseApplication.loanService.refreshTaskCount(),
object : BaseSubscriber<BaseResponse<Any>>() {
override fun onError(e: Throwable) {
}
override fun onNext(t: BaseResponse<Any>) {
}
})
}
} }
\ No newline at end of file
...@@ -9,6 +9,7 @@ import com.duben.dayplaylet.R ...@@ -9,6 +9,7 @@ import com.duben.dayplaylet.R
import com.duben.dayplaylet.ad.express.ExpressAdCallback import com.duben.dayplaylet.ad.express.ExpressAdCallback
import com.duben.dayplaylet.ad.express.MyExpressManager import com.duben.dayplaylet.ad.express.MyExpressManager
import com.duben.dayplaylet.ui.activitys.base.BaseActivity import com.duben.dayplaylet.ui.activitys.base.BaseActivity
import com.duben.dayplaylet.utils.SoundPoolUtil
import com.duben.dayplaylet.utils.UIUtils import com.duben.dayplaylet.utils.UIUtils
import com.duben.library.utils.nodoubleclick.AntiShake import com.duben.library.utils.nodoubleclick.AntiShake
import kotlinx.android.synthetic.main.activity_song_award.* import kotlinx.android.synthetic.main.activity_song_award.*
......
...@@ -18,6 +18,7 @@ import com.duben.dayplaylet.common.AppConfig ...@@ -18,6 +18,7 @@ import com.duben.dayplaylet.common.AppConfig
import com.duben.dayplaylet.manager.TrackManager import com.duben.dayplaylet.manager.TrackManager
import com.duben.dayplaylet.ui.activitys.base.BaseActivity import com.duben.dayplaylet.ui.activitys.base.BaseActivity
import com.duben.dayplaylet.utils.ConsumerToastUtil import com.duben.dayplaylet.utils.ConsumerToastUtil
import com.duben.dayplaylet.utils.SoundPoolUtil
import com.duben.dayplaylet.utils.SpanUtils import com.duben.dayplaylet.utils.SpanUtils
import com.duben.dayplaylet.utils.UIUtils import com.duben.dayplaylet.utils.UIUtils
import com.duben.library.utils.nodoubleclick.AntiShake import com.duben.library.utils.nodoubleclick.AntiShake
...@@ -74,6 +75,7 @@ class TaskAwardActivity : BaseActivity(), View.OnClickListener { ...@@ -74,6 +75,7 @@ class TaskAwardActivity : BaseActivity(), View.OnClickListener {
} }
override fun initViewsAndEvents() { override fun initViewsAndEvents() {
SoundPoolUtil.getInstance().getGoldVoice()
showAdView() showAdView()
tv_award_hint.text = SpanUtils() tv_award_hint.text = SpanUtils()
.append("金元宝") .append("金元宝")
......
...@@ -316,7 +316,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR ...@@ -316,7 +316,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
} }
if (signMsg == null) { if (signMsg == null) {
iv_main_sign.visibility = View.GONE iv_main_sign.visibility = View.GONE
if (!isNoSignFlag) { if (!isNoSignFlag && !isShowSignFlag) {
isNoSignFlag = true isNoSignFlag = true
HalfScreenManager.getInstance().showAd(requireActivity(), null) HalfScreenManager.getInstance().showAd(requireActivity(), null)
} }
......
...@@ -45,11 +45,8 @@ import com.duben.dayplaylet.ui.activitys.SongAwardActivity ...@@ -45,11 +45,8 @@ import com.duben.dayplaylet.ui.activitys.SongAwardActivity
import com.duben.dayplaylet.ui.fragment.base.LazyLoadBaseFragment import com.duben.dayplaylet.ui.fragment.base.LazyLoadBaseFragment
import com.duben.dayplaylet.ui.widgets.countdowntimer.CountDownTimerSupport import com.duben.dayplaylet.ui.widgets.countdowntimer.CountDownTimerSupport
import com.duben.dayplaylet.ui.widgets.countdowntimer.OnCountDownTimerListener import com.duben.dayplaylet.ui.widgets.countdowntimer.OnCountDownTimerListener
import com.duben.dayplaylet.utils.FormatUtil import com.duben.dayplaylet.utils.*
import com.duben.dayplaylet.utils.LogUtil
import com.duben.dayplaylet.utils.RxBus
import com.duben.dayplaylet.utils.RxBus.MsgEvent import com.duben.dayplaylet.utils.RxBus.MsgEvent
import com.duben.dayplaylet.utils.SpanUtils
import com.duben.library.utils.nodoubleclick.AntiShake import com.duben.library.utils.nodoubleclick.AntiShake
import io.reactivex.Observer import io.reactivex.Observer
import io.reactivex.disposables.Disposable import io.reactivex.disposables.Disposable
...@@ -89,6 +86,8 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView, View.OnClickListener { ...@@ -89,6 +86,8 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView, View.OnClickListener {
private var mPos = 0 private var mPos = 0
private var isNineFlag = false
override fun getContentViewLayoutID() = R.layout.fragment_music override fun getContentViewLayoutID() = R.layout.fragment_music
override fun initViewsAndEvents() { override fun initViewsAndEvents() {
...@@ -566,12 +565,16 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView, View.OnClickListener { ...@@ -566,12 +565,16 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView, View.OnClickListener {
if (it.completeCount >= it.turnNeedCount) { if (it.completeCount >= it.turnNeedCount) {
tv_open_cash_info.visibility = View.GONE tv_open_cash_info.visibility = View.GONE
if (!isNineFlag) {
isNineFlag = true
Handler(Looper.getMainLooper()).postDelayed({ Handler(Looper.getMainLooper()).postDelayed({
val bundle = Bundle() val bundle = Bundle()
bundle.putString(NineActivity.DRAW_ID, it.unitId) bundle.putString(NineActivity.DRAW_ID, it.unitId)
bundle.putString(NineActivity.CASH, it.cash) bundle.putString(NineActivity.CASH, it.cash)
readyGo(NineActivity::class.java, bundle) readyGo(NineActivity::class.java, bundle)
}, 800) }, 800)
}
} else { } else {
tv_open_cash_info.visibility = View.VISIBLE tv_open_cash_info.visibility = View.VISIBLE
tv_open_cash_info.text = SpanUtils() tv_open_cash_info.text = SpanUtils()
...@@ -666,6 +669,8 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView, View.OnClickListener { ...@@ -666,6 +669,8 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView, View.OnClickListener {
} }
override fun reportAddCoinMsgSuc(coin: Int, di: Int) { override fun reportAddCoinMsgSuc(coin: Int, di: Int) {
SoundPoolUtil.getInstance().getGoldVoice()
when (mCarrierType) { when (mCarrierType) {
Constant.CARRIERTYPE_SONG_CLICK -> { Constant.CARRIERTYPE_SONG_CLICK -> {
showRewardAnim(coin, di) showRewardAnim(coin, di)
...@@ -751,6 +756,7 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView, View.OnClickListener { ...@@ -751,6 +756,7 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView, View.OnClickListener {
awardVideo(Constant.CARRIERTYPE_SONG_MORE) awardVideo(Constant.CARRIERTYPE_SONG_MORE)
} }
SoundPoolUtil.getInstance().getGoldVoice()
mTimer = CountDownTimerSupport(8000, 1000) mTimer = CountDownTimerSupport(8000, 1000)
mTimer?.setOnCountDownTimerListener(object : mTimer?.setOnCountDownTimerListener(object :
OnCountDownTimerListener { OnCountDownTimerListener {
......
...@@ -43,6 +43,7 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener { ...@@ -43,6 +43,7 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
private var tasksAdapter: TasksAdapter? = null private var tasksAdapter: TasksAdapter? = null
private var drawCashDialog: DrawCashDialog? = null private var drawCashDialog: DrawCashDialog? = null
private var taskInfoBean: TaskInfoBean? = null
override fun getContentViewLayoutID() = R.layout.fragment_main_my override fun getContentViewLayoutID() = R.layout.fragment_main_my
...@@ -127,8 +128,12 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener { ...@@ -127,8 +128,12 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
showDrawCashDialog() showDrawCashDialog()
} }
R.id.btn_task -> { // 任务,领金元宝 R.id.btn_task -> { // 任务,领金元宝
taskInfoBean?.let {
if (it.diMsg.complete < it.diMsg.max) {
showAd(Constant.CARRIERTYPE_TASK_YUANBAO) showAd(Constant.CARRIERTYPE_TASK_YUANBAO)
} }
}
}
R.id.tv_my_explain -> { // 收益说明 R.id.tv_my_explain -> { // 收益说明
val bundle = Bundle() val bundle = Bundle()
bundle.putString(WebActivity.WEB_TITLE, "收益说明") bundle.putString(WebActivity.WEB_TITLE, "收益说明")
...@@ -158,6 +163,13 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener { ...@@ -158,6 +163,13 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
} }
override fun getHallListSuc(data: TaskInfoBean) { override fun getHallListSuc(data: TaskInfoBean) {
this.taskInfoBean = data
pb_task.progress = data.diMsg.complete
pb_task.max = data.diMsg.max
tv_task_count.text = "今日剩余${data.diMsg.max - data.diMsg.complete}次"
tasksAdapter?.taskData = data.list tasksAdapter?.taskData = data.list
recy_tasks.adapter?.notifyDataSetChanged() recy_tasks.adapter?.notifyDataSetChanged()
} }
......
...@@ -25,10 +25,7 @@ import com.duben.dayplaylet.ui.activitys.DrawProgressActivity ...@@ -25,10 +25,7 @@ import com.duben.dayplaylet.ui.activitys.DrawProgressActivity
import com.duben.dayplaylet.ui.activitys.MainActivity import com.duben.dayplaylet.ui.activitys.MainActivity
import com.duben.dayplaylet.ui.fragment.MyFragment import com.duben.dayplaylet.ui.fragment.MyFragment
import com.duben.dayplaylet.ui.fragment.base.LazyLoadBaseFragment import com.duben.dayplaylet.ui.fragment.base.LazyLoadBaseFragment
import com.duben.dayplaylet.utils.ConsumerToastUtil import com.duben.dayplaylet.utils.*
import com.duben.dayplaylet.utils.ForegroundOrBackground
import com.duben.dayplaylet.utils.SpanUtils
import com.duben.dayplaylet.utils.ToastUtil
import com.duben.library.utils.nodoubleclick.AntiShake import com.duben.library.utils.nodoubleclick.AntiShake
import kotlinx.android.synthetic.main.activity_feekback.* import kotlinx.android.synthetic.main.activity_feekback.*
import kotlinx.android.synthetic.main.fragment_draw.* import kotlinx.android.synthetic.main.fragment_draw.*
...@@ -65,6 +62,7 @@ class DrawCashFragment : LazyLoadBaseFragment(), DrawCashView, DrawCashAdapter.O ...@@ -65,6 +62,7 @@ class DrawCashFragment : LazyLoadBaseFragment(), DrawCashView, DrawCashAdapter.O
private var currentDrawInfo: DrawInfoBean.DrawInfoItemBean? = null private var currentDrawInfo: DrawInfoBean.DrawInfoItemBean? = null
var payChannel = ALIPAY var payChannel = ALIPAY
var alipayStatus = false var alipayStatus = false
private var currentPosition = 0
override fun getContentViewLayoutID() = R.layout.fragment_draw override fun getContentViewLayoutID() = R.layout.fragment_draw
...@@ -120,9 +118,9 @@ class DrawCashFragment : LazyLoadBaseFragment(), DrawCashView, DrawCashAdapter.O ...@@ -120,9 +118,9 @@ class DrawCashFragment : LazyLoadBaseFragment(), DrawCashView, DrawCashAdapter.O
mDrawCashAdapter?.setNewInstance(data.list) mDrawCashAdapter?.setNewInstance(data.list)
if (data.list.size > 0) { if (data.list.size > 0) {
currentDrawInfo = data.list.get(0) currentDrawInfo = data.list.get(currentPosition)
mDrawCashAdapter?.setPosition(0) mDrawCashAdapter?.setPosition(currentPosition)
this.onItemClick(0) this.onItemClick(currentPosition)
} }
} }
...@@ -140,15 +138,17 @@ class DrawCashFragment : LazyLoadBaseFragment(), DrawCashView, DrawCashAdapter.O ...@@ -140,15 +138,17 @@ class DrawCashFragment : LazyLoadBaseFragment(), DrawCashView, DrawCashAdapter.O
.create() .create()
mDrawCashAdapter?.setNewInstance(data.list) mDrawCashAdapter?.setNewInstance(data.list)
if (data.list.size > 0) { if (data.list.size > 0) {
currentDrawInfo = data.list.get(0) currentDrawInfo = data.list.get(currentPosition)
mDrawCashAdapter?.setPosition(0) mDrawCashAdapter?.setPosition(currentPosition)
this.onItemClick(0) this.onItemClick(currentPosition)
} }
} }
override fun onItemClick(position: Int) { override fun onItemClick(position: Int) {
currentDrawInfo = yuanbaoBean?.list?.get(position) currentDrawInfo = yuanbaoBean?.list?.get(position)
currentPosition = position
if (drawType == DRAW_TYPE_CASH) { if (drawType == DRAW_TYPE_CASH) {
currentPosition = position
// 红包 // 红包
currentDrawInfo = redPkgBean?.list?.get(position) currentDrawInfo = redPkgBean?.list?.get(position)
} }
...@@ -181,6 +181,16 @@ class DrawCashFragment : LazyLoadBaseFragment(), DrawCashView, DrawCashAdapter.O ...@@ -181,6 +181,16 @@ class DrawCashFragment : LazyLoadBaseFragment(), DrawCashView, DrawCashAdapter.O
when (v.id) { when (v.id) {
R.id.btn_draw -> { R.id.btn_draw -> {
/**
* 21 任务弹框,
* 11 直接在当前页面观看视频,-- 立即赚钱
* 12 跳转到别的地方赚钱,--前端 去赚钱
* 13 直接谈提示,用tip
* 1满足可以提现条件 可以判断是否白嫖视频了
*/
currentDrawInfo?.let {
when (it.status) {
1 -> {
//1、支付渠道 //1、支付渠道
if (TextUtils.equals(payChannel, WEIXIN_PAY)) { if (TextUtils.equals(payChannel, WEIXIN_PAY)) {
// showToast("微信支付维护中") // showToast("微信支付维护中")
...@@ -205,23 +215,13 @@ class DrawCashFragment : LazyLoadBaseFragment(), DrawCashView, DrawCashAdapter.O ...@@ -205,23 +215,13 @@ class DrawCashFragment : LazyLoadBaseFragment(), DrawCashView, DrawCashAdapter.O
return return
} }
/**
* 21 任务弹框,
* 11 直接在当前页面观看视频,-- 立即赚钱
* 12 跳转到别的地方赚钱,--前端 去赚钱
* 13 直接谈提示,用tip
* 1满足可以提现条件 可以判断是否白嫖视频了
*/
currentDrawInfo?.let {
when (it.status) {
1 -> {
if (it.isNeedSeeVedioBeforeCashout) { if (it.isNeedSeeVedioBeforeCashout) {
//票 //票
showAd(Constant.CARRIERTYPE_ONLY_SHOW) showAd(Constant.CARRIERTYPE_ONLY_SHOW)
} else { } else {
//发起提现 //发起提现
TrackManager.getInstance().addCashoutReq(currentDrawInfo?.unitId) TrackManager.getInstance().addCashoutReq(currentDrawInfo?.unitId)
showToast("提现成功") showToast("发起提现成功")
} }
} }
11 -> { 11 -> {
...@@ -312,16 +312,25 @@ class DrawCashFragment : LazyLoadBaseFragment(), DrawCashView, DrawCashAdapter.O ...@@ -312,16 +312,25 @@ class DrawCashFragment : LazyLoadBaseFragment(), DrawCashView, DrawCashAdapter.O
Constant.CARRIERTYPE_ONLY_SHOW -> { Constant.CARRIERTYPE_ONLY_SHOW -> {
TrackManager.getInstance().addCashoutReq(currentDrawInfo?.unitId) TrackManager.getInstance().addCashoutReq(currentDrawInfo?.unitId)
Handler(Looper.getMainLooper()).postDelayed({ Handler(Looper.getMainLooper()).postDelayed({
showToast("提现成功") showToast("发起提现成功")
}, 1000) }, 1000)
} }
Constant.CARRIERTYPE_REWARD_COIN -> { Constant.CARRIERTYPE_REWARD_COIN -> {
Handler(Looper.getMainLooper()).postDelayed({ Handler(Looper.getMainLooper()).postDelayed({
Handler(Looper.getMainLooper()).postDelayed({
ConsumerToastUtil.showAwardText(requireContext(), AppConfig.awardRedpkg, 0)
}, 800)
onFragmentResume() onFragmentResume()
}, 1000) }, 1000)
} }
Constant.CARRIERTYPE_REWARD_DI -> { Constant.CARRIERTYPE_REWARD_DI -> {
Handler(Looper.getMainLooper()).postDelayed({ Handler(Looper.getMainLooper()).postDelayed({
Handler(Looper.getMainLooper()).postDelayed({
ConsumerToastUtil.showAwardText(requireContext(), 0, AppConfig.awardYuanbao)
}, 800)
onFragmentResume() onFragmentResume()
}, 1000) }, 1000)
} }
......
...@@ -13,8 +13,13 @@ import com.duben.dayplaylet.R ...@@ -13,8 +13,13 @@ import com.duben.dayplaylet.R
object ConsumerToastUtil { object ConsumerToastUtil {
@JvmStatic @JvmStatic
fun showAwardText(context: Context?, redPkgInt: Int, yuanbaoInt: Int) { fun showAwardText(context: Context?, redPkgInt: Int, yuanbaoInt: Int) {
SoundPoolUtil.getInstance().getGoldVoice()
if (redPkgInt == 0 && yuanbaoInt == 0) return
if (context == null) return if (context == null) return
try { try {
val toastview = LayoutInflater.from(context).inflate(R.layout.toast_text_layout, null) val toastview = LayoutInflater.from(context).inflate(R.layout.toast_text_layout, null)
val ll_toast_redpkg = toastview.findViewById<View>(R.id.ll_toast_redpkg) as LinearLayout val ll_toast_redpkg = toastview.findViewById<View>(R.id.ll_toast_redpkg) as LinearLayout
......
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 SoundPoolUtil {
private static SoundPoolUtil soundPoolUtil;
private static Context context;
private SoundPool soundPool;
private MediaPlayer player;
//单例模式
public static SoundPoolUtil getInstance() {
SoundPoolUtil.context = MintsApplication.getContext();
if (soundPoolUtil == null)
soundPoolUtil = new SoundPoolUtil(context);
return soundPoolUtil;
}
@SuppressLint("NewApi")//这里初始化SoundPool的方法是安卓5.0以后提供的新方式
private SoundPoolUtil(Context context) {
soundPool = new SoundPool.Builder().build();
//加载音频文件
soundPool.load(context, R.raw.coin, 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 getGoldVoice() {
player = MediaPlayer.create(context, R.raw.coin);
if (player != null) {
player.start();
}
}
public void onDestory() {
if (player != null) {
player.stop();
player.release();
player = null;
}
}
}
...@@ -37,6 +37,7 @@ import com.duben.dayplaylet.ui.adapter.VideoEpisodeAdapter ...@@ -37,6 +37,7 @@ 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.utils.ForegroundOrBackground
import com.duben.dayplaylet.utils.FormatUtil import com.duben.dayplaylet.utils.FormatUtil
import com.duben.dayplaylet.utils.SoundPoolUtil
import com.duben.dayplaylet.utils.SpanUtils 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.*
...@@ -463,6 +464,7 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic ...@@ -463,6 +464,7 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
override fun reportAddCoinMsgSuc(coin: Int, di: Int) { override fun reportAddCoinMsgSuc(coin: Int, di: Int) {
cdvv.reset() cdvv.reset()
videoPresenter.rdVedioMsg() videoPresenter.rdVedioMsg()
SoundPoolUtil.getInstance().getGoldVoice()
showRewardAnim(coin, di) showRewardAnim(coin, di)
} }
......
...@@ -65,6 +65,14 @@ ...@@ -65,6 +65,14 @@
android:layout_marginEnd="18dp" /> android:layout_marginEnd="18dp" />
</FrameLayout> </FrameLayout>
<TextView
android:id="@+id/tv_nine_timer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textSize="13sp"
android:textColor="@color/white"></TextView>
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
...@@ -6,23 +6,28 @@ ...@@ -6,23 +6,28 @@
<ImageView <ImageView
android:id="@+id/app_logo" android:id="@+id/app_logo"
android:layout_width="100dp" android:layout_width="wrap_content"
android:layout_height="100dp" android:layout_height="wrap_content"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginTop="120dp" android:layout_marginTop="90dp"
android:src="@mipmap/ic_launcher_main" /> android:src="@mipmap/ic_launcher_main" />
<TextView <ImageView
android:id="@+id/iv_splash_title"
android:layout_below="@+id/app_logo" android:layout_below="@+id/app_logo"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginTop="40dp" android:layout_marginTop="30dp"
android:layout_height="wrap_content" android:src="@mipmap/ic_splash_top"
android:layout_above="@id/progressBar" android:layout_height="wrap_content"/>
android:text="@string/app_name"
android:textStyle="bold" <ImageView
android:textColor="@color/black" android:layout_below="@+id/iv_splash_title"
android:textSize="36sp" /> android:layout_width="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="90dp"
android:src="@mipmap/bg_splash_center"
android:layout_height="wrap_content"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
......
...@@ -6,23 +6,28 @@ ...@@ -6,23 +6,28 @@
<ImageView <ImageView
android:id="@+id/app_logo" android:id="@+id/app_logo"
android:layout_width="100dp" android:layout_width="wrap_content"
android:layout_height="100dp" android:layout_height="wrap_content"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginTop="120dp" android:layout_marginTop="90dp"
android:src="@mipmap/ic_launcher_main" /> android:src="@mipmap/ic_launcher_main" />
<TextView <ImageView
android:id="@+id/iv_splash_title"
android:layout_below="@+id/app_logo" android:layout_below="@+id/app_logo"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginTop="40dp" android:layout_marginTop="30dp"
android:layout_height="wrap_content" android:src="@mipmap/ic_splash_top"
android:layout_above="@id/progressBar" android:layout_height="wrap_content"/>
android:text="@string/app_name"
android:textStyle="bold" <ImageView
android:textColor="@color/black" android:layout_below="@+id/iv_splash_title"
android:textSize="36sp" /> android:layout_width="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="90dp"
android:src="@mipmap/bg_splash_center"
android:layout_height="wrap_content"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
......
...@@ -294,7 +294,7 @@ ...@@ -294,7 +294,7 @@
android:id="@+id/tv_task_count" android:id="@+id/tv_task_count"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="今日剩余10次" android:text="今日剩余-次"
android:textSize="12sp" android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@id/btn_task" app:layout_constraintEnd_toEndOf="@id/btn_task"
......
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