Commit 3b54e39d authored by maxiaoliang's avatar maxiaoliang

修改加速剂任务

parent 1baa60fa
package com.ym.game.adapter
import android.animation.ObjectAnimator
import android.animation.ValueAnimator
import android.app.Activity
import android.text.TextUtils
import android.view.LayoutInflater
......@@ -19,6 +21,7 @@ import com.ym.library.utils.LogUtils
import com.ym.library.utils.Utils
import com.ym.ddcy.R
import com.ym.library.module.NewsEntity
import com.ym.library.module.TaskCompleteEntity
import com.ym.library.module.WateringTaskEntity
import com.ym.library.net.GameApiClient
import com.ym.library.utils.EventUtils
......@@ -60,6 +63,17 @@ class SpeedWaterTaskAdapter :
// holder.btnProgess.setProgress(data.current_nums!!)
holder.tvProgess.text = "${data.current_nums}/${data.awardLimit}"
}
if (data?.adRenderStyle != null && data?.adRenderStyle == 1) {
holder?.rlbg.setBackgroundResource(R.drawable.withdraw_bg)
} else if (data?.adRenderStyle != null && data?.adRenderStyle == 3) {
holder?.rlbg.setBackgroundResource(R.drawable.icon_luck_task)
}
if (data?.buttonSway != null && data?.buttonSway == 1) {
startAnimator(holder?.ivStatus)
} else {
holder?.ivStatus.clearAnimation()
}
// holder.tvCount.text = "+${data.awardNum}"
// holder.imgspeed.setImageResource(R.mipmap.icon_speed_get)
// if (data.subTitle != null) {
......@@ -74,7 +88,7 @@ class SpeedWaterTaskAdapter :
when (data.status) {
0 ->{
EventUtils.onEvent("jiasu_renwu_undone_click_"+mList[position].sid, "金币任务去完成点击")
EventUtils.onEvent("jiasu_renwu_undone_click_"+mList[position].sid, "加速剂任务去完成点击")
listener.onItemClick(it, position, mList[position])
}
......@@ -85,6 +99,10 @@ class SpeedWaterTaskAdapter :
}
//领取
2 ->{
if (mList[position].opentype == 1) {
EventUtils.onEvent("jiasu_done_click_total","加速剂任务视频领取点击")
}
EventUtils.onEvent("jiasu_done_click_"+mList[position].sid, "加速剂任务领取点击")
getDripTaskReceive( data.sid!!,data)
}
......@@ -125,26 +143,54 @@ class SpeedWaterTaskAdapter :
val ivStatus: ImageView = itemView.findViewById(R.id.tv_watering_item_status)
val imgspeed: ImageView = itemView.findViewById(R.id.img_icon_item)
val layoutRoot: LinearLayout = itemView.findViewById(R.id.layout_watering_root)
val rlbg: RelativeLayout = itemView.findViewById(R.id.ll_one)
}
// 领取水滴 type:1每日领水 2高额领水
private fun getDripTaskReceive(sid: Int, data: NewsEntity) {
GameApiClient.gameApi.getAcceleTask(sid).compose(
RxSchedulers.observableIO2Main()
).subscribe(object : BaseObserver<Any>() {
override fun onSuccess(result: Any?) {
).subscribe(object : BaseObserver<TaskCompleteEntity>() {
override fun onSuccess(result: TaskCompleteEntity?) {
RxBusUtil.getDefault()
.send(RxBusConstant.RX_SPEED_WATER_TASK_LIST)
if (result != null) {
MainDialog.showgetWaterDrop(mContext, 5, "task_accelerator", data.awardCoins!!, null)
MainDialog.showgetWaterDrop(mContext, 5, "task_accelerator", result.awardCoins!!, null)
}
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {}
})
}
private var animatorList: MutableList<ObjectAnimator> = ArrayList()
private var viewList: MutableList<View> = ArrayList()
private fun startAnimator(view: View) {
val oa: ObjectAnimator = ObjectAnimator.ofFloat(
view,
View.ROTATION,
0F, 8F, -8F, 0F, 0F, 0F, 0F, 0F, 0F
)
oa.repeatCount = ValueAnimator.INFINITE
oa.setDuration(1000).start()
animatorList.add(oa)
viewList.add(view)
}
fun clearAnimation() {
if (animatorList.size > 0) {
for (animator in animatorList) {
animator?.cancel()
}
animatorList.clear()
}
if (viewList.size > 0) {
for (view in viewList) {
view?.clearAnimation()
}
viewList.clear()
}
}
/**
* 添加点击缩放效果
*/
......
......@@ -59,9 +59,9 @@ class WateringTaskAdpater :
holder.tvCount.text = "+${data.coins}"
holder.llnum.gravity=Gravity.CENTER
}
if (data?.adRenderStyle != null && data?.adRenderStyle == 3) {
if (data?.adRenderStyle != null && data?.adRenderStyle == 1) {
holder?.rlbg.setBackgroundResource(R.drawable.withdraw_bg)
} else if (data?.adRenderStyle != null && data?.adRenderStyle == 1) {
} else if (data?.adRenderStyle != null && data?.adRenderStyle == 3) {
holder?.rlbg.setBackgroundResource(R.drawable.icon_luck_task)
}
......
......@@ -13,5 +13,6 @@ class SpeedWaterContract {
interface Presenter {
fun getAcceleratorsTask()
fun getTaskComplete(sid: Int)
}
}
\ No newline at end of file
package com.ym.game.presenter
import com.ym.game.contract.SpeedWaterContract
import com.ym.library.module.NewsEntity
import com.ym.library.module.TaskListEntity
import com.ym.library.module.WateringTaskEntity
import com.ym.library.net.BaseObserver
......@@ -39,4 +40,19 @@ class SpeedWaterPresenter : SpeedWaterContract.Presenter {
}
})
}
override fun getTaskComplete(sid: Int) {
GameApiClient.gameApi.getTaskCompleteReport(sid).compose(
RxSchedulers.observableIO2Main()
).subscribe(object : BaseObserver<NewsEntity>() {
override fun onSuccess(result: NewsEntity?) {
getAcceleratorsTask()
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
getAcceleratorsTask()
}
})
}
}
\ No newline at end of file
......@@ -179,7 +179,7 @@ class SiginDropsPopupwindow : PopupWindow(), WateringRewardContract.View,
fun showAd(sId: Int) {
AdUtils.playRewardAd(mContext as Activity, "home_task", object : IAdVideoListener {
override fun onAdClose() {
// mPresenter?.getTaskComplete(sId)
// mPresenter?.getTaskComplete(sId)
wateringTaskAdpater?.getDripTaskReceive(1,sId)
}
......
......@@ -102,7 +102,7 @@ class SpeedWaterPopupWindow : PopupWindow(), SpeedWaterContract.View,
if (data.sid != null) {
// EventUtils.onEvent("welfare_task_undone_click", "${data.sid}")
showAd(data.sid)
EventUtils.onEvent("renwu_undone_click_total")
EventUtils.onEvent("jiasu_undone_click_total")
}
else {
JumpUtils.adJump(data, mContext)
......@@ -151,9 +151,9 @@ class SpeedWaterPopupWindow : PopupWindow(), SpeedWaterContract.View,
}
}
fun showAd(sId: Int) {
AdUtils.playRewardAd(mContext as Activity, "home_task", object : IAdVideoListener {
AdUtils.playRewardAd(mContext as Activity, "speed_water_task", object : IAdVideoListener {
override fun onAdClose() {
// mPresenter?.getTaskComplete(sId)
mPresenter?.getTaskComplete(sId)
}
......
......@@ -21,11 +21,11 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_13"
android:layout_marginTop="@dimen/dp_12"
android:layout_marginTop="@dimen/dp_24"
android:includeFontPadding="false"
android:text="浇水10次"
android:textColor="#642D2D"
android:textSize="20sp"
android:textSize="@dimen/sp_16"
android:textStyle="bold"/>
......@@ -38,17 +38,17 @@
android:layout_marginTop="@dimen/dp_10"
android:includeFontPadding="false"
android:textColor="#8F6E42"
android:textSize="16sp"
android:textSize="13sp"
tools:text="10/10" />
<LinearLayout
android:id="@+id/id_ll_right"
android:layout_width="wrap_content"
android:layout_width="@dimen/dp_100"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="@dimen/dp_2"
android:layout_marginRight="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_8"
android:layout_marginRight="@dimen/dp_8"
android:gravity="center">
<ImageView
......@@ -74,9 +74,9 @@
android:layout_height="wrap_content"
android:layout_below="@+id/id_ll_right"
android:layout_alignParentRight="true"
android:layout_marginTop="@dimen/dp_2"
android:layout_marginTop="@dimen/dp_6"
android:layout_marginRight="@dimen/dp_13"
android:layout_marginBottom="@dimen/dp_4"
android:layout_marginBottom="@dimen/dp_9"
android:src="@mipmap/icon_mian_popup_complete" />
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
......@@ -19,7 +19,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_13"
android:layout_marginTop="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_24"
android:includeFontPadding="false"
android:text="浇水10次"
android:textColor="#642D2D"
......@@ -29,7 +29,7 @@
<LinearLayout
android:id="@+id/layout_watering_progress"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_32"
android:layout_height="@dimen/dp_28"
android:layout_below="@+id/tv_watering_item_title"
android:layout_marginLeft="@dimen/dp_13"
android:gravity="center">
......
......@@ -26,9 +26,11 @@
<dimen name="dp_21">21dp</dimen>
<dimen name="dp_22">22dp</dimen>
<dimen name="dp_23">23dp</dimen>
<dimen name="dp_24">24dp</dimen>
<dimen name="dp_25">25dp</dimen>
<dimen name="dp_26">26dp</dimen>
<dimen name="dp_27">27dp</dimen>
<dimen name="dp_28">28dp</dimen>
<dimen name="dp_29">29dp</dimen>
<dimen name="dp_30">30dp</dimen>
<dimen name="dp_32">32dp</dimen>
......
......@@ -191,7 +191,7 @@ interface IGameApi {
* @return
*/
@POST(NetConfig.Game.URL_GAME_ACCELERATORS_TASK_RECEIVE)
fun getAcceleTask(@Query("id") id: Int): Observable<Response<Any>>
fun getAcceleTask(@Query("id") id: Int): Observable<Response<TaskCompleteEntity>>
/**
* 排行榜领取
......
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