Commit b497afab authored by wangxuewei's avatar wangxuewei

[提交人]:王雪伟

[提交简述] :幸运农场1.0.6
[实现方案] :调整UI,加入拆红包功能
parent 33b1c743
...@@ -303,6 +303,114 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback { ...@@ -303,6 +303,114 @@ 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
}
})
}
}
private fun getRedPackPlanReceive() {
GameApiClient.gameApi.getOpenPlantBox()
.compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<GuideEntity>() {
override fun onSuccess(result: GuideEntity?) {
Log.d("wxw", "底部拆红包" + Utils.obj2Str(result))
if (result != null) {
if (result.awardNum >= 0) {
MainDialog.showGetPlanRedPackage(
this@GameActivity,
result.awardNum
)
}
}
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
Log.d("wxw", "底部拆红包 error")
}
})
}
/** /**
* 获取首页信息 * 获取首页信息
*/ */
......
...@@ -35,7 +35,11 @@ class SigninDropsAdapter : ...@@ -35,7 +35,11 @@ class SigninDropsAdapter :
holder.tvStatus.text = "已领取" holder.tvStatus.text = "已领取"
holder.ivStatus.setImageResource(R.mipmap.icon_main_popup_singnin_received) holder.ivStatus.setImageResource(R.mipmap.icon_main_popup_singnin_received)
} else { } else {
holder.tvStatus.text = "+${data.awardNum}" if(position == mList.size-1){
holder.tvStatus.text = "???"
}else{
holder.tvStatus.text = "+${data.awardNum}"
}
holder.ivStatus.setImageResource(R.mipmap.icon_main_popup_singnin_receiv) holder.ivStatus.setImageResource(R.mipmap.icon_main_popup_singnin_receiv)
} }
if (data.id == 7) { if (data.id == 7) {
......
...@@ -7,6 +7,7 @@ package com.ym.game.module; ...@@ -7,6 +7,7 @@ package com.ym.game.module;
*/ */
public class GuideEntity { public class GuideEntity {
private int status; private int status;
private double awardNum;
public int getStatus() { public int getStatus() {
return status; return status;
...@@ -15,4 +16,12 @@ public class GuideEntity { ...@@ -15,4 +16,12 @@ public class GuideEntity {
public void setStatus(int status) { public void setStatus(int status) {
this.status = status; this.status = status;
} }
public double getAwardNum() {
return awardNum;
}
public void setAwardNum(double awardNum) {
this.awardNum = awardNum;
}
} }
...@@ -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,16 @@ interface IGameApi { ...@@ -153,6 +153,16 @@ 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<GuideEntity>>
/** /**
* 看视频上报 * 看视频上报
* @param * @param
......
...@@ -496,4 +496,36 @@ object MainDialog { ...@@ -496,4 +496,36 @@ object MainDialog {
mDialog.show() mDialog.show()
} }
/**
* 拆红包红包奖励
*/
fun showGetPlanRedPackage(
context: Context?,
awardCents: Double
) {
if (context == null) {
return
}
val mDialog = Dialog(context, R.style.UpdateVersionCompatDialogTheme)
val mDialogView =
showBottomDialog(
R.layout.dialog_layout_get_plan_red_package,
context,
mDialog,
0,
Gravity.CENTER
)
val tvmoneycount = mDialogView?.findViewById<TextView>(R.id.id_tv_moeny_count2)
tvmoneycount.text = "$awardCents"
mDialogView.findViewById<TextView>(R.id.id_tv_get2).setOnClickListener {
mDialog.dismiss()
}
mDialog.setCanceledOnTouchOutside(false)
mDialog.setCancelable(false)
mDialog.show()
}
} }
\ No newline at end of file
...@@ -56,7 +56,8 @@ ...@@ -56,7 +56,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
android:textColor="@color/color_7C1714" android:textColor="@color/color_7C1714"
android:textSize="24sp" android:textSize="30sp"
android:textStyle="bold"
tools:text="+40g" /> tools:text="+40g" />
</LinearLayout> </LinearLayout>
...@@ -82,7 +83,8 @@ ...@@ -82,7 +83,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
android:textColor="@color/color_7C1714" android:textColor="@color/color_7C1714"
android:textSize="24sp" android:textSize="30sp"
android:textStyle="bold"
tools:text="+40g" /> tools:text="+40g" />
</LinearLayout> </LinearLayout>
...@@ -109,7 +111,8 @@ ...@@ -109,7 +111,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
android:textColor="@color/color_7C1714" android:textColor="@color/color_7C1714"
android:textSize="24sp" android:textSize="30sp"
android:textStyle="bold"
tools:text="+40g" /> tools:text="+40g" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/icon_red_package_bg"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="80dp"
android:text="恭喜获得现金奖励"
android:textColor="@color/white"
android:textSize="36sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_40"
android:orientation="horizontal">
<TextView
android:id="@+id/id_tv_moeny_count2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textColor="@color/white"
android:textSize="58sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_2"
android:text="元"
android:textColor="@color/white"
android:textSize="28sp"
android:textStyle="bold" />
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_20"
android:text="已存入我的钱包"
android:textColor="@color/white"
android:textSize="20sp" />
<TextView
android:id="@+id/id_tv_get2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/icon_get_bg"
android:gravity="center"
android:text="开心收下"
android:textColor="#27292B"
android:textSize="24sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
...@@ -6,11 +6,20 @@ ...@@ -6,11 +6,20 @@
android:gravity="center" android:gravity="center"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <LinearLayout
android:id="@+id/id_item_game_order_img" android:layout_width="60dp"
android:layout_width="wrap_content" android:layout_height="60dp"
android:layout_height="wrap_content" android:layout_marginRight="5dp"
android:layout_marginRight="20dp" /> android:gravity="center">
<ImageView
android:id="@+id/id_item_game_order_img"
android:layout_width="wrap_content"
android:src="@mipmap/luobo_fruit"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
...@@ -22,10 +31,10 @@ ...@@ -22,10 +31,10 @@
android:id="@+id/id_item_game_order_name" android:id="@+id/id_item_game_order_name"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_9" android:layout_marginBottom="@dimen/dp_5"
android:text="玉米" android:text="玉米"
android:textColor="#8F4C07" android:textColor="#8F4C07"
android:textSize="@dimen/sp_15" android:textSize="@dimen/sp_18"
android:textStyle="bold" /> android:textStyle="bold" />
<LinearLayout <LinearLayout
...@@ -47,10 +56,11 @@ ...@@ -47,10 +56,11 @@
android:id="@+id/id_item_game_order_desc" android:id="@+id/id_item_game_order_desc"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="0/0"
android:layout_marginLeft="15dp" android:layout_marginLeft="15dp"
android:text="0/0"
android:textColor="#FF9128" android:textColor="#FF9128"
android:textSize="@dimen/sp_12" /> android:textSize="@dimen/sp_16"
android:textStyle="bold" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
android:layout_marginBottom="2dp" android:layout_marginBottom="2dp"
android:text="60g" android:text="60g"
android:textColor="@color/color_ffffff" android:textColor="@color/color_ffffff"
android:textSize="10sp" /> android:textSize="14sp" />
</RelativeLayout> </RelativeLayout>
<TextView <TextView
......
...@@ -14,16 +14,17 @@ ...@@ -14,16 +14,17 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
tools:text="浇水10次"
android:textColor="@color/color_8C551C" android:textColor="@color/color_8C551C"
android:textSize="14sp" /> android:textSize="20sp"
android:textStyle="bold"
tools:text="浇水10次" />
<LinearLayout <LinearLayout
android:id="@+id/layout_watering_progress" android:id="@+id/layout_watering_progress"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/tv_watering_item_title" android:layout_below="@+id/tv_watering_item_title"
android:layout_marginTop="12dp" android:layout_marginTop="10dp"
android:layout_marginBottom="19dp" android:layout_marginBottom="19dp"
android:gravity="center"> android:gravity="center">
...@@ -37,12 +38,12 @@ ...@@ -37,12 +38,12 @@
app:cornerRadius="8dp" />--> app:cornerRadius="8dp" />-->
<ProgressBar <ProgressBar
android:layout_marginRight="4dp"
android:id="@+id/progess_watering_item" android:id="@+id/progess_watering_item"
style="?android:attr/progressBarStyleHorizontal" style="?android:attr/progressBarStyleHorizontal"
android:layout_width="150dp" android:layout_width="150dp"
android:layout_height="15dp" android:layout_height="15dp"
android:layout_below="@+id/tv_watering_item_title" android:layout_below="@+id/tv_watering_item_title"
android:layout_marginRight="4dp"
android:progressDrawable="@drawable/user_progressbar_bg" /> android:progressDrawable="@drawable/user_progressbar_bg" />
<TextView <TextView
...@@ -51,9 +52,9 @@ ...@@ -51,9 +52,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/tv_watering_item_title" android:layout_below="@+id/tv_watering_item_title"
android:layout_toRightOf="@+id/progess_watering_item" android:layout_toRightOf="@+id/progess_watering_item"
tools:text="10/10" android:textColor="@color/color_8C551C"
android:textColor="@color/color_CDA560" android:textSize="16sp"
android:textSize="12sp" /> tools:text="10/10" />
</LinearLayout> </LinearLayout>
<TextView <TextView
...@@ -61,12 +62,16 @@ ...@@ -61,12 +62,16 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_marginTop="10dp" android:layout_marginTop="14dp"
android:layout_marginRight="14dp" android:layout_marginRight="32dp"
android:drawableLeft="@mipmap/icon_popupwater_icon" android:drawableLeft="@mipmap/icon_popupwater_icon"
android:drawablePadding="4dp" android:drawablePadding="4dp"
android:scaleX="1.5"
android:scaleY="1.5"
android:text="+0g" android:text="+0g"
android:textColor="@color/color_EC8D3B" /> android:textColor="#E85740"
android:textSize="15sp"
android:textStyle="bold" />
<ImageView <ImageView
android:id="@+id/tv_watering_item_status" android:id="@+id/tv_watering_item_status"
...@@ -74,7 +79,7 @@ ...@@ -74,7 +79,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/tv_watering_item_count" android:layout_below="@+id/tv_watering_item_count"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_marginTop="8dp" android:layout_marginTop="10dp"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:src="@drawable/icon_mian_popup_complete" /> android:src="@drawable/icon_mian_popup_complete" />
......
...@@ -242,5 +242,7 @@ public class NetConfig { ...@@ -242,5 +242,7 @@ public class NetConfig {
public static final String URL_GAME_RED_PACK_AWARD_RECEIVE="app/v3/common/award/multiple";//翻倍领取接口 public static final String URL_GAME_RED_PACK_AWARD_RECEIVE="app/v3/common/award/multiple";//翻倍领取接口
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/farm/open_plant_box";//开底部红包
} }
} }
...@@ -61,10 +61,11 @@ ...@@ -61,10 +61,11 @@
android:background="@drawable/receive_btn"> android:background="@drawable/receive_btn">
<ImageView <ImageView
android:id="@+id/id_receive_tv_img"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:paddingLeft="30dp" android:paddingLeft="35dp"
android:src="@drawable/receive_video_img" /> android:src="@drawable/receive_video_img" />
<TextView <TextView
...@@ -72,11 +73,11 @@ ...@@ -72,11 +73,11 @@
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:drawablePadding="50dp"
android:gravity="center" android:gravity="center"
android:paddingLeft="32dp"
android:text="领6倍奖励" android:text="领6倍奖励"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="18sp" android:textSize="22sp"
android:textStyle="bold" /> android:textStyle="bold" />
</RelativeLayout> </RelativeLayout>
......
...@@ -54,7 +54,8 @@ ...@@ -54,7 +54,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:textColor="#7C1714" android:textColor="#7C1714"
android:textSize="24sp" android:textSize="30sp"
android:textStyle="bold"
tools:text="+40g" /> tools:text="+40g" />
</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