Commit 67541ea6 authored by maxiaoliang's avatar maxiaoliang

提交修改的代码

parent f2423fa4
......@@ -40,6 +40,7 @@ class SplashActivity : BaseActivity(), SplashContract.View {
}
Constant.ReportSessionId = "" + System.currentTimeMillis() + ReportUtils.getRandom(10)//上报使用的sessionId
EventUtils.onEvent("app_start")
AdManager.loadSplashAd(AdUtils.AD_SPLASH)
ImmersionBar.with(this)
.hideBar(BarHide.FLAG_HIDE_NAVIGATION_BAR)
.init()
......@@ -71,7 +72,7 @@ class SplashActivity : BaseActivity(), SplashContract.View {
override fun jumpPage() {
if (!SettingPreference.getIsShowGuide()) {
EventUtils.onEvent("SplashActivity_loadSplash")
AdManager.loadSplashAd(this,
AdManager.showSplashAd(this,
AdUtils.AD_SPLASH, "splash",tv_skipview, splash_container!!,object : ZXADSplashListener {
override fun onAdShow() {}
......@@ -80,6 +81,7 @@ class SplashActivity : BaseActivity(), SplashContract.View {
}
override fun onError(errorMsg: String?) {
LogUtils.e("huang",errorMsg.toString())
startMain()
}
})
......
......@@ -11,11 +11,12 @@ import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.ym.library.base.BaseRecyclerAdapter
import com.ym.library.module.OrderEntity
import com.ym.library.module.OrderListEntity
import com.ym.modulecommon.AppliContext
import com.ym.msdh.R
class OrderAdapter : BaseRecyclerAdapter<OrderListEntity.FarmOrderDataListBean, OrderAdapter.ViewHolder> {
class OrderAdapter : BaseRecyclerAdapter<OrderEntity.FarmOrderDataListBean, OrderAdapter.ViewHolder> {
private var mContext: Context? = null
constructor(content: Context?) : super() {
......@@ -25,10 +26,10 @@ class OrderAdapter : BaseRecyclerAdapter<OrderListEntity.FarmOrderDataListBean,
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
var data = mList[position]
if (data?.imgUrl != null && data?.imgUrl != "") {
Glide.with(mContext!!).load(data?.imgUrl)
.into(holder?.iv_order_item_img)
}
// if (data?.imgUrl != null && data?.imgUrl != "") {
// Glide.with(mContext!!).load(data?.imgUrl)
// .into(holder?.iv_order_item_img)
// }
holder?.tv_order_item_title.text = data?.name
holder?.progess_order_bar.max = data?.targetNum?:0
......
......@@ -56,9 +56,7 @@ class WareHouseAdapter : BaseRecyclerAdapter<FlyBoxEntity, WareHouseAdapter.View
8 -> {
holder.item_img?.setImageResource(R.mipmap.img_grape)
}
9 -> {
holder.item_img?.setImageResource(R.mipmap.img_strawberry)
}
}
}
//果实
......@@ -88,9 +86,7 @@ class WareHouseAdapter : BaseRecyclerAdapter<FlyBoxEntity, WareHouseAdapter.View
8 -> {
holder.item_img?.setImageResource(R.mipmap.putao_fruit)
}
9 -> {
holder.item_img?.setImageResource(R.mipmap.caomei_fruit)
}
}
}
......
......@@ -60,7 +60,8 @@ class BaseApplication : BaseApplication() {
//TODO 上线去掉测试地址
NetConfig.BASE_FEED_URL = "http://feedapitest2.zhangxinhulian.com/"
AdManager.init(this,"afcbef40e31631d3")
//AdManager.init(this,"afcbef40e31631d3")
AdManager.init(this,"b1c85b22f06d1990")
LogUtils.getConfig().logSwitch = true
UMConfigure.setLogEnabled(true)
UMConfigure.init(this, "5f9bb48945b2b751a91fb2d5", "", UMConfigure.DEVICE_TYPE_PHONE, "")
......
......@@ -637,6 +637,101 @@ object MainDialog {
mDialog?.show()
}
}
//生虫弹窗
// fun showDialogWorm(
// activity: Activity?,
// onClickListener: View.OnClickListener
// ) {
// if (activity == null) return
// val mDialog = Dialog(activity, R.style.UpdateVersionCompatDialogTheme)
// val mDialogView = showBottomDialog(
// R.layout.dialog_worm,
// activity,
// mDialog,
// 0,
// Gravity.CENTER
// )
// EventUtils.onEvent("show_clean_worm_dialog", "除虫弹窗")
// val layoutAd = mDialogView?.findViewById<FrameLayout>(R.id.layout_get_drop_ad)
// AdUtils.showFeedAd(activity, "clean_worm", layoutAd)
// mDialogView.findViewById<ImageView>(R.id.id_img_close_clean_worm).setOnClickListener {
// mDialog.dismiss()
// }
//
// mDialogView.findViewById<ImageView>(R.id.id_img_clean_worm).setOnClickListener {
// EventUtils.onEvent("click_clean_worm_video_btn", "除虫看视频点击")
// onClickListener.onClick(it)
// mDialog.dismiss()
// }
// mDialog.setOnDismissListener(object : DialogInterface.OnDismissListener {
// override fun onDismiss(p0: DialogInterface?) {
// onDestroy()
// AdUtils.loadFeedCacheAdToCache(activity)
// }
// })
// mDialog?.setCanceledOnTouchOutside(false)
// mDialog?.setCancelable(false)
// if(activity.isFinishing){
// return
// }
// mDialog?.show()
// }
//种子不足弹窗
fun showDialogSeedNotEnough(
activity: Activity?,
id: Int?,
seedPrice: Int?,
seedVideo: Int?,
buySeedOnClickListener: View.OnClickListener,
receiveSeedOnClickListener: View.OnClickListener
) {
if (activity == null) return
val mDialog = Dialog(activity, R.style.UpdateVersionCompatDialogTheme)
val mDialogView = showBottomDialog(
R.layout.dialog_layout_produce_gourmet,
activity,
mDialog,
0,
Gravity.CENTER
)
val layoutAd = mDialogView?.findViewById<FrameLayout>(R.id.layout_ad)
AdUtils.showFeedAd(activity, "seed_not_enough_bigimage", layoutAd)
mDialogView.findViewById<TextView>(R.id.tv_dialog_shengchan_coin)?.text = "$seedPrice"
mDialogView.findViewById<TextView>(R.id.tv_dialog_shengchan_num)?.text =
"今天剩余${seedVideo}次"
var seedImg = mDialogView.findViewById<ImageView>(R.id.id_seed_not_enough_img);
if (id != null) {
setImage(seedImg, id)
}
mDialogView.findViewById<ImageView>(R.id.iv_shengchan_close).setOnClickListener {
mDialog.dismiss()
}
//买种子
mDialogView.findViewById<ImageView>(R.id.btn_dialog_coin_shengchan).setOnClickListener {
buySeedOnClickListener.onClick(it)
mDialog.dismiss()
}
//看视频领取种子
mDialogView.findViewById<ImageView>(R.id.btn_dialog_ad_shengchan).setOnClickListener {
receiveSeedOnClickListener.onClick(it)
mDialog.dismiss()
}
mDialog.setOnDismissListener(object : DialogInterface.OnDismissListener {
override fun onDismiss(p0: DialogInterface?) {
onDestroy()
AdUtils.loadFeedCacheAdToCache(activity)
}
})
mDialog?.setCanceledOnTouchOutside(false)
mDialog?.setCancelable(false)
if(activity.isFinishing){
return
}
mDialog?.show()
}
/**
* 添加点击缩放效果
*/
......
......@@ -4,23 +4,25 @@ import android.app.Activity
import android.app.Dialog
import android.view.Gravity
import android.widget.FrameLayout
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.ym.library.module.HomeListEntity
import com.ym.library.module.OrderEntity
import com.ym.library.module.OrderListEntity
import com.ym.library.utils.AdUtils
import com.ym.library.utils.EventUtils
import com.ym.msdh.R
import com.ym.msdh.game.adapter.OrderAdapter
import com.ym.msdh.game.listener.IDialogViewCloseCallback
import com.ym.msdh.game.utils.CenterDialog
/**
* 订单弹窗
*/
object OrderDialog {
fun show(activity: Activity,result: OrderListEntity?) {
fun show(activity: Activity,result: OrderEntity?) {
if (activity == null || result == null) return
EventUtils.onEvent("show_order_dialog", "订单弹窗曝光")
var mDialog = Dialog(activity, R.style.UpdateVersionCompatDialogTheme75)
......@@ -38,6 +40,9 @@ object OrderDialog {
val recycler_order = mDialogView?.findViewById<RecyclerView>(R.id.recycler_order)
val layout_ad = mDialogView?.findViewById<FrameLayout>(R.id.layout_ad)
mDialogView.findViewById<ImageView>(R.id.iv_order_close).setOnClickListener {
mDialog.dismiss()
}
tv_order_title.text = "${result?.orderLevel}级订单"
tv_order_num.text = "${result?.awardCash}"
......
......@@ -110,7 +110,7 @@ object TurntableDialog : TurntableUtils(), TurntableContract.View {
// RxBusUtil.getDefault().send(RxBusConstant.RX_MAIN_UPDATE_HOME_INFO)
mDialog?.dismiss()
timeTask?.cancel()
mListener.onCloseViewSuccess(true);
mListener.onCloseViewSuccess(true)
RxBusUtil.getDefault().unregister(this)
}
......
......@@ -23,7 +23,7 @@ object WareHouseDialog : WareHouseContract.View {
private var mPresenter: WareHousePresenter? = null
private var adapter: WareHouseAdapter? = null
//展示兑换记录窗口
//展示仓库窗口
fun showWareHouse(context: Activity?) {
if (context == null) {
return
......
......@@ -20,7 +20,7 @@
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:background="@mipmap/icon_main_dialog_get_drops_bg">
android:background="@drawable/icon_base_dialog_bg">
</RelativeLayout>
......@@ -42,7 +42,7 @@
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginBottom="20dp"
android:background="@mipmap/icon_content_bg">
>
<ImageView
android:id="@+id/id_img_title"
......@@ -50,18 +50,19 @@
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="35dp"
android:src="@mipmap/icon_top_bg" />
android:src="@mipmap/icon_top_bg"
android:visibility="gone"/>
<TextView
android:id="@+id/id_tv_gongxi_get"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/dp_44"
android:layout_marginTop="@dimen/dp_74"
android:text="恭喜获得金币"
android:textColor="@color/white"
android:textSize="20sp"
android:visibility="invisible" />
android:visibility="visible" />
<LinearLayout
android:id="@+id/id_ll_content"
......
......@@ -2,7 +2,8 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
android:gravity="center"
android:orientation="vertical">
<FrameLayout
android:layout_width="wrap_content"
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_shengchan_root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
<RelativeLayout
android:layout_width="328dp"
android:layout_height="360dp"
android:layout_marginTop="6dp"
android:layout_marginRight="5dp"
android:background="@drawable/icon_base_dialog_bg_360">
<com.ym.library.widget.FontTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:includeFontPadding="false"
android:text="生产美食"
android:textColor="@color/white"
android:textSize="22sp" />
<ImageView
android:id="@+id/id_seed_not_enough_img"
android:layout_width="@dimen/dp_100"
android:layout_height="@dimen/dp_100"
android:layout_centerHorizontal="true"
android:layout_marginTop="80dp" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/btn_dialog_ad_shengchan"
android:layout_centerHorizontal="true">
<ImageView
android:id="@+id/btn_dialog_coin_shengchan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon_dialog_coin_shengchan" />
<ImageView
android:id="@+id/img_coin"
android:layout_width="@dimen/dp_24"
android:layout_height="@dimen/dp_24"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/dp_60"
android:src="@mipmap/icon_coin_little" />
<com.ym.library.widget.FontTextView
android:id="@+id/tv_dialog_shengchan_coin"
android:layout_width="@dimen/dp_50"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/img_coin"
android:drawablePadding="4dp"
android:gravity="center"
android:includeFontPadding="false"
android:text="299"
android:textColor="@color/white"
android:textSize="22sp" />
</RelativeLayout>
<ImageView
android:id="@+id/btn_dialog_ad_shengchan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/tv_dialog_shengchan_num"
android:layout_centerHorizontal="true"
android:src="@drawable/icon_dialog_ad_shengchan" />
<TextView
android:id="@+id/tv_dialog_shengchan_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="28dp"
android:includeFontPadding="false"
android:text="今天剩余10次"
android:textColor="#94491A"
android:textSize="13sp" />
</RelativeLayout>
<ImageView
android:id="@+id/iv_shengchan_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:src="@drawable/icon_base_dialog_close" />
</FrameLayout>
<include layout="@layout/layout_base_feed_ad" />
</LinearLayout>
\ No newline at end of file
......@@ -31,8 +31,8 @@
android:id="@+id/rl_record"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center" />
android:layout_marginTop="@dimen/dp_64"
android:layout_centerHorizontal="true"/>
</RelativeLayout>
......
......@@ -3,7 +3,8 @@
android:layout_width="@dimen/dp_100"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
android:orientation="vertical"
android:layout_marginBottom="@dimen/dp_10">
<LinearLayout
android:layout_width="@dimen/dp_42"
......@@ -13,15 +14,16 @@
<ImageView
android:id="@+id/id_img_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:src="@mipmap/baicai_fruit"/>
</LinearLayout>
<TextView
android:id="@+id/id_tv_ownnum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="#8F4C07"
android:textSize="@dimen/sp_16"
android:text="1111"
android:textColor="#94491A"
android:textSize="@dimen/sp_14"
android:textStyle="bold" />
</LinearLayout>
......@@ -62,6 +62,8 @@
<dimen name="dp_75">75dp</dimen>
<dimen name="dp_76">76dp</dimen>
<dimen name="dp_79">79dp</dimen>
<dimen name="dp_80">80dp</dimen>
<dimen name="dp_84">84dp</dimen>
<dimen name="dp_98">92dp</dimen>
<dimen name="dp_96">96dp</dimen>
<dimen name="dp_94">94dp</dimen>
......
......@@ -67,7 +67,7 @@ dependencies {
api ("com.bx:adsdk:1.3.3"){
exclude group: 'com.google.code.gson'
}
api 'com.ym.admodule:admodule:1.0.2.28'
api 'com.ym.admodule:admodule:1.0.2.31'
api 'com.airbnb.android:lottie:3.1.0'
/* api 'androidx.appcompat:appcompat:1.2.0-alpha02'
api 'com.android.support:design:28.0.0'
......
......@@ -596,4 +596,7 @@ public class Constant {
public static String ReportSessionId = "";
public static boolean isReportXiaoman = true;
public static int videoNumber = 0;
public static int videoCount = 15;
public static long videoTime = 0;
}
package com.ym.cattle.module
class BubbleOrBoxReceiveEntity {
var balance: Int? = 0
}
\ No newline at end of file
package com.ym.library.module
class OrderAwardEntity {
var awardCash:String=""
}
\ No newline at end of file
package com.ym.library.net
import android.text.TextUtils
import com.ym.library.BuildConfig
import com.ym.admodule.BuildConfig
import com.ym.library.Constant
import com.ym.modulecommon.net.NetConfig
import com.ym.modulecommon.utils.PhoneUtils
......
......@@ -111,7 +111,7 @@ interface IGameApi {
* @return
*/
@POST(NetConfig.Game.URL_GAME_ORDER_RECEIVE)
fun getOrderReceive(): Observable<Response<StatusEntity>>
fun getOrderReceive(): Observable<Response<OrderAwardEntity>>
//抽奖结果
@POST(NetConfig.Game.URL_GAME_FARM_LOTTERY)
......
package com.ym.library.net
import com.ym.cattle.module.BubbleOrBoxReceiveEntity
import com.ym.library.module.*
import com.ym.modulecommon.module.UserInfoEntity
import io.reactivex.Observable
......@@ -89,4 +90,9 @@ interface IUserApi {
"slot_id"
) slot_id: String
): Observable<Response<CoinEntity>>
@POST("app/v3/common/award/multiple")
fun h5Receive(
@Query("sid") id: String
): Observable<Response<BubbleOrBoxReceiveEntity?>>
}
\ No newline at end of file
package com.ym.cattle.presenter
import com.ym.modulecommon.net.BaseObserver
import com.ym.modulecommon.net.RxSchedulers
object ReportPresenter {
fun report() {
// AppClient.report.report().compose(RxSchedulers.observableIO2Main()).subscribe(object : BaseObserver<Any?>() {
// override fun onSuccess(result: Any?) {
//
// }
//
// override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
// }
// })
}
}
\ No newline at end of file
......@@ -3,11 +3,14 @@ package com.ym.library.net
import android.app.Activity
import android.os.Build
import android.text.TextUtils
import android.util.Log
import com.ayl.ces.jni.CesCore
import com.ym.library.Constant
import com.ym.library.utils.*
import com.ym.modulecommon.AppliContext
import com.ym.modulecommon.Config
import com.ym.modulecommon.module.UserInfoEntity
import com.ym.modulecommon.utils.SettingPreference.saveSecDesc
import io.reactivex.Observable
import io.reactivex.ObservableOnSubscribe
import io.reactivex.Observer
......@@ -336,23 +339,23 @@ class SplashPresenter : SplashContract.Presenter {
val md5: String = mNovelInitEntity?.md5 ?: ""
val lua: String = mNovelInitEntity?.lua ?: ""
// if (lua != null && !TextUtils.isEmpty(lua)) {
// Log.d("lua", "lua:---->" + lua)
// if (!TextUtils.isEmpty(md5)) {
// SettingPreference.saveMd5(md5)
// }
// SettingPreference.saveSecDesc(lua)
//
// CesCore.getInstance().setData(lua)
// Constant.Param.env = CesCore.getInstance().Ckwork(SettingPreference.getAndroidId())
// Constant.Param.md5 = SettingPreference.getMd5()
// } else {
// val lua = SettingPreference.getSecDesc()
// if (!TextUtils.isEmpty(lua)) {
// CesCore.getInstance().setData(lua)
// Constant.Param.env = CesCore.getInstance().Ckwork(SettingPreference.getAndroidId())
// }
// }
if (lua != null && !TextUtils.isEmpty(lua)) {
Log.d("lua", "lua:---->" + lua)
if (!TextUtils.isEmpty(md5)) {
com.ym.modulecommon.utils.SettingPreference.saveMd5(md5)
}
com.ym.modulecommon.utils.SettingPreference.saveSecDesc(lua)
CesCore.getInstance().setData(lua)
Constant.Param.env = CesCore.getInstance().Ckwork(com.ym.modulecommon.utils.SettingPreference.getAndroidId())
Constant.Param.md5 = com.ym.modulecommon.utils.SettingPreference.getMd5()
} else {
val lua = com.ym.modulecommon.utils.SettingPreference.getSecDesc()
if (!TextUtils.isEmpty(lua)) {
CesCore.getInstance().setData(lua)
Constant.Param.env = CesCore.getInstance().Ckwork(com.ym.modulecommon.utils.SettingPreference.getAndroidId())
}
}
deviceLogin()
// getUserInfo()
// TODO
......
......@@ -18,8 +18,8 @@ import com.ym.library.net.RxSchedulers
object AdUtils {
private const val TAG = "AdUtils"
const val AD_SPLASH = "splash"//开屏
const val AD_IMG_FADE = "common_bigimage"//大图
const val AD_REWARD_VIDIO = "common_video"//激励视频
const val AD_IMG_FADE = "bigimage"//大图
const val AD_REWARD_VIDIO = "video"//激励视频
private var activity: Activity? = null
private var handler = object : Handler() {
override fun handleMessage(msg: Message?) {
......
......@@ -666,5 +666,11 @@ public class DateUtils {
return time ;
}
public static double numbToDoule(String number) {
if(number!=null){
return Double.parseDouble(number);
}else {
return 0.0;
}
}
}
package com.ym.cattle.utils
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import com.ym.library.utils.LJButtonCountTimer
import com.ym.library.utils.MainLooper
import com.ym.modulecommon.AppliContext
/**
* Created by erwin on 2020/11/26
*
*/
object DialogCloseUtils {
fun setTimes(tv:TextView,iv:ImageView){
tv.visibility = View.VISIBLE
iv.visibility = View.GONE
tv.text = "3"
LJButtonCountTimer(AppliContext.get(), 3000, 1000, tv,iv).start()
}
}
\ No newline at end of file
......@@ -131,8 +131,8 @@ object GameDialog : BaseDialog() {
*/
fun showAllSpeedUp(
activity: Activity?,
time: String,
num: String,
time: Int,
num: Int,
listener: View.OnClickListener
) {
if (activity == null) return
......@@ -154,8 +154,8 @@ object GameDialog : BaseDialog() {
val tv_speed_up_num = mDialogView?.findViewById<TextView>(R.id.tv_speed_up_num)
val btn_speed_up_btn = mDialogView?.findViewById<ImageView>(R.id.btn_speed_up_btn)
val layout_ad = mDialogView?.findViewById<FrameLayout>(R.id.layout_ad)
tv_speed_up_time.text="所有土地获得${time}分钟加速"
tv_speed_up_num.text="今天还剩${num}次"
btn_speed_up_btn.setOnClickListener {
listener.onClick(it)
mDialog?.dismiss()
......@@ -548,7 +548,7 @@ object GameDialog : BaseDialog() {
/**
* 加速器
*/
fun showAccelerator(activity: Activity,num:Int,listener: View.OnClickListener) {
fun showAccelerator(activity: Activity,getnum:Int,num:Int,listener: View.OnClickListener) {
if (activity == null) return
val mDialog = Dialog(activity, R.style.UpdateVersionCompatDialogTheme)
val mDialogView =
......@@ -564,9 +564,10 @@ object GameDialog : BaseDialog() {
mDialogView.findViewById<LinearLayout>(R.id.layout_accelerator_root)
val btn_accelerator_btn = mDialogView.findViewById<ImageView>(R.id.btn_accelerator_btn)
val tv_accelerator_num = mDialogView.findViewById<TextView>(R.id.tv_accelerator_num)
val tv_get_num = mDialogView.findViewById<TextView>(R.id.tv_get_num)
val iv_accelerator_close = mDialogView.findViewById<ImageView>(R.id.iv_accelerator_close)
val layout_ad = mDialogView?.findViewById<FrameLayout>(R.id.layout_ad)
tv_get_num.text="+${getnum}"
tv_accelerator_num.text = "今天剩余${num}次"
btn_accelerator_btn.setOnClickListener {
......
package com.ym.cattle.listener
/**
* Created by erwin on 2020/11/23
*
*/
interface H5Listener {
fun onDialogClose(type: String)
}
\ No newline at end of file
package com.ym.library.utils;
import android.content.Context;
import android.graphics.Color;
import android.os.CountDownTimer;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
/**
* 按钮倒计时
* @author lbm
*
*/
public class LJButtonCountTimer extends CountDownTimer {
TextView mButton;
ImageView close;
Context mContext;
public LJButtonCountTimer(Context ctx, long millisInFuture, long countDownInterval, TextView button, ImageView close) {
super(millisInFuture, countDownInterval);
this.mButton = button;
this.mContext = ctx;
this.close = close;
}
@Override
public void onFinish() {
mButton.setTextColor(Color.parseColor("#EED685"));
mButton.setVisibility(View.GONE);
close.setVisibility(View.VISIBLE);
mButton.setEnabled(true);
cancel();
}
@Override
public void onTick(long arg0) {
mButton.setTextColor(Color.parseColor("#EED685"));
mButton.setText(((arg0/1000)+1)+"");
mButton.setEnabled(false);
}
}
package com.ym.cattle.utils
import android.content.Context
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import android.widget.Toast
import com.ym.modulecommon.AppliContext
import com.ym.library.R
/**
* Created by erwin on 2020/11/5
*
*/
object ToastUtils {
/**
* 弹出文字
*/
fun showTextToast(s: String) {
val context: Context = AppliContext.get()
val view: View = LayoutInflater.from(context).inflate(R.layout.toast_text_layout, null)
val title: TextView = view.findViewById(R.id.toast_tv) as TextView
title.setText(s)
showToast(context, view)
}
/**
* 金币
*/
fun showVideoCoin(s: String) {
val context: Context = AppliContext.get()
val view: View = LayoutInflater.from(context).inflate(R.layout.toast_img_layout, null)
val title: TextView = view.findViewById(R.id.toast_tv) as TextView
title.setText("获得翻倍奖励+" + s + "牛牛币")
showToast(context, view)
}
/**
* 红包
*/
fun showRedpack(s: String) {
val context: Context = AppliContext.get()
val view: View = LayoutInflater.from(context).inflate(R.layout.toast_redpack_layout, null)
showToast(context, view)
}
private fun showToast(context: Context, view: View) {
val toast = Toast(context)
toast.setGravity(Gravity.CENTER_HORIZONTAL or Gravity.CENTER, 0, 0)
toast.setDuration(Toast.LENGTH_SHORT)
toast.setView(view)
toast.show()
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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