Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
B
Browser White
Project
Project
Details
Activity
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanglei
Browser White
Commits
5eba597d
Commit
5eba597d
authored
Sep 04, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
783cec50
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
42 deletions
+57
-42
AdmobMaxHelper.kt
...src/main/java/com/base/browserwhite/ads/AdmobMaxHelper.kt
+1
-1
AdmobNativeUtils.kt
.../java/com/base/browserwhite/ads/admob/AdmobNativeUtils.kt
+47
-1
NewsActivity.kt
...va/com/base/browserwhite/ui/activity/news/NewsActivity.kt
+4
-2
ResultActivity.kt
...om/base/browserwhite/ui/activity/result/ResultActivity.kt
+4
-2
HomeFragment.kt
...in/java/com/base/browserwhite/ui/fragment/HomeFragment.kt
+1
-36
No files found.
app/src/main/java/com/base/browserwhite/ads/AdmobMaxHelper.kt
View file @
5eba597d
...
...
@@ -163,7 +163,7 @@ object AdmobMaxHelper {
if
(
getSpAdmobTrueMaxFalse
())
{
// com.base.browserwhite.ads.admob.AdmobOpenUtils.loadAppOpenAd()
AdmobInterstitialUtils
.
loadInterstitialAd
(
activity
)
AdmobNativeUtils
.
loadNativeList
(
3
)
AdmobNativeUtils
.
loadNativeList
(
4
)
}
else
{
if
(
isAdInit
.
get
())
{
// com.base.browserwhite.ads.max.AdMaxOpenUtils.loadAppOpenAd(activity)
...
...
app/src/main/java/com/base/browserwhite/ads/admob/AdmobNativeUtils.kt
View file @
5eba597d
...
...
@@ -10,6 +10,7 @@ import com.base.browserwhite.ads.AdDisplayUtils
import
com.base.browserwhite.ads.admob.AdmobEvent.clickAd
import
com.base.browserwhite.ads.admob.AdmobEvent.pullAd
import
com.base.browserwhite.ads.admob.AdmobEvent.showAd
import
com.base.browserwhite.bean.NewsBean
import
com.base.browserwhite.help.ConfigHelper
import
com.base.browserwhite.help.EventUtils
import
com.base.browserwhite.utils.LogEx
...
...
@@ -137,7 +138,7 @@ object AdmobNativeUtils {
}
}
var
readyNative
=
arrayListOf
<
NativeAd
>()
var
readyNative
=
arrayListOf
<
NativeAd
>()
fun
loadNativeList
(
count
:
Int
)
{
readyNative
.
clear
()
repeat
(
count
)
{
...
...
@@ -162,4 +163,49 @@ object AdmobNativeUtils {
adLoader
.
loadAd
(
mRequest
)
}
}
fun
addNativeAdNewsBean
(
it
:
List
<
NewsBean
>):
ArrayList
<
NewsBean
>
{
val
list
=
arrayListOf
<
NewsBean
>()
it
.
forEachIndexed
{
index
,
newsBean
->
list
.
add
(
newsBean
)
if
(
index
==
0
)
{
runCatching
{
val
ad
=
AdmobNativeUtils
.
readyNative
[
0
]
list
.
add
(
NewsBean
().
apply
{
uiType
=
1
nativeAd
=
ad
})
}
}
if
(
index
==
4
)
{
runCatching
{
val
ad
=
AdmobNativeUtils
.
readyNative
[
1
]
list
.
add
(
NewsBean
().
apply
{
uiType
=
1
nativeAd
=
ad
})
}
}
if
(
index
==
8
)
{
runCatching
{
val
ad
=
AdmobNativeUtils
.
readyNative
[
2
]
list
.
add
(
NewsBean
().
apply
{
uiType
=
1
nativeAd
=
ad
})
}
}
if
(
index
==
12
)
{
runCatching
{
val
ad
=
AdmobNativeUtils
.
readyNative
[
3
]
list
.
add
(
NewsBean
().
apply
{
uiType
=
1
nativeAd
=
ad
})
}
}
}
AdmobNativeUtils
.
loadNativeList
(
4
)
return
list
}
}
\ No newline at end of file
app/src/main/java/com/base/browserwhite/ui/activity/news/NewsActivity.kt
View file @
5eba597d
...
...
@@ -7,6 +7,7 @@ import androidx.activity.addCallback
import
androidx.core.view.updatePadding
import
com.base.browserwhite.ads.AdmobMaxHelper
import
com.base.browserwhite.ads.AdmobMaxHelper.lastShowInter
import
com.base.browserwhite.ads.admob.AdmobNativeUtils
import
com.base.browserwhite.bean.NewsCategory
import
com.base.browserwhite.databinding.ActivityNewsBinding
import
com.base.browserwhite.databinding.ItemTabNewsBinding
...
...
@@ -122,10 +123,11 @@ class NewsActivity : BaseActivity<ActivityNewsBinding>() {
if
(
it
.
isNotEmpty
())
{
binding
.
ivPlaceHolder
.
visibility
=
View
.
GONE
}
val
newsAdList
=
AdmobNativeUtils
.
addNativeAdNewsBean
(
it
)
if
(
lastNewsId
==
null
||
changeCategory
)
{
newsAdapter
.
submitList
(
i
t
)
newsAdapter
.
submitList
(
newsAdLis
t
)
}
else
{
newsAdapter
.
addAll
(
i
t
)
newsAdapter
.
addAll
(
newsAdLis
t
)
}
helper
.
trailingLoadState
=
LoadState
.
NotLoading
(
false
)
}
...
...
app/src/main/java/com/base/browserwhite/ui/activity/result/ResultActivity.kt
View file @
5eba597d
...
...
@@ -4,6 +4,7 @@ import android.annotation.SuppressLint
import
android.content.Intent
import
android.graphics.Color
import
androidx.activity.addCallback
import
com.base.browserwhite.ads.admob.AdmobNativeUtils
import
com.base.browserwhite.bean.ConstObject.APP_PROCESS
import
com.base.browserwhite.bean.ConstObject.JUNK_CLEANER
import
com.base.browserwhite.databinding.ActivityResultBinding
...
...
@@ -108,10 +109,11 @@ class ResultActivity : BaseActivity<ActivityResultBinding>() {
isLoading
=
false
binding
.
root
.
post
{
LogEx
.
logDebug
(
TAG
,
"beanCallBack"
)
val
newsAdList
=
AdmobNativeUtils
.
addNativeAdNewsBean
(
it
)
if
(
lastNewsId
==
null
)
{
newsAdapter
.
submitList
(
i
t
)
newsAdapter
.
submitList
(
newsAdLis
t
)
}
else
{
newsAdapter
.
addAll
(
i
t
)
newsAdapter
.
addAll
(
newsAdLis
t
)
}
helper
.
trailingLoadState
=
LoadState
.
NotLoading
(
false
)
}
...
...
app/src/main/java/com/base/browserwhite/ui/fragment/HomeFragment.kt
View file @
5eba597d
...
...
@@ -220,7 +220,7 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>() {
LogEx
.
logDebug
(
TAG
,
"errorCallBack"
)
},
beanCallBack
=
{
isLoading
=
false
val
newsAdList
=
addNativeAdNewsBean
(
it
)
val
newsAdList
=
AdmobNativeUtils
.
addNativeAdNewsBean
(
it
)
binding
.
root
.
post
{
LogEx
.
logDebug
(
TAG
,
"beanCallBack"
)
if
(
lastNewsId
==
null
)
{
...
...
@@ -234,41 +234,6 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>() {
})
}
private
fun
addNativeAdNewsBean
(
it
:
List
<
NewsBean
>):
ArrayList
<
NewsBean
>
{
val
list
=
arrayListOf
<
NewsBean
>()
it
.
forEachIndexed
{
index
,
newsBean
->
list
.
add
(
newsBean
)
if
(
index
==
1
)
{
runCatching
{
val
ad
=
AdmobNativeUtils
.
readyNative
[
0
]
list
.
add
(
NewsBean
().
apply
{
uiType
=
1
nativeAd
=
ad
})
}
}
if
(
index
==
6
)
{
runCatching
{
val
ad
=
AdmobNativeUtils
.
readyNative
[
1
]
list
.
add
(
NewsBean
().
apply
{
uiType
=
1
nativeAd
=
ad
})
}
}
if
(
index
==
1
)
{
runCatching
{
val
ad
=
AdmobNativeUtils
.
readyNative
[
3
]
list
.
add
(
NewsBean
().
apply
{
uiType
=
1
nativeAd
=
ad
})
}
}
}
AdmobNativeUtils
.
loadNativeList
(
3
)
return
list
}
override
fun
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
?)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
)
...
...
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