Commit 1208ee59 authored by mengcuiguang's avatar mengcuiguang

添加界面逻辑,三方sdk,解决冲突等

parent fb03f606
......@@ -113,12 +113,14 @@
<activity
android:name=".ui.activitys.SettingsActivity"
android:screenOrientation="portrait" />
<activity android:name=".ui.activitys.GuideActivity" />
<activity android:name=".ui.activitys.LiebaoGameActivity" />
<activity android:name=".ui.activitys.DrawcashActivity" />
<activity android:name=".ui.activitys.WaterActivity" />
<activity android:name=".ui.activitys.WalkActivity" />
<activity android:name=".ui.activitys.AboutusActivity" />
<activity android:name=".ui.activitys.AboutusActivity"
android:screenOrientation="portrait"/>
<activity android:name=".ui.activitys.GuideActivity"/>
<activity android:name=".ui.activitys.LiebaoGameActivity"/>
<activity android:name=".ui.activitys.DrawcashActivity"/>
<activity android:name=".ui.activitys.WaterActivity"/>
<activity android:name=".ui.activitys.WalkActivity"/>
<activity android:name=".ui.activitys.EraseActivity"/>
<service
android:name=".service.UpdateService"
......
//package com.mints.highgold.ad
//
//import android.app.Activity
//import android.content.Intent
//import android.os.Bundle
//import com.mints.highgold.common.Constant
//import com.mints.highgold.ui.activitys.CsVedioActivity
//
///**
// * 创神视频
// */
//class ChuangshenVedioAdManager private constructor(activity: Activity) {
// private lateinit var chuangshenVedioAdListener: ChuangshenVedioAdListener
// var activity: Activity? = null
//
// companion object {
// private var _inst: ChuangshenVedioAdManager? = null
// fun getInstance(activity: Activity): ChuangshenVedioAdManager? {
// return if (_inst != null) {
// _inst
// } else {
// _inst = ChuangshenVedioAdManager(activity)
// _inst
// }
// }
// }
//
// init {
// init(activity)
// }
//
// private fun init(activity: Activity) {
// this.activity = activity
// }
//
// fun loadChuangshenAd(downloadCoin: Int = 0, curCoin: Int = 0, carrierType: String?, extraId: String?) {
// chuangshenVedioAdListener?.chuangshenVedioAdSuccess()
//
// val bundle = Bundle().apply {
// putString(Constant.TRY_VEDIO_COIN, curCoin.toString())
// putString(Constant.TRY_TASK_H5DOWNLOADCOIN, downloadCoin.toString())
// putString(Constant.TRY_CARRIER, carrierType)
// putString(Constant.MAIN_EXTRA_ID, extraId)
// }
// readyGo(CsVedioActivity::class.java, bundle)
// }
//
// fun setChuangshenVedioAdListener(chuangshenVedioAdListener: ChuangshenVedioAdListener) {
// this.chuangshenVedioAdListener = chuangshenVedioAdListener
// }
//
// interface ChuangshenVedioAdListener {
// fun chuangshenVedioAdSuccess()
// }
//
// fun readyGo(clazz: Class<*>?, bundle: Bundle) {
// val intent = Intent(activity, clazz)
// intent.putExtras(bundle)
// activity?.startActivity(intent)
// }
//
// fun destory() {
// //退出释放资源
//// Ad.getInstance().onDestroy()
// }
//}
\ No newline at end of file
//package com.mints.highgold.ad
//
//import android.app.Activity
//import com.dm.rvads.common.util.AdError
//import com.dm.rvads.rewardvideo.RewardVideoADListener
//import com.dm.rvads.rewardvideo.RewardVideoAd
//import com.mints.highgold.MintsApplication
//import com.mints.highgold.common.Constant
//import com.mints.highgold.manager.DomobManager
//import com.mints.highgold.manager.TrackManager
//import com.mints.highgold.mvp.presenters.DomobVedioAdPresenter
//import com.mints.highgold.mvp.views.DomobVedioAdView
//import com.mints.highgold.utils.LogUtil
//import java.util.*
//
///**
// * 多盟视频
// */
//class DomobVedioAdManager private constructor(activity: Activity) :
// DomobVedioAdView, RewardVideoADListener {
//
// private val TAG = DomobVedioAdManager::class.java.simpleName
//
// lateinit var rewardVideoAd: RewardVideoAd
//
// lateinit var domobVedioAdPresenter: DomobVedioAdPresenter
// private var domobVedioAdListener: DomobVedioAdListener? = null
// var activity: Activity? = null
//
// private var curCoin = 0
// private var extraId: String? = null
// private var downloadCoin = 10
// private var carrierType = ""
//
// private var isClickScreen: Boolean = true
//
// companion object {
// private var _inst: DomobVedioAdManager? = null
// fun getInstance(activity: Activity): DomobVedioAdManager? {
// return if (_inst != null) {
// _inst
// } else {
// _inst = DomobVedioAdManager(activity)
// _inst
// }
// }
// }
//
// init {
// init(activity)
// }
//
// private fun init(activity: Activity) {
// this.activity = activity
// domobVedioAdPresenter = DomobVedioAdPresenter()
// domobVedioAdPresenter.attachView(this)
// }
//
// fun loadDomobAd(downloadCoin: Int, curCoin: Int, carrierType: String, extraId: String?) {
// if (activity == null) {
// return
// }
// isClickScreen = true
//
// this.downloadCoin = downloadCoin
// this.carrierType = carrierType
// this.curCoin = curCoin
// this.extraId = extraId
//
// var postId: String
// when (carrierType) {
// Constant.CARRIER_DAILY_VIDEO -> postId = DomobManager.DOMOB_AD_VEDIO_MAIN_LOOK
// Constant.CARRIER_VERSUS_VIDEO -> postId = DomobManager.DOMOB_AD_VEDIO_VERSUS_LOOK
// Constant.CARRIER_ONLINE_INCOME_DOUBLE, Constant.CARRIER_HOMEWATER_BUBBLE -> postId = DomobManager.DOMOB_AD_VEDIO_MAIN_POP
// Constant.CARRIER_REDENVELOPE_DOUBLE, Constant.CARRIER_REDENVELOPE -> postId = DomobManager.DOMOB_AD_VEDIO_REDBOX
// else -> postId = DomobManager.DOMOB_AD_VEDIO_MAIN_LOOK
//
// }
// rewardVideoAd = RewardVideoAd(activity, DomobManager.DOMOB_AD_APPID, postId, this)
// rewardVideoAd.loadAD()
// }
//
// override fun onADClick() {
// TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_DOMOB, Constant.EVENT_TYPE_TWO, "", "")
//
// if (isClickScreen) {
// // 防止重复
// TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_DOMOB, Constant.EVENT_TYPE_FOUR, "", "")
// isClickScreen = false
// }
// if (domobVedioAdListener != null) {
// domobVedioAdListener?.domobVedioAdDownload()
// }
// }
//
// override fun onVideoCached() {
// rewardVideoAd.showAd()
// LogUtil.d(TAG, "onVideoCached")
// }
//
// override fun onReward() {
// LogUtil.d(TAG, "onReward")
// }
//
// override fun onADClose() {
// TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_DOMOB, Constant.EVENT_TYPE_THREE, "", "")
//
// if (domobVedioAdListener != null) {
// domobVedioAdListener?.domobVedioAdSuccess()
// }
//
// domobVedioAdPresenter?.reportAddCoinMsg(activity, getAdMapVO())
//
// LogUtil.d(TAG, "onADClose")
// }
//
// override fun onVideoComplete() {
// LogUtil.d(TAG, "onVideoComplete")
// }
//
// override fun onError(error: AdError?) {
// TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_DOMOB, Constant.EVENT_TYPE_ONE, (error?.errorCode).toString(), error?.errorMsg)
//
// if (domobVedioAdListener != null) {
// domobVedioAdListener?.domobVedioAdFail()
// }
//
// LogUtil.d(TAG, "onError code:${error?.errorCode} msg:${error?.errorMsg}")
// }
//
// override fun onADShow() {
// LogUtil.d(TAG, "onADShow")
// TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_DOMOB, Constant.EVENT_TYPE_ZERO, "", "")
// }
//
// fun setDomobVedioAdListener(domobVedioAdListener: DomobVedioAdListener?) {
// this.domobVedioAdListener = domobVedioAdListener
// }
//
// interface DomobVedioAdListener {
// fun domobVedioAdSuccess()
// fun domobVedioAdFail()
// fun domobVedioAdDownload()
// }
//
// override fun showLoading(msg: String?) {
// TODO("Not yet implemented")
// }
//
// override fun showToast(msg: String?) {
// TODO("Not yet implemented")
// }
//
// override fun hideLoading() {
// TODO("Not yet implemented")
// }
//
// override fun getBaseApplication() = activity?.application as MintsApplication
//
// private fun getAdMapVO(): HashMap<String, Any> {
// val vo = HashMap<String, Any>()
// vo["carrierType"] = carrierType
// vo["adtype"] = Constant.ADTYPE_VEDIO
// vo["adsource"] = Constant.AD_SOURCE_DOMOB
// when (carrierType) {
// Constant.CARRIER_VERSUS_VIDEO -> vo["coin"] = curCoin
// Constant.CARRIER_DAILY_DOWNLOAD -> vo["coin"] = curCoin
// Constant.CARRIER_DAILY_VIDEO -> vo["coin"] = curCoin
// Constant.CARRIER_HOMEWATER_BUBBLE -> vo["waterCoin"] = curCoin
// Constant.CARRIER_ONLINE_INCOME_DOUBLE -> vo["online_income"] = curCoin
// Constant.CARRIER_OFFLINE_DOUBLE -> {
// vo["offline_income"] = curCoin
// vo["page"] = Constant.PAGE_TWO
// vo["block"] = Constant.BLOCK_ONE
// vo["order"] = Constant.ORDER_ONE
// }
// Constant.CARRIER_SIGNIN_HOMEPAGE_CARD -> {
// vo["page"] = Constant.PAGE_TWO
// vo["block"] = Constant.BLOCK_ONE
// vo["order"] = Constant.ORDER_ONE
// }
// Constant.CARRIER_DRINK, Constant.CARRIER_DRINK_PATCH -> {
// vo["page"] = Constant.PAGE_ONE
// vo["block"] = Constant.BLOCK_FOUR
// vo["order"] = Constant.ORDER_ONE
// vo["critId"] = extraId!!
// }
// Constant.CARRIER_VERSUS_DRINKTEA -> {
// vo["page"] = Constant.PAGE_TWO
// vo["block"] = Constant.BLOCK_ONE
// vo["order"] = Constant.ORDER_THREE
// vo["critId"] = extraId!!
// }
// Constant.CARRIER_DAILY_TURN -> {
// vo["page"] = Constant.PAGE_ONE
// vo["block"] = Constant.BLOCK_THREE
// vo["order"] = Constant.ORDER_THREE
// vo["turntableKey"] = extraId!!
// }
// Constant.CARRIER_CHALLENGE_TURN -> {
// vo["page"] = Constant.PAGE_TWO
// vo["block"] = Constant.BLOCK_ONE
// vo["order"] = Constant.ORDER_FOUR
// vo["turntableKey"] = extraId!!
// }
// Constant.CARRIER_CHALLENGE_CARD -> {
// vo["page"] = Constant.PAGE_TWO
// vo["block"] = Constant.BLOCK_ONE
// vo["order"] = Constant.ORDER_FIVE
// vo["turntableKey"] = extraId!!
// }
// Constant.CARRIER_REDENVELOPE_DOUBLE, Constant.CARRIER_REDENVELOPE -> {
// vo["page"] = Constant.PAGE_ONE
// vo["block"] = Constant.BLOCK_ONE
// vo["order"] = Constant.ORDER_ONE
// vo["numKey"] = extraId!!
// }
// else -> {
// vo["page"] = Constant.PAGE_ONE
// if (curCoin != -1) {
// vo["online_income"] = curCoin
// }
// }
// }
// return vo
// }
//
// fun destory() {
// domobVedioAdPresenter?.let {
// domobVedioAdPresenter.dispose()
// domobVedioAdPresenter.detachView()
// }
// }
//}
\ No newline at end of file
......@@ -11,7 +11,7 @@ import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.manager.TrackManager;
import com.mints.goodmoney.manager.YlhAdManager;
import com.mints.goodmoney.mvp.presenters.YlhVedioAdPresenter;
import com.mints.goodmoney.mvp.views.LyVedioAdManagerView;
import com.mints.goodmoney.mvp.views.VedioAdManagerView;
import com.mints.goodmoney.ui.widgets.LoadingDialog;
import com.mints.goodmoney.utils.ToastUtil;
import com.qq.e.ads.rewardvideo.RewardVideoAD;
......@@ -23,7 +23,7 @@ import java.util.HashMap;
/**
* 优量汇视频
*/
public class YlhVedioAdManager implements LyVedioAdManagerView {
public class YlhVedioAdManager implements VedioAdManagerView {
private static YlhVedioAdManager _inst;
......@@ -80,19 +80,11 @@ public class YlhVedioAdManager implements LyVedioAdManagerView {
isClickScreen = true;
this.curCoin = curCoin;
this.extraId = extraId;
// showLoading("加载中...");
String ylhPostId;
switch (carrierType) {
case Constant.CARRIER_ONLINE_INCOME_DOUBLE:// 在线收益翻倍
case Constant.CARRIER_OFFLINE_DOUBLE:// 离线收益翻倍
case Constant.CARRIER_SIGNIN_HOMEPAGE_CARD:// 签到翻倍
case Constant.CARRIER_DRINK:// 喝水正常
case Constant.CARRIER_DRINK_PATCH:// 喝水补卡
case Constant.CARRIER_VERSUS_DRINKTEA://喝饮料
case Constant.CARRIER_DAILY_TURN:// 首页大转盘
ylhPostId = YlhAdManager.YLH_AD_VEDIO_MAIN_PAN_POSTID;
break;
case Constant.CARRIER_CHALLENGE_TURN:// 挑战大转盘
ylhPostId = YlhAdManager.YLH_AD_VEDIO_VERSUS_PAN_POSTID;
break;
......@@ -111,8 +103,6 @@ public class YlhVedioAdManager implements LyVedioAdManagerView {
rewardVideoAD = new RewardVideoAD(activity, YlhAdManager.YLH_AD_APPID, ylhPostId, new RewardVideoADListener() {
@Override
public void onADLoad() {//广告加载成功,可在此回调后进行广告展示,此时广告过期时间确定,可通过RewardVideoAD.getExpireTimestamp()获取
// hideLoading();
try {
if (!rewardVideoAD.hasShown()) {//广告展示检查2:当前广告数据还没有展示过
long delta = 1000;//建议给广告过期时间加个buffer,单位ms,这里demo采用1000ms的buffer
......@@ -132,7 +122,6 @@ public class YlhVedioAdManager implements LyVedioAdManagerView {
if (ylhVedioAdListener != null) {
ylhVedioAdListener.ylhVedioAdFail();
}
// loadCsjAd(CARRIER_TYPE);
}
}
......@@ -154,11 +143,6 @@ public class YlhVedioAdManager implements LyVedioAdManagerView {
@Override
public void onReward() {//激励视频广告激励发放
// overVedioLayout(carrierType);
if (ylhVedioAdListener != null) {
ylhVedioAdListener.ylhVedioAdSuccess();
}
if (activity != null) {
ylhVedioAdPresenter.reportAddCoinMsg(activity, getAdMapVO(carrierType));
}
......@@ -187,11 +171,13 @@ public class YlhVedioAdManager implements LyVedioAdManagerView {
public void onADClose() {//激励视频广告被关闭
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_YLH, Constant.EVENT_TYPE_THREE, "", "");
if (ylhVedioAdListener != null) {
ylhVedioAdListener.ylhVedioAdSuccess();
}
}
@Override
public void onError(AdError adError) {//广告流程出错,AdError中包含错误码和错误描述
// hideLoading();
if (adError != null) {
// 0 成功 1失败 2点击 3-有效展示
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_YLH, Constant.EVENT_TYPE_ONE, String.valueOf(adError.getErrorCode()), adError.getErrorMsg());
......@@ -199,7 +185,6 @@ public class YlhVedioAdManager implements LyVedioAdManagerView {
if (ylhVedioAdListener != null) {
ylhVedioAdListener.ylhVedioAdFail();
}
// loadCsjAd(CARRIER_TYPE);
}
});
......@@ -207,7 +192,7 @@ public class YlhVedioAdManager implements LyVedioAdManagerView {
}
@Override
public void checkLYContextSuc(boolean lyCmtFlag) {
public void checkSuc(boolean lyCmtFlag) {
}
/**
......@@ -226,42 +211,19 @@ public class YlhVedioAdManager implements LyVedioAdManagerView {
case Constant.CARRIER_VERSUS_VIDEO:// 每日任务-视频
vo.put("coin", curCoin);
break;
case Constant.CARRIER_DAILY_DOWNLOAD:// 每日任务-视频
vo.put("coin", curCoin);
break;
case Constant.CARRIER_DAILY_VIDEO:// 观看视频-视频
vo.put("coin", curCoin);
break;
case Constant.CARRIER_HOMEWATER_BUBBLE:// 首页喝水汽泡
case Constant.CARRIER_HOMEWATER:// 首页喝水汽泡
vo.put("waterCoin", curCoin);
break;
case Constant.CARRIER_ONLINE_INCOME_DOUBLE:// 在线收益翻倍
vo.put("online_income", curCoin);
break;
case Constant.CARRIER_OFFLINE_DOUBLE:// 离线收益翻倍
vo.put("offline_income", curCoin);
case Constant.CARRIER_SIGNIN_HOMEPAGE_CARD:// 签到翻倍
break;
case Constant.CARRIER_DRINK:// 喝水正常
case Constant.CARRIER_DRINK_PATCH:// 喝水补卡
vo.put("critId", extraId);
break;
case Constant.CARRIER_VERSUS_DRINKTEA://喝饮料
vo.put("critId", extraId);
break;
case Constant.CARRIER_DAILY_TURN:// 首页大转盘
vo.put("turntableKey", extraId);
break;
case Constant.CARRIER_CHALLENGE_TURN:// 挑战大转盘
vo.put("turntableKey", extraId);
break;
case Constant.CARRIER_CHALLENGE_CARD:// 挑战刮刮乐
vo.put("turntableKey", extraId);
break;
case Constant.CARRIER_REDENVELOPE_DOUBLE:// 红包翻倍奖励
case Constant.CARRIER_REDENVELOPE:// 红包奖励
vo.put("numKey", extraId);
break;
}
return vo;
}
......@@ -347,7 +309,6 @@ public class YlhVedioAdManager implements LyVedioAdManagerView {
this.ylhVedioAdListener = ylhVedioAdListener;
}
public interface YlhVedioAdListener {
void ylhVedioAdFail();
......
......@@ -4,7 +4,7 @@ package com.mints.goodmoney.common;
* 描述:配置app设置开关
* 作者:孟崔广
* 时间:2017/10/10 17:51
* 邮箱:mengcuiguang@cashbang.cn
* 邮箱:mengcga@163.com
*/
public class AppConfig {
......
......@@ -76,74 +76,36 @@ object Constant {
const val MAIN_CARRIER_TYPE = "main_carrier_type" //载体
const val LOGIN_FLAG = "login_flag" //登录标识
// 载体
const val CARRIER_DRINK = "DRINK" //喝水
const val CARRIER_DRINK_PATCH = "DRINK_PATCH" //喝水补卡
const val CARRIER_DAILY_DOWNLOAD = "DAILY_DOWNLOAD" //每日任务-视频
const val CARRIER_DAILY_DOWNLOAD_DOWNLOAD = "CARRIER_DAILY_DOWNLOAD_DOWNLOAD" //每日任务-下载
const val CARRIER_DAILY_VIDEO = "DAILY_VIDEO" //观看视频-视频
const val CARRIER_DAILY_VIDEO_DOWNLOAD = "DAILY_VIDEO_DOWNLOAD" //观看视频-下载
const val CARRIER_VERSUS_VIDEO = "CHALLENGE_VEDIO1" //每日挑战任务-视频
const val CARRIER_VERSUS_VIDEO_DOWNLOAD = "CHALLENGE_VEDIO1_DOWNLOAD" //每日挑战任务-下载
const val CARRIER_VERSUS_DOWNLOAD = "CHALLENGE_DOWNLOAD1" //每日挑战任务玩应用-视频
const val CARRIER_VERSUS_DOWNLOAD_DOWNLOAD = "CHALLENGE_DOWNLOAD1_DOWNLOAD" //每日挑战任务玩应用-下载
const val CARRIER_VERSUS_DRINKTEA = "CHALLENGE_DRINKS" //每日挑战喝荼
const val CARRIER_DAILY_TURN = "DAILY_TURN" //每日大转盘
const val CARRIER_CHALLENGE_TURN = "CHALLENGE_TURN" //挑战大转盘
const val CARRIER_VERSUS_VIDEO = "CHALLENGE_VEDIO1" //挑战任务-视频
const val CARRIER_CHALLENGE_TURN = "CHALLENGE_TURN" //大转盘
const val CARRIER_SIGNIN_HOMEPAGE_CARD = "SIGNIN_HOMEPAGE_CARD" //签到翻倍
const val CARRIER_SIGNIN_HOMEPAGE_AWARD = "SIGNIN_HOMEPAGE_AWARD" //签到奖励
const val CARRIER_HOMEVEDIO_BIG = "HOMEVEDIO_BIG" //首页大红包
const val CARRIER_HOMEVEDIO_SMALL = "HOMEVEDIO_SMALL" //首页小红包
const val CARRIER_OFFLINE_DOUBLE = "OFFLINE_DOUBLE" //离线收益
const val CARRIER_CHALLENGE_CARD = "CHALLENGE_CARD" //挑战刮刮乐
const val CARRIER_ONLINE_INCOME = "ONLINE_INCOME" //在线收益
const val CARRIER_ONLINE_INCOME_DOUBLE = "ONLINE_INCOME_DOUBLE" //在线收益双倍
const val CARRIER_POP_INTERACTIVE_AD = "POP_INTERACTIVE_AD" //首页泡泡互动广告
const val CARRIER_CHALLENGE_CARD = "CHALLENGE_CARD" //刮刮乐
const val CARRIER_GAME = "GAME" //游戏
const val CARRIER_REDENVELOPE = "REDENVELOPE" //红包点击领取
const val CARRIER_REDENVELOPE_DOUBLE = "REDENVELOPE_DOUBLE" //新年红包翻倍
const val CARRIER_GAME_HOME_LIST = "GAME_HOME_LIST" //首页游戏列表
const val CARRIER_HOMEPAGE_YWHZ = "HOMEPAGE_YWHZ" //首页高额游戏挑战奖励
const val CARRIER_ONLINE_INCOME = "ONLINE_INCOME" //在线收益
const val CARRIER_GAME_CHALLENGE_TIME = "GAME_CHALLENGE_TIME" //任务赚游戏
const val CARRIER_HOMEWATER_BUBBLE = "HOMEWATER_BUBBLE" //首页喝水汽泡
const val CARRIER_HOMEWATER_BUBBLE_TIME = "CARRIER_HOMEWATER_BUBBLE_TIME" //首页喝水汽泡整点
const val CARRIER_HOMEWATER_HIT = "HOMEWATER_HIT" //首页喝水打卡
const val CARRIER_VERSUS_HEALTH = "VERSUS_HEALTH" //任务赚健康
const val CARRIER_HOMEWATER = "HOMEWATER" //喝水
const val CARRIER_DRAWCASH = "CARRIER_DRAWCASH" //提现
const val CARRIER_HOTACTIVITY = "HOTACTIVITY" //热门活动
const val CARRIER_ROTATIONCHART = "ROTATIONCHART" //轮播图
const val CARRIER_YILANVEIDO_REDENVELOPE = "YILANVEIDO_REDENVELOPE" //yl视频红包
const val CARRIER_WALK_BUBBLE = "WALK_BUBBLE" //走路第4个汽泡
const val CARRIER_CHALLENGE_FIRSTWATER = "CHALLENGE_FIRSTWATER" //首次喝水挑战
const val CARRIER_CHALLENGE_IDCODE = "CHALLENGE_IDCODE" //绑定邀请码挑战
const val CARRIER_CHALLENGE_WECHAT = "CHALLENGE_WECHAT" //绑定微信挑战
const val CARRIER_CHALLENGE_MOBILE = "CHALLENGE_MOBILE" //绑定手机号挑战
const val CARRIER_CHALLENGE_NOTICE = "CHALLENGE_NOTICE" //开通通知权限挑战
const val CARRIER_CHALLENGE_FIRSTCASHOUT = "CHALLENGE_FIRSTCASHOUT" //首次提现挑战
const val CARRIER_CHALLENGE_FIRSTHOMEGAME = "CHALLENGE_FIRSTHOMEGAME" //首页游戏挑战
const val CARRIER_CHALLENGE_WATERCOMPLETE = "CHALLENGE_WATERCOMPLETE" //喝水达标
const val CARRIER_WALK = "WALK" //走路
const val CARRIER_WALK_BUBBLE = "WALK_BUBBLE" //走路汽泡
const val CARRIER_CHALLENGE_SHAREFRIEND = "CHALLENGE_SHAREFRIEND" //每日分享
const val CARRIER_MOBILE_COIN_EXCHANGE_REWARD = "MOBILE_COIN_EXCHANGE_REWARD" //移动积分兑换领取额外奖励
const val CARRIER_CHALLENGE_HEALTH_BREATH = "CHALLENGE_HEALTH_BREATH" //小健康-深呼吸
const val CARRIER_CHALLENGE_HEALTH_STAND = "CHALLENGE_HEALTH_STAND" //小健康-站一站
const val CARRIER_CHALLENGE_HEALTH_FRUIT = "CHALLENGE_HEALTH_FRUIT" //小健康-吃水果
const val CARRIER_CHALLENGE_HEALTH_EYE = "CHALLENGE_HEALTH_EYE" //小健康-放松眼
const val CARRIER_NEW_USER = "CARRIER_NEW_USER" //新用户5000红包
const val CARRIER_NEW_USER = "CARRIER_NEW_USER" //新用户红包
const val CARRIER_FRIENDS = "CARRIER_FRIENDS" //邀请好友
// 邀请好友
const val CHALLENGE_SHAREFRIEND = "CHALLENGE_SHAREFRIEND" //邀请好友
const val AD_SOURCE_LY = "LIYAN"
const val AD_SOURCE_CSJ = "CSJ"
const val AD_SOURCE_YLH = "YLH"
const val AD_SOURCE_CSJFULL = "CSJFULL"
const val AD_SOURCE_MINTEGRAL = "MINTEGRAL"
const val AD_SOURCE_HYTECH = "HYTECH" //东方网
const val AD_SOURCE_SHANHU = "CORAL" //珊瑚
const val AD_SOURCE_CHUANGSHEN = "CHUANGSHEN" //创神
const val AD_SOURCE_DOMOB = "DOMOB" //多盟
const val AD_SOURCE_SDHZ = "SDHZ" //闪电盒子
// 调用事件 0 成功 1失败 2点击 3-有效展示 4-去重
const val EVENT_TYPE_ZERO = "0"
......@@ -153,25 +115,14 @@ object Constant {
const val EVENT_TYPE_FOUR = "4"
const val ADTYPE_VEDIO = "VEDIO" //视频广告增加积分
const val ADTYPE_FULLSCREEN_VIDEO = "FULL_SCREEN_VIDEO" //全屏广告
const val ADTYPE_DOWNLOAD = "DOWNLOAD" //视频下载任务增加积分
// 穿山甲激励视频id
const val CSJ_VEDIO_APPIP = "csj_vedio_appip"
// 视频广告类型
const val LY_VEDIO_AD = "LY_VEDIO_AD"
const val CSJ_FULL_AD = "CSJ_FULL_AD"
const val CSJ_VEDIO_AD = "CSJ_VEDIO_AD"
const val YLH_VEDIO_AD = "YLH_VEDIO_AD"
const val YILAN_VEDIO_AD = "YILAN_VEDIO_AD"
const val HYTECH_VEDIO_AD = "HYTECH_VEDIO_AD"
const val MINTEGRAL_VEDIO_AD = "MINTEGRAL_VEDIO_AD"
const val SHANHU_VEDIO_AD = "SHANHU_VEDIO_AD"
const val CHUANGSHEN_VEDIO_AD = "CHUANGSHEN_VEDIO_AD"
const val DUOMENT_VEDIO_AD = "DUOMENT_VEDIO_AD"
const val SDHZ_VEDIO_AD = "SDHZ_VEDIO_AD"
// 游戏类型
......@@ -184,4 +135,6 @@ object Constant {
const val HOT_ACTIVITY_WATER = "water"
const val HOT_ACTIVITY_WALK = "walk"
const val HOT_ACTIVITY_CARD = "card"
// 打开激活
const val FIRST_DEVICE_FLAG = "first_device_flag"
}
\ No newline at end of file
......@@ -14,7 +14,7 @@ import rx.android.schedulers.AndroidSchedulers;
* 描述:AppHttpManager
* 作者:孟崔广
* 时间:2018/01/15 10:51
* 邮箱:mengcuiguang@cashbang.cn
* 邮箱:mengcga@163.com
*/
public class AppHttpManager {
......
package com.mints.goodmoney.manager;
import android.content.Context;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Log;
import com.google.gson.JsonObject;
import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.common.DeviceInfo;
import com.mints.goodmoney.mvp.model.BaseResponse;
import com.mints.goodmoney.mvp.model.Device;
import com.mints.goodmoney.net.LoanService;
import com.mints.library.net.NetCommon;
import com.mints.library.net.netstatus.NetUtils;
import com.mints.library.utils.TLog;
import com.mints.library.utils.json.JsonUtil;
import java.util.HashMap;
import java.util.Set;
import cn.jpush.android.api.JPushInterface;
import cn.jpush.android.api.TagAliasCallback;
import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
/**
* 描述:极光推送管理器
* 作者:孟崔广
* 时间:2019/10/5 13:54
* 邮箱:mengcga@163.com
*/
public class JpushManager {
private static final String TAG_LOG = "JpushManager";
private static JpushManager _inst;
private Context c;
private static final int MSG_SET_SERVICE = 1002;
private static final int MSG_SET_ALIAS = 1001;
public static JpushManager getInstance() {
if (_inst != null) {
return _inst;
} else {
_inst = new JpushManager();
return _inst;
}
}
private JpushManager() {
init();
return;
}
private void init() {
c = MintsApplication.getContext();
}
/**
* 绑定极光和自己的服务器
*
* @param uid 用户信息
*/
public void setJpushService(String uid) {
if (c == null || TextUtils.isEmpty(uid))
return;
Device device = new Device();
device.setDevicetype(1);
device.setUid(uid);
device.setJgid(JPushInterface.getRegistrationID(c));
device.setDeviceinfo(DeviceInfo.Companion.getInstance().getMobileModel());
mHandler.sendMessage(mHandler.obtainMessage(MSG_SET_SERVICE, JsonUtil.toJson(device)));
}
/**
* 绑定极光通讯(别名)
*/
public void setJpushAlias() {
if (c == null)
return;
mHandler.sendMessage(mHandler.obtainMessage(MSG_SET_ALIAS, "android"));
}
private final Handler mHandler = new Handler() {
@Override
public void handleMessage(android.os.Message msg) {
super.handleMessage(msg);
switch (msg.what) {
case MSG_SET_SERVICE:
TLog.d(TAG_LOG, "Set service in handler.");
userBindingJpush((String) msg.obj);
break;
case MSG_SET_ALIAS:
TLog.d(TAG_LOG, "Set alias in handler.");
JPushInterface.setAliasAndTags(c, (String) msg.obj, null, mAliasCallback);
break;
default:
TLog.d(TAG_LOG, "Unhandled msg - " + msg.what);
break;
}
}
};
/**
* 绑定用户
*
* @param jsondata
*/
public void userBindingJpush(String jsondata) {
MintsApplication loanApplication = (MintsApplication) this.c;
LoanService loanService = loanApplication.getLoanService();
HashMap<String, Object> vo = new HashMap<>();
vo.put("uploadData", jsondata);
loanService.registerDevice(vo)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(loanApplication.defaultSubscribeScheduler())
.subscribe(new Subscriber<BaseResponse<JsonObject>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
if (NetUtils.isNetworkConnected(c) && NetCommon.httpErrorCode(e) != 500) {
mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_SET_SERVICE, jsondata), 1000 * 60);
} else {
TLog.d(TAG_LOG, "No network");
}
}
@Override
public void onNext(BaseResponse<JsonObject> baseResponse) {
int code = baseResponse.getStatus();
switch (code) {
case 200:
case 401:
case 404:
break;
default:
if (NetUtils.isNetworkConnected(c)) {
mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_SET_SERVICE, jsondata), 1000 * 60);
} else {
TLog.d(TAG_LOG, "No network");
}
break;
}
}
});
}
private final TagAliasCallback mAliasCallback = new TagAliasCallback() {
@Override
public void gotResult(int code, String alias, Set<String> tags) {
String logs;
switch (code) {
case 0:
logs = "Set tag and alias success";
TLog.i(TAG_LOG, logs);
break;
case 6002:
logs = "Failed to set alias and tags due to timeout. Try again after 60s.";
TLog.i(TAG_LOG, logs);
if (NetUtils.isNetworkConnected(c)) {
mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_SET_ALIAS, alias), 2000 * 60);
} else {
Log.i(TAG_LOG, "No network");
}
break;
default:
logs = "Failed with errorCode = " + code;
TLog.e(TAG_LOG, logs);
}
}
};
}
......@@ -15,50 +15,24 @@ public class TtCsjAdManager {
public static final String TT_AD_APPID = "5060006";
public static final String TT_AD_NAME = "淘金空间高额版";
/*开屏*/
public static final String TT_AD_SPLASH_ID = "887315187";//开屏
/*激励视频*/
public static final String TT_AD_VEDIO_MAIN_DEV = "945131812";// 开发使用
public static final String TT_AD_VEDIO_MAIN_DOWNLOAD = "945131817";//首页点一点
public static final String TT_AD_VEDIO_MAIN_LOOK = "945131816";//首页看视频
public static final String TT_AD_VEDIO_DRINK = "945131819";//喝水打卡
public static final String TT_AD_VEDIO_MAIN_2 = "945131807";// 挑战前两项活动使用(首页2)
public static final String TT_AD_VEDIO_ERASE = "945131797";// 刮刮乐
public static final String TT_AD_VEDIO_TURNABLE = "945131803";// 挑战大转盘
public static final String TT_AD_VEDIO_GAME = "945131810";// 游戏
public static final String TT_AD_VEDIO_MOREDIALOG = "945131792";// 签到、气泡、离线弹框
public static final String TT_AD_VEDIO_REDBOX = "945131786";// 红包
/*banner*/
public static final String TT_AD_BANNER_ID_DRAWCASH = "945131766";//提现
public static final String TT_AD_BANNER_ID_MY = "945131765";//我的
public static final String TT_AD_BANNER_ID_MAIN = "945147447";//首页
public static final String TT_AD_BANNER_ID_DRAWCASH_RECORD = "945131768";//提现明细
public static final String TT_AD_BANNER_ID_REDBOX = "945145182";//抢红包
/*信息流*/
public static final String TT_AD_NATIVEEXPRESS_ID_DIALOG = "945131750";//信息流弹窗
public static final String TT_AD_NATIVEEXPRESS_ID_WATER1 = "945450706";//喝水界面1
public static final String TT_AD_NATIVEEXPRESS_ID_WATER2 = "945450708";//喝水界面2
public static final String TT_AD_NATIVEEXPRESS_ID_LIEBAO_LISTEXIT = "945131730";//猎豹列表和退出
/*全屏广告*/
public static final String TT_AD_ALLVEDIO_ID_LIEBAO = "945131838";//猎豹全屏带跳过按钮
public static final String TT_AD_ALLVEDIO_ID_OFFLINE_DOUBLE = "945131837";//全屏离线收益翻倍
public static final String TT_AD_ALLVEDIO_ID_CHALLENGE_TURN = "945131834";//全屏挑战大转盘
public static final String TT_AD_ALLVEDIO_ID_CHALLENGE_CARD = "945131833";//全屏挑战刮刮乐
public static final String TT_AD_ALLVEDIO_ID_EXCEPTION = "945131829";//激励视频异常或其他 时使用
public static final String TT_AD_ALLVEDIO_ID_DRINKTIME = "945177915";//喝水打卡m异常时使用
/*插屏广告*/
public static final String TT_AD_INSERT_ID_LIEBAO = "945131770";//猎豹插屏场景
public static final String TT_AD_INSERT_LOADING_ID_LIEBAO = "945131772";//猎豹游戏加载时
public static final String TT_AD_INSERT_LOADING_ID_DRAWCASH = "945143935";//提现
public static final String TT_AD_INSERT_LOADING_ID_SMALLVEDIO = "945143977";//小视频
public static final String TT_AD_INSERT_LOADING_ID_FRIENDS = "945145181";//邀请好友
public static final String TT_AD_INSERT_LOADING_ID_REDBOX = "945145179";//抢红包
public static final String TT_AD_INSERT_LOADING_ID_GAME = "945145177";//游戏赚
private static boolean sInit;
......@@ -102,6 +76,4 @@ public class TtCsjAdManager {
//.httpStack(new MyOkStack3())//自定义网络库,demo中给出了okhttp3版本的样例,其余请自行开发或者咨询工作人员。
.build();
}
}
......@@ -25,18 +25,12 @@ object YlhAdManager {
/* 插屏 */
const val YLH_AD_INTERSTITIALAD_DRAWCAH = "4021600917420124" //提现
const val YLH_AD_INTERSTITIALAD_SMALLVEDIO = "7041309928150366" //小视频
const val YLH_AD_INTERSTITIALAD_REDBOX = "4081004968252005" //抢红包
const val YLH_AD_INTERSTITIALAD_FRIENDS = "4051600998851098" //邀请好友
const val YLH_AD_INTERSTITIALAD_GAME = "3021005957922121" //游戏赚
const val YLH_AD_INTERSTITIALAD_LIEBAO = "4091610929319085" //猎豹
/* banner */
const val YLH_AD_BANNER_LIEBAO = "1091518939518038" //猎豹
/**
* 广告初始化
*/
......
......@@ -6,7 +6,7 @@ import java.io.Serializable;
* 描述:BaseResponse
* 作者:孟崔广
* 时间:2017/10/10 10:51
* 邮箱:mengcuiguang@cashbang.cn
* 邮箱:mengcga@163.com
*/
public class BaseResponse<T> implements Serializable {
......
package com.mints.goodmoney.mvp.model;
import java.io.Serializable;
public class MainVedioMsgBean implements Serializable {
private boolean toCreateReward;
private int bigRewardCoin;
private int smallRewardCoin;
private int createRewardNeedTime;
public boolean isToCreateReward() {
return toCreateReward;
}
public int getBigRewardCoin() {
return bigRewardCoin;
}
public int getSmallRewardCoin() {
return smallRewardCoin;
}
public int getCreateRewardNeedTime() {
return createRewardNeedTime;
}
}
package com.mints.goodmoney.mvp.model;
import java.io.Serializable;
public class OfflineBean implements Serializable {
private int offlineIncome;
public int getOfflineIncome() {
return offlineIncome;
}
}
package com.mints.goodmoney.mvp.model;
import java.io.Serializable;
public class WalkBean implements Serializable {
//"walk":"步数"
// "coin":"走路气泡"
// maxWalk 步数上限
// isWalk 是否领取奖励
// walkText 下次奖励内容
private int bubbleCoin;
private int bubbleCount;
private int walk;
private int maxWalk;
private boolean status;
private String walkText;
public int getBubbleCoin() {
return bubbleCoin;
}
public int getBubbleCount() {
return bubbleCount;
}
public int getWalk() {
return walk;
}
public int getMaxWalk() {
return maxWalk;
}
public boolean isWalk() {
return status;
}
public String getWalkText() {
return walkText;
}
}
package com.mints.goodmoney.mvp.model;
import java.io.Serializable;
/**
* 首页喝水
*/
public class WaterBean implements Serializable {
private int nextClickTime;//喝水展示时间
private int complete;//当前毫升
private int canGetCoinMax;//目标总数
private int onceDrink;//步长
private boolean status;// true-可以喝水
public int getNextClickTime() {
return nextClickTime;
}
public void setNextClickTime(int nextClickTime) {
this.nextClickTime = nextClickTime;
}
public int getComplete() {
return complete;
}
public void setComplete(int complete) {
this.complete = complete;
}
public int getCanGetCoinMax() {
return canGetCoinMax;
}
public void setCanGetCoinMax(int canGetCoinMax) {
this.canGetCoinMax = canGetCoinMax;
}
public int getOnceDrink() {
return onceDrink;
}
public void setOnceDrink(int onceDrink) {
this.onceDrink = onceDrink;
}
public boolean isStatus() {
return status;
}
public void setStatus(boolean status) {
this.status = status;
}
}
......@@ -11,14 +11,9 @@ import java.util.HashMap;
public class AwardPresenter extends BasePresenter<AwardView> {
/**
* 获取用户配置信息
*/
public void getUserTaskMsg() {
// view.showLoading("加载中...");
public void getCoinMsg() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.getUserTaskMsg(),
.call(loanService.getCoinMsg(),
new BaseSubscriber<BaseResponse<UserTaskMsgBean>>() {
@Override
public void onCompleted() {
......@@ -33,7 +28,6 @@ public class AwardPresenter extends BasePresenter<AwardView> {
view.hideLoading();
view.showToast(e.getMessage());
view.getUserTaskMsgFail();
}
@Override
......@@ -46,11 +40,7 @@ public class AwardPresenter extends BasePresenter<AwardView> {
case 200://成功
view.getUserTaskMsgSuc(baseResponse.getData());
break;
case 401:
view.getUserTaskMsgFail();
break;
default:
view.getUserTaskMsgFail();
view.showToast(message);
break;
}
......@@ -58,45 +48,6 @@ public class AwardPresenter extends BasePresenter<AwardView> {
});
}
/**
* 穿山甲回调确认
*/
public void checkCoinRecordByTid(String tid, String carrierType) {
HashMap<String, Object> vo = new HashMap<>();
vo.put("tid", tid);
AppHttpManager.getInstance(loanApplication)
.call(loanService.checkCoinRecordByTid(vo),
new BaseSubscriber<BaseResponse<Object>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(BaseResponse<Object> baseResponse) {
if (isLinkView()) return;
int code = baseResponse.getStatus();
String message = baseResponse.getMessage();
switch (code) {
case 200://成功
view.checkCsjSuc(carrierType);
break;
default:
view.showToast(message);
break;
}
}
});
}
/**
* 提交下载任务
*/
public void reportAddCoinMsg(HashMap<String, Object> vo) {
AppHttpManager.getInstance(loanApplication)
.call(loanService.reportAddCoinMsg(vo),
......@@ -104,29 +55,16 @@ public class AwardPresenter extends BasePresenter<AwardView> {
@Override
public void onCompleted() {
if (isLinkView()) return;
}
@Override
public void onError(Throwable e) {
if (isLinkView()) return;
view.showToast(e.getMessage());
}
@Override
public void onNext(BaseResponse<Object> baseResponse) {
if (isLinkView()) return;
int code = baseResponse.getStatus();
String message = baseResponse.getMessage();
switch (code) {
case 200://成功
break;
default:
view.showToast(message);
break;
}
}
});
}
......
......@@ -10,7 +10,7 @@ import rx.Subscription;
* 描述:BasePresenter
* 作者:孟崔广
* 时间:2018/1/10 17:51
* 邮箱:mengcuiguang@cashbang.cn
* 邮箱:mengcga@163.com
*/
public class BasePresenter<V extends BaseView> implements Presenter<V> {
......
......@@ -9,7 +9,7 @@ import rx.Subscription;
* 描述:BasePresenter
* 作者:孟崔广
* 时间:2018/1/10 17:51
* 邮箱:mengcuiguang@cashbang.cn
* 邮箱:mengcga@163.com
*/
public class BaseTrackPresenter implements Presenter<MintsApplication> {
......
......@@ -4,7 +4,7 @@ import android.app.Activity;
import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.mvp.model.BaseResponse;
import com.mints.goodmoney.mvp.views.LyVedioAdManagerView;
import com.mints.goodmoney.mvp.views.VedioAdManagerView;
import com.mints.goodmoney.net.LoanService;
import com.mints.library.net.neterror.BaseSubscriber;
import com.mints.library.net.neterror.Throwable;
......@@ -14,7 +14,7 @@ import java.util.HashMap;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
public class CsjFullVedioAdPresenter extends BasePresenter<LyVedioAdManagerView>{
public class CsjFullVedioAdPresenter extends BasePresenter<VedioAdManagerView>{
private MintsApplication loanApplication;
private LoanService loanService;
......
......@@ -4,7 +4,7 @@ import android.app.Activity;
import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.mvp.model.BaseResponse;
import com.mints.goodmoney.mvp.views.LyVedioAdManagerView;
import com.mints.goodmoney.mvp.views.VedioAdManagerView;
import com.mints.goodmoney.net.LoanService;
import com.mints.library.net.neterror.BaseSubscriber;
import com.mints.library.net.neterror.Throwable;
......@@ -14,53 +14,12 @@ import java.util.HashMap;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
public class CsjVedioAdPresenter extends BasePresenter<LyVedioAdManagerView>{
public class CsjVedioAdPresenter extends BasePresenter<VedioAdManagerView>{
private MintsApplication loanApplication;
private LoanService loanService;
private Subscription subscription;
/**
* 穿山甲回调确认
*/
public void checkCoinRecordByTid(Activity activity, String tid) {
if (activity == null)
return;
loanApplication = (MintsApplication) activity.getApplication();
loanService = loanApplication.getLoanService();
HashMap<String, Object> vo = new HashMap<>();
vo.put("tid", tid);
subscription = loanService.checkCoinRecordByTid(vo)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(loanApplication.defaultSubscribeScheduler())
.subscribe(new BaseSubscriber<BaseResponse<Object>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
// view.checkLYContextSuc(false);
}
@Override
public void onNext(BaseResponse<Object> baseResponse) {
int code = baseResponse.getStatus();
String message = baseResponse.getMessage();
switch (code) {
case 200://成功
view.checkLYContextSuc(true);
break;
}
}
});
}
public void dispose() {
loanService = null;
loanApplication = null;
......
......@@ -6,8 +6,7 @@ import com.mints.goodmoney.common.DeviceInfo
import com.mints.goodmoney.manager.AppHttpManager
import com.mints.goodmoney.manager.ShumeiManager
import com.mints.goodmoney.manager.UserManager
import com.mints.goodmoney.mvp.model.BaseResponse
import com.mints.goodmoney.mvp.model.UserBean
import com.mints.goodmoney.mvp.model.*
import com.mints.goodmoney.mvp.views.HomeView
import com.mints.goodmoney.utils.DeviceUuidFactory
import com.mints.library.net.neterror.BaseSubscriber
......@@ -17,6 +16,118 @@ import java.util.*
class HomePresenter : BasePresenter<HomeView>() {
/**
* 打开激活
*/
fun comSaveTerminalInfo(ps: AppPreferences) {
val vo = HashMap<String, Any>()
val deviceInfo: DeviceInfo = DeviceInfo.instance
val macAddress: String = deviceInfo.getMacAddress()
val mac = macAddress.replace(":", "")
vo["mac"] = mac
vo["mac1"] = macAddress
vo["androidid"] = deviceInfo.getAndroidId(null)
vo["imei"] = deviceInfo.iMEI
vo["oaid"] = ps.getString(Constant.OAID, "")!!
vo["os"] = "android"
vo["model"] = deviceInfo.brand + " " + deviceInfo.mobileModel
vo["uuid"] = DeviceUuidFactory().deviceUuid
vo["osversion"] = deviceInfo.oSVersion
vo["appversion"] = deviceInfo.versionName
AppHttpManager.getInstance(loanApplication)
.call(loanService.comSaveTerminalInfo(vo),
object : BaseSubscriber<BaseResponse<Any>>() {
override fun onCompleted() {
if (isLinkView) return
}
override fun onError(e: Throwable) {
if (isLinkView) return
}
override fun onNext(baseResponse: BaseResponse<Any>) {
if (isLinkView) return
val code: Int = baseResponse.getStatus()
when (code) {
200 -> {
ps.put(Constant.FIRST_DEVICE_FLAG, true)
}
}
}
})
}
fun getHallBaseMsg() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.getHallBaseMsg(),
object : BaseSubscriber<BaseResponse<UserTaskMsgBean>>() {
override fun onCompleted() {
if (isLinkView) return
view.hideLoading()
}
override fun onError(e: Throwable) {
if (isLinkView) return
view.hideLoading()
view.showToast(e.message)
}
override fun onNext(baseResponse: BaseResponse<UserTaskMsgBean>) {
if (isLinkView) return
val code = baseResponse.getStatus()
val message = baseResponse.getMessage()
when (code) {
200 -> view.getHallBaseMsgSuc(baseResponse.getData())
else -> view.showToast(message)
}
}
})
}
fun getHomeVedioMsg() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.getHomeVedioMsg(),
object : BaseSubscriber<BaseResponse<MainVedioMsgBean>>() {
override fun onCompleted() {
if (isLinkView) return
}
override fun onError(e: Throwable) {
if (isLinkView) return
}
override fun onNext(baseResponse: BaseResponse<MainVedioMsgBean>) {
if (isLinkView) return
val code = baseResponse.getStatus()
val message = baseResponse.getMessage()
when (code) {
200 -> view.getHomeVedioMsgSuc(baseResponse.getData())
else -> view.showToast(message)
}
}
})
}
fun requestAddHomeVedioReward() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.requestAddHomeVedioReward(),
object : BaseSubscriber<BaseResponse<Any>>() {
override fun onCompleted() {
if (isLinkView) return
}
override fun onError(e: Throwable) {
if (isLinkView) return
}
override fun onNext(baseResponse: BaseResponse<Any>) {
if (isLinkView) return
}
})
}
/**
* 游客登录
*/
......@@ -55,31 +166,19 @@ class HomePresenter : BasePresenter<HomeView>() {
fun saveTerminalInfo(ps: AppPreferences) {
val vo = HashMap<String, Any>()
val deviceInfo: DeviceInfo = DeviceInfo.instance
try {
val macAddress: String = deviceInfo.getMacAddress()
if (!TextUtils.isEmpty(macAddress)) {
val mac = macAddress.replace(":", "")
vo["mac"] = mac
vo["mac1"] = macAddress
}
} catch (e: Exception) {
e.printStackTrace()
vo["mac"] = "02:00:00:00:00:00"
vo["mac1"] = "02:00:00:00:00:00".replace(":", "")
}
val macAddress: String = deviceInfo.getMacAddress()
val mac = macAddress.replace(":", "")
vo["mac"] = mac
vo["mac1"] = macAddress
vo["androidid"] = deviceInfo.getAndroidId(null)
vo["imei"] = deviceInfo.iMEI
vo["oaid"] = ps.getString(Constant.OAID,"")!!
vo["oaid"] = ps.getString(Constant.OAID, "")!!
vo["os"] = "android"
vo["model"] = deviceInfo.brand + " " + deviceInfo.mobileModel
vo["uuid"] = DeviceUuidFactory().deviceUuid
vo["osversion"] = deviceInfo.oSVersion
vo["appversion"] = deviceInfo.versionName
try {
vo["shumeiId"] = ShumeiManager.getInstance().getShumeiDeviceId()
} catch (e: java.lang.Exception) {
e.printStackTrace()
}
vo["shumeiId"] = ShumeiManager.getInstance().getShumeiDeviceId()
AppHttpManager.getInstance(loanApplication)
.call(loanService.saveTerminalInfo(vo),
object : BaseSubscriber<BaseResponse<Any>>() {
......@@ -95,7 +194,7 @@ class HomePresenter : BasePresenter<HomeView>() {
if (isLinkView) return
val code = baseResponse.status
when (code) {
// 200 -> baseMsg()
200 -> getHallBaseMsg()
}
}
})
......
package com.mints.goodmoney.mvp.presenters
import android.text.TextUtils
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.common.DeviceInfo
import com.mints.goodmoney.manager.AppHttpManager
import com.mints.goodmoney.manager.JpushManager
import com.mints.goodmoney.manager.ShumeiManager
import com.mints.goodmoney.manager.UserManager
import com.mints.goodmoney.mvp.model.BaseResponse
......@@ -86,7 +86,7 @@ class LoginPresenter : BasePresenter<LoginView>() {
when (code) {
200 -> if (data != null) {
UserManager.getInstance().saveUserInfo(data)
saveTerminalInfo(ps)
saveTerminalInfo(ps,data.consumer.pk_id)
view.loginSuc()
}
else -> view.showToast(message)
......@@ -126,7 +126,7 @@ class LoginPresenter : BasePresenter<LoginView>() {
when (code) {
200 -> if (data != null) {
UserManager.getInstance().saveUserInfo(data)
saveTerminalInfo(ps)
saveTerminalInfo(ps,data.consumer.pk_id)
view.loginSuc()
}
else -> view.showToast(message)
......@@ -140,21 +140,13 @@ class LoginPresenter : BasePresenter<LoginView>() {
*
* @param context
*/
fun saveTerminalInfo(ps: AppPreferences) {
fun saveTerminalInfo(ps: AppPreferences,userId:Long) {
val vo = HashMap<String, Any>()
val deviceInfo: DeviceInfo = DeviceInfo.instance
try {
val macAddress: String = deviceInfo.getMacAddress()
if (!TextUtils.isEmpty(macAddress)) {
val mac = macAddress.replace(":", "")
vo["mac"] = mac
vo["mac1"] = macAddress
}
} catch (e: Exception) {
e.printStackTrace()
vo["mac"] = "02:00:00:00:00:00"
vo["mac1"] = "02:00:00:00:00:00".replace(":", "")
}
val macAddress: String = deviceInfo.getMacAddress()
val mac = macAddress.replace(":", "")
vo["mac"] = mac
vo["mac1"] = macAddress
vo["androidid"] = deviceInfo.getAndroidId(null)
vo["imei"] = deviceInfo.iMEI
vo["oaid"] = ps.getString(Constant.OAID, "")!!
......@@ -163,11 +155,7 @@ class LoginPresenter : BasePresenter<LoginView>() {
vo["uuid"] = DeviceUuidFactory().deviceUuid
vo["osversion"] = deviceInfo.oSVersion
vo["appversion"] = deviceInfo.versionName
try {
vo["shumeiId"] = ShumeiManager.getInstance().getShumeiDeviceId()
} catch (e: java.lang.Exception) {
e.printStackTrace()
}
vo["shumeiId"] = ShumeiManager.getInstance().getShumeiDeviceId()
AppHttpManager.getInstance(loanApplication)
.call(loanService.saveTerminalInfo(vo),
......@@ -182,6 +170,13 @@ class LoginPresenter : BasePresenter<LoginView>() {
override fun onNext(baseResponse: BaseResponse<Any>) {
if (isLinkView) return
val code = baseResponse.status
when (code) {
200 -> {
JpushManager.getInstance().setJpushService(userId.toString())
}
}
}
})
}
......
......@@ -189,18 +189,10 @@ class MyPresenter : BasePresenter<MyView>() {
fun saveTerminalInfo(ps: AppPreferences) {
val vo = HashMap<String, Any>()
val deviceInfo: DeviceInfo = DeviceInfo.instance
try {
val macAddress: String = deviceInfo.getMacAddress()
if (!TextUtils.isEmpty(macAddress)) {
val mac = macAddress.replace(":", "")
vo["mac"] = mac
vo["mac1"] = macAddress
}
} catch (e: Exception) {
e.printStackTrace()
vo["mac"] = "02:00:00:00:00:00"
vo["mac1"] = "02:00:00:00:00:00".replace(":", "")
}
val macAddress: String = deviceInfo.getMacAddress()
val mac = macAddress.replace(":", "")
vo["mac"] = mac
vo["mac1"] = macAddress
vo["androidid"] = deviceInfo.getAndroidId(null)
vo["imei"] = deviceInfo.iMEI
vo["oaid"] = ps.getString(Constant.OAID, "")!!
......@@ -209,11 +201,7 @@ class MyPresenter : BasePresenter<MyView>() {
vo["uuid"] = DeviceUuidFactory().deviceUuid
vo["osversion"] = deviceInfo.oSVersion
vo["appversion"] = deviceInfo.versionName
try {
vo["shumeiId"] = ShumeiManager.getInstance().getShumeiDeviceId()
} catch (e: java.lang.Exception) {
e.printStackTrace()
}
vo["shumeiId"] = ShumeiManager.getInstance().getShumeiDeviceId()
AppHttpManager.getInstance(loanApplication)
.call(loanService.saveTerminalInfo(vo),
object : BaseSubscriber<BaseResponse<Any>>() {
......
......@@ -56,18 +56,10 @@ class PanPresenter : BasePresenter<PanView>() {
fun saveTerminalInfo(ps: AppPreferences) {
val vo = HashMap<String, Any>()
val deviceInfo: DeviceInfo = DeviceInfo.instance
try {
val macAddress: String = deviceInfo.getMacAddress()
if (!TextUtils.isEmpty(macAddress)) {
val mac = macAddress.replace(":", "")
vo["mac"] = mac
vo["mac1"] = macAddress
}
} catch (e: Exception) {
e.printStackTrace()
vo["mac"] = "02:00:00:00:00:00"
vo["mac1"] = "02:00:00:00:00:00".replace(":", "")
}
val macAddress: String = deviceInfo.getMacAddress()
val mac = macAddress.replace(":", "")
vo["mac"] = mac
vo["mac1"] = macAddress
vo["androidid"] = deviceInfo.getAndroidId(null)
vo["imei"] = deviceInfo.iMEI
vo["oaid"] = ps.getString(Constant.OAID,"")!!
......@@ -76,11 +68,7 @@ class PanPresenter : BasePresenter<PanView>() {
vo["uuid"] = DeviceUuidFactory().deviceUuid
vo["osversion"] = deviceInfo.oSVersion
vo["appversion"] = deviceInfo.versionName
try {
vo["shumeiId"] = ShumeiManager.getInstance().getShumeiDeviceId()
} catch (e: java.lang.Exception) {
e.printStackTrace()
}
vo["shumeiId"] = ShumeiManager.getInstance().getShumeiDeviceId()
AppHttpManager.getInstance(loanApplication)
.call(loanService.saveTerminalInfo(vo),
object : BaseSubscriber<BaseResponse<Any>>() {
......
......@@ -4,7 +4,7 @@ package com.mints.goodmoney.mvp.presenters;
* 描述:Presenter
* 作者:孟崔广
* 时间:2017/10/10 10:51
* 邮箱:mengcuiguang@cashbang.cn
* 邮箱:mengcga@163.com
*/
public interface Presenter<V> {
......
......@@ -42,7 +42,7 @@ import rx.android.schedulers.AndroidSchedulers;
* 描述:版本更新
* 作者:孟崔广
* 时间:2017/10/10 10:51
* 邮箱:mengcuiguang@cashbang.cn
* 邮箱:mengcga@163.com
*/
public class VersionUpdatePresenter {
......
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.WalkBean;
import com.mints.goodmoney.mvp.views.WalkView;
import com.mints.goodmoney.mvp.views.WaterView;
import com.mints.library.net.neterror.BaseSubscriber;
import com.mints.library.net.neterror.Throwable;
public class WalkPresenter extends BasePresenter<WalkView> {
public void getWalkMsg() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.getWalkMsg(),
new BaseSubscriber<BaseResponse<WalkBean>>() {
@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<WalkBean> baseResponse) {
if (isLinkView()) return;
int code = baseResponse.getStatus();
String message = baseResponse.getMessage();
switch (code) {
case 200://成功
view.getWalkMsgSuc(baseResponse.getData());
break;
default:
view.showToast(message);
break;
}
}
});
}
public void clickForWalk() {
view.showLoading("加载中...");
AppHttpManager.getInstance(loanApplication)
.call(loanService.clickForWalk(),
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();
String message = baseResponse.getMessage();
switch (code) {
case 200://成功
JsonObject data = baseResponse.getData();
if (data != null) {
int coin = data.get("coin").getAsInt();
view.clickForWalkSuc(coin);
} else {
view.clickForWalkSuc(0);
}
break;
default:
view.showToast(message);
break;
}
}
});
}
}
......@@ -6,7 +6,7 @@ import com.mints.goodmoney.MintsApplication;
* 描述:BaseView
* 作者:孟崔广
* 时间:2017/10/10 17:51
* 邮箱:mengcuiguang@cashbang.cn
* 邮箱:mengcga@163.com
*/
public interface BaseView {
......
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