Commit 8f8a2771 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent ebc92009
......@@ -158,6 +158,7 @@
<activity
android:name=".ui.activitys.NineActivity"
android:exported="false"
android:launchMode="singleTask"
android:theme="@style/TransparentTheme" />
<activity
android:name=".ui.activitys.SongAwardActivity"
......
......@@ -19,7 +19,7 @@ import kotlinx.android.synthetic.main.activity_hint.*
/**
* 描述:提示
* 作者:孟崔广
* 时间:2021/12/13 14:05
* 时间:2023/9/13 14:05
*/
class HintActivity : BaseActivity(), View.OnClickListener {
......@@ -158,14 +158,18 @@ class HintActivity : BaseActivity(), View.OnClickListener {
startActivity(intent)
} catch (e: java.lang.Exception) {
try {
val componentName = ComponentName("com.android.settings", "com.android.settings.DevelopmentSettings")
val componentName = ComponentName(
"com.android.settings",
"com.android.settings.DevelopmentSettings"
)
val intent = Intent()
intent.component = componentName
intent.action = "android.intent.action.View"
startActivity(intent)
} catch (e1: java.lang.Exception) {
try {
val intent = Intent("com.android.settings.APPLICATION_DEVELOPMENT_SETTINGS") //部分小米手机采用这种方式跳转
val intent =
Intent("com.android.settings.APPLICATION_DEVELOPMENT_SETTINGS") //部分小米手机采用这种方式跳转
startActivity(intent)
} catch (e2: java.lang.Exception) {
}
......
......@@ -21,9 +21,12 @@ import com.duben.dayplaylet.manager.UserManager
import com.duben.dayplaylet.ui.activitys.base.BaseActivity
import com.duben.dayplaylet.ui.widgets.DialogListener
import com.duben.dayplaylet.ui.widgets.WithDrawSucDialog
import com.duben.dayplaylet.ui.widgets.countdowntimer.CountDownTimerSupport
import com.duben.dayplaylet.ui.widgets.countdowntimer.OnCountDownTimerListener
import com.duben.dayplaylet.utils.rxutil.CommonRxTask
import com.duben.dayplaylet.utils.rxutil.RxjavaUtil
import com.duben.library.utils.nodoubleclick.AntiShake
import kotlinx.android.synthetic.main.activity_hint.*
import kotlinx.android.synthetic.main.activity_nine.*
/**
......@@ -40,6 +43,7 @@ class NineActivity : BaseActivity(), View.OnClickListener {
private var mWithDrawSucDialog: WithDrawSucDialog? = null
var drawId = ""
var cash = ""
var isClickFlag = false
override fun getContentViewLayoutID() = R.layout.activity_nine
......@@ -60,6 +64,7 @@ class NineActivity : BaseActivity(), View.OnClickListener {
override fun initViewsAndEvents() {
initListener()
playFingerAnim(finger_view)
startTimer()
}
private fun initListener() {
......@@ -72,6 +77,12 @@ class NineActivity : BaseActivity(), View.OnClickListener {
overridePendingTransition(0, R.anim.scale_out)
}
override fun onDestroy() {
super.onDestroy()
stopTimer()
}
override fun onClick(v: View) {
if (AntiShake.check(v.id)) return
......@@ -80,6 +91,8 @@ class NineActivity : BaseActivity(), View.OnClickListener {
finish()
}
R.id.iv_nine_next -> {
isClickFlag = true
if (!UserManager.getInstance().alipaySet) {
// 去授权
showToast("发起支付宝授权..")
......@@ -214,4 +227,57 @@ class NineActivity : BaseActivity(), View.OnClickListener {
}
view.setImageDrawable(lottieDrawable)
}
private var mTimer: CountDownTimerSupport? = null
fun stopTimer() {
if (mTimer != null) {
mTimer!!.stop()
mTimer = null
}
}
private fun startTimer() {
try {
// 延迟跳转
stopTimer()
mTimer = CountDownTimerSupport(3000L, 1000L)
mTimer?.setOnCountDownTimerListener(object : OnCountDownTimerListener {
override fun onTick(millisUntilFinished: Long) {
if (!this@NineActivity.isFinishing) {
}
}
override fun onFinish() {
if (!this@NineActivity.isFinishing) {
if (isClickFlag) return
if (!UserManager.getInstance().alipaySet) {
// 去授权
showToast("发起支付宝授权..")
AlipayAuthManager.authV2(this@NineActivity,
object : AlipayAuthManager.AuthListener {
override fun authSuccess() {
showToast("支付宝授权成功")
}
override fun authFail(resultStatus: String) {
showToast("支付宝授权失败 " + resultStatus)
}
})
return
}
HalfScreenManager.getInstance().preLoadAd(this@NineActivity)
showAd(Constant.CARRIERTYPE_SING_OVER)
}
}
})
mTimer?.start()
} catch (e: Exception) {
e.printStackTrace()
}
}
}
\ No newline at end of file
......@@ -82,6 +82,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
private var isSignDrawFlag = false // 签到2次打款 用户主动取消流程结束
private var isShowSignFlag = false
private var isShowNewuserFlag = false
private var isNoSignFlag = false
// 新人红包
var newcomerDialog: NewcomerDialog? = null
......@@ -315,6 +316,10 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
}
if (signMsg == null) {
iv_main_sign.visibility = View.GONE
if (!isNoSignFlag) {
isNoSignFlag = true
HalfScreenManager.getInstance().showAd(requireActivity(), null)
}
} else {
iv_main_sign.visibility = View.VISIBLE
tv_main_signcash.text = "${signMsg!!.sumCash}元"
......
......@@ -565,6 +565,13 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView, View.OnClickListener {
pb_open_cash.progress = it.completeCount
if (it.completeCount >= it.turnNeedCount) {
tv_open_cash_info.visibility = View.GONE
Handler(Looper.getMainLooper()).postDelayed({
val bundle = Bundle()
bundle.putString(NineActivity.DRAW_ID, it.unitId)
bundle.putString(NineActivity.CASH, it.cash)
readyGo(NineActivity::class.java, bundle)
}, 800)
} else {
tv_open_cash_info.visibility = View.VISIBLE
tv_open_cash_info.text = SpanUtils()
......
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