Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
I
ImageVideoBanner
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jiangjiantao
ImageVideoBanner
Commits
70319ef7
Commit
70319ef7
authored
Oct 14, 2020
by
gaodapeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改了部分逻辑,把replace改成setData,方便多次设置
parent
5f36cec8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
28 deletions
+25
-28
ImageVideoBanner.java
...rc/main/java/com/widget/imagebanner/ImageVideoBanner.java
+13
-16
AndroidManifest.xml
imageVideoBanner/src/main/AndroidManifest.xml
+12
-12
No files found.
banner/src/main/java/com/widget/imagebanner/ImageVideoBanner.java
View file @
70319ef7
...
...
@@ -86,8 +86,10 @@ public class ImageVideoBanner extends FrameLayout implements ImageVideoFragment.
}
public
void
replaceData
(
List
<
com
.
widget
.
imagebanner
.
bean
.
BannerBean
>
listBean
)
{
mAdapter
.
replaceData
(
listBean
);
public
void
setData
(
List
<
com
.
widget
.
imagebanner
.
bean
.
BannerBean
>
listBean
)
{
if
(
listBean
!=
null
)
{
mAdapter
.
setData
(
listBean
);
}
}
public
void
addData
(
List
<
com
.
widget
.
imagebanner
.
bean
.
BannerBean
>
listBean
)
{
...
...
@@ -207,10 +209,12 @@ public class ImageVideoBanner extends FrameLayout implements ImageVideoFragment.
public
void
startBanner
()
{
//如果第一页是视频 不用定时器
if
(
mList
.
size
()
>
0
)
{
if
(
mList
.
get
(
0
).
getType
()
==
0
)
{
startBanner
(
period
);
}
}
}
public
void
startBanner
(
long
delay
)
{
stopBanner
();
...
...
@@ -288,24 +292,17 @@ public class ImageVideoBanner extends FrameLayout implements ImageVideoFragment.
return
false
;
}
public
void
replaceData
(
List
<
BannerBean
>
listBean
)
{
public
void
setData
(
@NonNull
List
<
BannerBean
>
listBean
)
{
// 新数据和原来数据对比,不一致才去刷新
boolean
change
=
compareData
(
listBean
);
if
(!
change
)
{
notifyDataSetChanged
();
// startBanner();
return
;
}
if
(
null
!=
listBean
)
{
mList
.
clear
();
addData
(
listBean
);
//如果第一张是图片 需要开启定时器
if
(
listBean
.
get
(
0
).
getType
()
==
0
)
{
startBanner
();
}
notifyDataSetChanged
();
autoCurrIndex
=
0
;
// startBanner();
}
}
...
...
imageVideoBanner/src/main/AndroidManifest.xml
View file @
70319ef7
...
...
@@ -15,18 +15,18 @@
android:supportsRtl=
"true"
android:theme=
"@style/AppTheme"
>
<
!--<activity-->
<!--android:name=".MainActivity"-->
<!--android:configChanges="orientation|keyboardHidden|screenSize|keyboard|navigation"-->
<!--android:exported="true"-->
<!--android:launchMode="singleTask"-->
<!--android:screenOrientation="portrait">--
>
<
!--<intent-filter>--
>
<
!--<action android:name="android.intent.action.MAIN" />--
>
<
!--<category android:name="android.intent.category.LAUNCHER" />--
>
<
!--</intent-filter>--
>
<
!--</activity>--
>
<
activity
android:name=
".MainActivity"
android:configChanges=
"orientation|keyboardHidden|screenSize|keyboard|navigation"
android:exported=
"true"
android:launchMode=
"singleTask"
android:screenOrientation=
"portrait"
>
<
intent-filter
>
<
action
android:name=
"android.intent.action.MAIN"
/
>
<
category
android:name=
"android.intent.category.LAUNCHER"
/
>
<
/intent-filter
>
<
/activity
>
</application>
...
...
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