Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_flowbox
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_flowbox
Commits
17691cba
Commit
17691cba
authored
Jul 05, 2021
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加gromore全屏广告
parent
3f24f8fd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
185 additions
and
23 deletions
+185
-23
build.gradle
app/build.gradle
+1
-1
FullGroManager.java
...c/main/java/com/mints/flowbox/ad/full/FullGroManager.java
+161
-0
CsjGroMoreManager.kt
.../main/java/com/mints/flowbox/manager/CsjGroMoreManager.kt
+1
-0
MainActivity.kt
.../main/java/com/mints/flowbox/ui/activitys/MainActivity.kt
+22
-22
No files found.
app/build.gradle
View file @
17691cba
...
...
@@ -226,7 +226,7 @@ dependencies {
// 三方接入
// bugly
implementation
'com.tencent.bugly:crashreport:
2.1.9
'
//其中latest.release指代最新Bugly SDK版本号,也可以指定明确的版本号,例如2.1.9
implementation
'com.tencent.bugly:crashreport:
3.3.92
'
//其中latest.release指代最新Bugly SDK版本号,也可以指定明确的版本号,例如2.1.9
implementation
'com.tencent.bugly:nativecrashreport:3.0'
//其中latest.release指代最新Bugly NDK版本号,也可以指定明确的版本号,例如3.0
// 一览视频
implementation
(
"com.yilan.sdk:ui:3.3.3.6"
)
{
...
...
app/src/main/java/com/mints/flowbox/ad/full/FullGroManager.java
0 → 100644
View file @
17691cba
package
com
.
mints
.
flowbox
.
ad
.
full
;
import
android.annotation.SuppressLint
;
import
android.app.Activity
;
import
android.util.Log
;
import
com.bytedance.msdk.api.AdError
;
import
com.bytedance.msdk.api.AdSlot
;
import
com.bytedance.msdk.api.GDTExtraOption
;
import
com.bytedance.msdk.api.TTAdConstant
;
import
com.bytedance.msdk.api.TTMediationAdSdk
;
import
com.bytedance.msdk.api.TTSettingConfigCallback
;
import
com.bytedance.msdk.api.TTVideoOption
;
import
com.bytedance.msdk.api.fullVideo.TTFullVideoAd
;
import
com.bytedance.msdk.api.fullVideo.TTFullVideoAdListener
;
import
com.bytedance.msdk.api.fullVideo.TTFullVideoAdLoadCallback
;
import
com.mints.flowbox.BuildConfig
;
import
com.mints.flowbox.ad.inscreen.InterstitialGroManager
;
import
com.mints.flowbox.common.Constant
;
import
com.mints.flowbox.manager.CsjGroMoreManager
;
import
com.mints.flowbox.manager.TrackManager
;
import
com.mints.flowbox.manager.UserManager
;
import
com.mints.flowbox.utils.LogUtil
;
import
com.mints.flowbox.utils.VideoOptionUtil
;
import
java.util.HashMap
;
/**
* gromore全屏广告
*/
public
class
FullGroManager
{
private
static
final
String
TAG
=
FullGroManager
.
class
.
getSimpleName
();
private
TTFullVideoAd
mTTFullVideoAd
;
private
Activity
activity
;
private
boolean
isLoadSuccess
=
false
;
public
void
loadFullAd
(
Activity
activity
)
{
// 加载到广告且未展示 则返回
if
(
isLoadSuccess
)
return
;
this
.
activity
=
activity
;
if
(
TTMediationAdSdk
.
configLoadSuccess
())
{
loadAd
();
}
else
{
TTMediationAdSdk
.
registerConfigCallback
(
mSettingConfigCallback
);
}
}
/**
* config回调
*/
private
TTSettingConfigCallback
mSettingConfigCallback
=
new
TTSettingConfigCallback
()
{
@SuppressLint
(
"LongLogTag"
)
@Override
public
void
configLoad
()
{
loadAd
();
}
};
private
void
loadAd
()
{
/**
* 选择的模板类型
* 如果服务端配置了模板类型跟随服务端配置
* 有效值 0 客户端设置生效 1 原生 2 模板 1.0 3 模板 2.0
* 服务端没有下发数值客户端设置模板版本才会生效
*/
/**
* 注:每次加载全屏视频广告的时候需要新建一个TTFullVideoAd,否则可能会出现广告填充问题
* ( 例如:mTTFullVideoAd = new TTFullVideoAd(this, adUnitId);)
*/
mTTFullVideoAd
=
new
TTFullVideoAd
(
activity
,
CsjGroMoreManager
.
INSTANCE
.
getAD_UNIT_FULL_ID
());
//声音控制 模板 2.0
TTVideoOption
videoOption
=
VideoOptionUtil
.
getTTVideoOption2
();
//创建广告请求参数AdSlot,具体参数含义参考文档
AdSlot
.
Builder
adSlotBuilder
=
new
AdSlot
.
Builder
()
.
setTTVideoOption
(
videoOption
)
//设置声音控制
.
setUserID
(
UserManager
.
getInstance
().
getUserID
())
//用户id,必传参数
.
setMediaExtra
(
"media_extra"
)
//附加参数,可选
.
setOrientation
(
TTAdConstant
.
VERTICAL
);
//必填参数,期望视频的播放方向:TTAdConstant.HORIZONTAL 或 TTAdConstant.VERTICAL;
//请求广告
mTTFullVideoAd
.
loadFullAd
(
adSlotBuilder
.
build
(),
new
TTFullVideoAdLoadCallback
()
{
@Override
public
void
onFullVideoLoadFail
(
AdError
adError
)
{
isLoadSuccess
=
false
;
}
@Override
public
void
onFullVideoAdLoad
()
{
isLoadSuccess
=
true
;
}
@Override
public
void
onFullVideoCached
()
{
isLoadSuccess
=
true
;
}
});
}
public
void
showFullAd
()
{
if
(
BuildConfig
.
DEBUG
)
{
LogUtil
.
d
(
TAG
,
"showFullAd isLoadSuccess="
+
isLoadSuccess
+
" isReady="
+
mTTFullVideoAd
.
isReady
());
}
if
(
isLoadSuccess
&&
mTTFullVideoAd
!=
null
&&
mTTFullVideoAd
.
isReady
()
&&
activity
!=
null
)
{
//设置监听器
mTTFullVideoAd
.
showFullAd
(
activity
,
mTTFullVideoAdListener
);
HashMap
<
String
,
Object
>
vo
=
new
HashMap
<>();
vo
.
put
(
"adcode"
,
mTTFullVideoAd
.
getAdNetworkRitId
());
vo
.
put
(
"ecpm"
,
mTTFullVideoAd
.
getPreEcpm
());
vo
.
put
(
"adSource"
,
mTTFullVideoAd
.
getAdNetworkPlatformId
());
vo
.
put
(
"adType"
,
Constant
.
GRO_MORE_ADTYPE3
);
vo
.
put
(
"adid"
,
CsjGroMoreManager
.
INSTANCE
.
getAD_UNIT_INTERSTITIAL_ID
());
TrackManager
.
getInstance
().
cmtGroMoreInfo
(
vo
);
}
else
{
// 当加载到广告后 ,长时间未展示失效时 改变状态
isLoadSuccess
=
false
;
}
}
/**
* 激励视频交互回调
*/
private
TTFullVideoAdListener
mTTFullVideoAdListener
=
new
TTFullVideoAdListener
()
{
@Override
public
void
onFullVideoAdShow
()
{
Log
.
d
(
TAG
,
"onFullVideoAdShow"
);
}
@Override
public
void
onFullVideoAdClick
()
{
Log
.
d
(
TAG
,
"onFullVideoAdClick"
);
}
@Override
public
void
onFullVideoAdClosed
()
{
Log
.
d
(
TAG
,
"onFullVideoAdClosed"
);
}
@Override
public
void
onVideoComplete
()
{
Log
.
d
(
TAG
,
"onVideoComplete"
);
}
@Override
public
void
onVideoError
()
{
Log
.
d
(
TAG
,
"onVideoError"
);
}
@Override
public
void
onSkippedVideo
()
{
Log
.
d
(
TAG
,
"onSkippedVideo"
);
}
};
}
app/src/main/java/com/mints/flowbox/manager/CsjGroMoreManager.kt
View file @
17691cba
...
...
@@ -15,6 +15,7 @@ object CsjGroMoreManager {
var
AD_UNIT_SPLASH_ID
=
"887497104"
// 开屏
var
AD_UNIT_VIDEO_ID
=
"946265896"
// 激励视频
var
AD_UNIT_INTERSTITIAL_ID
=
"946265898"
// 插屏
var
AD_UNIT_FULL_ID
=
""
// 全屏
fun
init
(
application
:
MintsApplication
)
{
TTGroMoreAdManagerHolder
.
init
(
application
)
...
...
app/src/main/java/com/mints/flowbox/ui/activitys/MainActivity.kt
View file @
17691cba
...
...
@@ -369,28 +369,28 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
// 数美初始化
ShumeiManager
.
getInstance
().
initShumei
()
// 游客首次提示1500新人奖励 且 不是分享包
val
channel
=
CommonUtils
.
getAppMetaData
(
MintsApplication
.
getContext
(),
"CHANNEL_NAME"
)
if
(!
TextUtils
.
equals
(
channel
,
Constant
.
CHANNEL_SHARE
)
&&
AppPreferencesManager
.
get
().
getBoolean
(
Constant
.
FIRST_VISITOR_FLAG
,
true
)
)
{
AppPreferencesManager
.
get
().
put
(
Constant
.
FIRST_VISITOR_FLAG
,
false
)
val
bundle
=
Bundle
()
bundle
.
putInt
(
Constant
.
MAIN_CUR_COIN
,
if
(
userMsgBean
!=
null
&&
userMsgBean
!!
.
userMsg
.
showCoin
>
0
)
userMsgBean
?.
userMsg
?.
showCoin
!!
else
1500
)
bundle
.
putString
(
Constant
.
MAIN_CARRIER_TYPE
,
Constant
.
CARRIER_NEW_VISITOR
)
readyGo
(
AwardActivity
::
class
.
java
,
bundle
)
}
//
// 游客首次提示1500新人奖励 且 不是分享包
//
val channel = CommonUtils.getAppMetaData(
//
MintsApplication.getContext(),
//
"CHANNEL_NAME"
//
)
//
if (!TextUtils.equals(channel, Constant.CHANNEL_SHARE) && AppPreferencesManager.get().getBoolean(
//
Constant.FIRST_VISITOR_FLAG,
//
true
//
)
//
) {
//
AppPreferencesManager.get().put(Constant.FIRST_VISITOR_FLAG, false)
//
val bundle = Bundle()
//
bundle.putInt(
//
Constant.MAIN_CUR_COIN,
//
if (userMsgBean != null && userMsgBean!!.userMsg.showCoin > 0) userMsgBean?.userMsg?.showCoin!! else 1500
//
)
//
bundle.putString(
//
Constant.MAIN_CARRIER_TYPE,
//
Constant.CARRIER_NEW_VISITOR
//
)
//
readyGo(AwardActivity::class.java, bundle)
//
}
}
}
}
...
...
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