Commit 09461390 authored by wangxuewei's avatar wangxuewei

[提交人]:王雪伟

[提交简述] :多多菜园1.0.2
[实现方案] :加入通知栏开关
加入收获领红包,替换ui
parent 578fa157
...@@ -35,6 +35,7 @@ import io.reactivex.Observable ...@@ -35,6 +35,7 @@ import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import org.jetbrains.anko.act import org.jetbrains.anko.act
import java.lang.reflect.Method import java.lang.reflect.Method
import kotlin.math.log
/** /**
* @author (wangXuewei) * @author (wangXuewei)
...@@ -331,6 +332,91 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback { ...@@ -331,6 +332,91 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
} }
} }
/**
* 点击底部拆红包看视频
*/
var flyBoxIsClick2 = true
fun adRedPackPlan() {
if (flyBoxIsClick2) {
flyBoxIsClick2 = false
AdManager.loadRewardVideoAd(
ADConfig.AD_REWARD_VIDIO,
this,
object : ZXADVideoListener {
override fun onFail() {
flyBoxIsClick2 = true
}
override fun onSuccess() {
flyBoxIsClick2 = true
}
override fun onError() {
flyBoxIsClick2 = true
}
override fun onRewardVideoCached() {
flyBoxIsClick2 = true
}
override fun setRewardAdInteractionListener() {
flyBoxIsClick2 = true
}
override fun onRewardVerify() {
flyBoxIsClick2 = true
}
override fun onVideoError() {
flyBoxIsClick2 = true
// showToponWaterVideo()
}
override fun onRewardVideoAdLoad() {
flyBoxIsClick2 = true
}
override fun onRewardVideoAdLoad(entity: NewsEntity) {
flyBoxIsClick2 = true
}
override fun onAdShow() {
flyBoxIsClick2 = true
}
override fun onAdVideoBarClick(newsEntity: NewsEntity) {
flyBoxIsClick2 = true
}
override fun onAdClose() {
flyBoxIsClick2 = true
//看视频上报
getVideoAcceleratorsReceive();
getRedPackPlanReceive();
}
override fun onVideoComplete() {
flyBoxIsClick2 = true
}
override fun onSkippedVideo() {
flyBoxIsClick2 = true
}
override fun onFullScreenVideoCached() {
flyBoxIsClick2 = true
}
override fun onLoadVideoAd(rewardVideoAD: ZXADRewardVideo) {
flyBoxIsClick2 = true
}
})
}
}
/** /**
* 获取首页信息 * 获取首页信息
*/ */
...@@ -512,7 +598,13 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback { ...@@ -512,7 +598,13 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
// "总共获得奖励+${result.rewardContentList[0].totalRewardNum / 100.toDouble()}元"; // "总共获得奖励+${result.rewardContentList[0].totalRewardNum / 100.toDouble()}元";
// ToastUtil.showImageToas(act, allMoneyNum) // ToastUtil.showImageToas(act, allMoneyNum)
callUnity("RedPackList", "redPackListDataUpdate", "") callUnity("RedPackList", "redPackListDataUpdate", "")
MainDialog.showgetWaterDrop(act, 4, "签到", result.rewardContentList[0].totalRewardNum, null) MainDialog.showgetWaterDrop(
act,
4,
"签到",
result.rewardContentList[0].totalRewardNum,
null
)
} }
} }
...@@ -1017,6 +1109,32 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback { ...@@ -1017,6 +1109,32 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
}) })
} }
fun getRedPackPlanReceive() {
GameApiClient.gameApi.getOpenPlantBox()
.compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<FlyBoxEntity>() {
override fun onSuccess(result: FlyBoxEntity?) {
Log.d("wxw", "底部拆红包" + Utils.obj2Str(result))
if (result != null) {
var type = result.type
if (type != null) {
MainDialog.showopenBox(
this@GameActivity, type,
"拆红包",
result.awardNum ?: 0,
result,
this@GameActivity
)
}
}
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
Log.d("wxw", "底部拆红包 error")
}
})
}
fun GameEvent(keyName: String, valueName: String) { fun GameEvent(keyName: String, valueName: String) {
EventUtils.onEvent(keyName, valueName); EventUtils.onEvent(keyName, valueName);
......
package com.ym.game.adapter package com.ym.game.adapter
import android.animation.AnimatorSet
import android.animation.ObjectAnimator
import android.content.Context import android.content.Context
import android.text.Html import android.text.Html
import android.text.TextUtils import android.text.TextUtils
...@@ -11,6 +13,8 @@ import android.widget.ImageView ...@@ -11,6 +13,8 @@ import android.widget.ImageView
import android.widget.ProgressBar import android.widget.ProgressBar
import android.widget.TextView import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.ym.ddcy.R
import com.ym.game.module.ExchangeEntity
import com.ym.game.module.WithDrawEntity import com.ym.game.module.WithDrawEntity
import com.ym.game.net.GameApiClient import com.ym.game.net.GameApiClient
import com.ym.game.view.MainDialog import com.ym.game.view.MainDialog
...@@ -20,11 +24,8 @@ import com.ym.library.net.BaseObserver ...@@ -20,11 +24,8 @@ import com.ym.library.net.BaseObserver
import com.ym.library.net.RxSchedulers import com.ym.library.net.RxSchedulers
import com.ym.library.rxbus.RxBusConstant import com.ym.library.rxbus.RxBusConstant
import com.ym.library.rxbus.RxBusUtil import com.ym.library.rxbus.RxBusUtil
import com.ym.library.utils.LogUtils
import com.ym.library.utils.Utils
import com.ym.ddcy.R
import com.ym.game.module.ExchangeEntity
import com.ym.library.utils.EventUtils import com.ym.library.utils.EventUtils
import com.ym.library.utils.Utils
class CashExchangeAdapter : class CashExchangeAdapter :
BaseRecyclerAdapter<WithDrawEntity.WdList, CashExchangeAdapter.ViewHolder> { BaseRecyclerAdapter<WithDrawEntity.WdList, CashExchangeAdapter.ViewHolder> {
...@@ -53,6 +54,11 @@ class CashExchangeAdapter : ...@@ -53,6 +54,11 @@ class CashExchangeAdapter :
holder.item_progress?.max = bean.targetNum!! holder.item_progress?.max = bean.targetNum!!
holder.item_progress?.setProgress(bean.completeNum!!) holder.item_progress?.setProgress(bean.completeNum!!)
holder.item_jindu?.text = "${bean.completeNum}/${bean.targetNum}" holder.item_jindu?.text = "${bean.completeNum}/${bean.targetNum}"
if (position==1&&bean.type == 1){
if (holder.item_duihuan != null) {
initShotAnim(holder.item_duihuan!!)
}
}
holder.item_duihuan?.setOnClickListener { holder.item_duihuan?.setOnClickListener {
if (Utils.isFastClick2()) { if (Utils.isFastClick2()) {
duihuan(bean.id, bean.type!!, bean.cash) duihuan(bean.id, bean.type!!, bean.cash)
...@@ -196,6 +202,18 @@ class CashExchangeAdapter : ...@@ -196,6 +202,18 @@ class CashExchangeAdapter :
this.onTouchEvent(event) this.onTouchEvent(event)
} }
} }
var animatorSet :AnimatorSet?=null
private fun initShotAnim(iv: ImageView) {
animatorSet = AnimatorSet()
val animatorX: ObjectAnimator = ObjectAnimator.ofFloat(iv, "scaleX", 1f, 0.8f, 1f)
val animatorY: ObjectAnimator = ObjectAnimator.ofFloat(iv, "scaleY", 1f, 0.8f, 1f)
animatorX.setRepeatCount(-1)
animatorY.setRepeatCount(-1)
animatorSet?.play(animatorX)?.with(animatorY)
animatorSet?.setDuration(600)?.start()
}
// private fun stopAnimation(iv: ImageView){
//
// }
} }
\ No newline at end of file
...@@ -24,6 +24,15 @@ public class HomeInfoEntity { ...@@ -24,6 +24,15 @@ public class HomeInfoEntity {
private int boxNum; private int boxNum;
private int acceleratorsNum; private int acceleratorsNum;
private String imgUrl; private String imgUrl;
private int plantBoxNum;
public int getPlantBoxNum() {
return plantBoxNum;
}
public void setPlantBoxNum(int plantBoxNum) {
this.plantBoxNum = plantBoxNum;
}
public String getImgUrl() { public String getImgUrl() {
return imgUrl; return imgUrl;
......
...@@ -153,6 +153,15 @@ interface IGameApi { ...@@ -153,6 +153,15 @@ interface IGameApi {
@POST(NetConfig.Game.URL_GAME_OPEN_BOX) @POST(NetConfig.Game.URL_GAME_OPEN_BOX)
fun getopenBox(): Observable<Response<FlyBoxEntity>> fun getopenBox(): Observable<Response<FlyBoxEntity>>
/**
* 底部拆红包奖励
* @param
* @paramq
* @return
*/
@POST(NetConfig.Game.URL_GAME_OPEN_PLANT_BOX)
fun getOpenPlantBox(): Observable<Response<FlyBoxEntity>>
/** /**
* 看视频上报 * 看视频上报
* @param * @param
......
...@@ -59,13 +59,13 @@ ...@@ -59,13 +59,13 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10" android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="20dp"> android:layout_marginRight="15dp">
<ProgressBar <ProgressBar
android:id="@+id/progess_with_draw_item" android:id="@+id/progess_with_draw_item"
style="?android:attr/progressBarStyleHorizontal" style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="12dp" android:layout_height="15dp"
android:progressDrawable="@drawable/user_progressbar_bg" /> android:progressDrawable="@drawable/user_progressbar_bg" />
<TextView <TextView
...@@ -73,9 +73,9 @@ ...@@ -73,9 +73,9 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerInParent="true" android:layout_centerInParent="true"
android:layout_marginBottom="-3dp" android:layout_marginBottom="-6dp"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="10sp" /> android:textSize="15sp" />
</RelativeLayout> </RelativeLayout>
</LinearLayout> </LinearLayout>
......
...@@ -554,7 +554,7 @@ object AdManager { ...@@ -554,7 +554,7 @@ object AdManager {
override fun onAdFail() { override fun onAdFail() {
Log.d(TAG, "onAdFail totalEntity.size" + totalEntity.size) Log.d(TAG, "onAdFail totalEntity.size" + totalEntity.size)
AdCache.rewardList.put(slotName, totalEntity)
if (totalEntity.size > 0) { if (totalEntity.size > 0) {
var newsEntitys = totalEntity[0] var newsEntitys = totalEntity[0]
loadVideoAd(mActivity, newsEntitys, listener, this) loadVideoAd(mActivity, newsEntitys, listener, this)
...@@ -566,6 +566,7 @@ object AdManager { ...@@ -566,6 +566,7 @@ object AdManager {
loadVideoAd(mActivity, totalEntity[0], listener, callback) loadVideoAd(mActivity, totalEntity[0], listener, callback)
totalEntity.removeAt(0) totalEntity.removeAt(0)
AdCache.rewardList.put(slotName, totalEntity)
listener.onSuccess() listener.onSuccess()
} }
......
...@@ -469,6 +469,7 @@ object TTADUtils { ...@@ -469,6 +469,7 @@ object TTADUtils {
override fun onError(code: Int, message: String) { override fun onError(code: Int, message: String) {
EventUtils.onEventPullFail(entity) EventUtils.onEventPullFail(entity)
listener.onError() listener.onError()
Log.e("huang",code.toString()+" "+message +entity.codeId+" "+entity.codeAppId)
callback.onAdFail() callback.onAdFail()
} }
......
...@@ -226,6 +226,7 @@ public class KSADUtils { ...@@ -226,6 +226,7 @@ public class KSADUtils {
Log.d(TAG, (System.currentTimeMillis() - startTime) + ""); Log.d(TAG, (System.currentTimeMillis() - startTime) + "");
if (System.currentTimeMillis() - startTime > 7000) { if (System.currentTimeMillis() - startTime > 7000) {
listener.onVideoError(); listener.onVideoError();
callback.onAdFail();
removeCallbacksAndMessages(null); removeCallbacksAndMessages(null);
return; return;
} }
......
...@@ -251,6 +251,7 @@ public class NetConfig { ...@@ -251,6 +251,7 @@ public class NetConfig {
public static final String URL_GAME_CLOUD_CHECK = "app/v1/game/farm/cloud_check";//云朵加速判断 public static final String URL_GAME_CLOUD_CHECK = "app/v1/game/farm/cloud_check";//云朵加速判断
public static final String URL_GAME_OPEN_PLANT_BOX = "app/v1/game/ddcy/open_plant_box";//底部拆红包
} }
} }
...@@ -105,7 +105,7 @@ public class WxImplUtils implements UMAuthListener { ...@@ -105,7 +105,7 @@ public class WxImplUtils implements UMAuthListener {
str = errorMsg; str = errorMsg;
mLoading.setResult(false, str, 1000); mLoading.setResult(false, str, 1000);
mLoading.dismiss(); mLoading.dismiss();
mCallback.onWxFail(errorMsg); // mCallback.onWxFail(errorMsg);
} else if (TextUtils.equals("106", code)) { } else if (TextUtils.equals("106", code)) {
str = errorMsg; str = errorMsg;
Constant.Param.uid = ""; Constant.Param.uid = "";
...@@ -114,8 +114,9 @@ public class WxImplUtils implements UMAuthListener { ...@@ -114,8 +114,9 @@ public class WxImplUtils implements UMAuthListener {
SettingPreference.saveUserInfo(null); SettingPreference.saveUserInfo(null);
mLoading.setResult(false, str, 1000); mLoading.setResult(false, str, 1000);
mLoading.dismiss(); mLoading.dismiss();
mCallback.onWxFail(errorMsg); // mCallback.onWxFail(errorMsg);
} }
mCallback.onWxFail(errorMsg);
} }
}); });
} }
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<clip> <clip>
<shape> <shape>
<corners android:radius="8dp" /> <corners android:radius="8dp" />
<solid android:color="#E85740" /> <solid android:color="#94CA46" />
</shape> </shape>
</clip> </clip>
</item> </item>
......
...@@ -173,7 +173,7 @@ ...@@ -173,7 +173,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:button="@drawable/checkbox_style" android:button="@drawable/checkbox_style"
android:checked="true" /> android:checked="false" />
</LinearLayout> </LinearLayout>
......
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