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
44569fae
Commit
44569fae
authored
Jul 26, 2021
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复信息流加载失败问题
parent
7e4866d2
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
115 additions
and
115 deletions
+115
-115
ExpressManager.kt
.../main/java/com/mints/flowbox/ad/express/ExpressManager.kt
+6
-27
PreExpressManager.kt
...in/java/com/mints/flowbox/ad/express/PreExpressManager.kt
+53
-0
PreLoadExpressManager.kt
...ava/com/mints/flowbox/ad/express/PreLoadExpressManager.kt
+0
-29
MainActivity.kt
.../main/java/com/mints/flowbox/ui/activitys/MainActivity.kt
+55
-55
SplashGroMoreActivity.java
...com/mints/flowbox/ui/activitys/SplashGroMoreActivity.java
+1
-4
No files found.
app/src/main/java/com/mints/flowbox/ad/express/ExpressManager.kt
View file @
44569fae
...
...
@@ -14,38 +14,20 @@ object ExpressManager {
* 加载应用内信息流
* @param isMain 是否是网赚信息流
*/
fun
loadExpress
(
isMain
:
Boolean
)
{
fun
loadExpress
(
isMain
:
Boolean
=
false
,
_frameLayout
:
FrameLayout
?
=
null
)
{
if
(
AppConfig
.
groMoreVideoAdCount
>
0
)
{
GroMoreCarrierExpressManager
.
instance
.
loadADFrameLayout
(
isMain
)
GroMoreCarrierExpressManager
.
instance
.
loadADFrameLayout
(
isMain
,
_frameLayout
)
}
else
{
PreLoadExpressManager
.
loadADFrameLayout
()
}
}
/**
* 加载应用
内
信息流
* @param is
Main 是否是网赚
信息流
* 加载应用
外
信息流
* @param is
Screen 是否是锁屏
信息流
*/
fun
loadExpress
(
isMain
:
Boolean
,
_frameLayout
:
FrameLayout
?
=
null
)
{
if
(
AppConfig
.
groMoreVideoAdCount
>
0
)
{
GroMoreCarrierExpressManager
.
instance
.
loadADFrameLayout
(
isMain
,
_frameLayout
)
}
else
{
PreLoadExpressManager
.
loadADFrameLayout
()
}
}
/** 加载应用外信息流 */
fun
loadAppOutExpress
(
isScreen
:
Boolean
=
false
)
{
if
(
AppConfig
.
groMoreVideoAdCount
>
0
)
{
AppOutGroMoreCarrierExpressManager
.
instance
.
loadADFrameLayout
(
isScreen
)
}
}
/** 加载应用外信息流 */
fun
loadAppOutExpress
(
isScreen
:
Boolean
=
false
,
_frameLayout
:
FrameLayout
?
=
null
)
{
if
(
AppConfig
.
groMoreVideoAdCount
>
0
)
{
AppOutGroMoreCarrierExpressManager
.
instance
.
loadADFrameLayout
(
isScreen
,
_frameLayout
)
}
AppOutGroMoreCarrierExpressManager
.
instance
.
loadADFrameLayout
(
isScreen
,
_frameLayout
)
}
/** 获取应用内信息流 */
...
...
@@ -59,10 +41,7 @@ object ExpressManager {
/** 获取应用外信息流 */
fun
getAppOutExpressFrameLayout
():
FrameLayout
?
{
if
(
AppConfig
.
groMoreVideoAdCount
>
0
)
{
return
AppOutGroMoreCarrierExpressManager
.
instance
.
getADFrameLayout
()
}
return
null
return
AppOutGroMoreCarrierExpressManager
.
instance
.
getADFrameLayout
()
}
val
lp
=
RelativeLayout
.
LayoutParams
(
...
...
app/src/main/java/com/mints/flowbox/ad/express/PreExpressManager.kt
0 → 100644
View file @
44569fae
package
com.mints.flowbox.ad.express
import
com.mints.flowbox.BuildConfig
import
com.mints.flowbox.utils.LogUtil
import
com.mints.flowbox.utils.TimeRender
/**
*
* @author jyx
* @date 2021/7/26
* @des 预加载信息流
*/
class
PreOutExpressManager
{
private
val
TAG
=
PreOutExpressManager
::
class
.
java
.
simpleName
private
val
adLoadTime
:
Long
=
0
// 广告展示时间,45分钟后当前广告失效,重新预加载广告
private
var
adPreingTime
:
Long
=
0
// 防止预加载超时 2分钟
private
var
isLoadSuccess
=
0
//0-加载失败/未加载 1-加载中 2-加载成功
fun
preloadExpress
()
{
val
isOversped
=
TimeRender
.
isOversped45Min
(
adLoadTime
,
45
)
val
isPreingOversped
=
TimeRender
.
isOversped45Min
(
adPreingTime
,
2
)
if
(
BuildConfig
.
DEBUG
)
{
LogUtil
.
d
(
TAG
,
"信息流预加载 ------> \n 1、进入预加载 isLoadSuccess="
+
isLoadSuccess
+
" isOversped="
+
isOversped
+
" isPreingOversped="
+
isPreingOversped
)
}
if
(
isLoadSuccess
==
0
// 加载失败
||
(
adLoadTime
>
0
&&
isOversped
)
// 广告超过45分钟
||
(
adPreingTime
>
0
&&
isPreingOversped
&&
isLoadSuccess
==
1
)
// 预加载超时2分钟
)
{
LogUtil
.
d
(
TAG
,
"信息流预加载 ------> \n 2、执行预加载去了=$isLoadSuccess"
)
adPreingTime
=
System
.
currentTimeMillis
()
isLoadSuccess
=
1
ExpressManager
.
loadAppOutExpress
(
true
)
}
}
fun
getExpress
()
{
}
}
\ No newline at end of file
app/src/main/java/com/mints/flowbox/ad/express/PreLoadExpressManager.kt
View file @
44569fae
...
...
@@ -21,9 +21,6 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
private
val
TAG
=
PreLoadExpressManager
::
class
.
java
.
simpleName
// @Volatile
// private var currentIndex = 0
@Volatile
private
var
mAdFrameLayout
:
FrameLayout
?
=
null
...
...
@@ -51,18 +48,6 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
fun
loadADFrameLayout
()
{
mAdFrameLayout
?.
removeAllViews
()
// when (++currentIndex) {
// 1 -> {
// TTPreLoadExpressManager.getInstance().loadTtFrameLayout(mAdFrameLayout)
// }
// 2 -> {
// YlhPreLoadExpressManager.loadYlhFrameLayout()
// }
// 3 -> {
// KsPreLoadExpressManager.loadKsFrameLayout(mAdFrameLayout as ViewGroup)
// }
// }
when
(
getRandomWeight
())
{
Constant
.
CSJ_EXPRESS_AD
->
TTPreLoadExpressManager
.
getInstance
()
.
loadTtFrameLayout
(
mAdFrameLayout
)
...
...
@@ -123,8 +108,6 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
}
fun
getADFrameLayout
():
FrameLayout
?
{
// if (currentIndex >= 3) currentIndex = 0
return
mAdFrameLayout
}
...
...
@@ -135,9 +118,6 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
}
override
fun
onTTAdLoadSuc
(
view
:
FrameLayout
?)
{
// if (currentIndex == 1) {
// mAdFrameLayout = adFrameLayout
// }
if
(
view
!=
null
)
{
AppConfig
.
isPreExpressAwardActivity
=
true
}
...
...
@@ -145,9 +125,6 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
}
override
fun
onYlhAdLoadSuc
(
view
:
NativeExpressADView
?)
{
// if (currentIndex == 2) {
// mAdFrameLayout?.addView(view)
// }
if
(
view
!=
null
)
{
AppConfig
.
isPreExpressAwardActivity
=
true
}
...
...
@@ -155,9 +132,6 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
}
override
fun
onKSAdLoadSuc
(
view
:
View
?)
{
// if (currentIndex == 3) {
// mAdFrameLayout?.addView(view)
// }
if
(
view
!=
null
)
{
AppConfig
.
isPreExpressAwardActivity
=
true
}
...
...
@@ -165,9 +139,6 @@ object PreLoadExpressManager : TTADLoadSuccessListener, YLHADLoadSuccessListener
}
override
fun
onGMAdLoadSuc
(
view
:
View
?)
{
// if (currentIndex == 3) {
// mAdFrameLayout?.addView(view)
// }
if
(
view
!=
null
)
{
AppConfig
.
isPreExpressAwardActivity
=
true
}
...
...
app/src/main/java/com/mints/flowbox/ui/activitys/MainActivity.kt
View file @
44569fae
This diff is collapsed.
Click to expand it.
app/src/main/java/com/mints/flowbox/ui/activitys/SplashGroMoreActivity.java
View file @
44569fae
...
...
@@ -41,11 +41,8 @@ import com.mints.flowbox.ui.widgets.dialog.PowerDialog;
import
com.mints.flowbox.utils.LogUtil
;
import
com.mints.library.utils.CommonUtils
;
import
org.jetbrains.annotations.NotNull
;
import
java.util.HashMap
;
/**
* GroMore开屏广告Activity示例
*/
...
...
@@ -113,7 +110,7 @@ public class SplashGroMoreActivity extends BaseActivity implements SplashView {
TrackManager
.
getInstance
().
firstApiWithUid
();
// 预加载弹窗信息流
ExpressManager
.
INSTANCE
.
loadExpress
(
true
);
ExpressManager
.
INSTANCE
.
loadExpress
(
true
,
null
);
mMainHandler
=
new
Handler
(
Looper
.
getMainLooper
());
...
...
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