Commit c4b7dd6a authored by 张释方's avatar 张释方

添加提现骰子需求

parent 17ae2018
......@@ -356,6 +356,8 @@ dependencies {
implementation(name: 'mduisdk_v3.1.0.18_support_msa_1.0.23', ext: 'aar')
implementation 'com.tencent.tbs.tbssdk:sdk:43903'
//动态图依赖
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.15'
// //芒果联盟
// implementation 'com.openppeace.mgmob:mgmob:1.3.5-alpha6'//MGMob
......
......@@ -253,7 +253,8 @@
android:screenOrientation="portrait" />
<activity android:name=".ui.activitys.XiaomanActivity"
android:screenOrientation="portrait"/>
<activity android:name=".ui.activitys.ShaiziActivity"
android:screenOrientation="portrait"/>
<service
android:name=".service.UpdateService"
android:exported="true" />
......
......@@ -6,6 +6,8 @@ import com.mints.goodmoney.manager.UserManager
object Constant {
const val MONEY_KEY="MONEY_KEY"
/**
* 首次弹出权限声明
*/
......
......@@ -3,6 +3,7 @@ package com.mints.goodmoney.manager
import android.app.Activity
import android.app.Application
import android.util.Log
import androidx.fragment.app.FragmentActivity
import com.mdad.sdk.mduisdk.AdManager
import com.mdad.sdk.mduisdk.CommonCallBack
import com.mints.goodmoney.MintsApplication
......@@ -26,6 +27,19 @@ object YyzManager {
})
}
fun initYyz(appActivity: FragmentActivity) {
//当用户登陆了且权限具备了后执行初始化操作
AdManager.getInstance(appActivity).init(appActivity, APPID, UserManager.getInstance().userID, KEY, object : CommonCallBack<Any?> {
override fun onSuccess(response: String) { //初始化成功
Log.e("hyw", "init onSuccess:$response")
}
override fun onFailure(response: String) { //初始化失败
Log.e("hyw", "init onFailure:$response")
}
})
}
fun openYyzTask(activity: Activity) {
......
......@@ -19,6 +19,7 @@ public class DrawcashBean implements Serializable {
private boolean openJDCash = true;
private String JDUrl = null;
public String getJDUrl() {
return JDUrl;
}
......
package com.mints.goodmoney.mvp.model;
import java.io.Serializable;
/**
* 首页喝水
*/
public class ShaiziBean implements Serializable {
private int randomPoint;
private Long diceId;
public int getRandomPoint() {
return randomPoint;
}
public Long getDiceId() {
return diceId;
}
}
......@@ -4,6 +4,7 @@ import android.text.TextUtils;
import com.google.gson.JsonObject;
import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.common.AppConfig;
import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.common.DeviceInfo;
import com.mints.goodmoney.manager.AppHttpManager;
......@@ -234,6 +235,52 @@ public class DrawcashPresenter extends BasePresenter<DrawcashView> {
});
}
public void queryCanRollDiceMsg(double cash) {
view.showLoading("加载中...");
HashMap<String, Object> vo = new HashMap<>();
vo.put("cash", cash);
AppHttpManager.getInstance(loanApplication)
.call(loanService.queryCanRollDiceMsg(vo),
new BaseSubscriber<BaseResponse<JsonObject>>() {
@Override
public void onCompleted() {
if (isLinkView()) return;
view.hideLoading();
}
@Override
public void onError(Throwable e) {
if (isLinkView()) return;
view.hideLoading();
view.showToast(e.getMessage());
}
@Override
public void onNext(BaseResponse<JsonObject> baseResponse) {
if (isLinkView()) return;
int code = baseResponse.getStatus();
switch (code) {
case 200://成功
JsonObject data = baseResponse.getData();
if (data != null) {
if (data.get("canRoll") != null) {
view.getqueryCanRollDiceMsg(data.get("canRoll").getAsBoolean());
}
}
break;
default:
view.showToast(baseResponse.getMessage());
break;
}
}
});
}
/**
* 检测是否京东金融新用户
*/
......
package com.mints.goodmoney.mvp.presenters;
import com.google.gson.JsonObject;
import com.mints.goodmoney.manager.AppHttpManager;
import com.mints.goodmoney.mvp.model.BaseResponse;
import com.mints.goodmoney.mvp.model.ShaiziBean;
import com.mints.goodmoney.mvp.model.WaterBean;
import com.mints.goodmoney.mvp.views.ShaiziView;
import com.mints.goodmoney.mvp.views.WaterView;
import com.mints.library.net.neterror.BaseSubscriber;
import com.mints.library.net.neterror.Throwable;
import java.util.HashMap;
public class ShaiziPresenter extends BasePresenter<ShaiziView> {
public void getRollDiceMsg(double cash,boolean isBig) {
HashMap<String, Object> vo = new HashMap<>();
vo.put("cash", cash);
vo.put("isBig",isBig);
//添加摇色子ID
AppHttpManager.getInstance(loanApplication)
.call(loanService.getRollDiceMsg(vo),
new BaseSubscriber<BaseResponse<ShaiziBean>>() {
@Override
public void onCompleted() {
if (isLinkView()) return;
view.hideLoading();
}
@Override
public void onError(Throwable e) {
if (isLinkView()) return;
view.getShaiziMsgHomefail();
view.hideLoading();
//提示错误信息
view.showToast(e.getMessage());
}
@Override
public void onNext(BaseResponse<ShaiziBean> baseResponse) {
if (isLinkView()) return;
int code = baseResponse.getStatus();
switch (code) {
case 200://成功
view.getShaiziMsgHomeSuc(baseResponse.getData());
break;
default:
view.showToast(baseResponse.getMessage());
break;
}
}
});
}
public void addShaiziresult(double cash,long diceid) {
HashMap<String, Object> vo = new HashMap<>();
vo.put("payChannel","WEIXIN");
vo.put("cash", cash);
vo.put("diceid",diceid);
//添加摇色子ID
AppHttpManager.getInstance(loanApplication)
.call(loanService.addShaiziresult(vo),
new BaseSubscriber<BaseResponse<ShaiziBean>>() {
@Override
public void onCompleted() {
if (isLinkView()) return;
view.hideLoading();
}
@Override
public void onError(Throwable e) {
if (isLinkView()) return;
view.hideLoading();
view.showToast(e.getMessage());
}
@Override
public void onNext(BaseResponse<ShaiziBean> baseResponse) {
if (isLinkView()) return;
int code = baseResponse.getStatus();
switch (code) {
case 200://成功
break;
default:
view.showToast(baseResponse.getMessage());
break;
}
}
});
}
}
......@@ -2,6 +2,9 @@ package com.mints.goodmoney.mvp.views;
import com.mints.goodmoney.mvp.model.DrawcashBean;
import com.mints.goodmoney.mvp.model.ShaiziBean;
import retrofit2.http.Body;
public interface DrawcashView extends BaseView {
/**
......@@ -26,4 +29,7 @@ public interface DrawcashView extends BaseView {
void checkJDNewUsersFail();
void getCommonJdUrlSuc(String jdUrl);
void getqueryCanRollDiceMsg(boolean showDialog);
}
package com.mints.goodmoney.mvp.views;
import com.mints.goodmoney.mvp.model.ShaiziBean;
public interface ShaiziView extends BaseView {
/**
* 骰子
*
* @param data
*/
void getShaiziMsgHomeSuc(ShaiziBean data);
void getShaiziMsgHomefail();
}
......@@ -20,6 +20,7 @@ import com.mints.goodmoney.mvp.model.MealBean;
import com.mints.goodmoney.mvp.model.MorningClockBean;
import com.mints.goodmoney.mvp.model.MyInfo;
import com.mints.goodmoney.mvp.model.RotationChartBean;
import com.mints.goodmoney.mvp.model.ShaiziBean;
import com.mints.goodmoney.mvp.model.SignCardBean;
import com.mints.goodmoney.mvp.model.TaskCpdBean;
import com.mints.goodmoney.mvp.model.TurnBean;
......@@ -237,6 +238,9 @@ public interface LoanService {
@POST("api/addCashoutReq")
Observable<BaseResponse<Object>> addCashoutReq(@Body Map<String, Object> vo);
@POST("api/addCashoutReq")
Observable<BaseResponse<ShaiziBean>> addShaiziresult(@Body Map<String, Object> vo);
/**
* 提现记录
*
......@@ -614,8 +618,8 @@ public interface LoanService {
Observable<BaseResponse<Object>> addTurnToOtherMsg(@Body Map<String, Object> vo);
/**
*
* 我的页面Banner
*
* @return
*/
@POST("api/myRotationChart")
......@@ -623,6 +627,7 @@ public interface LoanService {
/**
* 参数判断(公众号弹框)
*
* @param vo
* @return
*/
......@@ -637,9 +642,14 @@ public interface LoanService {
@POST("api/vedioPlans")
Observable<BaseResponse<UserTaskMsgBean>> vedioPlans();
/**
* 默认http工厂
*/
@POST("api/queryCanRollDiceMsg")
Observable<BaseResponse<JsonObject>> queryCanRollDiceMsg(@Body Map<String, Object> vo);
@POST("api/getRollDiceMsg")
Observable<BaseResponse<ShaiziBean>> getRollDiceMsg(@Body Map<String,Object> vo);
/**
* 默认http工厂
*/
class Factory {
public static LoanService create() {
......
package com.mints.goodmoney.ui.activitys
import android.app.Dialog
import android.os.Bundle
import android.text.TextUtils
import android.util.Log
import android.view.View
import android.widget.CompoundButton
import androidx.recyclerview.widget.GridLayoutManager
......@@ -21,6 +23,8 @@ import com.mints.goodmoney.mvp.views.DrawcashView
import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.goodmoney.ui.adapter.DrawcashAdapter
import com.mints.goodmoney.ui.adapter.listener.OnItemClickListener
import com.mints.goodmoney.ui.widgets.dialog.DialogListener
import com.mints.goodmoney.ui.widgets.dialog.DialogUtils.showTxDialog
import com.mints.goodmoney.ui.widgets.dialog.DrawcashVideoDialog
import com.mints.goodmoney.utils.LogUtil
import com.mints.library.utils.CommonUtils
......@@ -53,7 +57,7 @@ class DrawcashActivity : BaseActivity(),
private var priceList: MutableList<DrawcashBean.CashOutMoneyArrBean>? = null
private var wxInfo: WXInfo? = null
private var userConfig: DrawcashBean? = null
private var isLoadRvItem: Boolean = true //是否首次加载rv item
private var isLoadRvItem: Boolean = true //是否首次加载rvitem
// private var isJDNewUser = false
// private var jumpJdUrl: String? = null
......@@ -64,6 +68,7 @@ class DrawcashActivity : BaseActivity(),
override fun isApplyKitKatTranslucency() = false
override fun initViewsAndEvents() {
drawcashPresenter.attachView(this)
tv_title.text = "提现"
iv_left_icon.visibility = View.VISIBLE
iv_left_icon.setImageResource(R.mipmap.ic_arrow_back)
......@@ -74,7 +79,6 @@ class DrawcashActivity : BaseActivity(),
view_title.text = "提现规则"
vedioAdingManager = VideoAdingManager.getInstance(this)
drawcashPresenter.attachView(this)
initListener()
}
......@@ -173,8 +177,11 @@ class DrawcashActivity : BaseActivity(),
val curCount = userConfig?.vedioComplete!!
val sumCount = priceList!![drawcashAdapter.getPosition()].vedio
if (curCount >= sumCount) {
drawcashPresenter.saveTerminalInfo(priceList!![drawcashAdapter.getPosition()].money)
//摇骰子弹窗
drawcashPresenter.queryCanRollDiceMsg(priceList!![drawcashAdapter.getPosition()].money)
// drawcashPresenter.saveTerminalInfo(priceList!![drawcashAdapter.getPosition()].money)
} else {
//提现看视频啦
drawcashVideoDialog(curCount, sumCount)
}
}
......@@ -337,15 +344,39 @@ class DrawcashActivity : BaseActivity(),
}
it.setOnClickListener(object : DrawcashVideoDialog.OnClickListener {
override fun onClick() {
if (priceList != null && priceList!!.size > 0) {
drawcashPresenter.saveTerminalInfo(priceList!![drawcashAdapter.getPosition()].money)
}
drawcashPresenter.queryCanRollDiceMsg(priceList!![drawcashAdapter.getPosition()].money)
}
})
it.show()
}
}
private fun ShaiziDialog(drawcashPresenter: DrawcashPresenter, priceList: MutableList<DrawcashBean.CashOutMoneyArrBean>?, drawcashAdapter: DrawcashAdapter) {
showTxDialog(this@DrawcashActivity, object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
when (v?.id) {
R.id.tv_cash -> {//提现
if (priceList != null && priceList!!.size > 0) {
drawcashPresenter.saveTerminalInfo(priceList!![drawcashAdapter.getPosition()].money)
}
dialog?.dismiss()
}
R.id.tv_double -> {//翻倍
val bundle = Bundle()
bundle.putDouble(Constant.MONEY_KEY, priceList!![drawcashAdapter.getPosition()].money)
readyGo(ShaiziActivity::class.java, bundle)
dialog?.dismiss()
}
R.id.iv_Close -> {
dialog?.dismiss()
}
}
}
})
}
override fun checkJDNewUsersSuc(isJdNewUser: Boolean, JDUrl: String?) {
// jdTintDialog?.dismiss()
......@@ -378,6 +409,22 @@ class DrawcashActivity : BaseActivity(),
}
}
/**
* 获取是否提示 骰子弹框
*/
override fun getqueryCanRollDiceMsg(showDialog: Boolean) {
LogUtil.e("jinbitixian","========$showDialog")
if (showDialog){
ShaiziDialog(drawcashPresenter, priceList, drawcashAdapter);
}else{
//提现
if (priceList != null && priceList!!.size > 0) {
drawcashPresenter.saveTerminalInfo(priceList!![drawcashAdapter.getPosition()].money)
}
}
}
override fun userFrequently() {
if (AntiShake.check(tvDrawcashExplain?.id)) return
......
package com.mints.goodmoney.ui.activitys
import android.app.Dialog
import android.os.Bundle
import android.os.Handler
import android.view.View
import com.bumptech.glide.Glide
import com.cmcm.cmgame.utils.boolean
import com.mints.goodmoney.R
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.mvp.model.ShaiziBean
import com.mints.goodmoney.mvp.presenters.ShaiziPresenter
import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.goodmoney.ui.widgets.dialog.DialogListener
import com.mints.goodmoney.ui.widgets.dialog.DialogUtils
import com.mints.goodmoney.utils.LogUtil
import com.mints.goodmoney.utils.SpanUtils
import com.mints.goodmoney.utils.ToastUtil
import kotlinx.android.synthetic.main.activity_shaizi.*
import java.util.*
class ShaiziActivity : BaseActivity(), View.OnClickListener, com.mints.goodmoney.mvp.views.ShaiziView {
private var count: Int = 0
private var diceId: Long? = null
private var moneys: Double = 0.0
private val shaiziPresenter by lazy { ShaiziPresenter() }
private var starttime: Long? = null
private var flag: Int = 0
override fun getContentViewLayoutID() = R.layout.activity_shaizi
override fun isApplyKitKatTranslucency() = false
override fun initViewsAndEvents() {
shaiziPresenter.attachView(this)
var spannable = SpanUtils().append(" 猜骰子投掷数字为大还是小,1/2/3/为小,4/5/6为大,猜中时本次提现获得")
.append("双倍收益")
.setBold()
.append("(奖励以金币形式发放),若没有猜中则本次提现金币回收。")
.create()
tv2.text = spannable
initListener()
}
override fun onResume() {
super.onResume()
}
override fun onPause() {
super.onPause()
}
override fun onDestroy() {
//关闭 接口绑定
shaiziPresenter.detachView()
super.onDestroy()
}
override fun onClick(v: View) {
when (v.id) {
R.id.shaiziback -> {
finish()
}
R.id.btn_big -> {
starttime = System.currentTimeMillis()
shaiziPresenter.getRollDiceMsg(moneys, true)
flag = 1
}
R.id.btn_small -> {
starttime = System.currentTimeMillis()
shaiziPresenter.getRollDiceMsg(moneys, false)
}
}
}
fun startShaizi(time: Long) {
Glide.with(context).asGif().load(R.drawable.shaizi).into(iv_saizi);
val timer = Timer()
val task: TimerTask = object : TimerTask() {
override fun run() {
runOnUiThread {
when (count) {
1 -> Glide.with(context).load(R.mipmap.iv_tx_sz1).into(iv_saizi);
2 -> Glide.with(context).load(R.mipmap.iv_tx_sz2).into(iv_saizi);
3 -> Glide.with(context).load(R.mipmap.iv_tx_sz3).into(iv_saizi);
4 -> Glide.with(context).load(R.mipmap.iv_tx_sz4).into(iv_saizi);
5 -> Glide.with(context).load(R.mipmap.iv_tx_sz5).into(iv_saizi);
6 -> Glide.with(context).load(R.mipmap.iv_tx_sz6).into(iv_saizi);
}
if (flag == 1) {
if (count >= 4) {
showresultDialog("恭喜您!", "本次开奖结果为大,您的收益已翻倍!", true)
} else {
showresultDialog("很遗憾!", "本次开奖结果为小,您未中奖,金币已收回。",false)
}
} else {
if (count <= 3) {
showresultDialog("恭喜您!", "本次开奖结果为小,您的收益已翻倍!",true)
} else {
showresultDialog("很遗憾!", "本次开奖结果为大,您未中奖,金币已收回。",false)
}
}
}
}
}
timer.schedule(task, (time!! - starttime!!) + 2000)
}
/**
* 展示 骰子结果 弹框
*/
private fun showresultDialog(s: String, s1: String, b: Boolean) {
DialogUtils.showWinDialog(this@ShaiziActivity, s, s1, object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
when (v?.id) {
R.id.tv_know -> {
//向服务器传递 提现金额 骰子Id
if (b) shaiziPresenter.addShaiziresult(moneys, diceId!!)
dialog?.dismiss()
finish()
}
}
}
})
}
/**
* 获取 提现金额
*/
override fun getBundleExtras(extras: Bundle) {
super.getBundleExtras(extras)
moneys = extras.getDouble(Constant.MONEY_KEY)
}
private fun initListener() {
shaiziback.setOnClickListener(this)
btn_small.setOnClickListener(this)
btn_big.setOnClickListener(this)
}
/**
* 请求成功
*/
override fun getShaiziMsgHomeSuc(data: ShaiziBean) {
//设置按钮 不可点击
setButtonstatus(false)
//更改按钮 背景
if (flag == 1) {
btn_big.setBackgroundResource(R.mipmap.btn_tx_down)
} else {
btn_small.setBackgroundResource(R.mipmap.btn_tx_down_small)
}
//获取骰子 点数、Id
count = data.randomPoint
diceId = data.diceId
//执行延时,旋转骰子,显示结果
startShaizi(System.currentTimeMillis())
}
/**
* 设置按钮状态(可否点击)
*/
private fun setButtonstatus(b: Boolean) {
btn_small.isEnabled = b
btn_big.isEnabled = b
}
/**
* 请求失败
*/
override fun getShaiziMsgHomefail() {
//设置按钮 可点击
setButtonstatus(true)
//改变按钮 背景
if (flag == 1) {
btn_big.setBackgroundResource(R.mipmap.btn_tx_up)
} else {
btn_small.setBackgroundResource(R.mipmap.btn_tx_up_small)
}
}
}
......@@ -360,45 +360,6 @@ class MyFragment : BaseFragment(),
}
}
private fun gzhDialog() {
DialogUtils.showGzhDialog(requireActivity(), object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
when (v?.id) {
R.id.tv_focus -> {
//并将“淘金空间”复制到粘贴板上
// val clipboardManager = dialog?.ownerActivity?.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
// val clipData = ClipData.newPlainText("Label", "淘金空间")
// clipboardManager.setPrimaryClip(clipData)
// // Toast 提示
// showToast("已复制内容到剪贴板")
//直接跳转到微信搜索界面
getWechatApi()
}
R.id.tv_subscribe -> {
//关闭当前页面
//并不在提示当前弹窗
if (activity != null && !activity!!.isFinishing && dialog != null && dialog.isShowing) {
dialog.dismiss()
ps.put(Constant.LOAN_PERMISSION_FLAG, false)
// 数美初始化
ShumeiManager.getInstance().initShumei()
}
}
R.id.iv_Close -> {
//关闭当前界面
//再次打开时会继续弹出该弹窗
if (activity != null && !activity!!.isFinishing && dialog != null && dialog.isShowing) {
dialog.dismiss()
ps.put(Constant.LOAN_PERMISSION_FLAG, false)
// 数美初始化
ShumeiManager.getInstance().initShumei()
}
}
}
}
})
}
/**
* 跳转到微信搜索页面
......@@ -987,7 +948,7 @@ class MyFragment : BaseFragment(),
myPresenter.getAutoUserHallBaseMsg()
return
}
LogUtil.e("jinbitixian","*****************************************+++++++++++++++++++========================****&&&&&&&&%%^&$^$&%$&")
readyGo(DrawcashActivity::class.java)
}
R.id.btn_coinRecord -> {
......@@ -1053,6 +1014,7 @@ class MyFragment : BaseFragment(),
readyGo(WxLoginActivity::class.java)
return
}
YyzManager.initYyz(requireActivity())
YyzManager.openYyzTask(requireActivity())
}
Constant.HOT_ACTIVITY_CAICY -> {
......
......@@ -74,4 +74,22 @@ object DialogUtils {
bonusDialog.show()
dialogListener.setDialog(bonusDialog)
}
/**
* 提现弹框
*/
fun showTxDialog(ctx: Context,dialogListener: DialogListener){
val weakReference = WeakReference<Context>(ctx)
val bonusDialog = TxDialog(weakReference.get()!!, dialogListener)
bonusDialog.show()
dialogListener.setDialog(bonusDialog)
}
/**
* 中奖弹窗
*/
fun showWinDialog(ctx: Context,str1:String,str2:String,dialogListener: DialogListener){
val weakReference = WeakReference<Context>(ctx)
val bonusDialog = WinDialog(weakReference.get()!!, dialogListener,str1,str2)
bonusDialog.show()
dialogListener.setDialog(bonusDialog)
}
}
\ No newline at end of file
......@@ -60,6 +60,7 @@ class DrawcashVideoDialog(activity: Activity) :
when (v.id) {
R.id.btn_dialog_drawcash_next -> {
if (TextUtils.equals(tvNext.text.toString(), "去提现")) {
onClickListener?.onClick()
dismiss()
} else {
......
package com.mints.goodmoney.ui.widgets.dialog
import android.app.Dialog
import android.content.Context
import android.view.Gravity
import android.view.KeyEvent
import android.view.WindowManager
import android.widget.ImageView
import android.widget.TextView
import com.mints.goodmoney.R
class TxDialog(context: Context, private val listener: DialogListener) :
Dialog(context, R.style.dialog_two) {
private val lp: WindowManager.LayoutParams
private val iv_Close: ImageView
private val tv_cash: TextView
private val tv_double: TextView
init {
setContentView(R.layout.dialog_tx)
// 设置window属性
lp = window!!.attributes
lp.gravity = Gravity.CENTER
lp.width = WindowManager.LayoutParams.WRAP_CONTENT
lp.windowAnimations = R.style.DialogAnimBottom
window!!.attributes = lp
// 设置外部不可关闭
setCancelable(false)
setCanceledOnTouchOutside(false)
setOnKeyListener { _, i, _ ->
i == KeyEvent.KEYCODE_BACK
}
// 查找View
tv_cash = findViewById(R.id.tv_cash)
tv_double = findViewById(R.id.tv_double)
iv_Close = findViewById(R.id.iv_Close)
//设置文字底部下划线,不同android系统显示效果不同,未使用
// tv_subscribe.paint.setFlags(Paint.UNDERLINE_TEXT_FLAG)
// tv_subscribe.paint.setAntiAlias(true)//抗锯齿
tv_cash.setOnClickListener(listener)
tv_double.setOnClickListener(listener)
iv_Close.setOnClickListener(listener)
}
}
\ No newline at end of file
package com.mints.goodmoney.ui.widgets.dialog
import android.app.Dialog
import android.content.Context
import android.view.Gravity
import android.view.KeyEvent
import android.view.WindowManager
import android.widget.ImageView
import android.widget.TextView
import com.mints.goodmoney.R
import org.w3c.dom.Text
class WinDialog(context: Context, private val listener: DialogListener, str1: String, str2: String) :
Dialog(context, R.style.dialog_two) {
private val lp: WindowManager.LayoutParams
private val tv_result_title: TextView
private val tv_result: TextView
private val tv_know: TextView
init {
setContentView(R.layout.dialog_win)
// 设置window属性
lp = window!!.attributes
lp.gravity = Gravity.CENTER
lp.width = WindowManager.LayoutParams.WRAP_CONTENT
lp.windowAnimations = R.style.DialogAnimBottom
window!!.attributes = lp
// 设置外部不可关闭
setCancelable(false)
setCanceledOnTouchOutside(false)
setOnKeyListener { _, i, _ ->
i == KeyEvent.KEYCODE_BACK
}
// 查找View
tv_result_title = findViewById(R.id.tv_result_title)
tv_know = findViewById(R.id.tv_know)
tv_result = findViewById(R.id.tv_result)
tv_result_title.text = str1
tv_result.text = str2
tv_know.setOnClickListener(listener)
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/transparent" />
<corners android:radius="8pt" />
<stroke android:width="0.5pt" android:color="#ffffff" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/white"/>
<corners android:radius="8pt" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="90"
android:endColor="#F96637"
android:startColor="#FF8833" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="500dp"
android:layout_height="800dp"
android:layout_gravity="center"
android:background="@mipmap/bg_shaizi"
android:orientation="vertical">
<ImageView
android:id="@+id/shaiziback"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="80dp"
android:paddingTop="55dp"
android:src="@mipmap/iv_tx_return" />
<ImageView
android:id="@+id/iv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/shaiziback"
android:layout_centerHorizontal="true"
android:src="@mipmap/iv_tx" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/shaiziback"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:text="猜大小,搏翻倍!"
android:textColor="#F9F9F9"
android:textSize="23dp" />
<ImageView
android:id="@+id/iv_bg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/iv_title"
android:layout_centerHorizontal="true"
android:layout_marginTop="19dp"
android:src="@mipmap/bg_tx_main" />
<ImageView
android:id="@+id/iv_zhaozi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/iv_title"
android:layout_centerHorizontal="true"
android:layout_marginTop="78dp"
android:src="@mipmap/bg_tx_main1" />
<ImageView
android:id="@+id/iv_saizi"
android:layout_width="82dp"
android:layout_height="82dp"
android:layout_below="@+id/iv_title"
android:layout_centerHorizontal="true"
android:layout_marginTop="127dp"
android:src="@mipmap/iv_tx_shaizi" />
<Button
android:id="@+id/btn_big"
android:layout_width="84dp"
android:layout_height="84dp"
android:layout_below="@id/iv_zhaozi"
android:layout_marginLeft="148dp"
android:layout_marginTop="37dp"
android:background="@mipmap/btn_tx_up"
android:text="大"
android:textColor="#F9F9F9"
android:textSize="22dp" />
<Button
android:id="@+id/btn_small"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_below="@id/iv_zhaozi"
android:layout_centerHorizontal="true"
android:layout_marginLeft="47dp"
android:layout_marginTop="45dp"
android:layout_toRightOf="@id/btn_big"
android:background="@mipmap/btn_tx_up_small"
android:text="小"
android:textColor="#F9F9F9"
android:textSize="20dp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/iv_bg"
android:layout_centerInParent="true"
android:layout_marginTop="19dp"
android:src="@mipmap/bg_tx_main2" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/iv_bg"
android:layout_centerInParent="true"
android:layout_marginTop="27dp"
android:orientation="vertical">
<TextView
android:id="@+id/tv_hd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:text="活动规则"
android:textColor="#EB5762"
android:textSize="17dp" />
<TextView
android:id="@+id/tv2"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:paddingLeft="0dp"
android:textColor="#EB5762"
android:textSize="13dp" />
</LinearLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/btn_small"
android:layout_marginTop="50dp"
android:layout_toRightOf="@+id/btn_small"
android:src="@mipmap/iv_tx_tizi" />
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/bg_tx"
android:orientation="vertical">
<ImageView
android:id="@+id/iv_Close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_margin="10dp"
android:src="@mipmap/iv_close_tx"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="9dp"
android:layout_marginTop="129dp"
android:text="恭喜您!"
android:textColor="#F9F9F9"
android:textSize="18sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="9dp"
android:layout_marginTop="20dp"
android:text="获得一次翻倍提现的机会,请问是否参加?"
android:textColor="#F9F9F9"
android:textSize="14sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="37dp"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_cash"
android:layout_width="106dp"
android:layout_height="33dp"
android:layout_gravity="center_horizontal"
android:layout_marginRight="11dp"
android:layout_marginBottom="10dp"
android:background="@drawable/btn_tx_bg"
android:gravity="center"
android:text="不,直接提现"
android:textColor="@color/white"
android:textSize="14sp" />
<TextView
android:id="@+id/tv_double"
android:layout_width="111dp"
android:layout_height="33dp"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="11dp"
android:background="@drawable/btn_tx_double_bg"
android:drawableLeft="@mipmap/bg_btn_tx"
android:gravity="center"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:text="我要翻倍"
android:textColor="#F96637"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/bg_win"
android:orientation="vertical">
<TextView
android:id="@+id/tv_result_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="20dp"
android:layout_marginTop="30dp"
android:layout_marginRight="20dp"
android:gravity="center"
android:text="恭喜您!"
android:textColor="#F46147"
android:textSize="20dp" />
<TextView
android:id="@+id/tv_result"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="20dp"
android:layout_marginTop="12dp"
android:layout_marginRight="20dp"
android:gravity="center"
android:textColor="#F46147"
android:textSize="15dp" />
<TextView
android:id="@+id/tv_know"
android:layout_width="120dp"
android:layout_height="36dp"
android:layout_gravity="center"
android:layout_marginLeft="20dp"
android:layout_marginTop="22dp"
android:layout_marginRight="20dp"
android:background="@mipmap/btn_win_bg"
android:gravity="center"
android:text="我知道了"
android:textColor="#F9F9F9"
android:textSize="16dp" />
</LinearLayout>
......@@ -16,6 +16,17 @@
<item name="android:gravity">bottom</item>
</style>
<style name="dialog_two" parent="@android:style/Theme.Dialog">
<item name="android:windowBackground">@color/color_0000</item>
<item name="android:windowFrame">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowIsTranslucent">false</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:background">@null</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
<style name="loading_small" parent="@android:style/Widget.ProgressBar.Small">
<item name="android:indeterminateDrawable">@drawable/ufo_loading</item>
<item name="android:layout_width">25dip</item>
......
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m
android.injected.testOnly=false
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
DEBUG_URL="http://39.97.65.143:9082/api-gm/"
#DEBUG_URL="http://192.168.31.194:8101/"
RELEASE_URL="https://api.mints-id.com/api-gm/"
RELEASE_KEY_PASSWORD=mints.goodmoney
RELEASE_KEY_ALIAS=mints_goodmoney
RELEASE_STORE_PASSWORD=mints.goodmoney
RELEASE_STORE_FILE=mints_goodmoney.jks
#ShareSDK
RELEASE_SHARESDK_KEY=310fab7ce0f62
RELEASE_SHARESDK_SECRET=f35465ed0c6da5ce2f0e7ae96f2601c2
#TalkingData
DEBUG_TD_KEY=E6AFD6917D48441886EE62ACFF463576
RELEASE_TD_KEY=E6AFD6917D48441886EE62ACFF463576
DEBUG_TD_SCHEMA_KEY=talkingdata.e6afd6917d48441886ee62acff463576
RELEASE_TD_SCHEMA_KEY=talkingdata.e6afd6917d48441886ee62acff463576
#友盟
RELEASE_UMENG_KEY=5f83c3eb80455950e4a759d3
#JPush
RELEASE_JPUSH_KEY=d1fc227e2d3ec3c7a8cafa69
android.useAndroidX=true
android.enableJetifier=true
\ No newline at end of file
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