All Projects → IslamKhSh → Cardslider

IslamKhSh / Cardslider

Licence: apache-2.0
Card Slider is an android component allows you to implement carousel effect with infinite indicators and more features

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Cardslider

IndicatorView
IndicatorView Library For Android
Stars: ✭ 41 (-74.37%)
Mutual labels:  view, carousel, viewpager, indicator
Discretescrollview
A scrollable list of items that centers the current element and provides easy-to-use APIs for cool item animations.
Stars: ✭ 5,533 (+3358.13%)
Mutual labels:  view, viewpager, carousel
Banner
🔥🔥ViewPager,ViewPager2无限轮播功能。自定义Indicator,支持一屏三页,支持仿魅族banner效果。极其简单的使用方式
Stars: ✭ 393 (+145.63%)
Mutual labels:  view, viewpager, indicator
Inkpageindicator
InkPageIndicator created by @nickbutcher for Plaid https://github.com/nickbutcher/plaid and backported by me for API 14+ (4.0+)
Stars: ✭ 589 (+268.13%)
Mutual labels:  viewpager, indicator
Viewpagerindicator
一个简单好用的ViewPagerIndicator,提供了六种类型,为viewpager添加酷炫效果,并且支持轮播图( A simple, cool, customizable ViewPagerIndicator.show cool indicator for viewpager , it also good for viewpager as carousel )
Stars: ✭ 366 (+128.75%)
Mutual labels:  viewpager, indicator
Scrollingpagerindicator
Pager indicator inspired by Instagram. Lightweight and easy to set up.
Stars: ✭ 419 (+161.88%)
Mutual labels:  viewpager, indicator
Adaptablebottomnavigation
A simpler way for implementing the Bottom Navigation View on Android
Stars: ✭ 844 (+427.5%)
Mutual labels:  view, viewpager
Viewtooltip
A fluent tooltip for Android
Stars: ✭ 1,029 (+543.13%)
Mutual labels:  view, indicator
Magicindicator
A powerful, customizable and extensible ViewPager indicator framework. As the best alternative of ViewPagerIndicator, TabLayout and PagerSlidingTabStrip —— 强大、可定制、易扩展的 ViewPager 指示器框架。是ViewPagerIndicator、TabLayout、PagerSlidingTabStrip的最佳替代品。支持角标,更支持在非ViewPager场景下使用(使用hide()、show()切换Fragment或使用setVisibility切换FrameLayout里的View等),http://www.jianshu…
Stars: ✭ 8,969 (+5505.63%)
Mutual labels:  viewpager, indicator
Rvpindicator
ViewPager指示器 实现联动,自身滚动,支持类型 : 下滑线,三角形,全背景,图片
Stars: ✭ 99 (-38.12%)
Mutual labels:  viewpager, indicator
Bannerlayout
Support unlimited picture rotation BannerLayout, the minimum implementation of the code banner
Stars: ✭ 92 (-42.5%)
Mutual labels:  view, viewpager
Bubblepagerindicator
A view pager indicator view to deal with a large amount of pages.
Stars: ✭ 127 (-20.62%)
Mutual labels:  viewpager, indicator
Loopingviewpager
A ViewPager and PagerAdapter combination that support auto scroll, infinite loop and page indicators.
Stars: ✭ 310 (+93.75%)
Mutual labels:  viewpager, indicator
Cmpagetitleview
✍️一分钟集成类似抖音,新浪微博,腾讯视频,网易新闻,今日头条等常见的标题栏样式,api灵活易扩展,支持Cocoapods和Masonry布局,支持ChildController的完整生命周期
Stars: ✭ 270 (+68.75%)
Mutual labels:  viewpager, indicator
FastBanner
🔥快速轮播图,支持自定义布局和使用自有图片显示组件
Stars: ✭ 27 (-83.12%)
Mutual labels:  view, viewpager
react-native-viewpager-indicator
修改自react-native-scrollable-tab-view,增加了根据文字内容适配下划线长度的功能。
Stars: ✭ 52 (-67.5%)
Mutual labels:  viewpager, indicator
Banner
🔥🔥🔥Banner 2.0 来了!Android广告图片轮播控件,内部基于ViewPager2实现,Indicator和UI都可以自定义。
Stars: ✭ 11,682 (+7201.25%)
Mutual labels:  viewpager, indicator
Android-Universal-ViewPager-Indicator
Android Universal ViewPager Indicator
Stars: ✭ 41 (-74.37%)
Mutual labels:  viewpager, indicator
ArcPageIndicator
Android Page Indicator for ViewPager with original animations. It uses an ellipse to dispose indication spots, and can draw a hand, like in old elevators.
Stars: ✭ 73 (-54.37%)
Mutual labels:  viewpager, indicator
Androidanimationexercise
Android 动画各种实现,包括帧动画、补间动画和属性动画的总结分享
Stars: ✭ 1,254 (+683.75%)
Mutual labels:  view, viewpager

Card Slider License Android Arsenal Jitpack.io

This is an Android library that implemnts carousel effect with many features and attrs to get exactly what you need.

preview

Demo App

Android app on Google Play

Card Slider components

  1. CardSliderViewPager: Custom ViewPager2 and uses a page transformer to apply carousel effect as shown in GIF.
    • As ViewPager2 is still a final class follow this issue, I added it as part of my package.
  2. CardSliderIndicator: Custom LinearLayout that that contain indicators as children views.
  3. CardSliderAdapter: Abstract class that must be extended and passed to CardSliderViewPager as its adapter.

Features

1- Show preview of pages in left and right (or top and bottom).

2- Can resize (scale) and change opacity of the pages to make focused page larger and more focused in height as shown in GIF (carousel effect).

3- Can make pages auto swiped after specific time.

4- Add indicator and full customize it easily.

5- Infinite indicators like those in the Instagram app.

6- RTL Support.

7- Support vertical orientation.

Add to project

  1. Add it in your root build.gradle at the end of repositories:
allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}
  1. Add the dependency:
implementation 'com.github.IslamKhSh:CardSlider:{latest_version}'

Find the latest version here

Usage

  1. Add it to your layout:
 <com.github.islamkhsh.CardSliderViewPager
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:id="@+id/viewPager"
           android:layout_marginTop="24dp"
           app:cardSlider_smallScaleFactor="0.9" //scale factor of height of pages in left and right (1 if no resizing nedded)
           app:cardSlider_otherPagesWidth="24dp" // width of displayed parts of left and right pages
           app:cardSlider_pageMargin="12dp" // margin between pages
   	   app:auto_slide_time="3"/>  // auto sliding time in seconds
  1. Create your item (page) layout.

  2. Extend CardSliderAdapter

class MovieAdapter(private val movies : ArrayList<Movie>) : CardSliderAdapter<MovieAdapter.MovieViewHolder>() {

    override fun getItemCount() = movies.size

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MovieViewHolder {
        val view = LayoutInflater.from(parent.context).inflate(R.layout.item_page, parent, false)
        return MovieViewHolder(view)
    }
    
    override fun bindVH(holder: MovieViewHolder, position: Int) {
      //TODO bind item object with item layout view
    }

    class MovieViewHolder(view: View) : RecyclerView.ViewHolder(view)
}

or using Java

public class MovieAdapter extends CardSliderAdapter<MovieAdapter.MovieViewHolder> {
    
    private ArrayList<Movie> movies;
    
    public MovieAdapter(ArrayList<Movie> movies){
        this.movies = movies;
    }
    
    @Override
    public int getItemCount(){
    	return movies.getSize();
    }
    
     @Override
    public MovieViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_page, parent, false);
	return new MovieViewHolder(view);
    }
    
    @Override
    public void bindVH(int position, MovieViewHolder holder) {
      //TODO bind item object with item layout view
    }
    
    class MovieViewHolder extends RecyclerView.ViewHolder {
    	
	public MovieViewHolder(View view){
	      super(view);
	}
    }
}
  1. Add adapter to CardSliderViewPager
  val movies = ArrayList<Movie>().apply{
  // add items to arraylist
  }
  
  findViewById<CardSliderViewPager>(R.id.viewPager).adapter = MoviesAdapter(movies)

or using Java

  ArrayList<Movie> movies = new ArrayList<Movie>();
    // add items to arraylist
  
  CardSliderViewPager cardSliderViewPager = (CardSliderViewPager) findViewById(R.id.viewPager);
  cardSliderViewPager.setAdapter(new MoviesAdapter(movies));

5- To add indicator add it to your layout

 <com.github.islamkhsh.CardSliderIndicator
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/indicator"
	    app:indicatorsToShow="5" />

And then bind it with your CardSliderViewPager

  <com.github.islamkhsh.CardSliderViewPager
            ...
            app:cardSlider_indicator="@id/indicator"/>

Attributes List

1- CardSliderViewPager

Attribute Description Default value
cardSlider_smallScaleFactor The small scale of the next and previous pages. 1 (no resizing)
cardSlider_smallAlphaFactor The small opacity factor of the next and previous pages. 1 (no opacity)
cardSlider_baseShadow The CardView Elevation when selected. 2dp
cardSlider_minShadow The CardView Elevation of next and previous cards. baseShadow * smallScaleFactor
cardSlider_pageMargin The space between two pages. This must be large than baseShadow + minShadow or it will be override. baseShadow + minShadow
cardSlider_otherPagesWidth The width of displayed parts from next and previous cards . 0
cardSlider_indicator The id of CardSliderIndicator to work with this view pager. no indicator
auto_slide_time The time in seconds to auto sliding between pages in it no sliding (STOP_AUTO_SLIDING)

2- CardSliderIndicator

Attribute Description Default value
defaultIndicator The indicator drawable in case of not selected default_dot.xml
selectedIndicator The indicator drawable in case of selected. selected_dot.xml
indicatorMargin The space between indicators the minimum width of defaultIndicator and selectedIndicator
indicatorsToShow The number of indicators to show and others will be hidden like Instagram app -1 (CardSliderIndicator.UNLIMITED_INDICATORS)
  Copyright [2019] [IslamKhSh]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].