Commit 09461390 authored by wangxuewei's avatar wangxuewei

[提交人]:王雪伟

[提交简述] :多多菜园1.0.2
[实现方案] :加入通知栏开关
加入收获领红包,替换ui
parent 578fa157
......@@ -35,6 +35,7 @@ import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import org.jetbrains.anko.act
import java.lang.reflect.Method
import kotlin.math.log
/**
* @author (wangXuewei)
......@@ -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 {
// "总共获得奖励+${result.rewardContentList[0].totalRewardNum / 100.toDouble()}元";
// ToastUtil.showImageToas(act, allMoneyNum)
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 {
})
}
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) {
EventUtils.onEvent(keyName, valueName);
......
package com.ym.game.adapter
import android.animation.AnimatorSet
import android.animation.ObjectAnimator
import android.content.Context
import android.text.Html
import android.text.TextUtils
......@@ -11,6 +13,8 @@ import android.widget.ImageView
import android.widget.ProgressBar
import android.widget.TextView
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.net.GameApiClient
import com.ym.game.view.MainDialog
......@@ -20,11 +24,8 @@ import com.ym.library.net.BaseObserver
import com.ym.library.net.RxSchedulers
import com.ym.library.rxbus.RxBusConstant
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.Utils
class CashExchangeAdapter :
BaseRecyclerAdapter<WithDrawEntity.WdList, CashExchangeAdapter.ViewHolder> {
......@@ -53,6 +54,11 @@ class CashExchangeAdapter :
holder.item_progress?.max = bean.targetNum!!
holder.item_progress?.setProgress(bean.completeNum!!)
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 {
if (Utils.isFastClick2()) {
duihuan(bean.id, bean.type!!, bean.cash)
......@@ -196,6 +202,18 @@ class CashExchangeAdapter :
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 {
private int boxNum;
private int acceleratorsNum;
private String imgUrl;
private int plantBoxNum;
public int getPlantBoxNum() {
return plantBoxNum;
}
public void setPlantBoxNum(int plantBoxNum) {
this.plantBoxNum = plantBoxNum;
}
public String getImgUrl() {
return imgUrl;
......
......@@ -153,6 +153,15 @@ interface IGameApi {
@POST(NetConfig.Game.URL_GAME_OPEN_BOX)
fun getopenBox(): Observable<Response<FlyBoxEntity>>
/**
* 底部拆红包奖励
* @param
* @paramq
* @return
*/
@POST(NetConfig.Game.URL_GAME_OPEN_PLANT_BOX)
fun getOpenPlantBox(): Observable<Response<FlyBoxEntity>>
/**
* 看视频上报
* @param
......
......@@ -59,13 +59,13 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="20dp">
android:layout_marginRight="15dp">
<ProgressBar
android:id="@+id/progess_with_draw_item"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="12dp"
android:layout_height="15dp"
android:progressDrawable="@drawable/user_progressbar_bg" />
<TextView
......@@ -73,9 +73,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginBottom="-3dp"
android:layout_marginBottom="-6dp"
android:textColor="@color/white"
android:textSize="10sp" />
android:textSize="15sp" />
</RelativeLayout>
</LinearLayout>
......
......@@ -554,7 +554,7 @@ object AdManager {
override fun onAdFail() {
Log.d(TAG, "onAdFail totalEntity.size" + totalEntity.size)
AdCache.rewardList.put(slotName, totalEntity)
if (totalEntity.size > 0) {
var newsEntitys = totalEntity[0]
loadVideoAd(mActivity, newsEntitys, listener, this)
......@@ -566,6 +566,7 @@ object AdManager {
loadVideoAd(mActivity, totalEntity[0], listener, callback)
totalEntity.removeAt(0)
AdCache.rewardList.put(slotName, totalEntity)
listener.onSuccess()
}
......
......@@ -469,6 +469,7 @@ object TTADUtils {
override fun onError(code: Int, message: String) {
EventUtils.onEventPullFail(entity)
listener.onError()
Log.e("huang",code.toString()+" "+message +entity.codeId+" "+entity.codeAppId)
callback.onAdFail()
}
......
......@@ -226,6 +226,7 @@ public class KSADUtils {
Log.d(TAG, (System.currentTimeMillis() - startTime) + "");
if (System.currentTimeMillis() - startTime > 7000) {
listener.onVideoError();
callback.onAdFail();
removeCallbacksAndMessages(null);
return;
}
......
......@@ -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_OPEN_PLANT_BOX = "app/v1/game/ddcy/open_plant_box";//底部拆红包
}
}
......@@ -105,7 +105,7 @@ public class WxImplUtils implements UMAuthListener {
str = errorMsg;
mLoading.setResult(false, str, 1000);
mLoading.dismiss();
mCallback.onWxFail(errorMsg);
// mCallback.onWxFail(errorMsg);
} else if (TextUtils.equals("106", code)) {
str = errorMsg;
Constant.Param.uid = "";
......@@ -114,8 +114,9 @@ public class WxImplUtils implements UMAuthListener {
SettingPreference.saveUserInfo(null);
mLoading.setResult(false, str, 1000);
mLoading.dismiss();
mCallback.onWxFail(errorMsg);
// mCallback.onWxFail(errorMsg);
}
mCallback.onWxFail(errorMsg);
}
});
}
......
......@@ -13,7 +13,7 @@
<clip>
<shape>
<corners android:radius="8dp" />
<solid android:color="#E85740" />
<solid android:color="#94CA46" />
</shape>
</clip>
</item>
......
......@@ -173,7 +173,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:button="@drawable/checkbox_style"
android:checked="true" />
android:checked="false" />
</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