Commit 4bef18f9 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent 2cb786fe
......@@ -12,6 +12,7 @@ import com.duben.dayplaylet.mvp.model.BaseResponse
import com.duben.dayplaylet.utils.ToastUtil
import com.duben.library.net.neterror.BaseSubscriber
import com.duben.library.net.neterror.Throwable
import com.duben.library.utils.json.JsonUtil
import java.lang.ref.WeakReference
/**
......@@ -38,7 +39,9 @@ object AlipayAuthManager {
// 获取alipay_open_id,调支付时作为参数extern_token 的value
// 传入,则支付账户为该授权账户
UserManager.getInstance().alipaySet = true
println("mcg -->>>>> authinfo="+JsonUtil.toJson(authResult))
authListener?.authSuccess()
commitAlipayAutoInfo(JsonUtil.toJson(authResult))
} else {
// 其他状态值则为授权失败
authListener?.authFail(resultStatus)
......@@ -51,7 +54,7 @@ object AlipayAuthManager {
private fun commitAlipayAutoInfo(info: String) {
val vo = HashMap<String, Any>()
vo.put("", info)
vo.put("authInfo", info)
val baseApplication = MintsApplication.getContext() as MintsApplication
AppHttpManager.getInstance(baseApplication)
.call(baseApplication.loanService.cancelCollect(vo),
......@@ -72,17 +75,19 @@ object AlipayAuthManager {
fun authV2(activity: Activity, listener: AuthListener?) {
authListener = listener
val weakReference = WeakReference(activity)
val baseApplication = MintsApplication.getContext() as MintsApplication
AppHttpManager.getInstance(baseApplication)
.call(baseApplication.loanService.homeV1Types,
object : BaseSubscriber<BaseResponse<Any>>() {
override fun onError(e: Throwable) {
}
println("mcg -->>>>> 开始授权")
override fun onNext(t: BaseResponse<Any>) {
if (t.status == 200) {
// val baseApplication = MintsApplication.getContext() as MintsApplication
// AppHttpManager.getInstance(baseApplication)
// .call(baseApplication.loanService.homeV1Types,
// object : BaseSubscriber<BaseResponse<Any>>() {
// override fun onError(e: Throwable) {
//
// }
//
//
// override fun onNext(t: BaseResponse<Any>) {
// if (t.status == 200) {
val authInfo = ""
val authRunnable = Runnable { // 构造AuthTask 对象
val authTask = AuthTask(weakReference.get())
......@@ -97,11 +102,11 @@ object AlipayAuthManager {
// 必须异步调用
val authThread = Thread(authRunnable)
authThread.start()
} else {
ToastUtil.show(MintsApplication.getContext(), t.message)
}
}
})
// } else {
// ToastUtil.show(MintsApplication.getContext(), t.message)
// }
// }
// })
}
private var authListener: AuthListener? = null
......
......@@ -6,6 +6,8 @@ import android.os.Looper
import android.view.KeyEvent
import android.view.View
import android.widget.FrameLayout
import com.daimajia.androidanimations.library.Techniques
import com.daimajia.androidanimations.library.YoYo
import com.duben.dayplaylet.R
import com.duben.dayplaylet.ad.AdManager
import com.duben.dayplaylet.ad.AdStatusListener
......@@ -20,6 +22,7 @@ import com.duben.dayplaylet.utils.SpanUtils
import com.duben.dayplaylet.utils.UIUtils
import com.duben.library.utils.nodoubleclick.AntiShake
import kotlinx.android.synthetic.main.activity_task_award.*
import kotlinx.android.synthetic.main.dialog_sign.*
/**
* 个人中心-任务奖励
......@@ -46,6 +49,8 @@ class TaskAwardActivity : BaseActivity(), View.OnClickListener {
private var redPacketFlag = false
private var yuanbaoFlag = false
private var rope: YoYo.YoYoString? = null
override fun getContentViewLayoutID() = R.layout.activity_task_award
override fun isApplyKitKatTranslucency() = false
......@@ -97,6 +102,10 @@ class TaskAwardActivity : BaseActivity(), View.OnClickListener {
tv_award_yuanbao.text = "+${yuanbaoMore}"
initListener()
Handler().postDelayed({
rope = YoYo.with(Techniques.Pulse).duration(500).repeat(-1).playOn(iv_task_award_ad)
}, 300)
}
......@@ -122,6 +131,9 @@ class TaskAwardActivity : BaseActivity(), View.OnClickListener {
override fun onDestroy() {
super.onDestroy()
rope?.stop()
rope = null
}
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
......
......@@ -471,7 +471,6 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
}
override fun adClose(vo: HashMap<String, Any>?) {
println("mcg -->>>>> lili")
hideLoading()
adCloseNext(carrierType)
}
......@@ -479,7 +478,6 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
}
override fun adClose(vo: HashMap<String, Any>?) {
println("mcg -->>>>> waiwai")
adCloseNext(carrierType)
}
})
......
......@@ -2,7 +2,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 填充的颜色 -->
<solid android:color="#FEF9F5" />
<solid android:color="#feeddc" />
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners android:radius="10dip" />
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 填充的颜色 -->
<solid android:color="#FEF9F5" />
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners android:radius="10dip" />
</shape>
\ No newline at end of file
......@@ -56,7 +56,7 @@
android:layout_marginTop="20dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="20dp"
android:background="@drawable/shape_bg_task"
android:background="@drawable/shape_bg_task_progress"
android:padding="10dp">
<ImageView
......
......@@ -14,11 +14,11 @@
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/bg_task"
android:orientation="vertical">
<ImageView
android:layout_marginTop="10dp"
android:id="@+id/iv_award_quit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......@@ -30,7 +30,7 @@
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="100dp"
android:layout_marginTop="90dp"
android:layout_marginRight="20dp"
android:background="@drawable/shape_bg_task"
android:orientation="horizontal"
......
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