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
849b1abd
Commit
849b1abd
authored
Mar 26, 2021
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Banner展示逻辑修改
parent
bb1506aa
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
28 deletions
+24
-28
BannerManager.kt
.../main/java/com/mints/goodmoney/ad/banner/BannerManager.kt
+3
-3
MyFragment.kt
...c/main/java/com/mints/goodmoney/ui/fragment/MyFragment.kt
+15
-19
fragment_main_my.xml
GoodMoney/app/src/main/res/layout/fragment_main_my.xml
+6
-6
No files found.
GoodMoney/app/src/main/java/com/mints/goodmoney/ad/banner/BannerManager.kt
View file @
849b1abd
...
@@ -32,7 +32,7 @@ object BannerManager {
...
@@ -32,7 +32,7 @@ object BannerManager {
val
displayMetrics
=
MintsApplication
.
getContext
().
resources
.
displayMetrics
val
displayMetrics
=
MintsApplication
.
getContext
().
resources
.
displayMetrics
val
density
=
displayMetrics
.
density
val
density
=
displayMetrics
.
density
// 屏幕宽度 - margin宽度
// 屏幕宽度 - margin宽度
val
pxWidth
=
displayMetrics
.
widthPixels
-
(
1
0
*
density
+
0.5f
)
val
pxWidth
=
displayMetrics
.
widthPixels
-
(
2
0
*
density
+
0.5f
)
return
pxWidth
/
density
+
0.5f
return
pxWidth
/
density
+
0.5f
}
}
...
@@ -51,7 +51,7 @@ object BannerManager {
...
@@ -51,7 +51,7 @@ object BannerManager {
when
(
codeId
)
{
when
(
codeId
)
{
TtCsjAdManager
.
TT_AD_BANNER_MY
->
{
TtCsjAdManager
.
TT_AD_BANNER_MY
->
{
expressViewAcceptedSizeWidth
=
getViewWidth
()
expressViewAcceptedSizeWidth
=
getViewWidth
()
expressViewAcceptedSizeHeight
=
getViewHeight
()
expressViewAcceptedSizeHeight
=
0f
}
}
}
}
...
@@ -64,7 +64,7 @@ object BannerManager {
...
@@ -64,7 +64,7 @@ object BannerManager {
.
setAdCount
(
1
)
//请求广告数量为1到3条
.
setAdCount
(
1
)
//请求广告数量为1到3条
.
setNativeAdType
(
AdSlot
.
TYPE_BANNER
)
.
setNativeAdType
(
AdSlot
.
TYPE_BANNER
)
.
setExpressViewAcceptedSize
(
expressViewAcceptedSizeWidth
,
expressViewAcceptedSizeHeight
)
//期望模板广告view的size,单位dp
.
setExpressViewAcceptedSize
(
expressViewAcceptedSizeWidth
,
expressViewAcceptedSizeHeight
)
//期望模板广告view的size,单位dp
.
setImageAcceptedSize
(
640
,
32
0
)
//这个参数设置即可,不影响模板广告的size
.
setImageAcceptedSize
(
640
,
24
0
)
//这个参数设置即可,不影响模板广告的size
.
build
()
.
build
()
it
.
loadBannerExpressAd
(
adSlot
,
object
:
TTAdNative
.
NativeExpressAdListener
{
it
.
loadBannerExpressAd
(
adSlot
,
object
:
TTAdNative
.
NativeExpressAdListener
{
override
fun
onNativeExpressAdLoad
(
ads
:
MutableList
<
TTNativeExpressAd
>?)
{
override
fun
onNativeExpressAdLoad
(
ads
:
MutableList
<
TTNativeExpressAd
>?)
{
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/MyFragment.kt
View file @
849b1abd
...
@@ -358,27 +358,23 @@ class MyFragment : BaseFragment(),
...
@@ -358,27 +358,23 @@ class MyFragment : BaseFragment(),
*/
*/
override
fun
getMyRotationChartSuc
(
data
:
RotationChartBean
)
{
override
fun
getMyRotationChartSuc
(
data
:
RotationChartBean
)
{
mBannerData
=
data
mBannerData
=
data
banner_view
.
visibility
=
View
.
VISIBLE
mAdBannerAdapter
=
AdBannerAdapter
(
activity
)
mAdBannerAdapter
?.
setOnPageClickListener
(
this
)
mAdBannerAdapter
?.
let
{
val
list
=
mutableListOf
<
RotationChartBean
.
ListBean
?>()
if
(
mBannerData
?.
list
==
null
||
mBannerData
?.
list
!!
.
size
==
0
)
{
if
(
mBannerData
?.
list
==
null
||
mBannerData
?.
list
!!
.
size
==
0
)
{
list
.
addAll
(
it
.
mDatas
)
fl_my_banner
.
visibility
=
View
.
VISIBLE
banner_view
.
setStopScroll
(
true
)
banner_view
.
visibility
=
View
.
GONE
banner_view
.
stopAutoScroll
(
)
BannerManager
.
getTtBanner
(
TtCsjAdManager
.
TT_AD_BANNER_MY
,
fl_my_banner
)
}
else
{
}
else
{
list
.
addAll
(
mBannerData
!!
.
list
)
fl_my_banner
.
visibility
=
View
.
GONE
banner_view
.
setStopScroll
(
false
)
banner_view
.
visibility
=
View
.
VISIBLE
banner_view
.
startAutoScroll
()
mAdBannerAdapter
=
AdBannerAdapter
(
activity
)
}
list
.
add
(
data
.
position
,
null
)
it
.
setData
(
list
)
mAdBannerAdapter
?.
let
{
it
.
setOnPageClickListener
(
this
)
it
.
setData
(
mBannerData
?.
list
)
it
.
setAdPosition
(
data
.
position
)
it
.
setAdPosition
(
data
.
position
)
banner_view
.
setAdapter
(
it
)
}
}
}
banner_view
.
setAdapter
(
mAdBannerAdapter
)
}
}
override
fun
onRefresh
(
refreshLayout
:
RefreshLayout
)
{
override
fun
onRefresh
(
refreshLayout
:
RefreshLayout
)
{
...
...
GoodMoney/app/src/main/res/layout/fragment_main_my.xml
View file @
849b1abd
...
@@ -36,6 +36,12 @@
...
@@ -36,6 +36,12 @@
<include
layout=
"@layout/item_fragment_main_my_clock"
/>
<include
layout=
"@layout/item_fragment_main_my_clock"
/>
<include
layout=
"@layout/item_divider_gray"
/>
<include
layout=
"@layout/item_fragment_main_my_promotions"
/>
<include
layout=
"@layout/item_divider_gray"
/>
<FrameLayout
<FrameLayout
android:id=
"@+id/fl_my_banner"
android:id=
"@+id/fl_my_banner"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
...
@@ -45,12 +51,6 @@
...
@@ -45,12 +51,6 @@
android:background=
"@drawable/shape_bg_award"
android:background=
"@drawable/shape_bg_award"
android:visibility=
"gone"
/>
android:visibility=
"gone"
/>
<include
layout=
"@layout/item_divider_gray"
/>
<include
layout=
"@layout/item_fragment_main_my_promotions"
/>
<include
layout=
"@layout/item_divider_gray"
/>
<com.mints.goodmoney.ui.widgets.BannerView
<com.mints.goodmoney.ui.widgets.BannerView
android:id=
"@+id/banner_view"
android:id=
"@+id/banner_view"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
...
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