├── settings.gradle
├── app
├── src
│ └── main
│ │ ├── res
│ │ ├── values
│ │ │ ├── strings.xml
│ │ │ ├── colors.xml
│ │ │ └── styles.xml
│ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-nodpi
│ │ │ ├── banner_1.png
│ │ │ ├── banner_2.png
│ │ │ ├── banner_bg1.png
│ │ │ └── banner_bg2.png
│ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-anydpi-v26
│ │ │ ├── ic_launcher.xml
│ │ │ └── ic_launcher_round.xml
│ │ ├── layout
│ │ │ ├── item_banner.xml
│ │ │ ├── activity_main.xml
│ │ │ ├── activity_recycler_view.xml
│ │ │ └── activity_banner.xml
│ │ ├── drawable-v24
│ │ │ └── ic_launcher_foreground.xml
│ │ └── drawable
│ │ │ └── ic_launcher_background.xml
│ │ ├── java
│ │ └── com
│ │ │ └── wikikii
│ │ │ └── revealbanner
│ │ │ ├── bean
│ │ │ └── BannerListBean.java
│ │ │ ├── RecyclerViewActivity.java
│ │ │ ├── BannerListAdapter.java
│ │ │ └── BannerActivity.java
│ │ └── AndroidManifest.xml
├── .gitignore
├── proguard-rules.pro
└── build.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── reveal-banner
├── src
│ └── main
│ │ ├── res
│ │ ├── values
│ │ │ ├── strings.xml
│ │ │ └── ids.xml
│ │ ├── drawable
│ │ │ ├── icon_banner_indicator0.png
│ │ │ ├── icon_banner_indicator1.png
│ │ │ ├── indicator_normal_background.xml
│ │ │ └── indicator_selected_background.xml
│ │ └── layout
│ │ │ ├── item_normal_banner.xml
│ │ │ └── item_animation_banner.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ └── com
│ │ └── wikikii
│ │ └── bannerlib
│ │ └── banner
│ │ ├── LoopStyle.java
│ │ ├── bean
│ │ └── BannerInfo.java
│ │ ├── IndicatorLocation.java
│ │ ├── listener
│ │ ├── OnBannerItemClickListener.java
│ │ └── OnLoadImageViewListener.java
│ │ ├── util
│ │ ├── L.java
│ │ ├── DensityUtil.java
│ │ └── Tools.java
│ │ ├── OnDefaultImageViewLoader.java
│ │ ├── view
│ │ ├── BannerBgView.java
│ │ ├── BannerBgContainer.java
│ │ ├── BakedBezierInterpolator.java
│ │ └── RevealLayout.java
│ │ ├── LoopScroller.java
│ │ ├── LoopAdapterWrapper.java
│ │ └── LoopLayout.java
├── .gitignore
├── proguard-rules.pro
└── build.gradle
├── .gitignore
├── gradle.properties
├── gradlew.bat
├── README.md
└── gradlew
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':reveal-banner'
2 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | RevealBanner
3 |
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tokiii/RevealBanner/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/reveal-banner/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | bannerlib
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tokiii/RevealBanner/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tokiii/RevealBanner/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-nodpi/banner_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tokiii/RevealBanner/HEAD/app/src/main/res/mipmap-nodpi/banner_1.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-nodpi/banner_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tokiii/RevealBanner/HEAD/app/src/main/res/mipmap-nodpi/banner_2.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-nodpi/banner_bg1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tokiii/RevealBanner/HEAD/app/src/main/res/mipmap-nodpi/banner_bg1.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-nodpi/banner_bg2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tokiii/RevealBanner/HEAD/app/src/main/res/mipmap-nodpi/banner_bg2.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tokiii/RevealBanner/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tokiii/RevealBanner/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tokiii/RevealBanner/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/java/com/wikikii/revealbanner/bean/BannerListBean.java:
--------------------------------------------------------------------------------
1 | package com.wikikii.revealbanner.bean;
2 |
3 | public class BannerListBean {
4 | }
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tokiii/RevealBanner/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tokiii/RevealBanner/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tokiii/RevealBanner/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/reveal-banner/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tokiii/RevealBanner/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tokiii/RevealBanner/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/reveal-banner/src/main/res/drawable/icon_banner_indicator0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tokiii/RevealBanner/HEAD/reveal-banner/src/main/res/drawable/icon_banner_indicator0.png
--------------------------------------------------------------------------------
/reveal-banner/src/main/res/drawable/icon_banner_indicator1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tokiii/RevealBanner/HEAD/reveal-banner/src/main/res/drawable/icon_banner_indicator1.png
--------------------------------------------------------------------------------
/reveal-banner/src/main/res/values/ids.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/reveal-banner/src/main/res/drawable/indicator_normal_background.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/reveal-banner/src/main/res/drawable/indicator_selected_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Jul 13 22:34:27 CST 2020
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
7 |
8 | android.enableAapt2= false
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/reveal-banner/src/main/java/com/wikikii/bannerlib/banner/LoopStyle.java:
--------------------------------------------------------------------------------
1 | package com.wikikii.bannerlib.banner;
2 |
3 | /**
4 | * Loop style
5 | * 默认empty
6 | * 深度depth
7 | * 缩小zoo
8 | */
9 | public enum LoopStyle {
10 | Empty(-1),
11 | Depth(1),
12 | Zoom(2);
13 | private int value;
14 |
15 | LoopStyle(int idx) {
16 | this.value = idx;
17 | }
18 |
19 | public int getValue() {
20 | return value;
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/reveal-banner/src/main/java/com/wikikii/bannerlib/banner/bean/BannerInfo.java:
--------------------------------------------------------------------------------
1 | package com.wikikii.bannerlib.banner.bean;
2 |
3 | /**
4 | * BannerInfo
5 | *
6 | * @author Edwin.Wu
7 | * @version 2016/12/6 17:32
8 | * @since JDK1.8
9 | */
10 | public class BannerInfo {
11 | public T data;
12 | public String title;
13 |
14 | public BannerInfo(T data, String title) {
15 | this.data = data;
16 | this.title = title;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/reveal-banner/src/main/java/com/wikikii/bannerlib/banner/IndicatorLocation.java:
--------------------------------------------------------------------------------
1 | package com.wikikii.bannerlib.banner;
2 |
3 | /**
4 | * 指示器位置
5 | * Left左
6 | * center中
7 | * Right右
8 | */
9 | public enum IndicatorLocation {
10 | Left(1),
11 | Center(0),
12 | Right(2);
13 |
14 | private int value;
15 |
16 | IndicatorLocation(int idx) {
17 | this.value = idx;
18 | }
19 |
20 | public int getValue() {
21 | return value;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/reveal-banner/src/main/java/com/wikikii/bannerlib/banner/listener/OnBannerItemClickListener.java:
--------------------------------------------------------------------------------
1 | package com.wikikii.bannerlib.banner.listener;
2 |
3 |
4 | import com.wikikii.bannerlib.banner.bean.BannerInfo;
5 |
6 | import java.util.ArrayList;
7 |
8 | public interface OnBannerItemClickListener {
9 | /**
10 | * banner click
11 | *
12 | * @param index subscript
13 | * @param banner bean
14 | */
15 | void onBannerClick(int index, ArrayList banner);
16 | }
17 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.ap_
4 |
5 | # Files for the ART/Dalvik VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # Generated files
12 | bin/
13 | gen/
14 | out/
15 |
16 | # Gradle files
17 | .gradle/
18 | build/
19 |
20 | # Local configuration file (sdk path, etc)
21 | local.properties
22 |
23 | # Proguard folder generated by Eclipse
24 | proguard/
25 |
26 | # Log Files
27 | *.log
28 |
29 | # Android Studio Navigation editor temp files
30 | .navigation/
31 |
32 | # Android Studio captures folder
33 | captures/
34 |
35 | # Intellij
36 | *.iml
37 | .idea
38 |
39 | # Keystore files
40 | *.jks
41 |
42 | # MacOS
43 | .DS_Store
44 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.ap_
4 |
5 | # Files for the ART/Dalvik VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # Generated files
12 | bin/
13 | gen/
14 | out/
15 |
16 | # Gradle files
17 | .gradle/
18 | build/
19 |
20 | # Local configuration file (sdk path, etc)
21 | local.properties
22 |
23 | # Proguard folder generated by Eclipse
24 | proguard/
25 |
26 | # Log Files
27 | *.log
28 |
29 | # Android Studio Navigation editor temp files
30 | .navigation/
31 |
32 | # Android Studio captures folder
33 | captures/
34 |
35 | # Intellij
36 | *.iml
37 | .idea
38 |
39 | # Keystore files
40 | *.jks
41 |
42 | # MacOS
43 | .DS_Store
44 |
--------------------------------------------------------------------------------
/reveal-banner/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.ap_
4 |
5 | # Files for the ART/Dalvik VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # Generated files
12 | bin/
13 | gen/
14 | out/
15 |
16 | # Gradle files
17 | .gradle/
18 | build/
19 |
20 | # Local configuration file (sdk path, etc)
21 | local.properties
22 |
23 | # Proguard folder generated by Eclipse
24 | proguard/
25 |
26 | # Log Files
27 | *.log
28 |
29 | # Android Studio Navigation editor temp files
30 | .navigation/
31 |
32 | # Android Studio captures folder
33 | captures/
34 |
35 | # Intellij
36 | *.iml
37 | .idea
38 |
39 | # Keystore files
40 | *.jks
41 |
42 | # MacOS
43 | .DS_Store
44 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_banner.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
11 |
16 |
17 |
--------------------------------------------------------------------------------
/reveal-banner/src/main/res/layout/item_normal_banner.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
15 |
16 |
--------------------------------------------------------------------------------
/reveal-banner/src/main/java/com/wikikii/bannerlib/banner/util/L.java:
--------------------------------------------------------------------------------
1 | package com.wikikii.bannerlib.banner.util;
2 |
3 | import android.util.Log;
4 |
5 |
6 | public class L {
7 | public static boolean deBug = false;
8 | public static String TAG = "LoopView";
9 |
10 | public static void e(String msg) {
11 | if (deBug)
12 | Log.e(TAG, msg);
13 | }
14 |
15 | public static void e(String TAG, String msg) {
16 | if (deBug)
17 | Log.e(TAG, msg);
18 | }
19 |
20 | public static void e(String TAG, Throwable tr) {
21 | if (deBug)
22 | Log.e(TAG, "Error——", tr);
23 | }
24 |
25 | public static void e(String TAG, String msg, Throwable tr) {
26 | if (deBug)
27 | Log.e(TAG, msg, tr);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | android.enableJetifier=true
10 | android.useAndroidX=true
11 | org.gradle.jvmargs=-Xmx1536m
12 | # When configured, Gradle will run in incubating parallel mode.
13 | # This option should only be used with decoupled projects. More details, visit
14 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
15 | # org.gradle.parallel=true
16 |
--------------------------------------------------------------------------------
/reveal-banner/src/main/res/layout/item_animation_banner.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
19 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_recycler_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
11 |
12 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/reveal-banner/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/reveal-banner/src/main/java/com/wikikii/bannerlib/banner/OnDefaultImageViewLoader.java:
--------------------------------------------------------------------------------
1 | package com.wikikii.bannerlib.banner;
2 |
3 | import android.content.Context;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 |
7 | import com.wikikii.bannerlib.R;
8 | import com.wikikii.bannerlib.banner.listener.OnLoadImageViewListener;
9 |
10 |
11 | public abstract class OnDefaultImageViewLoader implements OnLoadImageViewListener {
12 |
13 | @Override
14 | public View createImageView(Context context, boolean isScaleAnimation) {
15 | View view;
16 | if (!isScaleAnimation) {
17 | view = LayoutInflater.from(context).inflate(R.layout.item_normal_banner, null, false);
18 | } else {
19 | view = LayoutInflater.from(context).inflate(R.layout.item_animation_banner, null, false);
20 |
21 | }
22 | return view;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/reveal-banner/src/main/java/com/wikikii/bannerlib/banner/listener/OnLoadImageViewListener.java:
--------------------------------------------------------------------------------
1 | package com.wikikii.bannerlib.banner.listener;
2 |
3 | import android.content.Context;
4 | import android.view.View;
5 | import android.widget.ImageView;
6 |
7 | public interface OnLoadImageViewListener {
8 | /**
9 | * create image
10 | *
11 | * @param context context
12 | * @return image
13 | */
14 | View createImageView(Context context, boolean isScaleAnimation);
15 |
16 | /**
17 | * image load
18 | *
19 | * @param imageView ImageView
20 | * @param parameter String 可以为一个文件路径、uri或者url
21 | * Uri uri类型
22 | * File 文件
23 | * Integer 资源Id,R.drawable.xxx或者R.mipmap.xxx
24 | * byte[] 类型
25 | * T 自定义类型
26 | */
27 | void onLoadImageView(ImageView imageView, Object parameter);
28 | }
29 |
--------------------------------------------------------------------------------
/reveal-banner/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 |
4 |
5 | android {
6 | compileSdkVersion 28
7 |
8 |
9 |
10 | defaultConfig {
11 | minSdkVersion 15
12 | targetSdkVersion 28
13 | versionCode 1
14 | versionName "1.0"
15 |
16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17 |
18 | }
19 |
20 | buildTypes {
21 | release {
22 | minifyEnabled false
23 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
24 | }
25 | }
26 |
27 | }
28 |
29 | dependencies {
30 | implementation fileTree(dir: 'libs', include: ['*.jar'])
31 |
32 | implementation 'androidx.appcompat:appcompat:1.1.0'
33 | testImplementation 'junit:junit:4.12'
34 | androidTestImplementation 'androidx.test.ext:junit:1.1.1'
35 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
36 | api "com.github.bumptech.glide:glide:4.11.0"
37 | }
38 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 |
4 | android {
5 | compileSdkVersion 28
6 | defaultConfig {
7 | applicationId "com.wikikii.revealbanner"
8 | minSdkVersion 15
9 | targetSdkVersion 27
10 | versionCode 1
11 | versionName "1.0"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | implementation fileTree(dir: 'libs', include: ['*.jar'])
23 | implementation 'androidx.appcompat:appcompat:1.1.0'
24 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
25 | implementation project(':reveal-banner')
26 | implementation 'androidx.recyclerview:recyclerview:1.1.0'
27 | implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.30'
28 | implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
29 |
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/reveal-banner/src/main/java/com/wikikii/bannerlib/banner/view/BannerBgView.java:
--------------------------------------------------------------------------------
1 | package com.wikikii.bannerlib.banner.view;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.widget.ImageView;
6 |
7 | /**
8 | * banner背景图
9 | */
10 | public class BannerBgView extends RevealLayout {
11 |
12 | private ImageView imageView;
13 |
14 | public BannerBgView(Context context) {
15 | super(context);
16 | addImageView(context);
17 | }
18 |
19 | public BannerBgView(Context context, AttributeSet attrs) {
20 | super(context, attrs);
21 | addImageView(context);
22 | }
23 |
24 | public BannerBgView(Context context, AttributeSet attrs, int defStyleAttr) {
25 | super(context, attrs, defStyleAttr);
26 | addImageView(context);
27 | }
28 |
29 |
30 | public void addImageView(Context context) {
31 | imageView = new ImageView(context);
32 | imageView.setScaleType(ImageView.ScaleType.FIT_XY);
33 | this.addView(imageView);
34 | }
35 |
36 |
37 | public ImageView getImageView() {
38 | return imageView;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_banner.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
16 |
19 |
20 |
24 |
25 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/reveal-banner/src/main/java/com/wikikii/bannerlib/banner/LoopScroller.java:
--------------------------------------------------------------------------------
1 | package com.wikikii.bannerlib.banner;
2 |
3 | import android.content.Context;
4 | import android.view.animation.Interpolator;
5 | import android.widget.Scroller;
6 |
7 | /**
8 | * Scroller
9 | * 更好的用户体验
10 | */
11 | public class LoopScroller extends Scroller {
12 | private int mDuration = 1000;//速率必须小于延迟时间loop_ms
13 |
14 | public LoopScroller(Context context) {
15 | super(context);
16 | }
17 |
18 | public LoopScroller(Context context, Interpolator interpolator) {
19 | super(context, interpolator);
20 | }
21 |
22 | public LoopScroller(Context context, Interpolator interpolator, boolean flywheel) {
23 | super(context, interpolator, flywheel);
24 | }
25 |
26 |
27 | @Override
28 | public void startScroll(int startX, int startY, int dx, int dy, int duration) {
29 | super.startScroll(startX, startY, dx, dy, mDuration);
30 | }
31 |
32 | @Override
33 | public void startScroll(int startX, int startY, int dx, int dy) {
34 | super.startScroll(startX, startY, dx, dy, mDuration);
35 | }
36 |
37 | public void setmDuration(int time) {
38 | mDuration = time;
39 | }
40 |
41 | public int getmDuration() {
42 | return mDuration;
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/reveal-banner/src/main/java/com/wikikii/bannerlib/banner/util/DensityUtil.java:
--------------------------------------------------------------------------------
1 | package com.wikikii.bannerlib.banner.util;
2 |
3 | import android.content.res.Resources;
4 |
5 | public class DensityUtil {
6 |
7 | public float density;
8 |
9 | public DensityUtil() {
10 | density = Resources.getSystem().getDisplayMetrics().density;
11 | }
12 |
13 | /**
14 | * 根据手机的分辨率从 dp 的单位 转成为 px(像素)
15 | * @param dpValue 虚拟像素
16 | * @return 像素
17 | */
18 | public static int dp2px(float dpValue) {
19 | return (int) (0.5f + dpValue * Resources.getSystem().getDisplayMetrics().density);
20 | }
21 |
22 | /**
23 | * 根据手机的分辨率从 px(像素) 的单位 转成为 dp
24 | * @param pxValue 像素
25 | * @return 虚拟像素
26 | */
27 | public static float px2dp(int pxValue) {
28 | return (pxValue / Resources.getSystem().getDisplayMetrics().density);
29 | }
30 |
31 | /**
32 | * 根据手机的分辨率从 dp 的单位 转成为 px(像素)
33 | * @param dpValue 虚拟像素
34 | * @return 像素
35 | */
36 | public int dip2px(float dpValue) {
37 | return (int) (0.5f + dpValue * density);
38 | }
39 |
40 | /**
41 | * 根据手机的分辨率从 px(像素) 的单位 转成为 dp
42 | * @param pxValue 像素
43 | * @return 虚拟像素
44 | */
45 | public float px2dip(int pxValue) {
46 | return (pxValue / density);
47 | }
48 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/reveal-banner/src/main/java/com/wikikii/bannerlib/banner/view/BannerBgContainer.java:
--------------------------------------------------------------------------------
1 | package com.wikikii.bannerlib.banner.view;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.widget.RelativeLayout;
6 |
7 | import com.bumptech.glide.Glide;
8 | import com.wikikii.bannerlib.banner.util.DensityUtil;
9 | import com.wikikii.bannerlib.banner.view.BannerBgView;
10 |
11 | import java.util.ArrayList;
12 | import java.util.List;
13 |
14 | /**
15 | * banner 背景容器
16 | */
17 | public class BannerBgContainer extends RelativeLayout {
18 |
19 | private List bannerBgViews = new ArrayList<>();
20 |
21 |
22 | public BannerBgContainer(Context context) {
23 | super(context);
24 | }
25 |
26 | public BannerBgContainer(Context context, AttributeSet attrs) {
27 | super(context, attrs);
28 | }
29 |
30 | public BannerBgContainer(Context context, AttributeSet attrs, int defStyleAttr) {
31 | super(context, attrs, defStyleAttr);
32 | }
33 |
34 | public List getBannerBgViews() {
35 | return this.bannerBgViews;
36 | }
37 |
38 | /**
39 | * 设置
40 | *
41 | * @param context
42 | * @param bgUrlList
43 | */
44 | public void setBannerBackBg(Context context, List