All Projects → imandolatkia → FullScreenCardViewPager_Android

imandolatkia / FullScreenCardViewPager_Android

Licence: other
Endless full-screen card ViewPager inspired by apple iBook for Android

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to FullScreenCardViewPager Android

Cardslideview
一行代码实现ViewPager卡片效果,比ViewPager2更强大,底层同样是RecyclerView
Stars: ✭ 301 (+124.63%)
Mutual labels:  card, viewpager
react-native-viewpager-carousel
a flexible viewpager library with carousel functionality
Stars: ✭ 39 (-70.9%)
Mutual labels:  viewpager
OnboardingDemo
Onboarding Example. Uses ViewPager's PageTransformer to animate elements.
Stars: ✭ 44 (-67.16%)
Mutual labels:  viewpager
react-native-card-button
Fully customizable Card Button via Paraboly for React Native.
Stars: ✭ 16 (-88.06%)
Mutual labels:  card
Margoulineur2000
NFC
Stars: ✭ 24 (-82.09%)
Mutual labels:  card
Adsorbent
Adsorbent of RecyclerView , RecyclerView吸顶
Stars: ✭ 25 (-81.34%)
Mutual labels:  viewpager
IndicatorView
IndicatorView Library For Android
Stars: ✭ 41 (-69.4%)
Mutual labels:  viewpager
UnderlinePageIndicator
Paging indicator widget compatible with the ViewPager
Stars: ✭ 65 (-51.49%)
Mutual labels:  viewpager
DynamicViewPagerDemo
ViewPager单屏显示多页面,动画效果
Stars: ✭ 49 (-63.43%)
Mutual labels:  viewpager
PyFlashAero
Python scripts for using the Toshiba® FlashAir® Wifi SD Cards on Linux, you may also have a look at my other JavaScript based project https://github.com/cyborg-x1/JSFlashAero which can be installed on the card and used in browser, but it is not that advanced right now.
Stars: ✭ 34 (-74.63%)
Mutual labels:  card
stepper-indicator
Step indicator for onboarding or simple viewpager
Stars: ✭ 180 (+34.33%)
Mutual labels:  viewpager
CircularCardsStackView
CircularCardsStackView is an Android library for dealing with swipeable card views.
Stars: ✭ 30 (-77.61%)
Mutual labels:  card
Flashcard-Maker-Android
Flashcard Maker is a study app that helps to create e-flashcards. It is more convenient to have flashcards on your phone so that you don't carry all the paperwork. You can prepare flashcards in your PC as CSV file and import it from the app.
Stars: ✭ 55 (-58.96%)
Mutual labels:  card
carousel-viewpager
Beautiful carousel layout implemented using ViewPager
Stars: ✭ 17 (-87.31%)
Mutual labels:  viewpager
dotacard
You are at FODA artwork repository. Play now for free
Stars: ✭ 22 (-83.58%)
Mutual labels:  card
PagerSlidingTabStrip
An interactive indicator to navigate between the different pages of a ViewPager
Stars: ✭ 2,194 (+1537.31%)
Mutual labels:  viewpager
MTG-Card-Reader
Reads a Magic: The Gathering card in front of a webcam and identifies it in an existing database of cards of a user-specified set.
Stars: ✭ 32 (-76.12%)
Mutual labels:  card
ViewPagers
When using the ViewPager widget it is not always obvious to the user that there are adjacent views they can navigate to. By implementing this widget you provide a clear indicator that there exists additional content which they can click or swipe to see.
Stars: ✭ 43 (-67.91%)
Mutual labels:  viewpager
multilayout
一个可以支持自动将分类标签拆分多行Tab标签的Layout
Stars: ✭ 14 (-89.55%)
Mutual labels:  viewpager
ngx-card
Angular 2+ wrapper for https://github.com/jessepollak/card
Stars: ✭ 73 (-45.52%)
Mutual labels:  card

FullScreenCardViewPager for Android

License Generic badge Generic badge Generic badge CodeFactor Quality Gate Status

Endless full-screen card ViewPager inspired by apple iBook for Android.

We are open to any new feature request, bug fix request, and pull request.


Demo

Endless cards Scale on scroll up Float actionbar
endless scale_2 ezgif-1-fee8937288b4

Download sample APK File 📥



Features

  • Scale cards on scroll up.
  • Endless (from server or database).
  • Show loading card.
  • Floating actionbar.
  • Save position when fragments are changed or onConfigurationChanged() called.
  • Lock horizontal scroll after card expanded.
  • Push side cards on card scale.
  • Support RTL.
  • Support java and kotlin projects.
  • Easy to use (3 tiny steps).
  • Support API > 16.


How to install? Maven Central

Add the following line to the app-level build.gradle file, in dependencies scope:

dependencies {
    ...
    // add this line:
    implementation "com.dolatkia:full-screen-card-viewpager:1.0.0"
}


How to use it in 3 steps?

Our library is based on RecyclerView, we need a RecyclerView.Adapter for each card. So let's start:

Step 1

Add FullScreenCardViewPager to your Fragment/Activity layout xml file:

    <com.dolatkia.horizontallycardslibrary.FullScreenCardViewPager
        android:id="@+id/fullScreenCardViewPager"
        android:background="@color/cards_background"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />


Step 2

Create adapter class that extends fromFullScreenCardViewPagerAdapter and override 3 abstract methods:

class MyFullScreenCardViewPagerAdapter(private val activity: Activity) :
    FullScreenCardViewPagerAdapter(activity) {
    
    // list of products that you should fill it yourself
    private val productsList = arrayListOf<Product>()

    // you should create your own RecyclerView.Adapter<RecyclerView.ViewHolder> for each card with the given position
    //data in this adapter will save
    override fun getCardRecyclerViewAdapter(position: Int): RecyclerView.Adapter<RecyclerView.ViewHolder> {
        return InnerRecyclerAdapter(activity, position, productsList[position])
    }

    // return number of cards (except loading card, loading card will add with the library)
    override fun getCardsCount(): Int {
        return productsList.size
    }

    // return View.OnClickListener to call when close button clicked
    override fun getOnCloseClickListener(position: Int, context: Context): View.OnClickListener {
        return View.OnClickListener { activity.onBackPressed() }
    }    
}

productsList = list of products that you should fill it yourself, each product is for one card.
InnerRecyclerAdapter = is your custom RecyclerView.Adapter to display in each card. for more details see sample app.


Step 3

Set adapter created in step 2 for FullScreenCardViewPager created in step 1.

// set customize adapter to fullScreenCardViewPager
// 0 = start position
// adapter = your customize adapter (for more details see sample app)
adapter = MyFullScreenCardViewPagerAdapter(this)
binding.fullScreenCardViewPager.setAdapter(adapter, 0)

All done :)


Some other settings and customization:

Action bar:

If you need actionbars for cards override these two methods in your adapter:

// create and return actionbar view
override fun onCreateActionBarCustomView(): View {
  return ItemActionbarBinding.inflate(activity.layoutInflater).root
}

// update actionbar view with relevant data
override fun onBindActionBarCustomView(position: Int, customView: View) {
  ("Beautiful Chair " + (position + 1).toString()).also {
    ItemActionbarBinding.bind(customView).title.text = it
  }
}


Endless cards:

override these two methods in your adapter:

override fun hasMoreData(): Boolean {
  return true
  // return true if you have endless cards and your data is incomplete,
  // return false if you don't have endless cards or you get all data or 
}

// load data (from server or db) in this method and add it to the adapter
// you should  manage your load data sequence yourself
override fun loadData() {
  Handler(Looper.getMainLooper()).postDelayed(
    {
      addFakeItems()
     // call this method when new data is ready
      dataLoaded()
    },
    1000 // value in milliseconds
  )
}


Save positions:

To save cards position and inner card scroll position when fragments are changed or onConfigurationChange() called (land<->portrate), Just create customize FullScreenCardViewPagerAdapter instance in onCreate() method of the fragment to avoid recreate it. for more information see the sample app. Demo


RTL (Right To Left) scroll:

call setRTL() method of fullScreenCardViewPager ,before set it's adapter

binding.fullScreenCardViewPager.setRTL()
// setAdapter() after setRtl()
binding.fullScreenCardViewPager.setAdapter(adapter, 0)

setRTL() doesn't work properly on API 28, contact me for the solution.


Customize UI:

To customize UI override these methods in your adapter:

// customize distance from top to enter actionbar
open fun getActionBarStartAnimationOffsetThreshold(
  recyclerView: RecyclerView,
  customActionBarView: View?
  ): Int {
  return PresentationUtils.convertDpToPixel(50, recyclerView.context)
}

// customize cards background-color
open fun getCardsColor(position: Int, context: Context): Int {
  return Color.parseColor("#ffffff")
}

// customize cards top-radius 
open fun getCardRadius(context: Context): Int {
  return PresentationUtils.convertDpToPixel(15, context)
}

// customize close icon
open fun getCloseResId(position: Int, context: Context): Int {
  return R.drawable.ic_close
}

// customize close color
open fun getCloseColor(position: Int, context: Context): Int {
  return Color.parseColor("#444444")
}

More Demo

Inner card horizontal scroll Save position
all_f ezgif-2-f999221f9053

Stargazers

Stargazers repo roster for @imandolatkia/FullScreenCardViewPager_Android

Forkers

Forkers repo roster for @imandolatkia/FullScreenCardViewPager_Android

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].