Commit 12f9ab31 authored by mengcuiguang2's avatar mengcuiguang2

添加gromore逻辑,修改激励视频,信息流,内存泄露优化。解决冲突

parents 4e210681 68c773e1
/build
mapping.txt
seeds.txt
unused.txt
local.properties
\ No newline at end of file
This diff is collapsed.
......@@ -93,7 +93,7 @@
android:value="${JPUSH_CHANNEL}" />
<activity
android:name=".ui.activitys.SplashYlhActivity"
android:name="com.mints.flowbox.ui.activitys.SplashGroMoreActivity"
android:excludeFromRecents="true"
android:theme="@style/NormalSplash">
<intent-filter>
......@@ -147,6 +147,9 @@
<activity android:name=".ui.activitys.Increasespeed2Activity" />
<activity android:name=".ui.activitys.IncreasespeedActivity" />
<activity android:name=".ui.activitys.BoostFastActivity" />
<activity android:name="com.mints.flowbox.ui.activitys.SplashGroMoreBackgroundActivity" />
<activity android:name="com.mints.flowbox.ui.activitys.RedboxEraseActivity" />
<activity
android:name=".ui.activitys.ScreenActivity"
android:excludeFromRecents="true"
......@@ -274,6 +277,7 @@
android:resource="@xml/ow_file_paths" />
</provider> <!-- 常驻通知栏service -->
<service android:name=".keepalive.NotificationService" />
</application>
</manifest>
\ No newline at end of file
......@@ -47,8 +47,6 @@ import com.orhanobut.logger.AndroidLogAdapter;
import com.orhanobut.logger.FormatStrategy;
import com.orhanobut.logger.Logger;
import com.orhanobut.logger.PrettyFormatStrategy;
import com.umeng.analytics.MobclickAgent;
import com.umeng.commonsdk.UMConfigure;
import net.DebugConfig;
import net.analytics.AnalyticsLogger;
......@@ -114,6 +112,7 @@ public class MintsApplication extends BaseApp {
System.out.println("mints ------------> umengConfig <------------");
// UmengHelper.init(this, channel);
com.mints.flowbox.manager.UmengManager.INSTANCE.preInit();
}
// TODO 这里可以设置外部模块的埋点统计功能
......@@ -265,7 +264,7 @@ public class MintsApplication extends BaseApp {
KeepAliveHelper.Companion.preInit(base, this, NotificationService.class);
// 9.0之后不可多进程使用一个目录下的WebView,写在SDK初始化之前
androidPWebView();
// androidPWebView();
}
/*
......@@ -281,26 +280,17 @@ public class MintsApplication extends BaseApp {
// 移动安全联盟 oaid
initMiitHelper();
// 优量汇
YlhAdManager.INSTANCE.initYlhAd(this);
// GroMore
CsjGroMoreManager.INSTANCE.init(this);
// OneWay
OwManager.INSTANCE.init(this);
// 穿山甲
TtCsjAdManager.init(this);
// 快手
KsManager.INSTANCE.initKs(this);
// 闪电盒子
WnManager.INSTANCE.initWn(this);
// 枫岚广告
MhManager.INSTANCE.initWn(this);
// MhManager.INSTANCE.initWn(this);
// 天卓珊瑚
TzManager.INSTANCE.initTz(this);
......@@ -329,6 +319,7 @@ public class MintsApplication extends BaseApp {
* 自定义logger
*/
private void bindLogger() {
try {
//自定义logger
FormatStrategy formatStrategy = PrettyFormatStrategy.newBuilder()
.showThreadInfo(false) //是否选择显示线程信息,默认为true
......@@ -338,6 +329,10 @@ public class MintsApplication extends BaseApp {
.tag("mints---network") //自定义TAG全部标签,默认PRETTY_LOGGER
.build();
Logger.addLogAdapter(new AndroidLogAdapter(formatStrategy));
} catch (Exception e) {
e.printStackTrace();
LogUtil.e(e);
}
}
private final MiitHelper.AppIdsUpdater appIdsUpdater = ids -> OAID = ids;
......@@ -355,23 +350,6 @@ public class MintsApplication extends BaseApp {
}
}
/**
* 友盟初始化
*/
public void initUm(Context context) {
try {
/*
* 参数4:设备类型,必须参数,传参数为UMConfigure.DEVICE_TYPE_PHONE则表示手机;传参数为UMConfigure.DEVICE_TYPE_BOX则表示盒子;默认为手机。
* 参数5:Push推送业务的secret,需要集成Push功能时必须传入Push的secret,否则传空。
*/
UMConfigure.init(context, CommonUtils.getAppMetaData(MintsApplication.getContext(), "UMENG_KEY"), CommonUtils.getAppMetaData(context, "CHANNEL_NAME"), UMConfigure.DEVICE_TYPE_PHONE, "");
UMConfigure.setLogEnabled(BuildConfig.DEBUG);
MobclickAgent.setPageCollectionMode(MobclickAgent.PageMode.LEGACY_MANUAL);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* app退出
*/
......
......@@ -4,6 +4,7 @@ import android.view.View
import android.widget.FrameLayout
import com.bytedance.sdk.openadsdk.AdSlot
import com.bytedance.sdk.openadsdk.TTAdNative
import com.bytedance.sdk.openadsdk.TTAdSdk
import com.bytedance.sdk.openadsdk.TTNativeExpressAd
import com.mints.flowbox.MintsApplication
import com.mints.flowbox.manager.TtCsjAdManager
......@@ -16,12 +17,14 @@ object BannerManager {
private var adNative: TTAdNative? = null
private var mTTAd: TTNativeExpressAd? = null
private var frameLayout: FrameLayout? = null
fun init() {
adNative = TtCsjAdManager.get().createAdNative(MintsApplication.getContext())
adNative = TTAdSdk.getAdManager().createAdNative(MintsApplication.getContext())
// TTAdSdk.getAdManager().createAdNative()
// 权限请求
TtCsjAdManager.get().requestPermissionIfNecessary(MintsApplication.getContext())
// TtCsjAdManager.get().requestPermissionIfNecessary(MintsApplication.getContext())
}
/**
......@@ -39,7 +42,7 @@ object BannerManager {
* 获取穿山甲banner
*/
fun getTtBanner(codeId: String, frameLayout: FrameLayout?) {
this.frameLayout = frameLayout
var expressViewAcceptedSizeWidth = getViewWidth()
var expressViewAcceptedSizeHeight = 0f
when (codeId) {
......@@ -49,6 +52,7 @@ object BannerManager {
}
}
// ToastUtil.showLong(MintsApplication.getContext(), "csj banner:$codeId")
adNative?.let {
val adSlot = AdSlot.Builder()
......@@ -63,10 +67,12 @@ object BannerManager {
override fun onNativeExpressAdLoad(ads: MutableList<TTNativeExpressAd>?) {
if (ads == null || ads.size == 0) return
BannerManager.frameLayout?.let {
mTTAd = ads[0]
bindAdListener(frameLayout)
bindAdListener()
mTTAd?.render()
}
}
override fun onError(code: Int, msg: String) {
LogUtil.d("BannerManager", "onError code:${code} msg:${msg}")
......@@ -75,7 +81,7 @@ object BannerManager {
}
}
private fun bindAdListener(frameLayout: FrameLayout?) {
private fun bindAdListener() {
mTTAd?.let {
it.setExpressInteractionListener(object : TTNativeExpressAd.ExpressAdInteractionListener {
override fun onAdClicked(p0: View?, p1: Int) {
......@@ -102,11 +108,12 @@ object BannerManager {
}
fun onDestroy() {
frameLayout = null
mTTAd?.let {
it.setExpressInteractionListener(null)
it.destroy()
mTTAd = null
it.setExpressInteractionListener(null)
}
mTTAd = null
adNative = null
}
}
\ No newline at end of file
package com.mints.flowbox.ad.express
import android.widget.FrameLayout
import com.mints.flowbox.common.AppConfig
import com.mints.flowbox.manager.TtCsjAdManager
/**
* 能用信息流加载
*/
object ExpressManager {
fun loadExpress() {
if (AppConfig.groMoreVideoAdCount > 0) {
GroMoreCarrierExpressManager.instance.loadADFrameLayout()
} else {
TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_WATER)
}
}
fun getExpressFrameLayout(): FrameLayout? {
if (AppConfig.groMoreVideoAdCount > 0) {
return GroMoreCarrierExpressManager.instance.getADFrameLayout()
} else {
return TTPreLoadCarrierExpressManager.getInstance().ttFrameLayout
}
}
}
\ No newline at end of file
......@@ -15,6 +15,7 @@ import com.kwad.sdk.api.*
import com.kwad.sdk.api.KsNativeAd.VideoPlayListener
import com.mints.flowbox.MintsApplication
import com.mints.flowbox.R
import com.mints.flowbox.common.AppConfig
import com.mints.flowbox.manager.ad.KsManager
import com.mints.flowbox.utils.LogUtil
import java.util.*
......@@ -42,6 +43,7 @@ object KsPreLoadExpressManager {
KsAdSDK.getLoadManager().loadNativeAd(scene, object : KsLoadManager.NativeAdListener {
override fun onError(p0: Int, p1: String?) {
LogUtil.d("$p0 -> $p1")
AppConfig.isPreExpressAwardActivity=false
}
override fun onNativeAdLoad(p0: MutableList<KsNativeAd>?) {
......@@ -51,6 +53,7 @@ object KsPreLoadExpressManager {
})
} catch (e: Exception) {
AppConfig.isPreExpressAwardActivity=false
e.printStackTrace()
}
}
......@@ -83,8 +86,7 @@ object KsPreLoadExpressManager {
* 使用SDK渲染的播放控件
*/
private fun getVideoItemView(parent: ViewGroup, ksNativeAd: KsNativeAd): View? {
val convertView: View =
LayoutInflater.from(mContext).inflate(R.layout.native_item_video, parent, false)
val convertView: View = LayoutInflater.from(mContext).inflate(R.layout.native_item_video, parent, false)
val videoViewHolder = AdVideoViewHolder(convertView)
// 设置广告数据
......@@ -119,8 +121,7 @@ object KsPreLoadExpressManager {
* 自定义的单图广告
*/
private fun getSingleImageItemView(parent: ViewGroup, ksNativeAd: KsNativeAd): View? {
val convertView: View =
LayoutInflater.from(mContext).inflate(R.layout.native_item_single_image, parent, false)
val convertView: View = LayoutInflater.from(mContext).inflate(R.layout.native_item_single_image, parent, false)
val viewHolder = AdSingleImageViewHolder(convertView)
bindCommonData(convertView as ViewGroup, viewHolder, ksNativeAd)
......@@ -138,8 +139,7 @@ object KsPreLoadExpressManager {
* 自定义的组图广告
*/
private fun getGroupImageItemView(parent: ViewGroup, ksNativeAd: KsNativeAd): View? {
val convertView: View =
LayoutInflater.from(mContext).inflate(R.layout.native_item_group_image, parent, false)
val convertView: View = LayoutInflater.from(mContext).inflate(R.layout.native_item_group_image, parent, false)
val viewHolder = AdGroupImageViewHolder(convertView)
bindCommonData(convertView as ViewGroup, viewHolder, ksNativeAd)
......@@ -168,17 +168,14 @@ object KsPreLoadExpressManager {
@SuppressLint("DefaultLocale")
private fun getNormalItemView(parent: ViewGroup): View? {
val convertView: View =
LayoutInflater.from(mContext).inflate(R.layout.native_item_normal, parent, false)
val convertView: View = LayoutInflater.from(mContext).inflate(R.layout.native_item_normal, parent, false)
val normalViewHolder = NormalViewHolder(convertView)
normalViewHolder.textView.text = "没有广告"
return convertView
}
private fun bindCommonData(
convertView: ViewGroup, adBaseViewHolder: AdBaseViewHolder,
ad: KsNativeAd
) {
private fun bindCommonData(convertView: ViewGroup, adBaseViewHolder: AdBaseViewHolder,
ad: KsNativeAd) {
// 点击转换view的集合,传入的view点击时会触发转换操作:app下载, 打开h5页面
val clickViewList: MutableList<View> = ArrayList()
clickViewList.add(convertView) // 点击整个view都可触发转换
......@@ -190,7 +187,7 @@ object KsPreLoadExpressManager {
object : KsNativeAd.AdInteractionListener {
override fun onAdClicked(view: View, ad: KsNativeAd) {
if (ad != null) {
// Toast.makeText(WenshuApplication.getContext(), "广告" + ad.appName + "被点击", Toast.LENGTH_SHORT).show()
// Toast.makeText(MintsApplication.getContext(), "广告" + ad.appName + "被点击", Toast.LENGTH_SHORT).show()
}
}
......@@ -201,7 +198,7 @@ object KsPreLoadExpressManager {
}
override fun handleDownloadDialog(p0: DialogInterface.OnClickListener?): Boolean {
TODO("Not yet implemented")
return false
}
})
......@@ -236,8 +233,7 @@ object KsPreLoadExpressManager {
adBaseViewHolder.mAppIcon.visibility = View.GONE
} else {
adBaseViewHolder.mAppIcon.visibility = View.VISIBLE
Glide.with(MintsApplication.getContext()).load(ad.appIconUrl)
.into(adBaseViewHolder.mAppIcon)
Glide.with(MintsApplication.getContext()).load(ad.appIconUrl).into(adBaseViewHolder.mAppIcon)
}
// app名称
if (!TextUtils.isEmpty(ad.appName)) {
......
......@@ -15,9 +15,7 @@ import java.util.*
/**
* 预加载信息流管理类
*/
@SuppressLint("StaticFieldLeak")
object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener,
KSADLoadSuccessListener, GMADLoadSuccessListener {
object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener, KSADLoadSuccessListener, GMADLoadSuccessListener {
private val TAG = PreLoadExpressManager::class.java.simpleName
......@@ -64,8 +62,7 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
// }
when (getRandomWeight()) {
Constant.CSJ_EXPRESS_AD -> TTPreLoadExpressManager.getInstance()
.loadTtFrameLayout(mAdFrameLayout)
Constant.CSJ_EXPRESS_AD -> TTPreLoadExpressManager.getInstance().loadTtFrameLayout(mAdFrameLayout)
Constant.YLH_EXPRESS_AD -> YlhPreLoadExpressManager.loadYlhFrameLayout()
Constant.KS_EXPRESS_AD -> KsPreLoadExpressManager.loadKsFrameLayout(mAdFrameLayout as ViewGroup)
Constant.GM_EXPRESS_AD -> GroMoreExpressManager.instance.loadADFrameLayout()
......@@ -138,6 +135,9 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
// if (currentIndex == 1) {
// mAdFrameLayout = adFrameLayout
// }
if(view!=null){
AppConfig.isPreExpressAwardActivity=true
}
mAdFrameLayout = view
}
......@@ -145,6 +145,9 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
// if (currentIndex == 2) {
// mAdFrameLayout?.addView(view)
// }
if(view!=null){
AppConfig.isPreExpressAwardActivity=true
}
mAdFrameLayout?.addView(view)
}
......@@ -152,6 +155,9 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
// if (currentIndex == 3) {
// mAdFrameLayout?.addView(view)
// }
if(view!=null){
AppConfig.isPreExpressAwardActivity=true
}
mAdFrameLayout?.addView(view)
}
......@@ -159,6 +165,9 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
// if (currentIndex == 3) {
// mAdFrameLayout?.addView(view)
// }
if(view!=null){
AppConfig.isPreExpressAwardActivity=true
}
mAdFrameLayout?.addView(view)
}
......
......@@ -106,7 +106,7 @@ public class TTPreLoadCarrierExpressManager {
public void loadTtFrameLayout(String codeId) {
init();
// ToastUtil.showLong(WenshuApplication.getContext(), "通用信息流:" + codeId);
// ToastUtil.showLong(MintsApplication.getContext(), "通用信息流:" + codeId);
if (mWorkHandler != null) {
Message msg = Message.obtain();
......
......@@ -4,7 +4,7 @@ import android.util.DisplayMetrics;
import android.widget.FrameLayout;
import com.mints.flowbox.MintsApplication;
import com.mints.flowbox.common.AppConfig;
import com.mints.flowbox.ad.express.TTADLoadSuccessListener;import com.mints.flowbox.common.AppConfig;
import com.mints.flowbox.manager.TTNativeExpressManager;
import com.mints.flowbox.manager.TtCsjAdManager;
......@@ -62,6 +62,7 @@ public class TTPreLoadExpressManager {
}
}
} catch (Exception e) {
AppConfig.isPreExpressAwardActivity=false;
e.printStackTrace();
}
});
......
package com.mints.flowbox.ad.express
import com.qq.e.ads.nativ.express2.*
import com.qq.e.comm.util.AdError
import com.mints.flowbox.MintsApplication
import com.mints.flowbox.common.AppConfig
import com.mints.flowbox.manager.ad.YlhAdManager
import com.mints.flowbox.utils.LogUtil
import com.qq.e.ads.nativ.ADSize
import com.qq.e.ads.nativ.NativeExpressAD
import com.qq.e.ads.nativ.NativeExpressADView
/**
* 优量汇预加载信息流
*/
......@@ -23,12 +27,9 @@ object YlhPreLoadExpressManager {
fun loadYlhFrameLayout() {
try {
nativeExpressAD = NativeExpressAD(
MintsApplication.getContext(),
ADSize(ADSize.FULL_WIDTH, ADSize.AUTO_HEIGHT),
YlhAdManager.YLH_AD_NATIVEEXPRESS_AWARD,
object : NativeExpressAD.NativeExpressADListener {
nativeExpressAD = NativeExpressAD(MintsApplication.getContext(), ADSize(ADSize.FULL_WIDTH, ADSize.AUTO_HEIGHT), YlhAdManager.YLH_AD_NATIVEEXPRESS_AWARD, object : NativeExpressAD.NativeExpressADListener {
override fun onNoAD(p0: AdError?) {
AppConfig.isPreExpressAwardActivity=false
}
override fun onADClicked(p0: NativeExpressADView?) {
......@@ -62,6 +63,7 @@ object YlhPreLoadExpressManager {
}
override fun onRenderFail(p0: NativeExpressADView?) {
AppConfig.isPreExpressAwardActivity=false
}
override fun onRenderSuccess(p0: NativeExpressADView?) {
......@@ -72,6 +74,7 @@ object YlhPreLoadExpressManager {
} catch (e: Exception) {
e.printStackTrace()
AppConfig.isPreExpressAwardActivity=false
}
}
......
......@@ -7,6 +7,7 @@ import com.bytedance.sdk.openadsdk.TTAdConstant;
import com.bytedance.sdk.openadsdk.TTAdNative;
import com.bytedance.sdk.openadsdk.TTAdSdk;
import com.bytedance.sdk.openadsdk.TTFullScreenVideoAd;
import com.mints.flowbox.MintsApplication;
import com.mints.flowbox.ad.video.base.BaseVideoAd;
import com.mints.flowbox.ad.video.base.VideoAdStatusListener;
import com.mints.flowbox.common.Constant;
......@@ -18,8 +19,6 @@ import com.mints.flowbox.manager.TtCsjAdManager;
*/
public class CsjFullVideoAdManager extends BaseVideoAd {
private static CsjFullVideoAdManager _inst;
private VideoAdStatusListener videoAdStatusListener;
Activity activity;
......@@ -28,20 +27,12 @@ public class CsjFullVideoAdManager extends BaseVideoAd {
private boolean isClickScreen = true; // 是否点击屏幕跳转广告
public static CsjFullVideoAdManager getInstance(Activity activity) {
if (_inst == null) {
_inst = new CsjFullVideoAdManager(activity);
}
return _inst;
public CsjFullVideoAdManager() {
init();
}
private CsjFullVideoAdManager(Activity activity) {
init(activity);
}
private void init(Activity activity) {
this.activity = activity;
ttAdNative = TTAdSdk.getAdManager().createAdNative(activity);
private void init() {
ttAdNative = TTAdSdk.getAdManager().createAdNative(MintsApplication.getContext());
}
/**
......
......@@ -8,11 +8,13 @@ import com.bytedance.sdk.openadsdk.TTAdNative;
import com.bytedance.sdk.openadsdk.TTAppDownloadListener;
import com.bytedance.sdk.openadsdk.TTRewardVideoAd;
import com.mints.flowbox.BuildConfig;
import com.mints.flowbox.MintsApplication;
import com.mints.flowbox.ad.code.CsjCode;
import com.mints.flowbox.ad.video.base.BaseVideoAd;
import com.mints.flowbox.ad.video.base.VideoAdStatusListener;
import com.mints.flowbox.common.AppConfig;
import com.mints.flowbox.common.Constant;
import com.mints.flowbox.manager.AppPreferencesManager;
import com.mints.flowbox.manager.TTNativeExpressManager;
import com.mints.flowbox.manager.TrackManager;
import com.mints.flowbox.manager.TtCsjAdManager;
......@@ -21,7 +23,6 @@ import com.mints.flowbox.utils.LogUtil;
import com.mints.flowbox.utils.MD5;
import com.mints.library.utils.json.JsonUtil;
import net.grandcentrix.tray.AppPreferences;
import java.util.HashMap;
......@@ -30,8 +31,6 @@ import java.util.HashMap;
*/
public class CsjVideoAdManager extends BaseVideoAd {
private static CsjVideoAdManager _inst;
private AppPreferences ps;
private int curCoin;
private String extraId;
private VideoAdStatusListener videoAdStatusListener;
......@@ -43,20 +42,11 @@ public class CsjVideoAdManager extends BaseVideoAd {
private boolean isClickScreen = true; // 是否点击屏幕跳转广告
public static CsjVideoAdManager getInstance(Activity activity) {
if (_inst == null) {
_inst = new CsjVideoAdManager(activity);
}
return _inst;
}
private CsjVideoAdManager(Activity activity) {
init(activity);
public CsjVideoAdManager() {
init();
}
private void init(Activity activity) {
this.activity = activity;
ps = new AppPreferences(activity);
private void init() {
userManager = UserManager.getInstance();
TTNativeExpressManager ttNativeExpressManager = new TTNativeExpressManager();
......@@ -68,7 +58,6 @@ public class CsjVideoAdManager extends BaseVideoAd {
if (mttRewardVideoAd != null) {
mttRewardVideoAd.setRewardAdInteractionListener(null);
}
ps = null;
activity = null;
}
......@@ -263,10 +252,7 @@ public class CsjVideoAdManager extends BaseVideoAd {
vo.put("adtype", Constant.ADTYPE_VEDIO);
vo.put("tid", tid);
vo.put("adsource", Constant.AD_SOURCE_CSJ);
if (ps == null) {
ps = new AppPreferences(activity);
}
vo.put("ip", ps.getString(Constant.CSJ_VEDIO_APPIP, ""));
vo.put("ip", AppPreferencesManager.INSTANCE.get().getString(Constant.CSJ_VEDIO_APPIP, ""));
switch (carrierType) {
case Constant.CARRIER_VERSUS_VIDEO:// 每日任务-视频
......
......@@ -9,37 +9,26 @@ import com.mints.flowbox.ad.video.base.BaseVideoAd
import com.mints.flowbox.ad.video.base.VideoAdStatusListener
import com.mints.flowbox.common.AppConfig
import com.mints.flowbox.common.Constant
import com.mints.flowbox.manager.ad.KsManager
import com.mints.flowbox.manager.TrackManager
import com.mints.flowbox.manager.ad.KsManager
import com.mints.flowbox.utils.LogUtil
import com.mints.flowbox.utils.ToastUtil
private val TAG = KsVideoAdManager::class.java.simpleName
/**
* 快手广告视频
*/
class KsVideoAdManager private constructor() :
class KsVideoAdManager public constructor() :
BaseVideoAd() {
private var videoAdStatusListener: VideoAdStatusListener? = null
private var mRewardVideoAd: KsRewardVideoAd? = null
private var activity: Activity? = null
private var isClickScreen: Boolean = true
companion object {
private var _inst: KsVideoAdManager? = null
fun getInstance(): KsVideoAdManager? {
return if (_inst != null) {
_inst
} else {
_inst = KsVideoAdManager()
_inst
}
}
}
override fun loadAd(activity: Activity, curCoin: Int, carrierType: String, extraId: String?) {
this.activity=activity
isClickScreen = true
val scene = KsScene.Builder(KsManager.KS_AD_VEDIO_POSTID).build()
......@@ -47,14 +36,10 @@ class KsVideoAdManager private constructor() :
override fun onError(p0: Int, p1: String?) {
videoAdStatusListener?.adFail()
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_KS, Constant.EVENT_TYPE_ONE, p0.toString(), p1)
ToastUtil.showLong(activity,"快手 onError: code->${p0.toString()} msg->${p1}")
// ToastUtil.showLong(activity,"快手 onError: code->${p0.toString()} msg->${p1}")
LogUtil.d(p1)
}
override fun onRequestResult(p0: Int) {
TODO("Not yet implemented")
}
override fun onRewardVideoAdLoad(p0: MutableList<KsRewardVideoAd>?) {
mRewardVideoAd = p0?.get(0)
if (mRewardVideoAd != null && mRewardVideoAd!!.isAdEnable) {
......@@ -116,6 +101,8 @@ class KsVideoAdManager private constructor() :
}
}
override fun onRequestResult(p0: Int) {}
})
......@@ -128,5 +115,6 @@ class KsVideoAdManager private constructor() :
override fun onDestroy() {
mRewardVideoAd = null
activity=null
}
}
\ No newline at end of file
......@@ -6,8 +6,8 @@ import com.mints.flowbox.ad.video.base.BaseVideoAd
import com.mints.flowbox.ad.video.base.VideoAdStatusListener
import com.mints.flowbox.common.AppConfig
import com.mints.flowbox.common.Constant
import com.mints.flowbox.manager.ad.MhManager
import com.mints.flowbox.manager.TrackManager
import com.mints.flowbox.manager.ad.MhManager
import com.mints.flowbox.utils.LogUtil
private val TAG = MhVideoAdManager::class.java.simpleName
......@@ -15,29 +15,19 @@ private val TAG = MhVideoAdManager::class.java.simpleName
/**
* 枫岚广告视频
*/
class MhVideoAdManager private constructor() :
class MhVideoAdManager public constructor() :
BaseVideoAd() {
private var videoAdStatusListener: VideoAdStatusListener? = null
private var mRewardVideoAd: RewardVideoAd? = null
private var isClickScreen: Boolean = true
private var activity: Activity? = null
companion object {
private var _inst: MhVideoAdManager? = null
fun getInstance(): MhVideoAdManager? {
return if (_inst != null) {
_inst
} else {
_inst = MhVideoAdManager()
_inst
}
}
}
override fun loadAd(activity: Activity, curCoin: Int, carrierType: String, extraId: String?) {
isClickScreen = true
this.activity=activity
val postId: String = when (carrierType) {
Constant.CARRIER_VERSUS_VIDEO -> MhManager.POS_ID
Constant.CARRIER_HOMEWATER -> MhManager.POS_ID
......@@ -112,5 +102,6 @@ class MhVideoAdManager private constructor() :
override fun onDestroy() {
mRewardVideoAd = null
activity=null
}
}
\ No newline at end of file
package com.mints.flowbox.ad.video
import android.app.Activity
import com.mints.flowbox.ad.video.base.BaseVideoAd
import com.mints.flowbox.ad.video.base.VideoAdStatusListener
import com.mints.flowbox.common.AppConfig
import com.mints.flowbox.common.Constant
import com.mints.flowbox.manager.TrackManager
import com.mints.flowbox.manager.ad.OwManager
import com.mints.flowbox.utils.LogUtil
import mobi.oneway.export.Ad.OWRewardedAd
import mobi.oneway.export.AdListener.OWRewardedAdListener
import mobi.oneway.export.enums.OnewayAdCloseType
import mobi.oneway.export.enums.OnewaySdkError
private val TAG = OwVideoAdManager::class.java.simpleName
/**
* OneWay广告视频
*/
class OwVideoAdManager public constructor() :
BaseVideoAd() {
private var videoAdStatusListener: VideoAdStatusListener? = null
private var owRewardedAd: OWRewardedAd? = null
private var isClickScreen: Boolean = true
private var activity: Activity? = null
override fun loadAd(activity: Activity, curCoin: Int, carrierType: String, extraId: String?) {
isClickScreen = true
this.activity=activity
//创建激励视频事件监听器
val owRewardedAdListener: OWRewardedAdListener = object : OWRewardedAdListener {
override fun onAdReady() {
owRewardedAd?.show(activity)
}
override fun onAdShow(tag: String) {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_OW, Constant.EVENT_TYPE_ZERO, "", "")
}
override fun onAdClick(tag: String) {
if (AppConfig.needReportClickAdEvent) {
TrackManager.getInstance().reportClickAdEvent()
}
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_OW, Constant.EVENT_TYPE_TWO, "", "")
if (isClickScreen) {
// 防止重复
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_OW, Constant.EVENT_TYPE_FOUR, "", "")
isClickScreen = false
}
videoAdStatusListener?.adDownload()
}
override fun onAdClose(tag: String, onewayVideoCloseType: OnewayAdCloseType) {
TrackManager.getInstance().reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_OW, extraId, curCoin))
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_OW, Constant.EVENT_TYPE_THREE, "", "")
videoAdStatusListener?.adSuccess()
}
override fun onAdFinish(s: String, onewayAdCloseType: OnewayAdCloseType, s1: String) {
}
override fun onSdkError(onewaySdkError: OnewaySdkError, msg: String) {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_OW, Constant.EVENT_TYPE_ONE, "999999","emun:"+onewaySdkError.name+"msg:"+ msg)
LogUtil.d(TAG, "onADError->$msg")
videoAdStatusListener?.adFail()
}
}
//创建激励视频对象
owRewardedAd = OWRewardedAd(activity, OwManager.REWARD_PID, owRewardedAdListener)
owRewardedAd?.loadAd()
}
fun setVideoAdStatusListener(videoAdStatusListener: VideoAdStatusListener?) {
this.videoAdStatusListener = videoAdStatusListener
}
override fun onDestroy() {
owRewardedAd?.destory()
owRewardedAd = null
activity=null
}
}
\ No newline at end of file
......@@ -3,10 +3,12 @@ package com.mints.flowbox.ad.video
import android.app.Activity
import android.text.TextUtils
import androidx.annotation.Nullable
import com.mints.flowbox.MintsApplication
import com.mints.flowbox.ad.video.base.BaseVideoAd
import com.mints.flowbox.ad.video.base.VideoAdStatusListener
import com.mints.flowbox.common.AppConfig
import com.mints.flowbox.common.Constant
import com.mints.flowbox.manager.AppPreferencesManager
import com.mints.flowbox.manager.TrackManager
import com.mints.flowbox.manager.UserManager
import com.mints.flowbox.utils.LogUtil
......@@ -18,20 +20,20 @@ import com.tz.sdk.core.ad.ADError
import com.tz.sdk.core.ad.ADSource
import com.tz.sdk.core.ad.ADType
import com.tz.sdk.core.loader.ADLoader
import net.grandcentrix.tray.AppPreferences
private val TAG = ShVideoAdManager::class.java.simpleName
/**
* 天卓珊瑚广告视频
*/
class ShVideoAdManager private constructor(activity: Activity) :
class ShVideoAdManager public constructor() :
BaseVideoAd() {
private var isClickScreen: Boolean = true
private var activity: Activity? = null
private var videoAdStatusListener: VideoAdStatusListener? = null
private lateinit var ps: AppPreferences
companion object {
......@@ -43,28 +45,18 @@ class ShVideoAdManager private constructor(activity: Activity) :
const val TZ_REWRAD_TYPE_DEBUG = 131
const val TZ_REWRAD_TYPE_RELEASE = 104
private var _inst: ShVideoAdManager? = null
fun getInstance(activity: Activity): ShVideoAdManager? {
return if (_inst != null) {
_inst
} else {
_inst = ShVideoAdManager(activity)
_inst
}
}
}
init {
init(activity)
init()
}
private fun init(activity: Activity) {
ps = AppPreferences(activity)
private fun init() {
}
override fun loadAd(activity: Activity, curCoin: Int, carrierType: String, extraId: String?) {
isClickScreen = true
this.activity=activity
val type = TZ_REWRAD_TYPE_RELEASE
// val type = if (BuildConfig.DEBUG) {
......@@ -180,7 +172,7 @@ class ShVideoAdManager private constructor(activity: Activity) :
vo["carrierType"] = carrierType
vo["adtype"] = Constant.ADTYPE_VEDIO
vo["tid"] = MD5.GetMD5Code(System.currentTimeMillis().toString() + UserManager.getInstance().userID)
vo["ip"] = ps.getString(Constant.CSJ_VEDIO_APPIP, "")!!
vo["ip"] = AppPreferencesManager.get().getString(Constant.CSJ_VEDIO_APPIP, "")!!
when (carrierType) {
Constant.CARRIER_VERSUS_VIDEO -> vo["coin"] = curCoin
Constant.CARRIER_HOMEWATER -> vo["waterCoin"] = curCoin
......
......@@ -15,29 +15,19 @@ private val TAG = WnVideoAdManager::class.java.simpleName
/**
* 闪电盒子视频
*/
class WnVideoAdManager private constructor() :
class WnVideoAdManager public constructor() :
BaseVideoAd() {
private var videoAdStatusListener: VideoAdStatusListener? = null
private var mRewardVideoAd: WNRewardVideoAd? = null
private var isClickScreen: Boolean = true
private var activity: Activity? = null
companion object {
private var _inst: WnVideoAdManager? = null
fun getInstance(): WnVideoAdManager? {
return if (_inst != null) {
_inst
} else {
_inst = WnVideoAdManager()
_inst
}
}
}
override fun loadAd(activity: Activity, curCoin: Int, carrierType: String, extraId: String?) {
isClickScreen = true
this.activity=activity
val postId: String = when (carrierType) {
Constant.CARRIER_VERSUS_VIDEO -> WnManager.WN_AD_VEDIO_MAIN_POSTID
Constant.CARRIER_HOMEWATER -> WnManager.WN_AD_VEDIO_DRINK_POSTID
......@@ -52,7 +42,7 @@ class WnVideoAdManager private constructor() :
WNAdSdk.getAdManager().loadRewardVideoAd(slot, object : WNRewardVideoAd.RewardVideoAdListener {
override fun onError(code: Int, message: String) {
LogUtil.d(TAG, "onError $code:$message")
LogUtil.d(TAG, "onError ${code}:${message}")
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SDHZ, Constant.EVENT_TYPE_ONE, (code).toString(), message)
......@@ -121,5 +111,6 @@ class WnVideoAdManager private constructor() :
it.interactionListener = null
}
mRewardVideoAd = null
activity=null
}
}
\ No newline at end of file
......@@ -22,7 +22,6 @@ import java.util.Map;
*/
public class YlhVideoAdManager extends BaseVideoAd {
private static YlhVideoAdManager _inst;
// 优量汇激励视频
private RewardVideoAD rewardVideoAD;
......@@ -30,17 +29,12 @@ public class YlhVideoAdManager extends BaseVideoAd {
private VideoAdStatusListener videoAdStatusListener;
private boolean isClickScreen = true; // 是否点击屏幕跳转广告
public static YlhVideoAdManager getInstance() {
if (_inst == null) {
_inst = new YlhVideoAdManager();
}
return _inst;
}
private Activity activity;
@Override
public void onDestroy() {
rewardVideoAD = null;
activity = null;
}
/**
......@@ -48,6 +42,7 @@ public class YlhVideoAdManager extends BaseVideoAd {
*/
@Override
public void loadAd(Activity activity, int curCoin, String carrierType, String extraId) {
this.activity = activity;
isClickScreen = true;
......
......@@ -96,6 +96,10 @@ public class AppConfig {
* gromore 剩余广告播放数
*/
public static int groMoreVideoAdCount = 0;
/**
* owVideo 剩余广告播放数
*/
public static int owVideoAdCount = 0;
/**
* 高额试玩任务标识
......@@ -158,4 +162,23 @@ public class AppConfig {
* 首页Banner展示金额
*/
public static String HOME_BANNER_SIGN_GIVECASH = "20";
/*
* 高额任务和超级翻倍 csjVideo 剩余广告播放数
*/
public static int csjHighVideoAdCount = 0;
/**
* 高额任务和超级翻倍 ylhVideo 剩余广告播放数
*/
public static int ylhHighVideoAdCount = 0;
/**
* 高额任务和超级翻倍 ksVideo 剩余广告播放数
*/
public static int ksHighVideoAdCount = 0;
/**
* 高额任务和超级翻倍 groVideo 剩余广告播放数
*/
public static int groHighVideoAdCount = 0;
}
......@@ -95,6 +95,7 @@ object Constant {
const val CARRIER_OFFLINE_DOUBLE = "OFFLINE_DOUBLE" //离线收益
const val CARRIER_CHALLENGE_CARD = "CHALLENGE_CARD" //刮刮乐
const val CARRIER_GAME = "GAME" //游戏
const val CARRIER_TURN_VEDIOCHALLENGE = "TURN_VEDIOCHALLENGE" //大转盘刮刮乐
const val CARRIER_HOMEWATER = "HOMEWATER" //喝水
const val CARRIER_WALK = "WALK" //走路
const val CARRIER_EATMEAL = "EATMEAL" // 打卡
......@@ -145,6 +146,8 @@ object Constant {
const val AD_SOURCE_CSJFULL = "CSJFULL"
const val AD_SOURCE_SH = "CORAL" //珊瑚天卓
const val AD_SOURCE_KS = "KS" //快手
const val AD_SOURCE_GROMORE = "GROMORE"
const val AD_SOURCE_OW = "OW" //OneWay
// 调用事件 0 成功 1失败 2点击 3-有效展示 4-去重
const val EVENT_TYPE_ZERO = "0"
......@@ -166,6 +169,8 @@ object Constant {
const val CSJ_FULL_AD = "CSJFULL_VEDIO_AD"
const val SH_VEDIO_AD = "SH_VEDIO_AD"
const val KS_VEDIO_AD = "KS_VEDIO_AD"
const val GROMORE_VEDIO_AD = "GROMORE_VEDIO_AD"
const val OW_VEDIO_AD = "OW_VEDIO_AD"
// 信息流广告类型
const val CSJ_EXPRESS_AD = "CSJ_EXPRESS_AD"
......
......@@ -8,6 +8,7 @@ import com.bytedance.sdk.openadsdk.AdSlot;
import com.bytedance.sdk.openadsdk.TTAdConstant;
import com.bytedance.sdk.openadsdk.TTAdManager;
import com.bytedance.sdk.openadsdk.TTAdNative;
import com.bytedance.sdk.openadsdk.TTAdSdk;
import com.bytedance.sdk.openadsdk.TTNativeExpressAd;
import com.mints.flowbox.MintsApplication;
import com.mints.flowbox.common.AppConfig;
......@@ -39,11 +40,11 @@ public class TTNativeExpressManager {
public TTAdNative initTTAd(boolean permission) {
Context context = MintsApplication.getContext();
//step1:初始化sdk
TTAdManager ttAdManager = TtCsjAdManager.get();
TTAdManager ttAdManager = TTAdSdk.getAdManager();
//step2:(可选,强烈建议在合适的时机调用):申请部分权限,如read_phone_state,防止获取不了imei时候,下载类广告没有填充的问题。
if (permission) {
TtCsjAdManager.get().requestPermissionIfNecessary(context);
}
// if (permission) {
// TtCsjAdManager.get().requestPermissionIfNecessary(context);
// }
//step3:创建TTAdNative对象,用于调用广告请求接口
mTTAdNative = ttAdManager.createAdNative(context);
return mTTAdNative;
......
......@@ -151,4 +151,16 @@ public class TrackManager {
trackPresenter.riskinfo();
}
}
public void reporGromeEcpm(HashMap<String, Object> vo) {
if (trackPresenter != null && !TextUtils.isEmpty(UserManager.getInstance().getUserID())) {
trackPresenter.reporGromeEcpm(vo);
}
}
public void reportGromoreAdClick(HashMap<String, Object> vo) {
if (trackPresenter != null && !TextUtils.isEmpty(UserManager.getInstance().getUserID())) {
trackPresenter.reportGromoreAdClick(vo);
}
}
}
......@@ -22,6 +22,7 @@ public class TtCsjAdManager {
/*开屏*/
public static String TT_AD_SPLASH_POSTID = "";// 开屏
public static String TT_AD_GRO_SPLASH = "887497100";// gro兜底开屏
/*banner*/
public static String TT_AD_BANNER_MY = "946261735";// 个人中心
......@@ -46,7 +47,7 @@ public class TtCsjAdManager {
public static String TT_AD_FULLVEDIO_ALL = "946261704";// 通用
/*信息流*/
public static String TT_AD_NATIVEEXPRESS_XMLY = "946261714";//喜马拉雅信息流
public static String TT_AD_NATIVEEXPRESS_AWARD = "";//信息流弹窗
public static String TT_AD_NATIVEEXPRESS_AWARD = "946261720";//信息流弹窗
public static String TT_AD_NATIVEEXPRESS_WALK = "946261720";//走路
public static String TT_AD_NATIVEEXPRESS_WATER = "946261720";//喝水
public static String TT_AD_NATIVEEXPRESS_MORNINGCLOCK = "946261720";//早上打卡
......
package com.mints.flowbox.manager
import com.umeng.analytics.MobclickAgent
import com.umeng.commonsdk.UMConfigure
import com.mints.flowbox.BuildConfig
import com.mints.flowbox.MintsApplication
import com.mints.library.utils.CommonUtils
object UmengManager {
fun preInit(){
UMConfigure.preInit(MintsApplication.getContext(), CommonUtils.getAppMetaData(MintsApplication.getContext(), "UMENG_KEY"),
CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME"))
}
/**
* 友盟初始化
*/
fun initUm() {
try {
/*
* 参数4:设备类型,必须参数,传参数为UMConfigure.DEVICE_TYPE_PHONE则表示手机;传参数为UMConfigure.DEVICE_TYPE_BOX则表示盒子;默认为手机。
* 参数5:Push推送业务的secret,需要集成Push功能时必须传入Push的secret,否则传空。
*/
UMConfigure.init(
MintsApplication.getContext(),
CommonUtils.getAppMetaData(MintsApplication.getContext(), "UMENG_KEY"),
CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME"),
UMConfigure.DEVICE_TYPE_PHONE,
""
)
UMConfigure.setLogEnabled(BuildConfig.DEBUG)
MobclickAgent.setPageCollectionMode(MobclickAgent.PageMode.LEGACY_MANUAL)
} catch (e: java.lang.Exception) {
e.printStackTrace()
}
}
}
\ No newline at end of file
......@@ -19,44 +19,53 @@ object UserWeight {
fun initAdWeight(data: UserTaskMsgBean) {
AppConfig.isVideoSleep = data.vedioRules.isVedioSleep
videoAdingManager.run {
initAdWeight(
data.vedioRules.csJ_VEDIO.rate,
var groMoreRate = 0
var groMoreCount = 0
if (data.vedioRules.gromorE_VEDIO != null) {
groMoreRate = data.vedioRules.gromorE_VEDIO.rate
groMoreCount = data.vedioRules.gromorE_VEDIO.surplus
}
videoAdingManager.initAdWeight(data.vedioRules.csJ_VEDIO.rate,
data.vedioRules.ylH_VEDIO.rate,
data.vedioRules.sdhZ_VEDIO.rate,
data.vedioRules.fL_VEDIO.rate,
data.vedioRules.corAl_VIDEO.rate,
0,
0,
data.vedioRules.csjfulL_VEDIO.rate,
data.vedioRules.kS_VEDIO.rate
data.vedioRules.kS_VEDIO.rate,
groMoreRate,
data.vedioRules.oW_VEDIO.rate
)
}
LogUtil.d(
TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} " +
LogUtil.d(TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} " +
"ylhWeight:${data.vedioRules.ylH_VEDIO.rate} " +
"sdhzWeight:${data.vedioRules.sdhZ_VEDIO.rate} " +
"csjFullWeight:${data.vedioRules.csjfulL_VEDIO.rate} " +
"shWeight:${data.vedioRules.corAl_VIDEO.rate} " +
"flWeight:${data.vedioRules.fL_VEDIO.rate} " +
"ksWeight:${data.vedioRules.kS_VEDIO.rate} "
"shWeight:${0} " +
"flWeight:${0} " +
"groMoreWeight:${groMoreRate} " +
"owWeight:${data.vedioRules.oW_VEDIO.rate} " +
"ksWeight:${data.vedioRules.kS_VEDIO.rate}"
)
// 广告视频数
AppConfig.csjVideoAdCount = data.vedioRules.csJ_VEDIO.surplus
AppConfig.ylhAdCount = data.vedioRules.ylH_VEDIO.surplus
AppConfig.wnVideoAdCount = data.vedioRules.sdhZ_VEDIO.surplus
AppConfig.flVideoAdCount = data.vedioRules.fL_VEDIO.surplus
AppConfig.csjFullVedioAdCount = data.vedioRules.csjfulL_VEDIO.surplus
AppConfig.shVideoAdCount = data.vedioRules.corAl_VIDEO.surplus
AppConfig.flVideoAdCount = 0
AppConfig.shVideoAdCount = 0
AppConfig.ksVideoAdCount = data.vedioRules.kS_VEDIO.surplus
LogUtil.d(
TAG, "首页视频数:csjCount:${AppConfig.csjVideoAdCount} " +
AppConfig.owVideoAdCount = data.vedioRules.oW_VEDIO.surplus
AppConfig.csjFullVedioAdCount = data.vedioRules.csjfulL_VEDIO.surplus
AppConfig.groMoreVideoAdCount = groMoreCount
LogUtil.d(TAG, "首页视频数:csjCount:${AppConfig.csjVideoAdCount} " +
"ylhCount:${AppConfig.ylhAdCount} " +
"sdhzCount:${AppConfig.wnVideoAdCount} " +
"csjFullCount:${AppConfig.csjFullVedioAdCount} " +
"shCount:${AppConfig.shVideoAdCount} " +
"flCount:${AppConfig.flVideoAdCount} " +
"ksCount:${AppConfig.ksVideoAdCount} "
"shCount:${0} " +
"flCount:${0} " +
"groMoreCount:${AppConfig.groMoreVideoAdCount} " +
"owCount:${AppConfig.owVideoAdCount} " +
"ksCount:${AppConfig.ksVideoAdCount}"
)
}
}
\ No newline at end of file
......@@ -23,7 +23,7 @@ import java.util.Map;
*/
public class TTGroMoreAdManagerHolder {
public static final String TT_AD_APPID = "5174315";
public static final String TT_AD_APPID = "5182992";
public static final String TT_AD_NAME = Constant.MINTS_APP_NAME;
private static boolean sInit;
......
package com.mints.flowbox.mvp.model;
import java.io.Serializable;
public class CoinMsgBean implements Serializable {
private int highCoin;
private int gromoreCoin;
private int coin;
private boolean showHigh;
private boolean riskinfoRate;
public int getHighCoin() {
return highCoin;
}
public int getGromoreCoin() {
return gromoreCoin;
}
public int getCoin() {
return coin;
}
public boolean isShowHigh() {
return showHigh;
}
public boolean isRiskinfoRate() {
return riskinfoRate;
}
}
......@@ -19,6 +19,7 @@ public class DrawcashBean implements Serializable {
private boolean openJDCash = true;
private String JDUrl = null;
public String getJDUrl() {
return JDUrl;
}
......@@ -86,20 +87,23 @@ public class DrawcashBean implements Serializable {
private int YLH_VEDIO;
private int FL_VEDIO;
private int CORAL_VEDIO;
private int KS_VEDIO;
private int RTA_VEDIO;
private int GROMORE_VEDIO;
private int OW_VEDIO;
public int getKS_VEDIO() {
return KS_VEDIO;
public int getRTA_VEDIO() {
return RTA_VEDIO;
}
public void setKS_VEDIO(int KS_VEDIO) {
this.KS_VEDIO = KS_VEDIO;
public void setRTA_VEDIO(int RTA_VEDIO) {
this.RTA_VEDIO = RTA_VEDIO;
}
private int KS_VEDIO;
public int getCORAL_VEDIO() {
return CORAL_VEDIO;
}
public int getSDHZ_VEDIO() {
return SDHZ_VEDIO;
}
......@@ -119,6 +123,17 @@ public class DrawcashBean implements Serializable {
public int getFL_VEDIO() {
return FL_VEDIO;
}
public int getKS_VEDIO() {
return KS_VEDIO;
}
public int getGROMORE_VEDIO() {
return GROMORE_VEDIO;
}
public int getOW_VEDIO() {
return OW_VEDIO;
}
}
public class CashOutMoneyArrBean implements Serializable {
......
......@@ -12,6 +12,8 @@ public class UserTaskMsgBean implements Serializable {
private UserRiskAppsBean userRiskApps;
private AdcodeBean adcode_v1 = null;
private FlowAdRulesBean flowAdRules;
private GroAdcodeBean gromoreAdcodes = null;
private HighRatePlanBean highRatePlan;
private String ip;
......@@ -30,6 +32,16 @@ public class UserTaskMsgBean implements Serializable {
private boolean needReportClickAdEvent;
public boolean isShowWechatTips() {
return showWechatTips;
}
public void setShowWechatTips(boolean showWechatTips) {
this.showWechatTips = showWechatTips;
}
private boolean showWechatTips;
public boolean isNeedReportClickAdEvent() {
return needReportClickAdEvent;
}
......@@ -136,4 +148,39 @@ public class UserTaskMsgBean implements Serializable {
public FlowAdRulesBean getFlowAdRules() {
return flowAdRules;
}
public HighRatePlanBean getHighRatePlan() {
return highRatePlan;
}
public void setHighRatePlan(HighRatePlanBean highRatePlan) {
this.highRatePlan = highRatePlan;
}
public static class HighRatePlanBean implements Serializable {
private int YLH;
private int KS;
private int CSJ;
private int GROMORE;
public int getYLH() {
return YLH;
}
public int getKS() {
return KS;
}
public int getCSJ() {
return CSJ;
}
public int getGROMORE() {
return GROMORE;
}
}
public GroAdcodeBean getGromoreAdcodes() {
return gromoreAdcodes;
}
}
......@@ -10,19 +10,14 @@ public class VedioRulesBean implements Serializable {
private FLVedioBean FL_VEDIO;
private CsjfullVedioBean CSJFULL_VEDIO;
private CORALVedioBean CORAL_VEDIO;
public KsVedioBean getKS_VEDIO() {
return KS_VEDIO;
}
public void setKS_VEDIO(KsVedioBean KS_VEDIO) {
this.KS_VEDIO = KS_VEDIO;
}
private KsVedioBean KS_VEDIO;
private KSVedioBean KS_VEDIO;
private RTAVedioBean RTA_VEDIO;
private GROMOREVedioBean GROMORE_VEDIO;
private OWVedioBean OW_VEDIO;
private boolean flVideoFlag;
private boolean vedioSleep;
public class CsjVedioBean implements Serializable {
private int surplus;//剩余可看视频数
private int rate;//权重
......@@ -88,6 +83,32 @@ public class VedioRulesBean implements Serializable {
}
}
public class KSVedioBean implements Serializable {
private int surplus;
private int rate;
public int getSurplus() {
return surplus;
}
public int getRate() {
return rate;
}
}
public class RTAVedioBean implements Serializable {
private int surplus;
private int rate;
public int getSurplus() {
return surplus;
}
public int getRate() {
return rate;
}
}
public class CsjfullVedioBean implements Serializable {
private int surplus;
private int rate;
......@@ -102,7 +123,7 @@ public class VedioRulesBean implements Serializable {
}
public class KsVedioBean implements Serializable {
public class GROMOREVedioBean implements Serializable {
private int surplus;
private int rate;
......@@ -136,6 +157,38 @@ public class VedioRulesBean implements Serializable {
return CORAL_VEDIO;
}
public RTAVedioBean getRTA_VEDIO() {
return RTA_VEDIO;
}
public GROMOREVedioBean getGROMORE_VEDIO() {
return GROMORE_VEDIO;
}
public OWVedioBean getOW_VEDIO() {
return OW_VEDIO;
}
public class OWVedioBean implements Serializable {
private int surplus;
private int rate;
public int getSurplus() {
return surplus;
}
public int getRate() {
return rate;
}
}
public void setRTA_VEDIO(RTAVedioBean RTA_VEDIO) {
this.RTA_VEDIO = RTA_VEDIO;
}
public KSVedioBean getKS_VEDIO() {
return KS_VEDIO;
}
public CsjfullVedioBean getCSJFULL_VEDIO() {
return CSJFULL_VEDIO;
}
......
......@@ -10,6 +10,7 @@ import com.mints.flowbox.common.DeviceInfo;
import com.mints.flowbox.manager.AppHttpManager;
import com.mints.flowbox.manager.ShumeiManager;
import com.mints.flowbox.mvp.model.BaseResponse;
import com.mints.flowbox.mvp.model.CoinMsgBean;
import com.mints.flowbox.mvp.model.UserBean;
import com.mints.flowbox.mvp.views.AwardView;
import com.mints.flowbox.utils.DeviceUuidFactory;
......@@ -25,7 +26,7 @@ public class AwardPresenter extends BasePresenter<AwardView> {
public void getCoinMsg() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.getCoinMsg(),
new BaseSubscriber<BaseResponse<JsonObject>>() {
new BaseSubscriber<BaseResponse<CoinMsgBean>>() {
@Override
public void onCompleted() {
if (isLinkView()) return;
......@@ -42,32 +43,16 @@ public class AwardPresenter extends BasePresenter<AwardView> {
}
@Override
public void onNext(BaseResponse<JsonObject> baseResponse) {
public void onNext(BaseResponse<CoinMsgBean> baseResponse) {
if (isLinkView()) return;
int code = baseResponse.getStatus();
String message = baseResponse.getMessage();
switch (code) {
case 200://成功
JsonObject data = baseResponse.getData();
CoinMsgBean data = baseResponse.getData();
if (data != null) {
boolean riskFlag = false;
JsonElement riskinfoRateElement = data.get("riskinfoRate");
if (riskinfoRateElement != null) {
riskFlag = data.get("riskinfoRate").getAsBoolean();
}
boolean showHigh = false;
JsonElement showHighElement = data.get("showHigh");
if (showHighElement != null) {
showHigh = data.get("showHigh").getAsBoolean();
}
int highCoin = 3000;
JsonElement highCoinElement = data.get("highCoin");
if (highCoinElement != null) {
highCoin = data.get("highCoin").getAsInt();
}
view.getUserTaskMsgSuc(data.get("coin").getAsInt(), riskFlag, showHigh, highCoin);
view.getUserTaskMsgSuc(data);
}
break;
default:
......
......@@ -128,8 +128,8 @@ class HomePresenter : BasePresenter<HomeView>() {
when (baseResponse.status) {
200 -> {
val codeBean = baseResponse.data
CsjCode.initListCode(codeBean.csjArr)
YlhCode.initListCode(codeBean.ylhArr)
// CsjCode.initListCode(codeBean.csjArr)
// YlhCode.initListCode(codeBean.ylhArr)
}
}
}
......
......@@ -68,6 +68,35 @@ public class TrackPresenter extends BaseTrackPresenter {
});
}
public void reporGromeEcpm(HashMap<String, Object> vo) {
AppHttpManager.getInstance(loanApplication)
.call(loanService.reporGromeEcpm(vo),
new BaseSubscriber<BaseResponse<JsonObject>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(BaseResponse<JsonObject> baseResponse) {
try {
if (baseResponse.getStatus() == 200) {
JsonObject data = baseResponse.getData();
if (data != null) {
AppConfig.gromoreId = data.get("ecpmId").getAsString();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* 离线收益
*/
......
......@@ -9,10 +9,7 @@ import com.mints.flowbox.common.DeviceInfo
import com.mints.flowbox.manager.AppHttpManager
import com.mints.flowbox.manager.ShumeiManager
import com.mints.flowbox.manager.UserManager
import com.mints.flowbox.mvp.model.BaseResponse
import com.mints.flowbox.mvp.model.ClickTurnBean
import com.mints.flowbox.mvp.model.TurnBean
import com.mints.flowbox.mvp.model.UserBean
import com.mints.flowbox.mvp.model.*
import com.mints.flowbox.mvp.views.TurnTableView
import com.mints.flowbox.utils.DeviceUuidFactory
import com.mints.library.net.neterror.BaseSubscriber
......@@ -22,6 +19,7 @@ import java.util.*
class TurnTablePresenter : BasePresenter<TurnTableView>() {
fun getTurnMsg() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.getTurnMsg(),
......@@ -93,10 +91,8 @@ class TurnTablePresenter : BasePresenter<TurnTableView>() {
200 -> {
val data = baseResponse.data
if (data.get("list") != null) {
val listArray = Gson().fromJson(
data.get("list"),
object : TypeToken<ArrayList<String>>() {}.type
) as ArrayList<String>
val listArray = Gson().fromJson(data.get("list"),
object : TypeToken<ArrayList<String>>() {}.type) as ArrayList<String>
view.cashoutLeadersSuc(listArray)
}
}
......@@ -107,14 +103,18 @@ class TurnTablePresenter : BasePresenter<TurnTableView>() {
}
fun clickForTurn() {
view.showLoading("加载中...")
AppHttpManager.getInstance(loanApplication)
.call(loanService.clickForTurn(),
object : BaseSubscriber<BaseResponse<ClickTurnBean>>() {
override fun onCompleted() {
if (isLinkView) return
view.hideLoading()
}
override fun onError(e: Throwable) {
if (isLinkView) return
view.hideLoading()
view.showToast(e.message)
view.clickForTurnFail()
}
......@@ -127,84 +127,9 @@ class TurnTablePresenter : BasePresenter<TurnTableView>() {
200 -> {
view.clickForTurnSuc(baseResponse.data)
}
else -> view.showToast(message)
}
}
})
}
/**
* 游客登录
*/
fun userLogin() {
val vo = HashMap<String, Any>()
vo["device"] = DeviceUuidFactory().deviceUuid.toString()
vo["shumeiId"] = ShumeiManager.getInstance().shumeiDeviceId
AppHttpManager.getInstance(loanApplication)
.call(loanService.visitorlogin(vo),
object : BaseSubscriber<BaseResponse<UserBean>>() {
override fun onCompleted() {
}
override fun onError(e: Throwable) {
}
override fun onNext(baseResponse: BaseResponse<UserBean>) {
if (isLinkView) return
val code = baseResponse.getStatus()
val message = baseResponse.getMessage()
val data: UserBean? = baseResponse.getData()
when (code) {
200 -> if (data != null) {
UserManager.getInstance().saveUserInfo(data)
saveTerminalInfo()
}
else -> view.showToast(message)
}
}
})
}
/**
* 提交设备信息
*
* @param context
*/
fun saveTerminalInfo() {
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
if (!TextUtils.isEmpty(MintsApplication.OAID)) {
vo["oaid"] = MintsApplication.OAID
}
vo["os"] = "android"
vo["model"] = deviceInfo.newModel
vo["uuid"] = DeviceUuidFactory().deviceUuid
vo["osversion"] = deviceInfo.oSVersion
vo["appversion"] = deviceInfo.versionName
vo["shumeiId"] = ShumeiManager.getInstance().getShumeiDeviceId()
AppHttpManager.getInstance(loanApplication)
.call(loanService.saveTerminalInfo(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 = baseResponse.status
when (code) {
200 -> {
getTurnMsg()
else ->{
view.showToast(message)
view.clickForTurnFail()
}
}
}
......@@ -231,11 +156,14 @@ class TurnTablePresenter : BasePresenter<TurnTableView>() {
.call(
loanService.setStatusInOneDayByCarrierType(vo),
object : BaseSubscriber<BaseResponse<Any>>() {
override fun onCompleted() {}
override fun onCompleted() {
}
override fun onNext(baseResponse: BaseResponse<Any>) {}
override fun onError(e: Throwable) {
}
override fun onError(e: Throwable?) {}
override fun onNext(baseResponse: BaseResponse<Any>) {
}
})
}
}
\ No newline at end of file
package com.mints.flowbox.mvp.views
import com.mints.flowbox.mvp.model.CoinMsgBean
interface AwardView : BaseView {
/**
* 获取用户配置信息成功
*/
fun getUserTaskMsgSuc(coin: Int, riskFlag: Boolean, showHigh: Boolean, highCoin: Int)
fun getUserTaskMsgSuc(data: CoinMsgBean)
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.mints.flowbox.mvp.views
import com.mints.flowbox.mvp.model.ClickTurnBean
import com.mints.flowbox.mvp.model.TurnBean
import com.mints.flowbox.mvp.model.UserTaskMsgBean
interface TurnTableView : BaseView {
fun getTurnTableSuc(data: TurnBean)
......
......@@ -9,6 +9,7 @@ import com.mints.flowbox.mvp.model.BaseResponse;
import com.mints.flowbox.mvp.model.CashoutChallengeBean;
import com.mints.flowbox.mvp.model.ClickTurnBean;
import com.mints.flowbox.mvp.model.CodeBean;
import com.mints.flowbox.mvp.model.CoinMsgBean;
import com.mints.flowbox.mvp.model.CommonParamBean;
import com.mints.flowbox.mvp.model.CpdBean;
import com.mints.flowbox.mvp.model.DrawcashBean;
......@@ -138,7 +139,7 @@ public interface LoanService {
* 获取用户配置信息
*/
@POST("api/getCoinMsg")
Observable<BaseResponse<JsonObject>> getCoinMsg();
Observable<BaseResponse<CoinMsgBean>> getCoinMsg();
/**
* 调用事件
......@@ -383,13 +384,13 @@ public interface LoanService {
/**
* 获取大转盘信息
*/
@POST("api/turn/getTurnMsg")
@POST("api/turnWithGrome/getTurnMsg")
Observable<BaseResponse<TurnBean>> getTurnMsg();
/**
* 点击获取转盘信息
*/
@POST("api/turn/clickForTurn")
@POST("api/turnWithGrome/clickForTurn")
Observable<BaseResponse<ClickTurnBean>> clickForTurn();
/**
......
......@@ -269,23 +269,18 @@ class DrawcashActivity : BaseActivity(),
* 设置视频权重
*/
private fun initAdWeight(data: DrawcashBean.VedioRules) {
vedioAdingManager.initAdWeight(
data.csJ_VEDIO,
data.ylH_VEDIO,
data.sdhZ_VEDIO,
data.fL_VEDIO,
data.coraL_VEDIO,
data.csjfulL_VEDIO,
data.kS_VEDIO
vedioAdingManager.initAdWeight(data.csJ_VEDIO,data.ylH_VEDIO,data.sdhZ_VEDIO,
0,0,data.csjfulL_VEDIO,data.kS_VEDIO,data.gromorE_VEDIO,data.oW_VEDIO
)
LogUtil.d(
TAG, "提现权重值:csjWeight:${data.csJ_VEDIO} " +
LogUtil.d(TAG, "提现权重值:csjWeight:${data.csJ_VEDIO} " +
"ylhWeight:${data.ylH_VEDIO} " +
"sdhzWeight:${data.sdhZ_VEDIO} " +
"csjFullWeight:${data.csjfulL_VEDIO} " +
"shWeight:${data.coraL_VEDIO} " +
"flWeight:${data.fL_VEDIO} " +
"ksWeight:${data.kS_VEDIO} "
"shWeight:${0} " +
"flWeight:${0} " +
"groMoreWeight:${data.gromorE_VEDIO} " +
"owWeight:${data.oW_VEDIO} " +
"ksWeight:${data.kS_VEDIO}"
)
// 广告视频数
AppConfig.csjVideoAdCount = 5
......
......@@ -3,6 +3,7 @@ package com.mints.flowbox.ui.activitys
import android.os.Bundle
import android.view.View
import com.mints.flowbox.R
import com.mints.flowbox.ad.express.ExpressManager
import com.mints.flowbox.common.Constant
import com.mints.flowbox.ad.express.TTPreLoadCarrierExpressManager
import com.mints.flowbox.manager.TtCsjAdManager
......@@ -88,7 +89,7 @@ class FoodSubsidyActivity : BaseActivity(), View.OnClickListener, FoodSubsidyVie
}
// 预加载信息流
TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_EAT)
ExpressManager.loadExpress()
}
......@@ -97,11 +98,9 @@ class FoodSubsidyActivity : BaseActivity(), View.OnClickListener, FoodSubsidyVie
*/
private fun initExpress() {
try {
if (TTPreLoadCarrierExpressManager.getInstance().ttFrameLayout != null) {
if (flSubsidykAd != null) {
flSubsidykAd.removeAllViews()
flSubsidykAd.addView(TTPreLoadCarrierExpressManager.getInstance().ttFrameLayout)
}
flSubsidykAd.addView(ExpressManager.getExpressFrameLayout())
}
} catch (e: Exception) {
e.printStackTrace()
......
......@@ -9,6 +9,7 @@ import androidx.viewpager.widget.ViewPager.OnPageChangeListener
import com.mints.flowbox.MintsApplication
import com.mints.flowbox.R
import com.mints.flowbox.common.Constant
import com.mints.flowbox.manager.AppPreferencesManager
import com.mints.flowbox.manager.UserManager
import com.mints.flowbox.ui.activitys.base.BaseActivity
import com.mints.flowbox.ui.adapter.ViewPagerAdapter
......@@ -41,9 +42,8 @@ class GuideActivity : BaseActivity() {
}
private fun readyGoMain() {
val instance = AppPreferences(MintsApplication.getContext())
val customVersion: Int = instance.getInt(Constant.CUSTOM_VERSION, 0)
instance.put(Constant.ISFIRSTENTER + customVersion, false)
val customVersion: Int = AppPreferencesManager.get().getInt(Constant.CUSTOM_VERSION, 0)
AppPreferencesManager.get().put(Constant.ISFIRSTENTER + customVersion, false)
val channel = CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME")
if (TextUtils.equals(channel, Constant.CHANNEL_SHARE) && !UserManager.getInstance().userIsLogin()) {
......
package com.mints.flowbox.ui.activitys
import android.os.Bundle
import android.view.KeyEvent
import android.view.View
import android.view.ViewGroup
import android.webkit.WebChromeClient
import com.github.lzyzsd.jsbridge.CallBackFunction
import com.github.lzyzsd.jsbridge.DefaultHandler
import com.mints.flowbox.BuildConfig
import com.mints.flowbox.R
import com.mints.flowbox.common.Constant
import com.mints.flowbox.manager.UserManager
import com.mints.flowbox.mvp.model.TurntableBean
import com.mints.flowbox.ui.activitys.base.BaseActivity
import com.mints.flowbox.utils.LogUtil
import com.mints.library.utils.json.JsonUtil
import kotlinx.android.synthetic.main.activity_erase.*
import kotlinx.android.synthetic.main.activity_erase_redbox.*
import kotlinx.android.synthetic.main.header_layout.*
/**
* 描述:红包刮刮乐
* 作者:孟崔广
* 时间:2021/6/10 15:48
* 邮箱:mengcga@163.com
*/
class RedboxEraseActivity : BaseActivity(), View.OnClickListener {
private val userManager by lazy { UserManager.getInstance() }
private val carrierType = Constant.CARRIER_TURN_VEDIOCHALLENGE
override fun getContentViewLayoutID() = R.layout.activity_erase_redbox
override fun isApplyKitKatTranslucency() = false
override fun initViewsAndEvents() {
tv_title.text = "现金刮刮乐"
iv_left_icon.visibility = View.VISIBLE
iv_left_icon.setImageResource(R.mipmap.ic_arrow_back)
initListener()
loadTurnUrl()
}
private fun initListener() {
iv_left_icon.setOnClickListener(this)
}
override fun onDestroy() {
super.onDestroy()
if (blEarseRedWebview != null) {
val parent = blEarseRedWebview.parent as ViewGroup
parent.removeView(blEarseRedWebview)
blEarseRedWebview.removeAllViews()
blEarseRedWebview.destroy()
}
}
override fun onClick(v: View) {
when (v.id) {
R.id.iv_left_icon -> {
finish()
}
}
}
/**
* 加载转盘url
*/
private fun loadTurnUrl() {
getTurnUrl()
blEarseRedWebview.setDefaultHandler(DefaultHandler())
blEarseRedWebview.webChromeClient = WebChromeClient()
blEarseRedWebview.setOnLongClickListener { true }
blEarseRedWebview.registerHandler("getEraseResult") { data, _ ->
if (!isFinishing) {
val turntableBean: TurntableBean = JsonUtil.parseJson(data, TurntableBean::class.java)
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, turntableBean.coin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, carrierType)
readyGoThenKill(AwardActivity::class.java, bundle)
}
}
blEarseRedWebview.setDefaultHandler(object : DefaultHandler() {
override fun handler(data: String, function: CallBackFunction) {
showToast(data)
}
})
}
/**
* 获取url
*/
private fun getTurnUrl() {
val tokenID: String = userManager.tokenID
val url: String = BuildConfig.MainIp + "hang/tcard.html?carrierType=" + carrierType + "&token=" + tokenID
LogUtil.d("getTurnUrl", url)
blEarseRedWebview.loadUrl(url)
}
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ import android.view.animation.AnimationSet
import com.mints.flowbox.R
import com.mints.flowbox.common.Constant
import com.mints.flowbox.common.DeviceInfo
import com.mints.flowbox.manager.AppPreferencesManager
import com.mints.flowbox.ui.activitys.base.BaseActivity
import kotlinx.android.synthetic.main.activity_splash.*
import net.grandcentrix.tray.AppPreferences
......@@ -18,7 +19,6 @@ class SplashActivity : BaseActivity() {
private val mAlph by lazy { AlphaAnimation(1f, 1f) }
private val animationSet by lazy { AnimationSet(true) }
private val ps by lazy { AppPreferences(context) }
override fun isApplyKitKatTranslucency() = false
......@@ -90,8 +90,8 @@ class SplashActivity : BaseActivity() {
}
private fun readyGoOtherActivity() {
val customVersion: Int = ps.getInt(Constant.CUSTOM_VERSION, 0)
val isFirstEnter: Boolean = ps.getBoolean(Constant.ISFIRSTENTER + customVersion, true)
val customVersion: Int = AppPreferencesManager.get().getInt(Constant.CUSTOM_VERSION, 0)
val isFirstEnter: Boolean = AppPreferencesManager.get().getBoolean(Constant.ISFIRSTENTER + customVersion, true)
if (isFirstEnter) {
readyGoThenKill(GuideActivity::class.java)
} else {
......
package com.mints.flowbox.ui.activitys;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.widget.FrameLayout;
import com.bytedance.msdk.adapter.pangle.PangleNetworkRequestInfo;
import com.bytedance.msdk.api.AdError;
import com.bytedance.msdk.api.AdSlot;
import com.bytedance.msdk.api.NetworkPlatformConst;
import com.bytedance.msdk.api.TTNetworkRequestInfo;
import com.bytedance.msdk.api.splash.TTSplashAd;
import com.bytedance.msdk.api.splash.TTSplashAdListener;
import com.bytedance.msdk.api.splash.TTSplashAdLoadCallback;
import com.mints.flowbox.MintsApplication;
import com.mints.flowbox.R;
import com.mints.flowbox.common.Constant;
import com.mints.flowbox.common.DeviceInfo;
import com.mints.flowbox.manager.AppPreferencesManager;
import com.mints.flowbox.manager.CsjGroMoreManager;
import com.mints.flowbox.manager.TrackManager;
import com.mints.flowbox.manager.TtCsjAdManager;
import com.mints.flowbox.manager.UserManager;
import com.mints.flowbox.ui.activitys.base.BaseActivity;
import com.mints.flowbox.utils.LogUtil;
import com.mints.library.utils.CommonUtils;
import java.util.HashMap;
/**
* GroMore开屏广告Activity示例
*/
public class SplashGroMoreActivity extends BaseActivity {
private static final String TAG = "SplashGroMoreActivity";
private TTSplashAd mTTSplashAd;
private FrameLayout mSplashContainer;
//是否强制跳转到主页面
private boolean mForceGoMain;
//开屏广告加载超时时间,建议大于1000,这里为了冷启动第一次加载到广告并且展示,示例设置了2000ms
private static final int AD_TIME_OUT = 4000;
private static final int MSG_GO_MAIN = 1;
//开屏广告是否已经加载
private boolean mHasLoaded;
// 百度开屏广告点击跳转落地页后倒计时不暂停,即使在看落地页,倒计时结束后仍然会强制跳转,需要特殊处理:
// 检测到广告被点击,且走了activity的onPaused证明跳转到了落地页,这时候onAdDismiss回调中不进行跳转,而是在activity的onResume中跳转。
private boolean isBaiduSplashAd = false;
private boolean baiduSplashAdClicked = false;
private boolean onPaused = false;
@Override
protected int getContentViewLayoutID() {
return R.layout.activity_splash_gromore;
}
@Override
protected void initViewsAndEvents() {
if (!isTaskRoot()) {
//点击Home键后再点击App图标,会回到原来的界面。今天重新打包后,但是在Debug模式下,一切正常,
// 但是把打完包的apk(Release)安装在其他手机上时,回到桌面后点击图标会重新打开启动页
finish();
return;
}
TrackManager.getInstance().getCommonHallBaseMsg();
TrackManager.getInstance().firstApiWithUid();
// 校验APP签名
checkAppSign();
}
/**
* 加载开屏广告
*/
private void loadSplashAd() {
/**
* 注:每次加载开屏广告的时候需要新建一个TTSplashAd,否则可能会出现广告填充问题
* ( 例如:mTTSplashAd = new TTSplashAd(this, mAdUnitId);)
*/
mTTSplashAd = new TTSplashAd(this, CsjGroMoreManager.INSTANCE.getAD_UNIT_SPLASH_ID());
mTTSplashAd.setTTAdSplashListener(mSplashAdListener);
//step3:创建开屏广告请求参数AdSlot,具体参数含义参考文档
AdSlot adSlot = new AdSlot.Builder()
.setImageAdSize(1080, 1920) // 既适用于原生类型,也适用于模版类型。
.build();
//自定义兜底方案 选择使用
TTNetworkRequestInfo ttNetworkRequestInfo;
//穿山甲兜底
ttNetworkRequestInfo = new PangleNetworkRequestInfo(TtCsjAdManager.TT_AD_APPID, TtCsjAdManager.TT_AD_GRO_SPLASH);
//gdt兜底
// ttNetworkRequestInfo = new GdtNetworkRequestInfo(YlhAdManager.YLH_AD_APPID, "2001697222975737");
//ks兜底
// ttNetworkRequestInfo = new KsNetworkRequestInfo("90009", "4000000042");
//百度兜底
// ttNetworkRequestInfo = new BaiduNetworkRequestInfo("e866cfb0", "2058622");
//step4:请求广告,调用开屏广告异步请求接口,对请求回调的广告作渲染处理
mTTSplashAd.loadAd(adSlot, ttNetworkRequestInfo, new TTSplashAdLoadCallback() {
// mTTSplashAd.loadAd(adSlot, new TTSplashAdLoadCallback() {
@Override
public void onSplashAdLoadFail(AdError adError) {
LogUtil.d(TAG, adError.message);
mHasLoaded = true;
LogUtil.d(TAG, "load splash ad error : " + adError.code + ", " + adError.message);
// 获取本次waterfall加载中,加载失败的adn错误信息。
if (mTTSplashAd != null)
LogUtil.d(TAG, "ad load infos: " + mTTSplashAd.getAdLoadInfoList());
goToMainActivity();
}
@Override
public void onSplashAdLoadSuccess() {
if (mTTSplashAd != null) {
mTTSplashAd.showAd(mSplashContainer);
isBaiduSplashAd = mTTSplashAd.getAdNetworkPlatformId() == NetworkPlatformConst.SDK_NAME_BAIDU;
// 获取本次waterfall加载中,加载失败的adn错误信息。
HashMap<String, Object> vo = new HashMap<>();
vo.put("adcode", mTTSplashAd.getAdNetworkRitId());
vo.put("ecpm", mTTSplashAd.getPreEcpm());
vo.put("adSource", mTTSplashAd.getAdNetworkPlatformId());
vo.put("adType", Constant.GRO_MORE_ADTYPE0);
vo.put("adid", CsjGroMoreManager.INSTANCE.getAD_UNIT_SPLASH_ID());
TrackManager.getInstance().cmtGroMoreInfo(vo);
}
LogUtil.d(TAG, "load splash ad success ");
}
@Override
public void onAdLoadTimeout() {
mHasLoaded = true;
Log.i(TAG, "开屏广告加载超时.......");
// 获取本次waterfall加载中,加载失败的adn错误信息。
if (mTTSplashAd != null)
LogUtil.d(TAG, "ad load infos: " + mTTSplashAd.getAdLoadInfoList());
goToMainActivity();
}
}, AD_TIME_OUT);
}
TTSplashAdListener mSplashAdListener = new TTSplashAdListener() {
@Override
public void onAdClicked() {
baiduSplashAdClicked = true;
LogUtil.d(TAG, "onAdClicked");
}
@Override
public void onAdShow() {
LogUtil.d(TAG, "onAdShow");
}
@Override
public void onAdSkip() {
LogUtil.d(TAG, "onAdSkip");
goToMainActivity();
}
@Override
public void onAdDismiss() {
LogUtil.d(TAG, "onAdDismiss");
if (isBaiduSplashAd && onPaused && baiduSplashAdClicked) {
// 这种情况下,百度开屏广告不能在onAdDismiss中跳转,需要在onResume中跳转主页。
return;
}
goToMainActivity();
}
};
@Override
protected void onResume() {
//判断是否该跳转到主页面
if (mForceGoMain) {
goToMainActivity();
}
if (isBaiduSplashAd && onPaused && baiduSplashAdClicked) {
// 这种情况下,百度开屏广告不能在onAdDismiss中跳转,需要自己在onResume中跳转主页。
goToMainActivity();
}
super.onResume();
}
@Override
protected void onPause() {
super.onPause();
onPaused = true;
}
@Override
protected void onStop() {
super.onStop();
mForceGoMain = true;
}
@Override
protected void onDestroy() {
super.onDestroy();
if (mTTSplashAd != null) {
mTTSplashAd.destroy();
}
}
/**
* 校验App签名
*/
private void checkAppSign() {
DeviceInfo deviceInfo = DeviceInfo.Companion.getInstance();
if (!deviceInfo.getSignInfo()) {
getBaseApplication().exitApp();
} else {
// YLLittleVideoFragment.preloadVideo();
try {
mSplashContainer = findViewById(R.id.splash_container);
//加载开屏广告
loadSplashAd();
} catch (Exception e) {
goToMainActivity();
}
}
}
@Override
protected boolean isApplyKitKatTranslucency() {
return false;
}
/**
* 跳转到主页面
*/
private void goToMainActivity() {
int customVersion = AppPreferencesManager.INSTANCE.get().getInt(Constant.CUSTOM_VERSION, 0);
boolean isFirstEnter = AppPreferencesManager.INSTANCE.get().getBoolean(Constant.ISFIRSTENTER + customVersion, true);
if (isFirstEnter) {
readyGoThenKill(GuideActivity.class);
} else {
String channel = CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME");
if (TextUtils.equals(channel, Constant.CHANNEL_SHARE) && !UserManager.getInstance().userIsLogin()) {
readyGo(WxLoginActivity.class);
} else {
readyGoThenKill(MainActivity.class);
}
}
// mSplashContainer.removeAllViews();
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
return true;
}
return super.onKeyDown(keyCode, event);
}
}
......@@ -12,6 +12,7 @@ import com.mints.flowbox.MintsApplication
import com.mints.flowbox.R
import com.mints.flowbox.common.Constant
import com.mints.flowbox.common.DeviceInfo
import com.mints.flowbox.manager.AppPreferencesManager
import com.mints.flowbox.manager.TrackManager
import com.mints.flowbox.manager.UserManager
import com.mints.flowbox.manager.ad.YlhAdManager
......@@ -35,7 +36,6 @@ class SplashYlhActivity : BaseActivity(), SplashADListener {
private var splashAD: SplashAD? = null
private var container: ViewGroup? = null
private val skipView: TextView? = null
private val ps by lazy { AppPreferences(context) }
var canJump = false
......@@ -196,8 +196,8 @@ class SplashYlhActivity : BaseActivity(), SplashADListener {
}
private fun readyGoOtherActivity() {
val customVersion: Int = ps.getInt(Constant.CUSTOM_VERSION, 0)
val isFirstEnter: Boolean = ps.getBoolean(Constant.ISFIRSTENTER + customVersion, true)
val customVersion: Int = AppPreferencesManager.get().getInt(Constant.CUSTOM_VERSION, 0)
val isFirstEnter: Boolean = AppPreferencesManager.get().getBoolean(Constant.ISFIRSTENTER + customVersion, true)
if (isFirstEnter) {
readyGoThenKill(GuideActivity::class.java)
} else {
......
......@@ -3,6 +3,7 @@ package com.mints.flowbox.ui.activitys
import android.os.Bundle
import android.view.View
import com.mints.flowbox.R
import com.mints.flowbox.ad.express.ExpressManager
import com.mints.flowbox.common.Constant
import com.mints.flowbox.ad.express.TTPreLoadCarrierExpressManager
import com.mints.flowbox.manager.TtCsjAdManager
......@@ -99,7 +100,7 @@ class WalkActivity : BaseActivity(), View.OnClickListener, WalkView, StepView.St
}
// 预加载信息流
TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_WALK)
ExpressManager.loadExpress()
}
/**
......@@ -107,11 +108,9 @@ class WalkActivity : BaseActivity(), View.OnClickListener, WalkView, StepView.St
*/
private fun initExpress() {
try {
if (TTPreLoadCarrierExpressManager.getInstance().ttFrameLayout != null) {
if (flWalkAd != null) {
flWalkAd.removeAllViews()
flWalkAd.addView(TTPreLoadCarrierExpressManager.getInstance().ttFrameLayout)
}
flWalkAd.addView(ExpressManager.getExpressFrameLayout())
}
} catch (e: Exception) {
e.printStackTrace()
......
......@@ -3,6 +3,7 @@ package com.mints.flowbox.ui.activitys
import android.os.Bundle
import android.view.View
import com.mints.flowbox.R
import com.mints.flowbox.ad.express.ExpressManager
import com.mints.flowbox.common.Constant
import com.mints.flowbox.ad.express.TTPreLoadCarrierExpressManager
import com.mints.flowbox.manager.TtCsjAdManager
......@@ -69,7 +70,7 @@ class WaterActivity : BaseActivity(), View.OnClickListener, WaterView.WaterViewL
}
// 预加载信息流
TTPreLoadCarrierExpressManager.getInstance().loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_WATER)
ExpressManager.loadExpress()
}
override fun clickForWaterSuc(waterCoin: Int) {
......@@ -111,11 +112,9 @@ class WaterActivity : BaseActivity(), View.OnClickListener, WaterView.WaterViewL
*/
private fun initExpress() {
try {
if (TTPreLoadCarrierExpressManager.getInstance().ttFrameLayout != null) {
if (flWaterAd != null) {
flWaterAd.removeAllViews()
flWaterAd.addView(TTPreLoadCarrierExpressManager.getInstance().ttFrameLayout)
}
flWaterAd.addView(ExpressManager.getExpressFrameLayout())
}
} catch (e: Exception) {
e.printStackTrace()
......
......@@ -75,7 +75,7 @@ class WrapperActivity : BaseActivity(), View.OnClickListener {
// 微转分享
layoutWrapper.visibility = View.VISIBLE
tv_title.text = "幸运大抽奖"
currentFragment = TurnTableFragment(true)
currentFragment = TurnTableFragment()
}
}
......
......@@ -126,7 +126,7 @@ public abstract class BaseActivity extends BaseAppCompatActivity implements Base
*/
@Override
public void showLoading(String message) {
if (this.getWindow() != null && !this.isFinishing()) {
if (!this.isFinishing() && this.getWindow() != null) {
if (progressDialog == null) {
progressDialog = new LoadingDialog(this);
progressDialog.setLoadText(message);
......
......@@ -14,6 +14,7 @@ import com.daimajia.androidanimations.library.YoYo
import com.mints.flowbox.R
import com.mints.flowbox.common.AppConfig
import com.mints.flowbox.common.Constant
import com.mints.flowbox.manager.AppPreferencesManager
import com.mints.flowbox.manager.UserManager
import com.mints.flowbox.mvp.model.FriendHallMsgBean
import com.mints.flowbox.mvp.presenters.FriendsPresenter
......@@ -71,7 +72,6 @@ class FriendsFragment(private var isResume: Boolean = false) : BaseFragment(), F
private var rope: YoYo.YoYoString? = null
private val ps by lazy { AppPreferences(context) }
private val userManager by lazy { UserManager.getInstance() }
......@@ -348,7 +348,7 @@ class FriendsFragment(private var isResume: Boolean = false) : BaseFragment(), F
return
}
if (!ps.getBoolean(Constant.FIRST_SHARE_INVITED, false)) {
if (!AppPreferencesManager.get().getBoolean(Constant.FIRST_SHARE_INVITED, false)) {
// 第一次邀请提示弹框
firstWeChatInvite()
} else {
......@@ -604,7 +604,7 @@ class FriendsFragment(private var isResume: Boolean = false) : BaseFragment(), F
"打开微信",
object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
ps.put(Constant.FIRST_SHARE_INVITED, true)
AppPreferencesManager.get().put(Constant.FIRST_SHARE_INVITED, true)
shareImgDialog()
}
})
......
......@@ -9,6 +9,7 @@ import android.view.View
import android.widget.AdapterView
import android.widget.GridView
import com.mints.flowbox.R
import com.mints.flowbox.ad.express.ExpressManager
import com.mints.flowbox.ad.express.PreLoadExpressManager
import com.mints.flowbox.ad.express.TTPreLoadCarrierExpressManager
import com.mints.flowbox.ad.video.VideoAdingManager
......@@ -202,7 +203,7 @@ class HomeFragment : BaseFragment(), WifiStateManager.WifiStateCallback,
private fun uploadDeviceInfo() {
homePresenter.comSaveTerminalInfo()
baseApplication.initUm(context)
UmengManager.initUm()
homePresenter.getAdcodesInOpenApp()
}
......@@ -287,26 +288,22 @@ class HomeFragment : BaseFragment(), WifiStateManager.WifiStateCallback,
// 自有界面
when (hotBean.toUrl) {
Constant.HOT_ACTIVITY_WATER -> {
TTPreLoadCarrierExpressManager.getInstance()
.loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_WATER)
ExpressManager.loadExpress()
readyGo(WaterActivity::class.java)
}
Constant.HOT_ACTIVITY_WALK -> {
TTPreLoadCarrierExpressManager.getInstance()
.loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_WALK)
ExpressManager.loadExpress()
readyGo(WalkActivity::class.java)
}
Constant.HOT_ACTIVITY_CARD -> {
readyGo(EraseActivity::class.java)
}
Constant.HOT_ACTIVITY_MORNINGCLOCK -> {
TTPreLoadCarrierExpressManager.getInstance()
.loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_MORNINGCLOCK)
ExpressManager.loadExpress()
readyGo(MorningClockActivity::class.java)
}
Constant.HOT_ACTIVITY_EAT -> {
TTPreLoadCarrierExpressManager.getInstance()
.loadTtFrameLayout(TtCsjAdManager.TT_AD_NATIVEEXPRESS_EAT)
ExpressManager.loadExpress()
readyGo(FoodSubsidyActivity::class.java)
}
Constant.HOT_ACTIVITY_SHARE_NEWS -> {
......
......@@ -51,7 +51,8 @@ public abstract class BaseFragment extends BaseAppFragment {
* @param message
*/
public void showLoading(String message) {
if (getActivity().getWindow() != null && !getActivity().isFinishing()) {
if (getActivity() != null && !getActivity().isFinishing() &&
getActivity().getWindow() != null && !getActivity().isFinishing()) {
if (progressDialog == null) {
progressDialog = new LoadingDialog(getActivity());
progressDialog.setLoadText(message);
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 填充的颜色 -->
<solid android:color="#5B5B5B" />
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners android:radius="5dip" />
</shape>
\ 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.
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