Skip to content

murgupluoglu/seatview-android

Repository files navigation

Installation

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

dependencies {
    implementation 'com.github.murgupluoglu:seatview-android:lastVersion'
}

Usage

    <com.murgupluoglu.seatview.SeatView
    android:id="@+id/seatView"
    android:layout_width="0dp"
    android:layout_height="0dp" />
   seatView.seatViewListener = object : SeatViewListener<BasicSeat> {
    override fun seatReleased(releasedSeat: BasicSeat, selectedSeats: HashSet<String>) {
    }

    override fun seatSelected(selectedSeat: BasicSeat, selectedSeats: HashSet<String>) {
    }

    override fun canSelectSeat(
        clickedSeat: BasicSeat,
        selectedSeats: HashSet<String>
    ): Boolean {
        return true
    }
   }
    
    seatView.initSeatView(seatList)

Seat Drawer (Optional)

You can create a custom seat drawer otherwise the default is NumberSeatDrawer

class CustomSeatDrawer : SeatDrawer {

   override fun <SEAT : Seat> draw(
       context: Context,
       params: SeatViewParameters,
       config: SeatViewConfig,
       canvas: Canvas,
       seat: SEAT,
       seatRectF: RectF,
       isSelected: Boolean
   ) {
   }
}

Add to SeatView

seatView.seatDrawer = CustomSeatDrawer()

Extensions (Optional)

You can create your own extensions like drawing center lines or drawing some debug points on SeatView

class CustomExtension : SeatViewExtension() {

   override fun isActive(): Boolean {
       return true
   }

   override fun init(params: SeatViewParameters, config: SeatViewConfig) {
   }

   override fun draw(
       canvas: Canvas,
       params: SeatViewParameters,
       config: SeatViewConfig
   ) {
   }

}

Add to SeatView

   seatView.extensions.add(DebugExtension())
   seatView.extensions.add(CenterLinesExtension())

Support

If you like the project please give it a star.

About

Android seat view with endless multi-seat options

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy