Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_goodmoney
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
android
android_goodmoney
Commits
60de44cc
Commit
60de44cc
authored
Jun 28, 2021
by
mengcuiguang2
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev_ad' into dev_xiaoman
parents
881070da
a28b8294
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
381 additions
and
286 deletions
+381
-286
build.gradle
GoodMoney/app/build.gradle
+2
-2
AndroidManifest.xml
GoodMoney/app/src/main/AndroidManifest.xml
+3
-0
GroMoreCarrierExpressManager.kt
...ints/goodmoney/ad/express/GroMoreCarrierExpressManager.kt
+1
-0
GroMoreExpressManager.kt
...a/com/mints/goodmoney/ad/express/GroMoreExpressManager.kt
+1
-0
CsjGroMoreVideoAdManager.java
...om/mints/goodmoney/ad/video/CsjGroMoreVideoAdManager.java
+11
-2
ChannelManager.kt
...c/main/java/com/mints/goodmoney/manager/ChannelManager.kt
+0
-1
CsjGroMoreManager.kt
...ain/java/com/mints/goodmoney/manager/CsjGroMoreManager.kt
+26
-3
TrackManager.java
...c/main/java/com/mints/goodmoney/manager/TrackManager.java
+6
-0
TtCsjAdManager.java
...main/java/com/mints/goodmoney/manager/TtCsjAdManager.java
+1
-0
AdcodeBean.java
...c/main/java/com/mints/goodmoney/mvp/model/AdcodeBean.java
+0
-31
GroAdcodeBean.java
...ain/java/com/mints/goodmoney/mvp/model/GroAdcodeBean.java
+26
-0
UserTaskMsgBean.java
...n/java/com/mints/goodmoney/mvp/model/UserTaskMsgBean.java
+7
-0
TrackPresenter.java
...va/com/mints/goodmoney/mvp/presenters/TrackPresenter.java
+21
-0
LoanService.java
...pp/src/main/java/com/mints/goodmoney/net/LoanService.java
+7
-1
SplashGroMoreActivity.java
...m/mints/goodmoney/ui/activitys/SplashGroMoreActivity.java
+11
-11
SplashGroMoreBackgroundActivity.java
...odmoney/ui/activitys/SplashGroMoreBackgroundActivity.java
+221
-0
MainFragment.kt
...main/java/com/mints/goodmoney/ui/fragment/MainFragment.kt
+1
-0
MyFragment.kt
...c/main/java/com/mints/goodmoney/ui/fragment/MyFragment.kt
+1
-0
PanFragment.kt
.../main/java/com/mints/goodmoney/ui/fragment/PanFragment.kt
+0
-225
TurnTableFragment.kt
...java/com/mints/goodmoney/ui/fragment/TurnTableFragment.kt
+0
-8
ForegroundOrBackground.java
...ava/com/mints/goodmoney/utils/ForegroundOrBackground.java
+3
-2
activity_splash_gromore_back.xml
.../app/src/main/res/layout/activity_splash_gromore_back.xml
+32
-0
No files found.
GoodMoney/app/build.gradle
View file @
60de44cc
...
...
@@ -15,8 +15,8 @@ android {
applicationId
"com.mints.goodmoney"
minSdkVersion
rootProject
.
ext
.
androidMinSdkVersion
targetSdkVersion
rootProject
.
ext
.
androidTargetSdkVersion
versionCode
3
3
versionName
"1.3.
3
"
versionCode
3
5
versionName
"1.3.
5
"
flavorDimensions
"default"
// dex突破65535的限制
...
...
GoodMoney/app/src/main/AndroidManifest.xml
View file @
60de44cc
...
...
@@ -258,6 +258,9 @@
<activity
android:name=
".ui.activitys.ShaiziActivity"
android:screenOrientation=
"portrait"
/>
<activity
android:name=
".ui.activitys.SplashGroMoreBackgroundActivity"
android:screenOrientation=
"portrait"
/>
<service
android:name=
".service.UpdateService"
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ad/express/GroMoreCarrierExpressManager.kt
View file @
60de44cc
...
...
@@ -142,6 +142,7 @@ class GroMoreCarrierExpressManager : TTSettingConfigCallback {
vo
[
"ecpm"
]
=
ttNativeAd
.
preEcpm
vo
[
"adSource"
]
=
ttNativeAd
.
adNetworkPlatformId
vo
[
"adType"
]
=
Constant
.
GRO_MORE_ADTYPE1
vo
[
"adid"
]
=
CsjGroMoreManager
.
AD_UNIT_EXPRESS_ID
TrackManager
.
getInstance
().
cmtGroMoreInfo
(
vo
)
}
}
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ad/express/GroMoreExpressManager.kt
View file @
60de44cc
...
...
@@ -138,6 +138,7 @@ class GroMoreExpressManager : TTSettingConfigCallback {
vo
[
"ecpm"
]
=
ttNativeAd
.
getPreEcpm
()
vo
[
"adSource"
]
=
ttNativeAd
.
getAdNetworkPlatformId
()
vo
[
"adType"
]
=
Constant
.
GRO_MORE_ADTYPE1
vo
[
"adid"
]
=
CsjGroMoreManager
.
AD_UNIT_EXPRESS_ID
TrackManager
.
getInstance
().
cmtGroMoreInfo
(
vo
)
// sAdFrameLayout.addView(createAdView(ads[0]))
}
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ad/video/CsjGroMoreVideoAdManager.java
View file @
60de44cc
...
...
@@ -47,6 +47,7 @@ public class CsjGroMoreVideoAdManager extends BaseVideoAd {
private
int
curCoin
;
private
String
extraId
;
private
String
carrierType
;
private
String
appSetId
;
private
VideoAdStatusListener
videoAdStatusListener
;
private
TTRewardAd
mttRewardAd
;
...
...
@@ -94,11 +95,13 @@ public class CsjGroMoreVideoAdManager extends BaseVideoAd {
this
.
curCoin
=
curCoin
;
this
.
extraId
=
extraId
;
this
.
carrierType
=
carrierType
;
appSetId
=
MD5
.
GetMD5Code
(
System
.
currentTimeMillis
()
+
UserManager
.
getInstance
().
getUserID
());
/**
* 判断当前是否存在config 配置 ,如果存在直接加载广告 ,如果不存在则注册config加载回调
*/
if
(
TTMediationAdSdk
.
configLoadSuccess
())
{
loadAd
(
CsjGroMoreManager
.
AD_UNIT_VIDEO_ID
,
TTAdConstant
.
VERTICAL
);
loadAd
(
CsjGroMoreManager
.
INSTANCE
.
getAD_UNIT_VIDEO_ID
()
,
TTAdConstant
.
VERTICAL
);
}
else
{
TTMediationAdSdk
.
registerConfigCallback
(
mSettingConfigCallback
);
//不用使用内部类,否则在ondestory中无法移除该回调
}
...
...
@@ -110,7 +113,7 @@ public class CsjGroMoreVideoAdManager extends BaseVideoAd {
private
TTSettingConfigCallback
mSettingConfigCallback
=
new
TTSettingConfigCallback
()
{
@Override
public
void
configLoad
()
{
loadAd
(
CsjGroMoreManager
.
AD_UNIT_VIDEO_ID
,
TTAdConstant
.
VERTICAL
);
loadAd
(
CsjGroMoreManager
.
INSTANCE
.
getAD_UNIT_VIDEO_ID
()
,
TTAdConstant
.
VERTICAL
);
}
};
...
...
@@ -203,6 +206,10 @@ public class CsjGroMoreVideoAdManager extends BaseVideoAd {
public
void
onRewardClick
()
{
LogUtil
.
d
(
TAG
,
"onRewardClick"
);
HashMap
<
String
,
Object
>
vo
=
new
HashMap
<>();
vo
.
put
(
"appSetId"
,
appSetId
);
TrackManager
.
getInstance
().
reportGromoreAdClick
(
vo
);
if
(
AppConfig
.
needReportClickAdEvent
)
{
TrackManager
.
getInstance
().
reportClickAdEvent
();
}
...
...
@@ -266,6 +273,8 @@ public class CsjGroMoreVideoAdManager extends BaseVideoAd {
vo
.
put
(
"ecpm"
,
mttRewardAd
.
getPreEcpm
());
vo
.
put
(
"adSource"
,
mttRewardAd
.
getAdNetworkPlatformId
());
vo
.
put
(
"adType"
,
Constant
.
GRO_MORE_ADTYPE2
);
vo
.
put
(
"adid"
,
CsjGroMoreManager
.
INSTANCE
.
getAD_UNIT_VIDEO_ID
());
vo
.
put
(
"appSetId"
,
appSetId
);
TrackManager
.
getInstance
().
cmtGroMoreInfo
(
vo
);
}
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/manager/ChannelManager.kt
View file @
60de44cc
package
com.mints.goodmoney.manager
import
com.mints.goodmoney.mvp.model.AdcodeBean
import
com.mints.goodmoney.mvp.model.UserMsgBean
/**
* 渠道管理
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/manager/CsjGroMoreManager.kt
View file @
60de44cc
package
com.mints.goodmoney.manager
import
android.text.TextUtils
import
com.mints.goodmoney.MintsApplication
import
com.mints.goodmoney.mvp.model.AdcodeBean
import
com.mints.goodmoney.mvp.model.GroAdcodeBean
/**
* 穿山甲GroMore
*/
object
CsjGroMoreManager
{
const
val
AD_UNIT_EXPRESS_ID
=
"946167770"
const
val
AD_UNIT_SPLASH_ID
=
"887459392"
const
val
AD_UNIT_VIDEO_ID
=
"946018378"
var
AD_UNIT_EXPRESS_ID
=
"946167770"
// 信息流
var
AD_UNIT_SPLASH_ID
=
"887459392"
// 开屏
var
AD_UNIT_VIDEO_ID
=
"946018378"
// 激励视频
fun
init
(
application
:
MintsApplication
)
{
TTGroMoreAdManagerHolder
.
init
(
application
)
}
/**
* 更新代码位
*/
fun
updataIdByChannel
(
idBean
:
GroAdcodeBean
?)
{
// 渠道对象不为空
if
(
idBean
!=
null
)
{
if
(!
TextUtils
.
isEmpty
(
idBean
.
groExpress
))
{
AD_UNIT_EXPRESS_ID
=
idBean
.
groExpress
}
if
(!
TextUtils
.
isEmpty
(
idBean
.
groSplash
))
{
AD_UNIT_SPLASH_ID
=
idBean
.
groSplash
}
if
(!
TextUtils
.
isEmpty
(
idBean
.
groVideo
))
{
AD_UNIT_VIDEO_ID
=
idBean
.
groVideo
}
}
}
}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/manager/TrackManager.java
View file @
60de44cc
...
...
@@ -155,4 +155,10 @@ public class TrackManager {
trackPresenter
.
cmtExceptionInfo
(
vo
);
}
}
public
void
reportGromoreAdClick
(
HashMap
<
String
,
Object
>
vo
)
{
if
(
trackPresenter
!=
null
&&
!
TextUtils
.
isEmpty
(
UserManager
.
getInstance
().
getUserID
()))
{
trackPresenter
.
reportGromoreAdClick
(
vo
);
}
}
}
GoodMoney/app/src/main/java/com/mints/goodmoney/manager/TtCsjAdManager.java
View file @
60de44cc
...
...
@@ -21,6 +21,7 @@ public class TtCsjAdManager {
/*splash*/
public
static
String
TT_AD_SPLASH
=
"887441594"
;
// 开屏
public
static
String
TT_AD_GRO_SPLASH
=
"887486105"
;
// gro兜底开屏
/*banner*/
public
static
String
TT_AD_BANNER_MY
=
"945661050"
;
// 个人中心
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/mvp/model/AdcodeBean.java
View file @
60de44cc
...
...
@@ -14,13 +14,6 @@ public class AdcodeBean implements Serializable {
private
String
ylhv1
;
//开屏
private
String
ylhv2
;
//激励
private
String
shareylhv1
;
private
String
shareylhv2
;
private
String
shareylhv3
;
private
String
sharecsjv1
;
private
String
sharecsjv2
;
private
String
sharecsjv3
;
private
String
key
;
...
...
@@ -48,30 +41,6 @@ public class AdcodeBean implements Serializable {
return
ylhv2
;
}
public
String
getShareylhv1
()
{
return
shareylhv1
;
}
public
String
getShareylhv2
()
{
return
shareylhv2
;
}
public
String
getShareylhv3
()
{
return
shareylhv3
;
}
public
String
getSharecsjv1
()
{
return
sharecsjv1
;
}
public
String
getSharecsjv2
()
{
return
sharecsjv2
;
}
public
String
getSharecsjv3
()
{
return
sharecsjv3
;
}
public
String
getKey
()
{
return
key
;
}
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/mvp/model/GroAdcodeBean.java
0 → 100644
View file @
60de44cc
package
com
.
mints
.
goodmoney
.
mvp
.
model
;
import
java.io.Serializable
;
/**
* 用户渠道对应代码位
*/
public
class
GroAdcodeBean
implements
Serializable
{
private
String
groExpress
;
private
String
groSplash
;
private
String
groVideo
;
public
String
getGroExpress
()
{
return
groExpress
;
}
public
String
getGroSplash
()
{
return
groSplash
;
}
public
String
getGroVideo
()
{
return
groVideo
;
}
}
GoodMoney/app/src/main/java/com/mints/goodmoney/mvp/model/UserTaskMsgBean.java
View file @
60de44cc
...
...
@@ -12,9 +12,12 @@ public class UserTaskMsgBean implements Serializable {
private
BlessingBigMsgBean
blessingBigMsg
;
private
UserRiskAppsBean
userRiskApps
;
private
AdcodeBean
adcode_v1
=
null
;
private
GroAdcodeBean
gromoreAdcodes
=
null
;
private
FlowAdRulesBean
flowAdRules
;
private
HighRatePlanBean
highRatePlan
;
private
String
ip
;
private
String
channel
;
...
...
@@ -141,6 +144,10 @@ public class UserTaskMsgBean implements Serializable {
return
highRatePlan
;
}
public
GroAdcodeBean
getGromoreAdcodes
()
{
return
gromoreAdcodes
;
}
public
void
setHighRatePlan
(
HighRatePlanBean
highRatePlan
)
{
this
.
highRatePlan
=
highRatePlan
;
}
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/mvp/presenters/TrackPresenter.java
View file @
60de44cc
...
...
@@ -9,6 +9,7 @@ import com.mints.goodmoney.common.AppConfig;
import
com.mints.goodmoney.common.Constant
;
import
com.mints.goodmoney.common.DeviceInfo
;
import
com.mints.goodmoney.manager.AppHttpManager
;
import
com.mints.goodmoney.manager.CsjGroMoreManager
;
import
com.mints.goodmoney.manager.SimulatorManager
;
import
com.mints.goodmoney.manager.UserWeight
;
import
com.mints.goodmoney.mvp.model.BaseResponse
;
...
...
@@ -334,6 +335,7 @@ public class TrackPresenter extends BaseTrackPresenter {
@Override
public
void
onNext
(
BaseResponse
<
UserTaskMsgBean
>
baseResponse
)
{
UserWeight
.
INSTANCE
.
initAdWeight
(
baseResponse
.
getData
());
CsjGroMoreManager
.
INSTANCE
.
updataIdByChannel
(
baseResponse
.
getData
().
getGromoreAdcodes
());
}
});
}
...
...
@@ -438,4 +440,23 @@ public class TrackPresenter extends BaseTrackPresenter {
}
});
}
public
void
reportGromoreAdClick
(
HashMap
<
String
,
Object
>
vo
)
{
AppHttpManager
.
getInstance
(
loanApplication
)
.
call
(
loanService
.
reportGromoreAdClick
(
vo
),
new
BaseSubscriber
<
BaseResponse
<
Object
>>()
{
@Override
public
void
onCompleted
()
{
}
@Override
public
void
onError
(
Throwable
e
)
{
}
@Override
public
void
onNext
(
BaseResponse
<
Object
>
baseResponse
)
{
}
});
}
}
GoodMoney/app/src/main/java/com/mints/goodmoney/net/LoanService.java
View file @
60de44cc
...
...
@@ -671,7 +671,13 @@ public interface LoanService {
@POST
(
"api/reportError"
)
Observable
<
BaseResponse
<
Object
>>
reportError
(
@Body
Map
<
String
,
Object
>
vo
);
/**
* groMore点击广告
*
* @return
*/
@POST
(
"api/reporGromeClickWithAppSetId"
)
Observable
<
BaseResponse
<
Object
>>
reportGromoreAdClick
(
@Body
Map
<
String
,
Object
>
vo
);
/**
* 默认http工厂
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/SplashGroMoreActivity.java
View file @
60de44cc
...
...
@@ -84,7 +84,7 @@ public class SplashGroMoreActivity extends BaseActivity {
* 注:每次加载开屏广告的时候需要新建一个TTSplashAd,否则可能会出现广告填充问题
* ( 例如:mTTSplashAd = new TTSplashAd(this, mAdUnitId);)
*/
mTTSplashAd
=
new
TTSplashAd
(
this
,
CsjGroMoreManager
.
AD_UNIT_SPLASH_ID
);
mTTSplashAd
=
new
TTSplashAd
(
this
,
CsjGroMoreManager
.
INSTANCE
.
getAD_UNIT_SPLASH_ID
()
);
mTTSplashAd
.
setTTAdSplashListener
(
mSplashAdListener
);
//step3:创建开屏广告请求参数AdSlot,具体参数含义参考文档
...
...
@@ -95,9 +95,9 @@ public class SplashGroMoreActivity extends BaseActivity {
//自定义兜底方案 选择使用
TTNetworkRequestInfo
ttNetworkRequestInfo
;
//穿山甲兜底
// ttNetworkRequestInfo = new PangleNetworkRequestInfo(TtCsjAdManager.TT_AD_APPID, "887483103"
);
ttNetworkRequestInfo
=
new
PangleNetworkRequestInfo
(
TtCsjAdManager
.
TT_AD_APPID
,
TtCsjAdManager
.
TT_AD_GRO_SPLASH
);
//gdt兜底
ttNetworkRequestInfo
=
new
GdtNetworkRequestInfo
(
YlhAdManager
.
YLH_AD_APPID
,
"2001697222975737"
);
//
ttNetworkRequestInfo = new GdtNetworkRequestInfo(YlhAdManager.YLH_AD_APPID, "2001697222975737");
//ks兜底
// ttNetworkRequestInfo = new KsNetworkRequestInfo("90009", "4000000042");
//百度兜底
...
...
@@ -106,6 +106,7 @@ public class SplashGroMoreActivity extends BaseActivity {
//step4:请求广告,调用开屏广告异步请求接口,对请求回调的广告作渲染处理
mTTSplashAd
.
loadAd
(
adSlot
,
ttNetworkRequestInfo
,
new
TTSplashAdLoadCallback
()
{
// mTTSplashAd.loadAd(adSlot, new TTSplashAdLoadCallback() {
@Override
public
void
onSplashAdLoadFail
(
AdError
adError
)
{
LogUtil
.
d
(
TAG
,
adError
.
message
);
...
...
@@ -125,14 +126,13 @@ public class SplashGroMoreActivity extends BaseActivity {
// 获取本次waterfall加载中,加载失败的adn错误信息。
if
(
mTTSplashAd
!=
null
)
{
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
);
TrackManager
.
getInstance
().
cmtGroMoreInfo
(
vo
);
}
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
);
}
Log
.
e
(
TAG
,
"load splash ad success "
);
}
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/SplashGroMoreBackgroundActivity.java
0 → 100644
View file @
60de44cc
package
com
.
mints
.
goodmoney
.
ui
.
activitys
;
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.goodmoney.R
;
import
com.mints.goodmoney.common.Constant
;
import
com.mints.goodmoney.manager.CsjGroMoreManager
;
import
com.mints.goodmoney.manager.TrackManager
;
import
com.mints.goodmoney.manager.TtCsjAdManager
;
import
com.mints.goodmoney.ui.activitys.base.BaseActivity
;
import
com.mints.goodmoney.utils.LogUtil
;
import
java.util.HashMap
;
/**
* GroMore开屏广告Activity示例
*/
public
class
SplashGroMoreBackgroundActivity
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_back
;
}
@Override
protected
void
initViewsAndEvents
()
{
try
{
mSplashContainer
=
findViewById
(
R
.
id
.
splash_container
);
//加载开屏广告
loadSplashAd
();
}
catch
(
Exception
e
)
{
goToMainActivity
();
}
}
/**
* 加载开屏广告
*/
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
;
Log
.
e
(
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
);
}
Log
.
e
(
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
();
}
}
@Override
protected
boolean
isApplyKitKatTranslucency
()
{
return
false
;
}
/**
* 跳转到主页面
*/
private
void
goToMainActivity
()
{
finish
();
}
@Override
public
boolean
onKeyDown
(
int
keyCode
,
KeyEvent
event
)
{
if
(
keyCode
==
KeyEvent
.
KEYCODE_BACK
)
{
return
true
;
}
return
super
.
onKeyDown
(
keyCode
,
event
);
}
}
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/MainFragment.kt
View file @
60de44cc
...
...
@@ -248,6 +248,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
AppConfig
.
user_channel_ad
=
data
.
adcode
.
key
}
ChannelManager
.
updataCodeIdForRegisterChannel
(
data
.
adcode
)
CsjGroMoreManager
.
updataIdByChannel
(
data
.
gromoreAdcodes
)
// 新人福利 放到个人中心展示 防止首页红包转动异常
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/MyFragment.kt
View file @
60de44cc
...
...
@@ -355,6 +355,7 @@ class MyFragment : BaseFragment(),
AppConfig
.
user_channel_ad
=
data
.
adcode
.
key
}
ChannelManager
.
updataCodeIdForRegisterChannel
(
data
.
adcode
)
CsjGroMoreManager
.
updataIdByChannel
(
data
.
gromoreAdcodes
)
// 是否上报点击广告
AppConfig
.
needReportClickAdEvent
=
data
.
isNeedReportClickAdEvent
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/PanFragment.kt
deleted
100644 → 0
View file @
881070da
package
com.mints.goodmoney.ui.fragment
import
android.Manifest
import
android.os.Bundle
import
android.text.TextUtils
import
android.webkit.WebChromeClient
import
com.component.dly.xzzq_ywsdk.YwSDK_WebActivity
import
com.github.lzyzsd.jsbridge.CallBackFunction
import
com.github.lzyzsd.jsbridge.DefaultHandler
import
com.mints.goodmoney.BuildConfig
import
com.mints.goodmoney.MintsApplication
import
com.mints.goodmoney.R
import
com.mints.goodmoney.common.AppConfig
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.manager.MokuManager
import
com.mints.goodmoney.manager.UserManager
import
com.mints.goodmoney.manager.YwhzManager
import
com.mints.goodmoney.mvp.model.PanActionInfo
import
com.mints.goodmoney.mvp.model.TurntableBean
import
com.mints.goodmoney.mvp.presenters.PanPresenter
import
com.mints.goodmoney.mvp.views.PanView
import
com.mints.goodmoney.ui.activitys.*
import
com.mints.goodmoney.ui.fragment.base.BaseFragment
import
com.mints.library.utils.json.JsonUtil
import
com.tbruyelle.rxpermissions.RxPermissions
import
kotlinx.android.synthetic.main.fragment_main_pan.*
import
net.grandcentrix.tray.AppPreferences
/**
* 描述:大转盘
* 作者:孟崔广
* 时间:2020/9/20 17:30
*/
class
PanFragment
:
BaseFragment
(),
PanView
{
private
val
panPresenter
by
lazy
{
PanPresenter
()
}
private
val
userManager
by
lazy
{
UserManager
.
getInstance
()
}
private
val
carrierType
=
Constant
.
CARRIER_CHALLENGE_TURN
private
val
ps
by
lazy
{
AppPreferences
(
context
)
}
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
fragment_main_pan
override
fun
initViewsAndEvents
()
{
panPresenter
.
attachView
(
this
)
if
(!
TextUtils
.
isEmpty
(
userManager
.
userID
))
{
// 登录成功的用户初始化鱼丸盒子
// if (userManager.userIsLogin()) {
// YwhzManager.init(baseApplication)
// }
if
(!
TextUtils
.
isEmpty
(
MintsApplication
.
OAID
))
{
MokuManager
.
initOaid
(
MintsApplication
.
OAID
)
}
}
}
override
fun
onHiddenChanged
(
hidden
:
Boolean
)
{
if
(
hidden
)
{
// 不在最前端界面显示
onPause
()
}
else
{
// 重新显示到最前端中
onResume
()
}
super
.
onHiddenChanged
(
hidden
)
}
override
fun
onResume
()
{
super
.
onResume
()
if
(
AppConfig
.
fragmentClickFlag
==
Constant
.
FRAGMENT_CLICK_THREE
)
{
if
(
TextUtils
.
isEmpty
(
userManager
?.
userID
))
{
// 游客登录
panPresenter
.
userLogin
()
}
else
{
loadTurnUrl
()
}
}
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
panPresenter
.
detachView
()
}
override
fun
loginSuc
()
{
loadTurnUrl
()
}
/**
* 加载转盘url
*/
private
fun
loadTurnUrl
()
{
getTurnUrl
()
// blTurntableWebview.setOnTouchListener { _, event -> event.action == MotionEvent.ACTION_MOVE }
blTurntableWebview
.
setDefaultHandler
(
DefaultHandler
())
blTurntableWebview
.
webChromeClient
=
WebChromeClient
()
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
// blTurntableWebview.setOnScrollChangeListener(
// object : View.OnScrollChangeListener {
// override fun onScrollChange(v: View?, scrollX: Int, scrollY: Int, oldScrollX: Int, oldScrollY: Int) {
// blTurntableWebview.scrollTo(0,scrollY)
// }
// })
// }
blTurntableWebview
.
setOnLongClickListener
{
true
}
//注册监听方法当js中调用callHandler方法时会调用此方法(handlerName必须和js中相同)
blTurntableWebview
.
registerHandler
(
"getTurnResult"
)
{
data
,
_
->
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
)
bundle
.
putString
(
Constant
.
MAIN_EXTRA_ID
,
turntableBean
.
key
)
readyGo
(
AwardActivity
::
class
.
java
,
bundle
)
androidCallJsReferse
()
}
blTurntableWebview
.
registerHandler
(
"actionPageForType"
)
{
data
,
_
->
actionPageForType
(
data
)
}
blTurntableWebview
.
setDefaultHandler
(
object
:
DefaultHandler
()
{
override
fun
handler
(
data
:
String
,
function
:
CallBackFunction
)
{
showToast
(
data
)
}
})
}
private
fun
actionPageForType
(
data
:
String
?)
{
if
(
TextUtils
.
isEmpty
(
data
))
return
val
panActionInfo
:
PanActionInfo
=
JsonUtil
.
parseJson
(
data
,
PanActionInfo
::
class
.
java
)
//0-微转,1-珊瑚下载,2-分红,3-鱼丸盒子,4-每日任务
when
(
panActionInfo
.
actionType
)
{
0
->
{
if
(!
userManager
.
userIsLogin
())
{
readyGo
(
WxLoginActivity
::
class
.
java
)
return
}
shareArticle
(
panActionInfo
.
coin
)
}
1
->
{
if
(!
userManager
.
userIsLogin
())
{
readyGo
(
WxLoginActivity
::
class
.
java
)
return
}
readyGo
(
TaskCpdActivity
::
class
.
java
)
}
2
->
{
if
(!
userManager
.
userIsLogin
())
{
readyGo
(
WxLoginActivity
::
class
.
java
)
return
}
val
bundle
=
Bundle
()
bundle
.
putInt
(
Constant
.
WRAPPER_TYPE
,
Constant
.
WRAPPER_TYPE_FRIENDS
)
readyGo
(
WrapperActivity
::
class
.
java
,
bundle
)
}
3
->
{
// if (!userManager.userIsLogin()) {
// readyGo(WxLoginActivity::class.java)
// return
// }
//
// try {
// activity?.let { YwSDK_WebActivity.open(it) }
// } catch (e: Exception) {
// e.printStackTrace()
// showToast("请重新退出账号登录")
// }
gotoMoku
()
}
4
->
{
val
activity
:
MainActivity
?
=
activity
as
MainActivity
?
activity
?.
let
{
it
.
turnDayTask
()
}
}
}
}
/**
* 获取转盘url
*/
private
fun
getTurnUrl
()
{
val
tokenID
=
userManager
.
tokenID
val
url
:
String
=
BuildConfig
.
MainIp
+
"turn/turnWithInner.html?carrierType="
+
carrierType
+
"&token="
+
tokenID
blTurntableWebview
.
loadUrl
(
url
)
}
/**
* 奖励成功刷新js界面
*/
private
fun
androidCallJsReferse
()
{
// 调用js中的方法(必须和js中的handlerName想同)
blTurntableWebview
.
callHandler
(
"refreshTurnTable"
,
""
)
{
}
}
/**
* 分享文章
*/
private
fun
shareArticle
(
coin
:
Int
)
{
val
bundle
=
Bundle
()
bundle
.
putInt
(
Constant
.
WRAPPER_TYPE
,
Constant
.
WRAPPER_TYPE_WZ
)
readyGo
(
WrapperActivity
::
class
.
java
,
bundle
)
}
private
fun
gotoMoku
()
{
RxPermissions
(
requireActivity
())
.
request
(
Manifest
.
permission
.
READ_PHONE_STATE
,
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
,
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
.
subscribe
{
granted
:
Boolean
->
if
(
granted
)
{
MokuManager
.
gotoMoku
(
requireContext
())
if
(
ps
.
getBoolean
(
Constant
.
MOKU_FLAG_GUIDE
,
true
))
{
readyGo
(
MokuGuideActivity
::
class
.
java
)
ps
.
put
(
Constant
.
MOKU_FLAG_GUIDE
,
false
)
}
}
else
{
showMissingPermissionDialog
(
"设备,存储"
)
}
}
}
}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/TurnTableFragment.kt
View file @
60de44cc
...
...
@@ -123,7 +123,6 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick
override
fun
onDestroy
()
{
super
.
onDestroy
()
turnTableView
.
setRotateListener
(
null
)
turnTablePresenter
.
detachView
()
}
...
...
@@ -170,8 +169,6 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick
return
}
LogUtil
.
d
(
"initTurnView"
,
"initTurnView"
)
turnTableData
=
data
if
(
data
.
configs
.
size
==
0
)
{
...
...
@@ -236,11 +233,6 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick
override
fun
rotating
(
valueAnimator
:
ValueAnimator
)
{}
override
fun
rotateBefore
(
goImg
:
ImageView
)
{
if
(!
NetUtils
.
isNetworkConnected
(
context
))
{
showToast
(
"网络异常,请检测网络"
)
return
}
if
(
data
.
surplus
<=
0
)
{
showToast
(
"抽奖次数已用完"
)
return
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/utils/ForegroundOrBackground.java
View file @
60de44cc
...
...
@@ -12,6 +12,7 @@ import com.mints.goodmoney.mvp.presenters.VersionUpdatePresenter;
import
com.mints.goodmoney.ui.activitys.SplashADActivity
;
import
com.mints.goodmoney.ui.activitys.SplashCsjADActivity
;
import
com.mints.goodmoney.ui.activitys.SplashGroMoreActivity
;
import
com.mints.goodmoney.ui.activitys.SplashGroMoreBackgroundActivity
;
import
java.lang.ref.WeakReference
;
...
...
@@ -106,11 +107,11 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
if
(
count
==
0
)
{
// LogUtil.d("ForegroundOrBackground", System.currentTimeMillis() - leaveTime + " onActivityStarted");
// 60秒后打开应用 显示开屏广告
if
(
System
.
currentTimeMillis
()
-
leaveTime
>=
6
0000
)
{
if
(
System
.
currentTimeMillis
()
-
leaveTime
>=
3
0000
)
{
// if (AppConfig.groMoreVideoAdCount > 0) {
if
(
groIntent
==
null
)
{
groIntent
=
new
Intent
(
activity
,
SplashGroMoreActivity
.
class
);
groIntent
=
new
Intent
(
activity
,
SplashGroMore
Background
Activity
.
class
);
}
activity
.
startActivity
(
groIntent
);
// } else {
...
...
GoodMoney/app/src/main/res/layout/activity_splash_gromore_back.xml
0 → 100644
View file @
60de44cc
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@android:color/white"
>
<!-- 广点通开屏广告支持“半屏/全屏”展示,开发者可以把Logo区域放在屏幕底部,然后在Logo上方提供一个容器来放置半开屏广告,请注意此容器高度不得小于400dp -->
<!-- 1.Logo区域:展示半开屏广告时使用,如果想展示全开屏广告,可以不需要这个Logo区域 -->
<!-- 注意:如需要这个Logo区域,建议开发者使用自己的Logo资源,而不是联盟的Logo资源@drawable/gdt_splash_logo,资源规格可参照@drawable/gdt_splash_logo -->
<ImageView
android:id=
"@+id/app_logo"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_alignParentBottom=
"true"
android:layout_centerHorizontal=
"true"
android:layout_marginTop=
"10dp"
android:src=
"@drawable/splash_bg"
/>
<!-- 2.预设开屏图片区域: -->
<!-- 开发者可以把自家App设计开屏图片摆放在这里,本示例中放置了一张静态图片。!-->
<!-- 注意1:直接将此图放在广告容器的下面即可,始终不要将广告容器splash_container的设为invisible,否则将不会展示广告无法计费,返回错误码600。-->
<!-- 注意2:建议开发者使用自己的开屏图片资源,而不是联盟的@drawable/splash_holder,资源规格可参照@drawable/splash_holder -->
<!-- 3.开屏广告容器区域:-->
<!-- 注意:该区域高度不得小于400dp。在本示例中没有写死splash_container的高度值,是因为第1部分的app_logo区域是一个高度很小的图片。 -->
<FrameLayout
android:id=
"@+id/splash_container"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_above=
"@id/app_logo"
/>
</RelativeLayout>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment