How yuyakaido/cardstackview works
Project type and purpose
• This is an Android UI component library (“cardstackview”) complemented by a sample Android app module.
• The library provides a highly customizable, swipeable card stack (built on RecyclerView), and the sample app demonstrates usage, configuration, and API callbacks.
File structure
Top-level:
• .circleci/config.yml – CI pipeline for build + tests
• gradle.properties, settings.gradle, gradle/… – Gradle build system + wrapper
• build.gradle – root build configuration
• cardstackview/ – library module
– src/main/java/com/yuyakaido/android/cardstackview/
• CardStackView (RecyclerView subclass)
• CardStackLayoutManager (custom LayoutManager)
• CardStackListener (callback interface)
• Direction, Duration, SwipeAnimationSetting.Builder, RewindAnimationSetting.Builder, etc.
– src/main/java/com/yuyakaido/android/cardstackview/internal/
• AnimationSetting, CardStackState, CardStackSmoothScroller, SnapHelper, DataObserver, DisplayUtil
– src/main/res/layout, overlay.xml – resource definitions
• sample/ – demo Android app module
– MainActivity.kt – initializes CardStackView
– CardStackAdapter.kt (RecyclerView.Adapter)
– Spot.kt & SpotDiffCallback.kt – data model + DiffUtil for paging
– res/layout, drawables, menu, mipmap – UI layouts & assets
README for insights
• Describes features (manual swipe, automatic swipe, rewind, overlays, paging, stack-from, thresholds, directions)
• Shows public interfaces & callbacks
• Emphasizes integration code snippets (Kotlin)
• Calls out migration from v1.x → v2.x
Components & interactions
• Developer Workflow & CI
– GitHub repo → CircleCI pipeline → build & test → publish artifact
– Gradle wrapper & settings drive build
• Library Module (“cardstackview”)
– CardStackView (UI component)
– CardStackLayoutManager (positioning & swipe logic)
– AnimationSetting (Swipe, Rewind builders)
– CardStackListener (event callbacks)
– Internal utilities (State, Scroller, SnapHelper, DisplayUtil, DataObserver)
– Resources (layouts, overlay XMLs)
– API boundary: public classes & methods
• Android Framework
– RecyclerView base class
– LayoutManager interface
– Adapter / DiffUtil
– Interpolator, View, FrameLayout (overlays)
• Sample App
– MainActivity (sets up CardStackView + LayoutManager + Listener)
– CardStackAdapter (binds Spot data to item_spot.xml)
– Spot model + DiffCallback (paging)
1. Developer → Git push → CI → Gradle build → library + sample
2. Sample App module depends on library module (compile-time)
3. At runtime: User swipe gesture → CardStackView → CardStackLayoutManager → AnimationSetting/InternalState
4. LayoutManager invokes internal Scroller & SnapHelper to animate view
5. CardStackListener callbacks propagate to MainActivity
6. Adapter updates via notifyItemRangeInserted or DiffUtil → DataObserver → UI refresh
c. Architectural patterns & design principles
• Adapter pattern (RecyclerView.Adapter for data binding)
• Builder pattern (SwipeAnimationSetting.Builder, RewindAnimationSetting.Builder)
• Observer pattern (CardStackDataObserver monitors adapter changes)
• Single Responsibility (separate classes for layout, state, animation, callbacks)
• Modularity (core library vs sample app)
d. Key technologies, frameworks, libraries
• Language: Java (library), Kotlin (sample)
• Build: Gradle (multi-module), CircleCI
• Android SDK: RecyclerView, LayoutManager, Interpolator, FrameLayout
• Testing/CI: CircleCI config (build/test pipeline)