Commit 8c70a554 authored by mengcuiguang's avatar mengcuiguang

添加ad

parent 35780f10
......@@ -184,7 +184,7 @@ dependencies {
implementation(name: 'msa_mdid_1.0.13', ext: 'aar')
// 穿山甲广告
implementation(name: 'open_ad_sdk', ext: 'aar')
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.6'
// implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.6'
// 广点通广告 腾讯
implementation(name: 'GDTSDK.unionNormal.4.232.1102', ext: 'aar')
// shareSdk
......
......@@ -69,9 +69,6 @@ class InitAppService : IntentService("InitializeService") {
// 数美
ShumeiManager.getInstance().initShumei()
// 猎豹游戏初始化
// LiebaoManager.getInstance().initCmGameSdk()
// 极光推送
initJpush()
}
......
......@@ -11,6 +11,7 @@ import androidx.multidex.MultiDexApplication;
import com.bun.miitmdid.core.JLibrary;
import com.component.dly.xzzq_ywsdk.YwSDK;
import com.mints.goodmoney.manager.LiebaoManager;
import com.mints.goodmoney.manager.OaidManager;
import com.mints.goodmoney.manager.TtCsjAdManager;
import com.mints.goodmoney.manager.UserManager;
......@@ -103,13 +104,16 @@ public class MintsApplication extends MultiDexApplication {
// initYlh();
// 穿山甲
// initCsj();
initCsj();
// 一览视频
initYL();
// 鱼丸盒子
// initYwhz();
initYwhz();
// 猎豹游戏初始化
LiebaoManager.getInstance().initCmGameSdk();
}
/**
......
......@@ -62,11 +62,11 @@ public class CsjVedioAdManager implements VedioAdManagerView {
private void init(Activity activity) {
this.activity = activity;
spUtil = SPUtil.getInstance(activity);
spUtil = SPUtil.getInstance();
userManager = UserManager.getInstance();
TTNativeExpressManager ttNativeExpressManager = new TTNativeExpressManager();
ttAdNative = ttNativeExpressManager.initTTAd(MintsApplication.getContext(), false);
ttAdNative = ttNativeExpressManager.initTTAd( false);
csjVedioAdPresenter = new CsjVedioAdPresenter();
csjVedioAdPresenter.attachView(this);
......@@ -81,6 +81,8 @@ public class CsjVedioAdManager implements VedioAdManagerView {
csjVedioAdPresenter.dispose();
csjVedioAdPresenter.detachView();
}
activity = null;
}
/**
......@@ -101,7 +103,7 @@ public class CsjVedioAdManager implements VedioAdManagerView {
if (!BuildConfig.DEBUG) {
switch (carrierType) {
case Constant.CARRIER_VERSUS_VIDEO:// 任务赚每日任务-视频
codeId = TtCsjAdManager.TT_AD_VEDIO_MAIN_2;
codeId = TtCsjAdManager.TT_AD_VEDIO_MAIN;
break;
case Constant.CARRIER_OFFLINE_DOUBLE:// 离线收益翻倍
codeId = TtCsjAdManager.TT_AD_VEDIO_MOREDIALOG;
......@@ -130,10 +132,11 @@ public class CsjVedioAdManager implements VedioAdManagerView {
mttRewardVideoAd.setRewardAdInteractionListener(null);
}
//step4:创建广告请求参数AdSlot,具体参数含义参考文档
AdSlot adSlot = new AdSlot.Builder()
.setCodeId(codeId)
.setSupportDeepLink(true)
//个性化模板广告需要设置期望个性化模板广告的大小,单位dp,激励视频场景,只要设置的值大于0即可。仅模板广告需要设置此参数
.setExpressViewAcceptedSize(500, 500)
.setImageAcceptedSize(1080, 1920)
.setUserID(userID)//用户id,必传参数
.setMediaExtra(JsonUtil.toJson(getAdMapVO(carrierType, tid)))
......@@ -213,7 +216,7 @@ public class CsjVedioAdManager implements VedioAdManagerView {
}
@Override
public void onRewardVerify(boolean rewardVerify, int rewardAmount, String rewardName) {
public void onRewardVerify(boolean var1, int var2, String var3, int var4, String var5) {
}
@Override
......
......@@ -176,7 +176,7 @@ public class VedioAdingManager {
int csjVedioAdCount = AppConfig.csjVedioAdCount;
int ylhAdCount = AppConfig.ylhAdCount;
if (ylhAdCount <= 0 &&csjVedioAdCount <= 0 ) {
if (ylhAdCount <= 0 && csjVedioAdCount <= 0) {
// showToast("今日视频已看完,请明天再来吧");
return true;
}
......@@ -196,6 +196,7 @@ public class VedioAdingManager {
ylhVedioAdManager = null;
}
activity = null;
}
public void setVedioAdingListener(VedioAdingListener vedioAdingListener) {
......
......@@ -67,6 +67,8 @@ public class YlhVedioAdManager implements VedioAdManagerView {
ylhVedioAdPresenter.dispose();
ylhVedioAdPresenter.detachView();
}
activity = null;
}
/**
......
......@@ -22,7 +22,7 @@ public class AppConfig {
/**
* ylh 剩余广告播放数
*/
public static int ylhAdCount = 5;
public static int ylhAdCount = 0;
/**
* csjFull 剩余广告播放数
*/
......
......@@ -91,6 +91,8 @@ object Constant {
const val CARRIER_WALK = "WALK" //走路
const val CARRIER_WALK_BUBBLE = "WALK_BUBBLE" //走路汽泡
const val CARRIER_NEW_USER = "CARRIER_NEW_USER" //新用户红包
const val CARRIER_GAME_ONLINE = "GAME_ONLINE" //跳转猎豹
const val CARRIER_CHALLENGE_SHAREFRIEND_DOUBLE = "CHALLENGE_SHAREFRIEND_DOUBLE" //邀请好友翻倍
const val SHAREFRIEND_COMPLETE_1 = "SHAREFRIEND_COMPLETE_1" //邀请任务1
const val SHAREFRIEND_COMPLETE_2 = "SHAREFRIEND_COMPLETE_2" //邀请任务2
......@@ -132,6 +134,7 @@ object Constant {
const val HOT_ACTIVITY_WATER = "water"
const val HOT_ACTIVITY_WALK = "walk"
const val HOT_ACTIVITY_CARD = "card"
const val HOT_ACTIVITY_H5 = "h5"
// 打开激活
const val FIRST_DEVICE_FLAG = "first_device_flag"
......
......@@ -77,21 +77,21 @@ public class LiebaoManager {
// 设置游戏的广告id
// CmGameAppInfo.TTInfo ttInfo = new CmGameAppInfo.TTInfo();
// // 游戏内广告有如下6种;
CmGameAppInfo.TTInfo ttInfo = new CmGameAppInfo.TTInfo();
// 游戏内广告有如下6种;
// ttInfo.setGameLoad_EXADId(TtCsjAdManager.TT_AD_INSERT_LOADING_ID_LIEBAO); // 游戏加载时,插屏广告1:1,模板渲染
// ttInfo.setRewardVideoId(TtCsjAdManager.TT_AD_VEDIO_GAME); // 激励视频
// ttInfo.setFullVideoId(TtCsjAdManager.TT_AD_ALLVEDIO_ID_LIEBAO); // 全屏视频,插屏场景下展示
ttInfo.setRewardVideoId(TtCsjAdManager.TT_AD_VEDIO_GAME); // 激励视频
ttInfo.setFullVideoId(TtCsjAdManager.TT_AD_ALLVEDIO_ID_LIEBAO); // 全屏视频,插屏场景下展示
// ttInfo.setExpressInteractionId(TtCsjAdManager.TT_AD_INSERT_ID_LIEBAO); // 插屏广告,插屏场景下展示,模板渲染,2:3
//// ttInfo.setExpressBannerId("901121159"); // Banner广告,模板渲染,尺寸:600*150,会导致游戏卡慢,暂时不用
// ttInfo.setGameEndExpressFeedAdId(TtCsjAdManager.TT_AD_NATIVEEXPRESS_ID_LIEBAO_LISTEXIT); // 游戏退出弹框,信息流广告,模板渲染
// // 游戏列表页面有如下2种:
// ttInfo.setGameListExpressFeedId(TtCsjAdManager.TT_AD_NATIVEEXPRESS_ID_LIEBAO_LISTEXIT); // 游戏列表,信息流广告,模板渲染
//// ttInfo.setGamelistExpressInteractionId("901121536"); // 模板渲染1:1,不能用于游戏tab页的入口
// cmGameAppInfo.setTtInfo(ttInfo);
//
// // 需要支持广点通广告时,才需下面代码
// // 【设置广点通广告id】
// ttInfo.setExpressBannerId("901121159"); // Banner广告,模板渲染,尺寸:600*150,会导致游戏卡慢,暂时不用
ttInfo.setGameEndExpressFeedAdId(TtCsjAdManager.TT_AD_NATIVEEXPRESS_ID_LIEBAO_LISTEXIT); // 游戏退出弹框,信息流广告,模板渲染
// 游戏列表页面有如下2种:
ttInfo.setGameListExpressFeedId(TtCsjAdManager.TT_AD_NATIVEEXPRESS_ID_LIEBAO_LISTEXIT); // 游戏列表,信息流广告,模板渲染
// ttInfo.setGamelistExpressInteractionId("901121536"); // 模板渲染1:1,不能用于游戏tab页的入口
cmGameAppInfo.setTtInfo(ttInfo);
// 需要支持广点通广告时,才需下面代码
// 【设置广点通广告id】
// CmGameAppInfo.GDTAdInfo gdtAdInfo = new CmGameAppInfo.GDTAdInfo();
// gdtAdInfo.setAppId(YlhAdManager.YLH_AD_APPID); // 广点通的APPID
// // 游戏内广告场景;
......@@ -100,14 +100,14 @@ public class LiebaoManager {
// gdtAdInfo.setBannerId(YlhAdManager.YLH_AD_BANNER_LIEBAO); // banner广告
// gdtAdInfo.setPlayGameInterId(YlhAdManager.YLH_AD_INTERSTITIALAD_LIEBAO);//游戏进行中关卡插屏
// cmGameAppInfo.setGdtAdInfo(gdtAdInfo);
//
//
// // 【设置广点通和穿山甲广告占比】
// // 概率设置规则,如下:
// // 0: 全部使用穿山甲广告
// // 100: 全部采用广点通广告
// // 40:穿山甲广告命中概率是60%,广点通是40%,如果一方没广告,则用另一方补量。
// cmGameAppInfo.setRewardAdProbability(80); // 默认值为0,全部采用穿山甲激励视频广告
cmGameAppInfo.setRewardAdProbability(0); // 默认值为0,全部采用穿山甲激励视频广告
//
//
// // 戏关卡间插屏广告概率设置建议,代码默认值为20
......
......@@ -10,6 +10,7 @@ import com.bytedance.sdk.openadsdk.TTAdManager;
import com.bytedance.sdk.openadsdk.TTAdNative;
import com.bytedance.sdk.openadsdk.TTAppDownloadListener;
import com.bytedance.sdk.openadsdk.TTNativeExpressAd;
import com.mints.goodmoney.MintsApplication;
import java.util.List;
......@@ -33,10 +34,9 @@ public class TTNativeExpressManager {
/**
* 穿山甲权限初始化
*
* @param context
*/
public TTAdNative initTTAd(Context context, boolean permission) {
public TTAdNative initTTAd(boolean permission) {
Context context= MintsApplication.getContext();
//step1:初始化sdk
TTAdManager ttAdManager = TtCsjAdManager.get();
//step2:(可选,强烈建议在合适的时机调用):申请部分权限,如read_phone_state,防止获取不了imei时候,下载类广告没有填充的问题。
......@@ -48,41 +48,26 @@ public class TTNativeExpressManager {
return mTTAdNative;
}
// /**
// * 获取穿山甲banner
// *
// * @param context
// * @param frameLayout
// * @param viewWidth
// * @param viewHeight
// */
// public FrameLayout getNativeExpressInit(Context context, String codeId, FrameLayout frameLayout, float viewWidth, float viewHeight) {
// return this.getTtNativeExpress(context, codeId, frameLayout, viewWidth, viewHeight);
// }
/**
* 获取穿山甲banner
*
* @param context
* @param frameLayout
* @param viewWidth
* @param viewHeight
*/
public void getNativeExpressInit(Context context, String codeId, FrameLayout frameLayout, float viewWidth, float viewHeight) {
this.getTtNativeExpress(context, codeId, frameLayout, viewWidth, viewHeight);
public void getNativeExpressInit(String codeId, FrameLayout frameLayout, float viewWidth, float viewHeight) {
this.getTtNativeExpress( codeId, frameLayout, viewWidth, viewHeight);
}
/**
* 获取穿山甲banner
*
* @param context
* @param viewWidth
* @param viewHeight
*/
// private FrameLayout getTtNativeExpress(Context context, String codeId, FrameLayout view, float viewWidth, float viewHeight) {
private void getTtNativeExpress(Context context, String codeId, FrameLayout view, float viewWidth, float viewHeight) {
// FrameLayout view = new FrameLayout(context);
private void getTtNativeExpress(String codeId, FrameLayout view, float viewWidth, float viewHeight) {
Context context= MintsApplication.getContext();
//step4:创建广告请求参数AdSlot,具体参数含义参考文档
AdSlot adSlot = new AdSlot.Builder()
.setCodeId(codeId) //广告位id
......@@ -112,13 +97,11 @@ public class TTNativeExpressManager {
}
mTTAd = ads.get(0);
mTTAd.render();
bindAdListener(context, mTTAd, view);
bindAdListener(mTTAd, view);
}
});
// return view;
}
/**
......@@ -133,33 +116,25 @@ public class TTNativeExpressManager {
/**
* banner广告事件
*
* @param context
* @param ad
* @param frameLayout
*/
private void bindAdListener(Context context, TTNativeExpressAd ad, FrameLayout frameLayout) {
private void bindAdListener(TTNativeExpressAd ad, FrameLayout frameLayout) {
ad.setExpressInteractionListener(new TTNativeExpressAd.ExpressAdInteractionListener() {
@Override
public void onAdClicked(View view, int type) {
// showToast("广告被点击");
}
@Override
public void onAdShow(View view, int type) {
// showToast("广告展示");
}
@Override
public void onRenderFail(View view, String msg, int code) {
// Log.e("ExpressView", "render fail:" + (System.currentTimeMillis() - startTime));
// showToast(msg + " code:" + code);
}
@Override
public void onRenderSuccess(View view, float width, float height) {
// Log.e("ExpressView", "render suc:" + (System.currentTimeMillis() - startTime));
//返回view的宽高 单位 dp
// showToast("渲染成功");
if (frameLayout != null) {
frameLayout.removeAllViews();
frameLayout.addView(view);
......
package com.mints.goodmoney.manager;
import android.content.Context;
import android.widget.FrameLayout;
import com.mints.goodmoney.MintsApplication;
public class TTPreLoadExpressManager {
private static TTPreLoadExpressManager _inst;
private FrameLayout ttFrameLayout;
private TTNativeExpressManager ttNativeExpressManager;
public static TTPreLoadExpressManager getInstance() {
if (_inst != null) {
return _inst;
} else {
_inst = new TTPreLoadExpressManager();
return _inst;
}
}
private TTPreLoadExpressManager() {
init();
}
private void init() {
ttNativeExpressManager = new TTNativeExpressManager();
ttNativeExpressManager.initTTAd(false);
}
public FrameLayout getTtFrameLayout() {
return ttFrameLayout;
}
/**
* 预加载 信息流
*/
public void loadTtFrameLayout() {
Context context= MintsApplication.getContext();
try {
ttFrameLayout = new FrameLayout(context);
ttNativeExpressManager.getNativeExpressInit(TtCsjAdManager.TT_AD_NATIVEEXPRESS_AWARD, ttFrameLayout, 310, 0);
ttNativeExpressManager.setTTNativeExpressManagerListener(new TTNativeExpressManager.TTNativeExpressManagerListener() {
@Override
public void setTtExpressView(FrameLayout view) {
if (view == null) {
ttFrameLayout = null;
} else {
try {
ttFrameLayout = view;
} catch (Exception e) {
e.printStackTrace();
ttFrameLayout = null;
}
}
}
});
} catch (Exception e) {
e.printStackTrace();
}
ttFrameLayout = null;
}
}
......@@ -12,27 +12,30 @@ import com.mints.goodmoney.BuildConfig;
*/
public class TtCsjAdManager {
public static final String TT_AD_APPID = "5060006";
public static final String TT_AD_NAME = "淘金空间高额版";
public static final String TT_AD_APPID = "5113521";
public static final String TT_AD_NAME = "好赚钱";
/*激励视频*/
public static final String TT_AD_VEDIO_MAIN_DEV = "945131812";// 开发使用
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_MOREDIALOG = "945131792";// 签到、气泡、离线弹框
public static final String TT_AD_VEDIO_MAIN_DEV = "945561938";// 开发使用
public static final String TT_AD_VEDIO_DRINK = "945562032";//喝水打卡
public static final String TT_AD_VEDIO_MAIN = "945562036";// 我的界面视频
public static final String TT_AD_VEDIO_ERASE = "945562037";// 刮刮乐
public static final String TT_AD_VEDIO_TURNABLE = "945562039";// 大转盘
public static final String TT_AD_VEDIO_MOREDIALOG = "945562040";// 签到、气泡、离线弹框
public static final String TT_AD_VEDIO_GAME = "945562067";// 猎豹
/*信息流*/
public static final String TT_AD_NATIVEEXPRESS_ID_DIALOG = "945131750";//信息流弹窗
public static final String TT_AD_NATIVEEXPRESS_ID_LIEBAO_LISTEXIT = "945131730";//猎豹列表和退出
public static final String TT_AD_NATIVEEXPRESS_AWARD = "945562047";//信息流弹窗
public static final String TT_AD_NATIVEEXPRESS_WALK = "945562480";//走路
public static final String TT_AD_NATIVEEXPRESS_WATER = "945562698";//喝水
public static final String TT_AD_NATIVEEXPRESS_ID_LIEBAO_LISTEXIT = "945562050";//猎豹列表和退出
/*全屏广告*/
public static final String TT_AD_ALLVEDIO_ID_LIEBAO = "945131838";//猎豹全屏带跳过按钮
public static final String TT_AD_ALLVEDIO_ID_LIEBAO = "945562481";//猎豹全屏带跳过按钮
/*插屏广告*/
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_ID_LIEBAO = "";//猎豹插屏场景
public static final String TT_AD_INSERT_LOADING_ID_LIEBAO = "";//猎豹游戏加载时
private static boolean sInit;
......
......@@ -11,6 +11,7 @@ public class MyInfo implements Serializable {
*/
private TaskVeidoBean taskVeido;
private TaskGameBean taskGame;
private TaskShareFriendBean taskShareFriend;
private UserMsgBean userMsg;
......@@ -18,6 +19,10 @@ public class MyInfo implements Serializable {
return taskVeido;
}
public TaskGameBean getTaskGame() {
return taskGame;
}
public void setTaskVeido(TaskVeidoBean taskVeido) {
this.taskVeido = taskVeido;
}
......@@ -38,17 +43,26 @@ public class MyInfo implements Serializable {
this.userMsg = userMsg;
}
public static class TaskVeidoBean {
public class TaskVeidoBean implements Serializable{
/**
* max : 20
* carrierType : CHALLENGE_VEDIO
* complete : 0
*/
private int coin;
private int max;
private String carrierType;
private int complete;
public int getCoin() {
return coin;
}
public void setCoin(int coin) {
this.coin = coin;
}
public int getMax() {
return max;
}
......@@ -74,18 +88,45 @@ public class MyInfo implements Serializable {
}
}
public static class TaskShareFriendBean {
public class TaskGameBean implements Serializable{
private int status;
private String carrierType;
private int coin;
public int getStatus() {
return status;
}
public String getCarrierType() {
return carrierType;
}
public int getCoin() {
return coin;
}
}
public class TaskShareFriendBean implements Serializable{
/**
* max : 20
* carrierType : CHALLENGE_SHAREFRIEND
* complete : 0
*/
private int coin;
private int max;
private String carrierType;
private int complete;
private int status;
public int getCoin() {
return coin;
}
public void setCoin(int coin) {
this.coin = coin;
}
public int getStatus() {
return status;
}
......
......@@ -100,7 +100,7 @@ class MyPresenter : BasePresenter<MyView>() {
when (code) {
200 -> {
view.getUserTaskMsgSuc(baseResponse.data)
// myHotActivity()
myHotActivity()
}
401 -> view.getUserTaskMsgFail()
else -> {
......
......@@ -6,6 +6,7 @@ import android.view.View
import com.mints.goodmoney.R
import com.mints.goodmoney.ad.VedioAdingManager
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.TTPreLoadExpressManager
import com.mints.goodmoney.mvp.model.UserTaskMsgBean
import com.mints.goodmoney.mvp.model.VedioAdingBean
import com.mints.goodmoney.mvp.presenters.AwardPresenter
......@@ -13,13 +14,12 @@ import com.mints.goodmoney.mvp.views.AwardView
import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.goodmoney.ui.widgets.countdowntimer.CountDownTimerSupport
import com.mints.goodmoney.ui.widgets.countdowntimer.OnCountDownTimerListener
import com.mints.goodmoney.utils.DeviceUuidFactory
import com.mints.goodmoney.utils.SoundPoolUtil
import com.mints.goodmoney.utils.SpanUtils
import com.mints.goodmoney.utils.Utils
import kotlinx.android.synthetic.main.activity_award.*
import java.math.BigDecimal
import java.util.HashMap
import java.util.*
/**
* 描述:奖励界面
......@@ -27,7 +27,8 @@ import java.util.HashMap
* 时间:2020/10/09 15:47
*/
class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
// private val vedioAdingManager by lazy { VedioAdingManager.getInstance(this@AwardActivity) }
private lateinit var vedioAdingManager: VedioAdingManager
private val awardPresenter by lazy { AwardPresenter() }
private var userConfig: UserTaskMsgBean? = null
private var mTimer: CountDownTimerSupport? = null
......@@ -47,6 +48,9 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
override fun initViewsAndEvents() {
awardPresenter.attachView(this)
vedioAdingManager = VedioAdingManager.getInstance(this)
initExpress()
initDataView()
initListener()
}
......@@ -64,10 +68,10 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
startTime()
when (carrierType) {
Constant.CARRIER_HOMEVEDIO_SMALL, Constant.CHALLENGE_SHAREFRIEND,
Constant.SHAREFRIEND_COMPLETE_1, Constant.SHAREFRIEND_COMPLETE_2,
Constant.SHAREFRIEND_COMPLETE_3, Constant.SHAREFRIEND_COMPLETE_4,
Constant.SHAREFRIEND_COMPLETE_5, Constant.SHAREFRIEND_COMPLETE_6 -> {
Constant.SHAREFRIEND_COMPLETE_5, Constant.SHAREFRIEND_COMPLETE_6,
Constant.CARRIER_HOMEVEDIO_SMALL, Constant.CARRIER_GAME_ONLINE -> {
val vo = HashMap<String, Any>()
vo["carrierType"] = carrierType
awardPresenter.reportAddCoinMsg(vo)
......@@ -75,6 +79,16 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
tvAwardContent.setText(curCoin.toString() + "金币已到账")
tvAwardNext.setText("我知道了")
}
Constant.CHALLENGE_SHAREFRIEND -> {
val vo = HashMap<String, Any>()
vo["carrierType"] = carrierType
awardPresenter.reportAddCoinMsg(vo)
tvAwardContent.setText(curCoin.toString() + "金币已到账")
tvAwardNext.setText("金币翻倍")
carrierType = Constant.CARRIER_CHALLENGE_SHAREFRIEND_DOUBLE
}
Constant.CARRIER_NEW_USER -> {
tvAwardContent.setText("新人红包")
tvAwardNext.setText("我知道了")
......@@ -128,7 +142,13 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
mTimer?.stop()
mTimer = null
// vedioAdingManager.destory()
try {
TTPreLoadExpressManager.getInstance().loadTtFrameLayout()
} catch (e: java.lang.Exception) {
e.printStackTrace()
}
vedioAdingManager.destory()
awardPresenter.detachView()
}
......@@ -149,9 +169,9 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
// 只有看视频才能领金币
Constant.CARRIER_OFFLINE_DOUBLE, Constant.CARRIER_SIGNIN_HOMEPAGE_CARD,
Constant.CARRIER_CHALLENGE_TURN, Constant.CARRIER_CHALLENGE_CARD,
Constant.CARRIER_VERSUS_VIDEO, Constant.CARRIER_WALK_BUBBLE -> {
// awardVedio()
finish()
Constant.CARRIER_VERSUS_VIDEO, Constant.CARRIER_WALK_BUBBLE,
Constant.CARRIER_CHALLENGE_SHAREFRIEND_DOUBLE -> {
awardVedio()
}
else -> {
finish()
......@@ -165,10 +185,10 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
* 获取激励视频
*/
private fun awardVedio() {
// if (vedioAdingManager.getVedioFinishFlag()) {
// showToast("今日视频已看完,请明天再来吧")
// return
// }
if (vedioAdingManager.getVedioFinishFlag()) {
showToast("今日视频已看完,请明天再来吧")
return
}
showLoading("加载中...")
......@@ -177,7 +197,7 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
bean.setCurCoin(curCoin)
bean.setExtraId(extraId)
// loadVedio(vedioAdingManager, bean)
loadVedio(vedioAdingManager, bean)
return
}
......@@ -185,28 +205,28 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
* 加载激励视频
*/
private fun loadVedio(vedioAdingManager: VedioAdingManager, bean: VedioAdingBean) {
// vedioAdingManager.setVedioAdingListener(object : VedioAdingManager.VedioAdingListener {
// override fun vedioAdingListenerError(adType: String) {
// showToast("加载超时,请休息一下")
// hideLoading()
// }
//
// override fun vedioAdingListenerFail(adType: String) {
// loadVedioFailCount++
// if (loadVedioFailCount == 2) {
// hideLoading()
// showToast("加载失败,请稍后重试!")
// } else {
// loadVedio(vedioAdingManager, bean)
// }
// }
//
// override fun vedioAdingListenerSuccess(adType: String) {
// hideLoading()
// vedioAdingSuccess(adType)
// }
// })
// vedioAdingManager.loadFailAding(bean)
vedioAdingManager.setVedioAdingListener(object : VedioAdingManager.VedioAdingListener {
override fun vedioAdingListenerError(adType: String) {
showToast("加载超时,请休息一下")
hideLoading()
}
override fun vedioAdingListenerFail(adType: String) {
loadVedioFailCount++
if (loadVedioFailCount >= 2) {
hideLoading()
showToast("加载失败,请稍后重试!")
} else {
loadVedio(vedioAdingManager, bean)
}
}
override fun vedioAdingListenerSuccess(adType: String) {
hideLoading()
vedioAdingSuccess(adType)
}
})
vedioAdingManager.loadFailAding(bean)
}
......@@ -279,4 +299,15 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
private fun vedioAdingSuccess(adType: String) {
setAdFinshLayout()
}
private fun initExpress() {
try {
if (flAwardAd != null) {
flAwardAd.removeAllViews()
flAwardAd.addView(TTPreLoadExpressManager.getInstance().ttFrameLayout)
}
} catch (e: Exception) {
}
}
}
\ No newline at end of file
......@@ -155,11 +155,11 @@ class LoginActivity : BaseActivity()
}
override fun loginSuc() {
// try {
// // 登录成功初始化鱼玩盒子userid
// baseApplication.initYwSdk()
// } catch (e: Exception) {
// }
try {
// 登录成功初始化鱼玩盒子userid
baseApplication.initYwSdk()
} catch (e: Exception) {
}
// false-登录 true-绑定手机号
if (loginFlag) {
......
......@@ -113,8 +113,9 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
R.id.tab_rl_main -> clickTab1Layout()
R.id.tab_rl_pan -> clickTab2Layout()
R.id.tab_rl_friends -> {
clickTab3Layout()
// clickTab3Layout()
// YwSDK_WebActivity.open(this)
readyGo(AwardActivity::class.java)
}
R.id.tab_rl_my -> clickTab4Layout()
}
......
......@@ -4,6 +4,8 @@ import android.os.Bundle
import android.view.View
import com.mints.goodmoney.R
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.TTNativeExpressManager
import com.mints.goodmoney.manager.TtCsjAdManager
import com.mints.goodmoney.mvp.model.WalkBean
import com.mints.goodmoney.mvp.presenters.WalkPresenter
import com.mints.goodmoney.mvp.views.WalkView
......@@ -19,6 +21,7 @@ import kotlinx.android.synthetic.main.activity_walk.*
class WalkActivity : BaseActivity(), View.OnClickListener, WalkView, StepView.StepViewListener {
private val walkPresenter by lazy { WalkPresenter() }
private val ttNativeExpressManager by lazy { TTNativeExpressManager() }
private var curCoin = 0//点击的汽泡金币
override fun getContentViewLayoutID() = R.layout.activity_walk
......@@ -27,6 +30,7 @@ class WalkActivity : BaseActivity(), View.OnClickListener, WalkView, StepView.St
override fun initViewsAndEvents() {
walkPresenter.attachView(this)
initExpress()
initListener()
}
......@@ -40,7 +44,7 @@ class WalkActivity : BaseActivity(), View.OnClickListener, WalkView, StepView.St
super.onDestroy()
svWalk?.destoryAnim()
ttNativeExpressManager.onTTAdDestroy()
walkPresenter.detachView()
}
......@@ -93,4 +97,16 @@ class WalkActivity : BaseActivity(), View.OnClickListener, WalkView, StepView.St
readyGo(AwardActivity::class.java, bundle)
}
}
/**
* 初始化信息iyc
*/
private fun initExpress() {
try {
ttNativeExpressManager.initTTAd( false)
ttNativeExpressManager.getNativeExpressInit( TtCsjAdManager.TT_AD_NATIVEEXPRESS_WALK, flWalkAd, 320f, 0f)
} catch (e: Exception) {
e.printStackTrace()
}
}
}
\ No newline at end of file
......@@ -4,12 +4,15 @@ import android.os.Bundle
import android.view.View
import com.mints.goodmoney.R
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.TTNativeExpressManager
import com.mints.goodmoney.manager.TtCsjAdManager
import com.mints.goodmoney.mvp.model.WaterBean
import com.mints.goodmoney.mvp.presenters.WaterPresenter
import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.goodmoney.ui.widgets.WaterView
import com.mints.goodmoney.ui.widgets.countdowntimer.CountDownTimerSupport
import com.mints.goodmoney.ui.widgets.countdowntimer.OnCountDownTimerListener
import kotlinx.android.synthetic.main.activity_walk.*
import kotlinx.android.synthetic.main.activity_water.*
/**
......@@ -21,6 +24,7 @@ class WaterActivity : BaseActivity(), View.OnClickListener, WaterView.WaterViewL
, com.mints.goodmoney.mvp.views.WaterView {
private val waterPresenter by lazy { WaterPresenter() }
private val ttNativeExpressManager by lazy { TTNativeExpressManager() }
override fun getContentViewLayoutID() = R.layout.activity_water
......@@ -28,7 +32,7 @@ class WaterActivity : BaseActivity(), View.OnClickListener, WaterView.WaterViewL
override fun initViewsAndEvents() {
waterPresenter.attachView(this)
initExpress()
initListener()
}
......@@ -51,6 +55,7 @@ class WaterActivity : BaseActivity(), View.OnClickListener, WaterView.WaterViewL
wvWater?.destoryAnim()
wvWater?.closeWaterViewTime()
ttNativeExpressManager.onTTAdDestroy()
waterPresenter.detachView()
}
......@@ -101,4 +106,16 @@ class WaterActivity : BaseActivity(), View.OnClickListener, WaterView.WaterViewL
// 喝水监听
wvWater.setWaterViewListener(this)
}
/**
* 初始化信息iyc
*/
private fun initExpress() {
try {
ttNativeExpressManager.initTTAd( false)
ttNativeExpressManager.getNativeExpressInit(TtCsjAdManager.TT_AD_NATIVEEXPRESS_WATER, flWaterAd, 320f, 0f)
} catch (e: Exception) {
e.printStackTrace()
}
}
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ import androidx.fragment.app.FragmentTransaction
import com.mints.goodmoney.R
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.TTPreLoadExpressManager
import com.mints.goodmoney.manager.UserManager
import com.mints.goodmoney.mvp.model.MainVedioMsgBean
import com.mints.goodmoney.mvp.model.UserTaskMsgBean
......@@ -58,6 +59,8 @@ class MainFragment : BaseFragment(), HomeView, AdVideoCallback, View.OnClickList
override fun initViewsAndEvents() {
homePresenter.attachView(this)
TTPreLoadExpressManager.getInstance().loadTtFrameLayout()
// 首次显示权限弹窗
showPowerDialog()
// 初始化视频
......
......@@ -15,6 +15,7 @@ import cn.sharesdk.framework.Platform
import cn.sharesdk.framework.Platform.ShareParams
import cn.sharesdk.framework.ShareSDK
import cn.sharesdk.wechat.friends.Wechat
import com.component.dly.xzzq_ywsdk.YwSDK_WebActivity.Companion.open
import com.mints.goodmoney.BuildConfig
import com.mints.goodmoney.R
import com.mints.goodmoney.common.AppConfig
......@@ -24,6 +25,7 @@ import com.mints.goodmoney.mvp.model.*
import com.mints.goodmoney.mvp.presenters.MyPresenter
import com.mints.goodmoney.mvp.views.MyView
import com.mints.goodmoney.ui.activitys.*
import com.mints.goodmoney.ui.adapter.GvMyAdapter
import com.mints.goodmoney.ui.adapter.MainMyAdapter
import com.mints.goodmoney.ui.adapter.listener.OnItemChildClickListener
import com.mints.goodmoney.ui.fragment.base.BaseFragment
......@@ -166,9 +168,9 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
override fun getMyHotActivitySuc(data: BannerBean?) {
// if (UserManager.getInstance().adShowFlag) {
data?.let {
// item_promotions_egv.visibility = View.VISIBLE
// hotList = it.list
// item_promotions_egv.adapter = GvMyAdapter(mContext, hotList)
item_promotions_egv.visibility = View.VISIBLE
hotList = it.list
item_promotions_egv.adapter = GvMyAdapter(mContext, hotList)
}
// } else {
// item_promotions_egv.visibility = View.GONE
......@@ -378,23 +380,27 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
}
}
val task2 = TaskBean(R.mipmap.icon_my_invite, "邀好友,赚金币", progressStrInvited, btnStr, 2)
// // 看福利视频赚金币
// 看福利视频赚金币
// var progressStrVideo = ""
// if (userConfig != null) {
// progressStrVideo = "(" + userConfig!!.taskVeido.complete + "/" + userConfig!!.taskVeido.max + ")"
// }
// val task3 = TaskBean(R.mipmap.icon_my_video, "看福利视频赚金币", progressStrVideo, "赚金币", 3)
// // 玩游戏,赚金币
// val task4 = TaskBean(R.mipmap.icon_my_game, "玩游戏,赚金币", "", "赚金币", 4)
// var task4Str = ""
// if (userConfig != null) {
// task4Str = if (userConfig!!.taskGame.status == 0) "赚金币" else "立即领取"
// }
// val task4 = TaskBean(R.mipmap.icon_my_game, "玩游戏,赚金币", "", task4Str, 4)
// // 小说免费看,金币大家赚
// val task5 = TaskBean(R.mipmap.icon_my_fiction, "小说免费看,金币大家赚", "", "去阅读", 5)
//// val task5 = TaskBean(R.mipmap.icon_my_fiction, "小说免费看,金币大家赚", "", "去阅读", 5)
// // 试玩平台
// val task6 = TaskBean(R.mipmap.icon_my_demo, "试玩平台", "", "", 5)
// val task6 = TaskBean(R.mipmap.icon_my_demo, "试玩平台", "", "赚金币", 5)
dataList.add(task1)
dataList.add(task2)
// dataList.add(task3)
// dataList.add(task4)
// dataList.add(task5)
//// dataList.add(task5)
// dataList.add(task6)
mainMyAdapter?.notifyDataSetChanged()
......@@ -427,14 +433,9 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
if (taskBean.btnStr == "立即领取") {
if (userConfig!!.taskShareFriend!!.complete < userConfig!!.taskShareFriend!!.max) {
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, 50)
bundle.putInt(Constant.MAIN_CUR_COIN, userConfig!!.taskShareFriend!!.coin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CHALLENGE_SHAREFRIEND)
readyGo(AwardActivity::class.java, bundle)
// userConfig?.taskShareFriend!!.complete += 1
// dataList[1].progressStr = "(" + userConfig!!.taskShareFriend.complete + "/" + userConfig!!.taskShareFriend.max + ")"
// dataList[1].btnStr = "去邀请"
// mainMyAdapter?.notifyItemChanged(1)
}
} else {
val wechatSp = ShareParams()
......@@ -448,15 +449,6 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
myPresenter.cmtShareStatus()
// 执行图文分享
wechat.share(wechatSp)
// Handler(Looper.getMainLooper())
// .postDelayed({
// userConfig?.taskShareFriend!!.complete
// dataList[1].progressStr = "(" + userConfig!!.taskShareFriend.complete + "/" + userConfig!!.taskShareFriend.max + ")"
// dataList[1].btnStr = "立即领取"
// mainMyAdapter?.notifyItemChanged(1)
// }, 1000)
} else {
showToast("请先安装微信")
}
......@@ -472,12 +464,21 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
}
// 玩游戏,赚金币
MainMyAdapter.TASK_TYPE_GAME -> {
if (taskBean.btnStr == "立即领取") {
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, userConfig?.taskGame?.coin!!)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_GAME_ONLINE)
readyGo(AwardActivity::class.java, bundle)
} else {
readyGo(LiebaoGameActivity::class.java)
}
}
// 小说免费看,金币大家赚
MainMyAdapter.TASK_TYPE_FICTION -> {
}
// MainMyAdapter.TASK_TYPE_FICTION -> {
// }
// 试玩平台
MainMyAdapter.TASK_TYPE_DEMO -> {
MainMyAdapter.TASK_TYPE_FICTION -> {
activity?.let { open(it) }
}
}
}
......@@ -541,22 +542,31 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
override fun onItemClick(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
if (hotList!!.isNotEmpty()) {
val hotBean: BannerBean.ListBean = hotList!![position]
val hotUrl: String = hotBean.url
val hotTourl: String = hotBean.toUrl
// myPresenter.addMyAdCount(Constant.CARRIER_HOTACTIVITY, hotBean.id)
// 自有界面
when (hotTourl) {
Constant.HOT_ACTIVITY_WATER -> {
// readyGo(RedboxActivity::class.java)
readyGo(WaterActivity::class.java)
}
Constant.HOT_ACTIVITY_WALK -> {
readyGo(WalkActivity::class.java)
}
Constant.HOT_ACTIVITY_CARD -> {
// readyGo(AdWebActivity::class.java)
readyGo(EraseActivity::class.java)
}
Constant.HOT_ACTIVITY_H5 -> {
val bundle = Bundle()
bundle.putString(WebActivity.WEB_TITLE, hotBean.title)
bundle.putString(WebActivity.WEB_URL, hotBean.url)
readyGo(WebActivity::class.java, bundle)
}
else -> {
val bundle = Bundle()
bundle.putString(WebActivity.WEB_TITLE, hotBean.title)
bundle.putString(WebActivity.WEB_URL, hotBean.url)
readyGo(WebActivity::class.java, bundle)
}
else -> showToast("该热门活动暂未开放")
}
}
}
......
......@@ -3,6 +3,8 @@ package com.mints.goodmoney.utils;
import android.content.Context;
import android.content.SharedPreferences;
import com.mints.goodmoney.MintsApplication;
import java.util.Map;
import java.util.Set;
......@@ -31,6 +33,15 @@ public class SPUtil {
return spUtil;
}
public static SPUtil getInstance() {
if (spUtil == null) {
mContext = MintsApplication.getContext();
spUtil = new SPUtil();
mPreferences = mContext.getSharedPreferences(mShareName, Context.MODE_PRIVATE);
}
return spUtil;
}
/**
* 批量保存
*/
......
......@@ -10,7 +10,7 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="160dp"
android:layout_marginTop="110dp"
android:layout_marginRight="30dp">
<TextView
......@@ -43,9 +43,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="30dp"
android:layout_marginLeft="25dp"
android:layout_marginTop="26dp"
android:layout_marginRight="30dp"
android:layout_marginRight="25dp"
android:background="@drawable/shape_bg_award"
android:orientation="vertical">
......@@ -107,9 +107,10 @@
</FrameLayout>
<FrameLayout
android:id="@+id/fl_award_ad"
android:id="@+id/flAwardAd"
android:layout_width="wrap_content"
android:layout_height="275dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_gravity="center_horizontal"
android:background="@color/full_transparent">
......
......@@ -55,7 +55,6 @@
android:layout_height="match_parent"
android:layout_weight="1.0"
android:gravity="center"
android:visibility="gone"
android:orientation="vertical">
<ImageView
......
......@@ -33,6 +33,16 @@
android:layout_marginTop="70dp" />
</FrameLayout>
<FrameLayout
android:id="@+id/flWalkAd"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@color/full_transparent">
</FrameLayout>
</LinearLayout>
</ScrollView>
......@@ -32,6 +32,16 @@
android:layout_gravity="center_horizontal"
android:layout_marginTop="80dp" />
</FrameLayout>
<FrameLayout
android:id="@+id/flWaterAd"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@color/full_transparent">
</FrameLayout>
</LinearLayout>
</ScrollView>
......@@ -38,8 +38,7 @@
<include layout="@layout/item_divider_gray" />
<include
layout="@layout/item_fragment_main_my_promotions"
android:visibility="gone" />
layout="@layout/item_fragment_main_my_promotions"/>
<include
layout="@layout/item_divider_gray"
......
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