Commit e45337f9 authored by jyx's avatar jyx

代码优化

parent 8a4c3b5d
...@@ -32,6 +32,7 @@ import com.duben.dayplaylet.ad.AdManager ...@@ -32,6 +32,7 @@ import com.duben.dayplaylet.ad.AdManager
import com.duben.dayplaylet.ad.AdStatusListener import com.duben.dayplaylet.ad.AdStatusListener
import com.duben.dayplaylet.ad.NoPreAdManager import com.duben.dayplaylet.ad.NoPreAdManager
import com.duben.dayplaylet.ad.express.MyExpressManager import com.duben.dayplaylet.ad.express.MyExpressManager
import com.duben.dayplaylet.ad.half.HalfScreenManager
import com.duben.dayplaylet.common.AppConfig import com.duben.dayplaylet.common.AppConfig
import com.duben.dayplaylet.common.Constant import com.duben.dayplaylet.common.Constant
import com.duben.dayplaylet.manager.DPHolder import com.duben.dayplaylet.manager.DPHolder
...@@ -52,7 +53,13 @@ import com.duben.dayplaylet.utils.SpanUtils ...@@ -52,7 +53,13 @@ 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
import kotlinx.android.synthetic.main.drama_activity_api_detail.*
import kotlinx.android.synthetic.main.fragment_music.* import kotlinx.android.synthetic.main.fragment_music.*
import kotlinx.android.synthetic.main.fragment_music.cl_reward
import kotlinx.android.synthetic.main.fragment_music.iv_cash_reward
import kotlinx.android.synthetic.main.fragment_music.iv_gold_reward
import kotlinx.android.synthetic.main.fragment_music.tv_cash_reward
import kotlinx.android.synthetic.main.fragment_music.tv_gold_reward
import kotlinx.android.synthetic.main.layout_draw_header.* import kotlinx.android.synthetic.main.layout_draw_header.*
/** /**
...@@ -615,6 +622,10 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView, View.OnClickListener { ...@@ -615,6 +622,10 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView, View.OnClickListener {
mainHandler.postDelayed({ mainHandler.postDelayed({
addAnimation(iv_cash_reward, iv_cash) addAnimation(iv_cash_reward, iv_cash)
}, 800) }, 800)
mainHandler.postDelayed({
rope = null
rope = YoYo.with(Techniques.Pulse).duration(300).playOn(rl_cash)
}, 1000)
}, 100) }, 100)
} }
...@@ -634,8 +645,17 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView, View.OnClickListener { ...@@ -634,8 +645,17 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView, View.OnClickListener {
mainHandler.postDelayed({ mainHandler.postDelayed({
addAnimation(iv_gold_reward, iv_gold) addAnimation(iv_gold_reward, iv_gold)
}, 800) }, 800)
mainHandler.postDelayed({
rope = null
rope = YoYo.with(Techniques.Pulse).duration(300).playOn(rl_gold)
}, 1000)
}, 100) }, 100)
} }
mainHandler.postDelayed({
cl_reward.visibility = View.GONE
}, 1500)
} }
override fun reportAddCoinMsgSuc(coin: Int, di: Int) { override fun reportAddCoinMsgSuc(coin: Int, di: Int) {
......
...@@ -295,16 +295,17 @@ class RedpkgFragment : LazyLoadBaseFragment(), View.OnClickListener, RedpkgView ...@@ -295,16 +295,17 @@ class RedpkgFragment : LazyLoadBaseFragment(), View.OnClickListener, RedpkgView
} }
override fun rdHongbaoClickSuc(isCash: Boolean, cash: Double, unitId: String) { override fun rdHongbaoClickSuc(isCash: Boolean, cash: Double, unitId: String) {
if (!isCash) { val bundle = Bundle()
val bundle = Bundle() bundle.putString(LoadingActivity.TEXT, "正在为您发放奖励..")
bundle.putString(LoadingActivity.TEXT, "正在为您发放奖励..") readyGo(LoadingActivity::class.java, bundle)
readyGo(LoadingActivity::class.java, bundle) Handler(Looper.getMainLooper()).postDelayed({
Handler(Looper.getMainLooper()).postDelayed({ if (!isCash) {
awardVideo(Constant.CARRIERTYPE_REWARD_HONGBAO, cash) awardVideo(Constant.CARRIERTYPE_REWARD_HONGBAO, cash)
}, 2200) } else {
} else { awardVideo(Constant.CARRIERTYPE_FORCASH_HONGBAO, cash, unitId)
awardVideo(Constant.CARRIERTYPE_FORCASH_HONGBAO, cash, unitId) }
} }, 2200)
} }
override fun rdHongbaoClickFail() { override fun rdHongbaoClickFail() {
......
...@@ -66,7 +66,6 @@ public class CountDownVideoView extends LinearLayout { ...@@ -66,7 +66,6 @@ public class CountDownVideoView extends LinearLayout {
} }
public void resume() { public void resume() {
isOver = false;
cdCountVedioView.resume(); cdCountVedioView.resume();
} }
......
...@@ -15,6 +15,8 @@ import android.widget.ImageView ...@@ -15,6 +15,8 @@ import android.widget.ImageView
import android.widget.RelativeLayout import android.widget.RelativeLayout
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import com.bytedance.sdk.dp.* import com.bytedance.sdk.dp.*
import com.daimajia.androidanimations.library.Techniques
import com.daimajia.androidanimations.library.YoYo
import com.google.gson.Gson import com.google.gson.Gson
import com.duben.dayplaylet.R import com.duben.dayplaylet.R
import com.duben.dayplaylet.ad.AdManager import com.duben.dayplaylet.ad.AdManager
...@@ -54,6 +56,8 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic ...@@ -54,6 +56,8 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
var outerDrama: DPDrama? = null var outerDrama: DPDrama? = null
} }
private var rope: YoYo.YoYoString? = null
private val videoPresenter by lazy { VideoPresenter() } private val videoPresenter by lazy { VideoPresenter() }
private var dpWidget: IDPWidget? = null private var dpWidget: IDPWidget? = null
...@@ -431,7 +435,6 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic ...@@ -431,7 +435,6 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
cdvv.setTime(data.surplusSeconds) cdvv.setTime(data.surplusSeconds)
cdvv.start() cdvv.start()
cdvv.setCountDownVideoListener(this) cdvv.setCountDownVideoListener(this)
cl_red_box.isClickable = false
cl_red_box.setOnClickListener { cl_red_box.setOnClickListener {
if (!cdvv.isOver) return@setOnClickListener if (!cdvv.isOver) return@setOnClickListener
...@@ -449,7 +452,6 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic ...@@ -449,7 +452,6 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
} }
override fun onLoadingFinish() { override fun onLoadingFinish() {
cl_red_box.isClickable = true
tv_tips.visibility = View.VISIBLE tv_tips.visibility = View.VISIBLE
triangle.visibility = View.VISIBLE triangle.visibility = View.VISIBLE
} }
...@@ -512,8 +514,6 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic ...@@ -512,8 +514,6 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
super.onClick(dialog, v) super.onClick(dialog, v)
dialog?.dismiss() dialog?.dismiss()
showAd(Constant.CARRIERTYPE_VEDIO) showAd(Constant.CARRIERTYPE_VEDIO)
cl_red_box.isClickable = false
} }
} }
) )
...@@ -522,7 +522,7 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic ...@@ -522,7 +522,7 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
} }
private fun showAd(carrierType: String, drama: DPDrama? = null, widget: IDPWidget? = null) { private fun showAd(carrierType: String, drama: DPDrama? = null, widget: IDPWidget? = null) {
HalfScreenManager.getInstance().preLoadAd(this) // HalfScreenManager.getInstance().preLoadAd(this)
AdManager.instance.showAd(this@DramaApiDetailActivity, carrierType, AdManager.instance.showAd(this@DramaApiDetailActivity, carrierType,
object : AdStatusListener { object : AdStatusListener {
...@@ -645,8 +645,13 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic ...@@ -645,8 +645,13 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
addAnimation(iv_cash_reward, iv_cash) addAnimation(iv_cash_reward, iv_cash)
}, 800) }, 800)
}, 100) }, 100)
mainHandler.postDelayed({
rope = null
rope = YoYo.with(Techniques.Pulse).duration(300).playOn(rl_cash)
}, 1000)
} }
if (goldReward <= 0) { if (goldReward <= 0) {
iv_gold_reward.visibility = View.GONE iv_gold_reward.visibility = View.GONE
tv_gold_reward.visibility = View.GONE tv_gold_reward.visibility = View.GONE
...@@ -664,13 +669,17 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic ...@@ -664,13 +669,17 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
addAnimation(iv_gold_reward, iv_gold) addAnimation(iv_gold_reward, iv_gold)
}, 800) }, 800)
}, 100) }, 100)
mainHandler.postDelayed({
rope = null
rope = YoYo.with(Techniques.Pulse).duration(300).playOn(rl_gold)
}, 1000)
} }
HalfScreenManager.getInstance().preLoadAd(this) // HalfScreenManager.getInstance().preLoadAd(this)
mainHandler.postDelayed({ mainHandler.postDelayed({
cl_reward.visibility = View.GONE cl_reward.visibility = View.GONE
// 展示插屏 // 展示插屏
HalfScreenManager.getInstance().showAd(this, null) // HalfScreenManager.getInstance().showAd(this, null)
}, 1500) }, 1500)
} }
......
...@@ -56,7 +56,8 @@ ...@@ -56,7 +56,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom|end" android:layout_gravity="bottom|end"
android:layout_marginEnd="@dimen/dp_10" android:layout_marginEnd="@dimen/dp_10"
android:layout_marginBottom="260dp" /> android:layout_marginBottom="260dp"
android:visibility="gone" />
<ImageView <ImageView
android:id="@+id/iv_pause" android:id="@+id/iv_pause"
......
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_marginTop="160dp" android:layout_marginTop="160dp"
android:layout_marginEnd="15dp"> android:layout_marginEnd="15dp"
android:visibility="gone">
<ImageView <ImageView
android:id="@+id/iv_open_cash" android:id="@+id/iv_open_cash"
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
android:visibility="gone" /> android:visibility="gone" />
<RelativeLayout <RelativeLayout
android:id="@+id/rl_cash"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="42dp" android:layout_height="42dp"
android:layout_marginStart="16dp"> android:layout_marginStart="16dp">
...@@ -59,6 +60,7 @@ ...@@ -59,6 +60,7 @@
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/rl_gold"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="42dp" android:layout_height="42dp"
android:layout_gravity="end" android:layout_gravity="end"
......
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