Skip to content

DYGames/RoomPager

Repository files navigation

RoomPager

RoomPager is 4-directional recycle pager view for create shortform video platform like youtube shorts and reels.

Usage

implementation("com.github.DYGames:roompager:1.0.3@aar")

You can use it by implementing an Adapter and a ViewHolder, just like Android RecyclerView (not exactly the same. sry)

app module of this repository contains sample usage of this

classDiagram
    RoomPager *-- VerticalScrollPager
    VerticalScrollPager *-- HorizontalScrollPager
    HorizontalScrollPager *-- RoomRecycler
    RoomRecycler "1" *-- "n" RoomPlayer

    ScrollPager <|-- VerticalScrollPager
    ScrollPager <|-- HorizontalScrollPager
    RoomPlayer <|-- YoutubeRoomPlayer
Loading

Docs

Adapter

createViewHolder(context: Context): T

  • calls when RoomPager is initialized. adpater should provide viewholder instance

getItemCount(): Int

  • adpater should returns number of item in data set

onRecycle(currentRoomPosition: Int, recycledViewHolders: List)

  • calls when recycling is done (user scrolled). usually adapter play/pause video player here.

onLoadNextRoom()

  • load next room (video) data from server/local. you can update adapter's data set here.

Adapter.ViewHolder

  • define each View on RoomPager (usually full-screen video player)

Demo

o.mov