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
81a3d44c
Commit
81a3d44c
authored
Nov 26, 2020
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优量汇信息流集成
parent
8df2e49c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
93 additions
and
2 deletions
+93
-2
YlhPreLoadExpressManager.kt
...a/com/mints/goodmoney/manager/YlhPreLoadExpressManager.kt
+89
-0
FoodSubsidyActivity.kt
...a/com/mints/goodmoney/ui/activitys/FoodSubsidyActivity.kt
+4
-2
No files found.
GoodMoney/app/src/main/java/com/mints/goodmoney/manager/YlhPreLoadExpressManager.kt
0 → 100644
View file @
81a3d44c
package
com.mints.goodmoney.manager
import
android.view.View
import
android.widget.FrameLayout
import
com.mints.goodmoney.MintsApplication
import
com.qq.e.ads.nativ.ADSize
import
com.qq.e.ads.nativ.NativeExpressAD
import
com.qq.e.ads.nativ.NativeExpressADView
import
com.qq.e.comm.util.AdError
object
YlhPreLoadExpressManager
{
private
var
ylhFrameLayout
:
FrameLayout
?
=
null
private
var
nativeExpressAD
:
NativeExpressAD
?
=
null
private
var
nativeExpressADView
:
NativeExpressADView
?
=
null
fun
getYlhFrameLayout
():
FrameLayout
?
{
return
ylhFrameLayout
}
fun
loadYlhFrameLayout
()
{
val
context
=
MintsApplication
.
getContext
()
try
{
ylhFrameLayout
=
FrameLayout
(
context
)
nativeExpressAD
=
NativeExpressAD
(
MintsApplication
.
getContext
(),
ADSize
(
320
,
ADSize
.
AUTO_HEIGHT
),
YlhAdManager
.
YLH_AD_SPLASH_POSTID
,
object
:
NativeExpressAD
.
NativeExpressADListener
{
override
fun
onNoAD
(
p0
:
AdError
?)
{
}
override
fun
onADClicked
(
p0
:
NativeExpressADView
?)
{
}
override
fun
onADCloseOverlay
(
p0
:
NativeExpressADView
?)
{
}
override
fun
onADClosed
(
p0
:
NativeExpressADView
?)
{
}
override
fun
onADExposure
(
p0
:
NativeExpressADView
?)
{
}
override
fun
onADLeftApplication
(
p0
:
NativeExpressADView
?)
{
}
override
fun
onADLoaded
(
p0
:
MutableList
<
NativeExpressADView
>?)
{
// 释放前一个展示的NativeExpressADView的资源
nativeExpressADView
?.
destroy
()
if
(
ylhFrameLayout
!!
.
visibility
!=
View
.
VISIBLE
)
{
ylhFrameLayout
!!
.
visibility
=
View
.
VISIBLE
}
if
(
ylhFrameLayout
!!
.
childCount
>
0
)
{
ylhFrameLayout
!!
.
removeAllViews
()
}
// 广告可见才会产生曝光,否则将无法产生收益。
ylhFrameLayout
!!
.
addView
(
nativeExpressADView
)
nativeExpressADView
!!
.
render
()
}
override
fun
onADOpenOverlay
(
p0
:
NativeExpressADView
?)
{
}
override
fun
onRenderFail
(
p0
:
NativeExpressADView
?)
{
}
override
fun
onRenderSuccess
(
p0
:
NativeExpressADView
?)
{
}
})
nativeExpressAD
?.
loadAD
(
1
)
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
}
ylhFrameLayout
=
null
}
/**
* 在页面销毁时调用 destroy
*/
fun
destoryADView
()
{
// 使用完了每一个NativeExpressADView之后都要释放掉资源
nativeExpressADView
?.
destroy
()
}
}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/FoodSubsidyActivity.kt
View file @
81a3d44c
...
@@ -5,7 +5,7 @@ import android.view.View
...
@@ -5,7 +5,7 @@ import android.view.View
import
com.mints.goodmoney.R
import
com.mints.goodmoney.R
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.manager.TTNativeExpressManager
import
com.mints.goodmoney.manager.TTNativeExpressManager
import
com.mints.goodmoney.manager.
TtCsjAd
Manager
import
com.mints.goodmoney.manager.
YlhPreLoadExpress
Manager
import
com.mints.goodmoney.mvp.model.MealBean
import
com.mints.goodmoney.mvp.model.MealBean
import
com.mints.goodmoney.mvp.presenters.FoodSubsidyPresenter
import
com.mints.goodmoney.mvp.presenters.FoodSubsidyPresenter
import
com.mints.goodmoney.mvp.views.FoodSubsidyView
import
com.mints.goodmoney.mvp.views.FoodSubsidyView
...
@@ -101,7 +101,9 @@ class FoodSubsidyActivity : BaseActivity(), View.OnClickListener, FoodSubsidyVie
...
@@ -101,7 +101,9 @@ class FoodSubsidyActivity : BaseActivity(), View.OnClickListener, FoodSubsidyVie
private
fun
initExpress
()
{
private
fun
initExpress
()
{
try
{
try
{
// ttNativeExpressManager.initTTAd(false)
// ttNativeExpressManager.initTTAd(false)
ttNativeExpressManager
.
getNativeExpressInit
(
TtCsjAdManager
.
TT_AD_NATIVEEXPRESS_EAT
,
flWalkAd
,
320f
,
0f
)
// ttNativeExpressManager.getNativeExpressInit(TtCsjAdManager.TT_AD_NATIVEEXPRESS_EAT, flWalkAd, 320f, 0f)
YlhPreLoadExpressManager
.
loadYlhFrameLayout
()
flWalkAd
.
addView
(
YlhPreLoadExpressManager
.
getYlhFrameLayout
())
}
catch
(
e
:
Exception
)
{
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
e
.
printStackTrace
()
}
}
...
...
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