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
a28b8294
Commit
a28b8294
authored
Jun 28, 2021
by
mengcuiguang2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.0.6添加gromore逻辑
parent
2992266c
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
305 additions
and
5 deletions
+305
-5
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
+9
-0
TrackManager.java
...c/main/java/com/mints/goodmoney/manager/TrackManager.java
+6
-0
TrackPresenter.java
...va/com/mints/goodmoney/mvp/presenters/TrackPresenter.java
+19
-0
LoanService.java
...pp/src/main/java/com/mints/goodmoney/net/LoanService.java
+7
-1
SplashGroMoreActivity.java
...m/mints/goodmoney/ui/activitys/SplashGroMoreActivity.java
+1
-0
SplashGroMoreBackgroundActivity.java
...odmoney/ui/activitys/SplashGroMoreBackgroundActivity.java
+221
-0
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 @
a28b8294
...
...
@@ -15,8 +15,8 @@ android {
applicationId
"com.mints.goodmoney"
minSdkVersion
rootProject
.
ext
.
androidMinSdkVersion
targetSdkVersion
rootProject
.
ext
.
androidTargetSdkVersion
versionCode
3
4
versionName
"1.3.
4
"
versionCode
3
5
versionName
"1.3.
5
"
flavorDimensions
"default"
// dex突破65535的限制
...
...
GoodMoney/app/src/main/AndroidManifest.xml
View file @
a28b8294
...
...
@@ -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 @
a28b8294
...
...
@@ -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 @
a28b8294
...
...
@@ -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 @
a28b8294
...
...
@@ -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,6 +95,8 @@ public class CsjGroMoreVideoAdManager extends BaseVideoAd {
this
.
curCoin
=
curCoin
;
this
.
extraId
=
extraId
;
this
.
carrierType
=
carrierType
;
appSetId
=
MD5
.
GetMD5Code
(
System
.
currentTimeMillis
()
+
UserManager
.
getInstance
().
getUserID
());
/**
* 判断当前是否存在config 配置 ,如果存在直接加载广告 ,如果不存在则注册config加载回调
*/
...
...
@@ -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/TrackManager.java
View file @
a28b8294
...
...
@@ -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/mvp/presenters/TrackPresenter.java
View file @
a28b8294
...
...
@@ -440,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 @
a28b8294
...
...
@@ -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 @
a28b8294
...
...
@@ -131,6 +131,7 @@ public class SplashGroMoreActivity extends BaseActivity {
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 @
a28b8294
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/utils/ForegroundOrBackground.java
View file @
a28b8294
...
...
@@ -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 @
a28b8294
<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