├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── .gitignore ├── .idea ├── encodings.xml ├── kotlinc.xml └── vcs.xml ├── LICENSE ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── smarteist │ │ └── imageslider │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── smarteist │ │ │ └── imageslider │ │ │ ├── MainActivity.java │ │ │ ├── Model │ │ │ └── SliderItem.java │ │ │ └── SliderAdapterExample.java │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ ├── bg_overlay.xml │ │ ├── ic_launcher_background.xml │ │ ├── oh_look_at_this.gif │ │ └── puma_offer.jpg │ │ ├── layout │ │ ├── activity_main.xml │ │ └── image_slider_layout_item.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.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 │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── smarteist │ └── imageslider │ └── ExampleUnitTest.java ├── autoimageslider ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── smarteist │ │ └── autoimageslider │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── smarteist │ │ │ └── autoimageslider │ │ │ ├── IndicatorView │ │ │ ├── IndicatorManager.java │ │ │ ├── PageIndicatorView.java │ │ │ ├── animation │ │ │ │ ├── AnimationManager.java │ │ │ │ ├── controller │ │ │ │ │ ├── AnimationController.java │ │ │ │ │ └── ValueController.java │ │ │ │ ├── data │ │ │ │ │ ├── AnimationValue.java │ │ │ │ │ ├── Value.java │ │ │ │ │ └── type │ │ │ │ │ │ ├── ColorAnimationValue.java │ │ │ │ │ │ ├── DropAnimationValue.java │ │ │ │ │ │ ├── FillAnimationValue.java │ │ │ │ │ │ ├── ScaleAnimationValue.java │ │ │ │ │ │ ├── SlideAnimationValue.java │ │ │ │ │ │ ├── SwapAnimationValue.java │ │ │ │ │ │ ├── ThinWormAnimationValue.java │ │ │ │ │ │ └── WormAnimationValue.java │ │ │ │ └── type │ │ │ │ │ ├── BaseAnimation.java │ │ │ │ │ ├── ColorAnimation.java │ │ │ │ │ ├── DropAnimation.java │ │ │ │ │ ├── FillAnimation.java │ │ │ │ │ ├── IndicatorAnimationType.java │ │ │ │ │ ├── ScaleAnimation.java │ │ │ │ │ ├── ScaleDownAnimation.java │ │ │ │ │ ├── SlideAnimation.java │ │ │ │ │ ├── SwapAnimation.java │ │ │ │ │ ├── ThinWormAnimation.java │ │ │ │ │ └── WormAnimation.java │ │ │ ├── draw │ │ │ │ ├── DrawManager.java │ │ │ │ ├── controller │ │ │ │ │ ├── AttributeController.java │ │ │ │ │ ├── DrawController.java │ │ │ │ │ └── MeasureController.java │ │ │ │ ├── data │ │ │ │ │ ├── Indicator.java │ │ │ │ │ ├── Orientation.java │ │ │ │ │ ├── PositionSavedState.java │ │ │ │ │ └── RtlMode.java │ │ │ │ └── drawer │ │ │ │ │ ├── Drawer.java │ │ │ │ │ └── type │ │ │ │ │ ├── BaseDrawer.java │ │ │ │ │ ├── BasicDrawer.java │ │ │ │ │ ├── ColorDrawer.java │ │ │ │ │ ├── DropDrawer.java │ │ │ │ │ ├── FillDrawer.java │ │ │ │ │ ├── ScaleDownDrawer.java │ │ │ │ │ ├── ScaleDrawer.java │ │ │ │ │ ├── SlideDrawer.java │ │ │ │ │ ├── SwapDrawer.java │ │ │ │ │ ├── ThinWormDrawer.java │ │ │ │ │ └── WormDrawer.java │ │ │ └── utils │ │ │ │ ├── CoordinatesUtils.java │ │ │ │ ├── DensityUtils.java │ │ │ │ └── IdUtils.java │ │ │ ├── InfiniteAdapter │ │ │ └── InfinitePagerAdapter.java │ │ │ ├── SliderAnimations.java │ │ │ ├── SliderPager.java │ │ │ ├── SliderView.java │ │ │ ├── SliderViewAdapter.java │ │ │ └── Transformations │ │ │ ├── AntiClockSpinTransformation.java │ │ │ ├── Clock_SpinTransformation.java │ │ │ ├── CubeInDepthTransformation.java │ │ │ ├── CubeInRotationTransformation.java │ │ │ ├── CubeInScalingTransformation.java │ │ │ ├── CubeOutDepthTransformation.java │ │ │ ├── CubeOutRotationTransformation.java │ │ │ ├── CubeOutScalingTransformation.java │ │ │ ├── DepthTransformation.java │ │ │ ├── FadeTransformation.java │ │ │ ├── FanTransformation.java │ │ │ ├── FidgetSpinTransformation.java │ │ │ ├── GateTransformation.java │ │ │ ├── HingeTransformation.java │ │ │ ├── HorizontalFlipTransformation.java │ │ │ ├── PopTransformation.java │ │ │ ├── SimpleTransformation.java │ │ │ ├── SpinnerTransformation.java │ │ │ ├── TossTransformation.java │ │ │ ├── VerticalFlipTransformation.java │ │ │ ├── VerticalShutTransformation.java │ │ │ └── ZoomOutTransformation.java │ └── res │ │ └── values │ │ ├── attrs.xml │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── smarteist │ └── autoimageslider │ └── ExampleUnitTest.java ├── build.gradle ├── gif ├── 0.gif ├── 4.gif ├── 7.gif └── 8.gif ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/libraries 5 | /.idea/modules.xml 6 | /.idea/workspace.xml 7 | .DS_Store 8 | /build 9 | /captures 10 | .externalNativeBuild 11 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/kotlinc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | defaultConfig { 6 | applicationId "com.smarteist.imageslider" 7 | minSdkVersion 15 8 | targetSdkVersion 28 9 | versionCode 1 10 | versionName "1.0" 11 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 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(include: ['*.jar'], dir: 'libs') 23 | implementation 'androidx.appcompat:appcompat:1.0.2' 24 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 25 | implementation 'androidx.legacy:legacy-support-v4:1.0.0' 26 | testImplementation 'junit:junit:4.12' 27 | implementation 'com.github.bumptech.glide:glide:4.9.0' 28 | annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0' 29 | androidTestImplementation 'androidx.test:runner:1.1.1' 30 | implementation 'androidx.cardview:cardview:1.0.0' 31 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 32 | implementation project(':autoimageslider') 33 | } 34 | -------------------------------------------------------------------------------- /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/androidTest/java/com/smarteist/imageslider/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.smarteist.imageslider; 2 | 3 | import android.content.Context; 4 | import androidx.test.InstrumentationRegistry; 5 | import androidx.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.smarteist.imageslider", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/smarteist/imageslider/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.smarteist.imageslider; 2 | 3 | import android.graphics.Color; 4 | import android.os.Bundle; 5 | import android.util.Log; 6 | import android.view.View; 7 | 8 | import androidx.appcompat.app.AppCompatActivity; 9 | 10 | import com.smarteist.autoimageslider.IndicatorView.PageIndicatorView; 11 | import com.smarteist.autoimageslider.IndicatorView.animation.type.IndicatorAnimationType; 12 | import com.smarteist.autoimageslider.IndicatorView.draw.controller.DrawController; 13 | import com.smarteist.autoimageslider.SliderAnimations; 14 | import com.smarteist.autoimageslider.SliderView; 15 | import com.smarteist.imageslider.Model.SliderItem; 16 | 17 | import java.util.ArrayList; 18 | import java.util.List; 19 | 20 | public class MainActivity extends AppCompatActivity { 21 | 22 | SliderView sliderView; 23 | private SliderAdapterExample adapter; 24 | 25 | @Override 26 | protected void onCreate(Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | setContentView(R.layout.activity_main); 29 | 30 | sliderView = findViewById(R.id.imageSlider); 31 | 32 | 33 | adapter = new SliderAdapterExample(this); 34 | sliderView.setSliderAdapter(adapter); 35 | sliderView.setIndicatorAnimation(IndicatorAnimationType.WORM); //set indicator animation by using SliderLayout.IndicatorAnimations. :WORM or THIN_WORM or COLOR or DROP or FILL or NONE or SCALE or SCALE_DOWN or SLIDE and SWAP!! 36 | sliderView.setSliderTransformAnimation(SliderAnimations.SIMPLETRANSFORMATION); 37 | sliderView.setAutoCycleDirection(SliderView.AUTO_CYCLE_DIRECTION_BACK_AND_FORTH); 38 | sliderView.setIndicatorSelectedColor(Color.WHITE); 39 | sliderView.setIndicatorUnselectedColor(Color.GRAY); 40 | sliderView.setScrollTimeInSec(3); 41 | sliderView.setAutoCycle(true); 42 | sliderView.startAutoCycle(); 43 | 44 | 45 | sliderView.setOnIndicatorClickListener(new DrawController.ClickListener() { 46 | @Override 47 | public void onIndicatorClicked(int position) { 48 | Log.i("GGG", "onIndicatorClicked: " + sliderView.getCurrentPagePosition()); 49 | } 50 | }); 51 | 52 | } 53 | 54 | public void renewItems(View view) { 55 | List sliderItemList = new ArrayList<>(); 56 | //dummy data 57 | for (int i = 0; i < 5; i++) { 58 | SliderItem sliderItem = new SliderItem(); 59 | sliderItem.setDescription("Slider Item " + i); 60 | if (i % 2 == 0) { 61 | sliderItem.setImageUrl("https://images.pexels.com/photos/929778/pexels-photo-929778.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260"); 62 | } else { 63 | sliderItem.setImageUrl("https://images.pexels.com/photos/747964/pexels-photo-747964.jpeg?auto=compress&cs=tinysrgb&h=750&w=1260"); 64 | } 65 | sliderItemList.add(sliderItem); 66 | } 67 | adapter.renewItems(sliderItemList); 68 | } 69 | 70 | public void removeLastItem(View view) { 71 | if (adapter.getCount() - 1 >= 0) 72 | adapter.deleteItem(adapter.getCount() - 1); 73 | } 74 | 75 | public void addNewItem(View view) { 76 | SliderItem sliderItem = new SliderItem(); 77 | sliderItem.setDescription("Slider Item Added Manually"); 78 | sliderItem.setImageUrl("https://images.pexels.com/photos/929778/pexels-photo-929778.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260"); 79 | adapter.addItem(sliderItem); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /app/src/main/java/com/smarteist/imageslider/Model/SliderItem.java: -------------------------------------------------------------------------------- 1 | package com.smarteist.imageslider.Model; 2 | 3 | public class SliderItem { 4 | 5 | private String description; 6 | private String imageUrl; 7 | 8 | public String getDescription() { 9 | return description; 10 | } 11 | 12 | public void setDescription(String description) { 13 | this.description = description; 14 | } 15 | 16 | public String getImageUrl() { 17 | return imageUrl; 18 | } 19 | 20 | public void setImageUrl(String imageUrl) { 21 | this.imageUrl = imageUrl; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/smarteist/imageslider/SliderAdapterExample.java: -------------------------------------------------------------------------------- 1 | package com.smarteist.imageslider; 2 | 3 | import android.content.Context; 4 | import android.graphics.Color; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.ImageView; 9 | import android.widget.TextView; 10 | import android.widget.Toast; 11 | import com.bumptech.glide.Glide; 12 | import com.smarteist.autoimageslider.SliderViewAdapter; 13 | import com.smarteist.imageslider.Model.SliderItem; 14 | import java.util.ArrayList; 15 | import java.util.List; 16 | 17 | public class SliderAdapterExample extends 18 | SliderViewAdapter { 19 | 20 | private Context context; 21 | private List mSliderItems = new ArrayList<>(); 22 | 23 | public SliderAdapterExample(Context context) { 24 | this.context = context; 25 | } 26 | 27 | public void renewItems(List sliderItems) { 28 | this.mSliderItems = sliderItems; 29 | notifyDataSetChanged(); 30 | } 31 | 32 | public void deleteItem(int position) { 33 | this.mSliderItems.remove(position); 34 | notifyDataSetChanged(); 35 | } 36 | 37 | public void addItem(SliderItem sliderItem) { 38 | this.mSliderItems.add(sliderItem); 39 | notifyDataSetChanged(); 40 | } 41 | 42 | @Override 43 | public SliderAdapterVH onCreateViewHolder(ViewGroup parent) { 44 | View inflate = LayoutInflater.from(parent.getContext()).inflate(R.layout.image_slider_layout_item, null); 45 | return new SliderAdapterVH(inflate); 46 | } 47 | 48 | @Override 49 | public void onBindViewHolder(SliderAdapterVH viewHolder, final int position) { 50 | 51 | SliderItem sliderItem = mSliderItems.get(position); 52 | 53 | viewHolder.textViewDescription.setText(sliderItem.getDescription()); 54 | viewHolder.textViewDescription.setTextSize(16); 55 | viewHolder.textViewDescription.setTextColor(Color.WHITE); 56 | Glide.with(viewHolder.itemView) 57 | .load(sliderItem.getImageUrl()) 58 | .fitCenter() 59 | .into(viewHolder.imageViewBackground); 60 | 61 | viewHolder.itemView.setOnClickListener(new View.OnClickListener() { 62 | @Override 63 | public void onClick(View v) { 64 | Toast.makeText(context, "This is item in position " + position, Toast.LENGTH_SHORT).show(); 65 | } 66 | }); 67 | } 68 | 69 | @Override 70 | public int getCount() { 71 | //slider view count could be dynamic size 72 | return mSliderItems.size(); 73 | } 74 | 75 | class SliderAdapterVH extends SliderViewAdapter.ViewHolder { 76 | 77 | View itemView; 78 | ImageView imageViewBackground; 79 | ImageView imageGifContainer; 80 | TextView textViewDescription; 81 | 82 | public SliderAdapterVH(View itemView) { 83 | super(itemView); 84 | imageViewBackground = itemView.findViewById(R.id.iv_auto_image_slider); 85 | imageGifContainer = itemView.findViewById(R.id.iv_gif_container); 86 | textViewDescription = itemView.findViewById(R.id.tv_auto_image_slider); 87 | this.itemView = itemView; 88 | } 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_overlay.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/oh_look_at_this.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smarteist/Android-Image-Slider/66b747be678ae1186e73e487539aa7f22f5cb9fd/app/src/main/res/drawable/oh_look_at_this.gif -------------------------------------------------------------------------------- /app/src/main/res/drawable/puma_offer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smarteist/Android-Image-Slider/66b747be678ae1186e73e487539aa7f22f5cb9fd/app/src/main/res/drawable/puma_offer.jpg -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 16 | 17 | 33 | 34 | 35 | 36 | 42 | 43 |