├── .github
    ├── FUNDING.yml
    ├── ISSUE_TEMPLATE
    │   ├── bug_report.md
    │   └── feature_request.md
    └── workflows
    │   ├── codeql.yml
    │   ├── detekt.yml
    │   ├── gradle-publish.yml
    │   └── gradle.yml
├── .gitignore
├── .idea
    ├── .gitignore
    ├── .name
    ├── compiler.xml
    ├── deploymentTargetDropDown.xml
    ├── gradle.xml
    ├── misc.xml
    └── vcs.xml
├── ART
    ├── Home.jpg
    └── cover.png
├── ATTRS.md
├── CODE_OF_CONDUCT.md
├── KT_ATTRS.md
├── LICENSE
├── README.md
├── SECURITY.md
├── SeatBookView
    ├── .gitignore
    ├── build.gradle
    ├── consumer-rules.pro
    ├── proguard-rules.pro
    └── src
    │   ├── androidTest
    │       └── java
    │       │   └── dev
    │       │       └── jahidhasanco
    │       │           └── seatbookview
    │       │               └── ExampleInstrumentedTest.kt
    │   ├── main
    │       ├── AndroidManifest.xml
    │       ├── java
    │       │   └── dev
    │       │   │   └── jahidhasanco
    │       │   │       └── seatbookview
    │       │   │           ├── SeatBookView.kt
    │       │   │           ├── SeatClickListener.kt
    │       │   │           └── SeatLongClickListener.kt
    │       └── res
    │       │   ├── drawable
    │       │       ├── seats_book.xml
    │       │       ├── seats_booked.xml
    │       │       ├── seats_reserved.xml
    │       │       └── seats_selected.xml
    │       │   ├── layout
    │       │       └── layout_view_group.xml
    │       │   └── values
    │       │       └── attrs.xml
    │   └── test
    │       └── java
    │           └── dev
    │               └── jahidhasanco
    │                   └── seatbookview
    │                       └── ExampleUnitTest.kt
├── app
    ├── .gitignore
    ├── build.gradle
    ├── proguard-rules.pro
    └── src
    │   ├── androidTest
    │       └── java
    │       │   └── dev
    │       │       └── jahidhasanco
    │       │           └── demo_app
    │       │               └── ExampleInstrumentedTest.kt
    │   ├── main
    │       ├── AndroidManifest.xml
    │       ├── java
    │       │   └── dev
    │       │   │   └── jahidhasanco
    │       │   │       └── demo_app
    │       │   │           └── MainActivity.kt
    │       └── res
    │       │   ├── drawable-v24
    │       │       └── ic_launcher_foreground.xml
    │       │   ├── drawable
    │       │       ├── book.xml
    │       │       ├── booked.xml
    │       │       ├── ic_baseline_drive_eta_24.xml
    │       │       ├── ic_bike.xml
    │       │       ├── ic_launcher_background.xml
    │       │       ├── ic_steering.xml
    │       │       ├── reserved.xml
    │       │       └── selected.xml
    │       │   ├── layout
    │       │       └── activity_main.xml
    │       │   ├── mipmap-anydpi-v26
    │       │       ├── ic_launcher.xml
    │       │       └── ic_launcher_round.xml
    │       │   ├── mipmap-hdpi
    │       │       ├── ic_launcher.webp
    │       │       └── ic_launcher_round.webp
    │       │   ├── mipmap-mdpi
    │       │       ├── ic_launcher.webp
    │       │       └── ic_launcher_round.webp
    │       │   ├── mipmap-xhdpi
    │       │       ├── ic_launcher.webp
    │       │       └── ic_launcher_round.webp
    │       │   ├── mipmap-xxhdpi
    │       │       ├── ic_launcher.webp
    │       │       └── ic_launcher_round.webp
    │       │   ├── mipmap-xxxhdpi
    │       │       ├── ic_launcher.webp
    │       │       └── ic_launcher_round.webp
    │       │   ├── values-night
    │       │       └── themes.xml
    │       │   ├── values
    │       │       ├── colors.xml
    │       │       ├── strings.xml
    │       │       └── themes.xml
    │       │   └── xml
    │       │       ├── backup_rules.xml
    │       │       └── data_extraction_rules.xml
    │   └── test
    │       └── java
    │           └── dev
    │               └── jahidhasanco
    │                   └── demo_app
    │                       └── ExampleUnitTest.kt
├── build.gradle
├── gradle.properties
├── gradle
    └── wrapper
    │   ├── gradle-wrapper.jar
    │   └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: [JahidHasanCo]
2 | custom: https://www.paypal.me/JahidHasanCo
3 | 
4 | 
5 | 
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
 1 | ---
 2 | name: Bug report
 3 | about: Create a report to help us improve
 4 | title: ''
 5 | labels: ''
 6 | assignees: ''
 7 | 
 8 | ---
 9 | 
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 | 
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Go to '...'
16 | 2. Click on '....'
17 | 3. Scroll down to '....'
18 | 4. See error
19 | 
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 | 
23 | **Screenshots**
24 | If applicable, add screenshots to help explain your problem.
25 | 
26 | **Desktop (please complete the following information):**
27 |  - OS: [e.g. iOS]
28 |  - Browser [e.g. chrome, safari]
29 |  - Version [e.g. 22]
30 | 
31 | **Smartphone (please complete the following information):**
32 |  - Device: [e.g. iPhone6]
33 |  - OS: [e.g. iOS8.1]
34 |  - Browser [e.g. stock browser, safari]
35 |  - Version [e.g. 22]
36 | 
37 | **Additional context**
38 | Add any other context about the problem here.
39 | 
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
 1 | ---
 2 | name: Feature request
 3 | about: Suggest an idea for this project
 4 | title: ''
 5 | labels: ''
 6 | assignees: ''
 7 | 
 8 | ---
 9 | 
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 | 
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 | 
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 | 
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 | 
--------------------------------------------------------------------------------
/.github/workflows/codeql.yml:
--------------------------------------------------------------------------------
 1 | # For most projects, this workflow file will not need changing; you simply need
 2 | # to commit it to your repository.
 3 | #
 4 | # You may wish to alter this file to override the set of languages analyzed,
 5 | # or to provide custom queries or build logic.
 6 | #
 7 | # ******** NOTE ********
 8 | # We have attempted to detect the languages in your repository. Please check
 9 | # the `language` matrix defined below to confirm you have the correct set of
10 | # supported CodeQL languages.
11 | #
12 | name: "CodeQL"
13 | 
14 | on:
15 |   push:
16 |     branches: [ "master" ]
17 |   pull_request:
18 |     # The branches below must be a subset of the branches above
19 |     branches: [ "master" ]
20 |   schedule:
21 |     - cron: '35 14 * * 5'
22 | 
23 | jobs:
24 |   analyze:
25 |     name: Analyze
26 |     runs-on: ubuntu-latest
27 |     permissions:
28 |       actions: read
29 |       contents: read
30 |       security-events: write
31 | 
32 |     strategy:
33 |       fail-fast: false
34 |       matrix:
35 |         language: [ 'java' ]
36 |         # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37 |         # Use only 'java' to analyze code written in Java, Kotlin or both
38 |         # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
39 |         # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
40 | 
41 |     steps:
42 |     - name: Checkout repository
43 |       uses: actions/checkout@v3
44 | 
45 |     # Initializes the CodeQL tools for scanning.
46 |     - name: Initialize CodeQL
47 |       uses: github/codeql-action/init@v2
48 |       with:
49 |         languages: ${{ matrix.language }}
50 |         # If you wish to specify custom queries, you can do so here or in a config file.
51 |         # By default, queries listed here will override any specified in a config file.
52 |         # Prefix the list here with "+" to use these queries and those in the config file.
53 | 
54 |         # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
55 |         # queries: security-extended,security-and-quality
56 | 
57 | 
58 |     # Autobuild attempts to build any compiled languages  (C/C++, C#, Go, or Java).
59 |     # If this step fails, then you should remove it and run the build manually (see below)
60 |     - name: Autobuild
61 |       uses: github/codeql-action/autobuild@v2
62 | 
63 |     # ℹ️ Command-line programs to run using the OS shell.
64 |     # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
65 | 
66 |     #   If the Autobuild fails above, remove it and uncomment the following three lines.
67 |     #   modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
68 | 
69 |     # - run: |
70 |     #     echo "Run, Build Application using script"
71 |     #     ./location_of_script_within_repo/buildscript.sh
72 | 
73 |     - name: Perform CodeQL Analysis
74 |       uses: github/codeql-action/analyze@v2
75 |       with:
76 |         category: "/language:${{matrix.language}}"
77 | 
--------------------------------------------------------------------------------
/.github/workflows/detekt.yml:
--------------------------------------------------------------------------------
  1 | # This workflow uses actions that are not certified by GitHub.
  2 | # They are provided by a third-party and are governed by
  3 | # separate terms of service, privacy policy, and support
  4 | # documentation.
  5 | 
  6 | # This workflow performs a static analysis of your Kotlin source code using
  7 | # Detekt.
  8 | #
  9 | # Scans are triggered:
 10 | # 1. On every push to default and protected branches
 11 | # 2. On every Pull Request targeting the default branch
 12 | # 3. On a weekly schedule
 13 | # 4. Manually, on demand, via the "workflow_dispatch" event
 14 | #
 15 | # The workflow should work with no modifications, but you might like to use a
 16 | # later version of the Detekt CLI by modifing the $DETEKT_RELEASE_TAG
 17 | # environment variable.
 18 | name: Scan with Detekt
 19 | 
 20 | on:
 21 |   # Triggers the workflow on push or pull request events but only for default and protected branches
 22 |   push:
 23 |     branches: [ "master" ]
 24 |   pull_request:
 25 |     branches: [ "master" ]
 26 |   schedule:
 27 |      - cron: '35 2 * * 1'
 28 | 
 29 |   # Allows you to run this workflow manually from the Actions tab
 30 |   workflow_dispatch:
 31 | 
 32 | env:
 33 |   # Release tag associated with version of Detekt to be installed
 34 |   # SARIF support (required for this workflow) was introduced in Detekt v1.15.0
 35 |   DETEKT_RELEASE_TAG: v1.15.0
 36 | 
 37 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel
 38 | jobs:
 39 |   # This workflow contains a single job called "scan"
 40 |   scan:
 41 |     name: Scan
 42 |     # The type of runner that the job will run on
 43 |     runs-on: ubuntu-latest
 44 | 
 45 |     # Steps represent a sequence of tasks that will be executed as part of the job
 46 |     steps:
 47 |     # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
 48 |     - uses: actions/checkout@v3
 49 | 
 50 |     # Gets the download URL associated with the $DETEKT_RELEASE_TAG
 51 |     - name: Get Detekt download URL
 52 |       id: detekt_info
 53 |       env:
 54 |         GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 55 |       run: |
 56 |         gh api graphql --field tagName=$DETEKT_RELEASE_TAG --raw-field query='
 57 |           query getReleaseAssetDownloadUrl($tagName: String!) {
 58 |             repository(name: "detekt", owner: "detekt") {
 59 |               release(tagName: $tagName) {
 60 |                 releaseAssets(name: "detekt", first: 1) {
 61 |                   nodes {
 62 |                     downloadUrl
 63 |                   }
 64 |                 }
 65 |                 tagCommit {
 66 |                   oid
 67 |                 }
 68 |               }
 69 |             }
 70 |           }
 71 |         ' 1> gh_response.json
 72 |         
 73 |         DETEKT_RELEASE_SHA=$(jq --raw-output '.data.repository.release.releaseAssets.tagCommit.oid' gh_response.json)
 74 |         if [ $DETEKT_RELEASE_SHA != "37f0a1d006977512f1f216506cd695039607c3e5" ]; then
 75 |           echo "Release tag doesn't match expected commit SHA"
 76 |           exit 1
 77 |         fi
 78 |         
 79 |         DETEKT_DOWNLOAD_URL=$(jq --raw-output '.data.repository.release.releaseAssets.nodes[0].downloadUrl' gh_response.json)
 80 |         echo "::set-output name=download_url::$DETEKT_DOWNLOAD_URL"
 81 | 
 82 |     # Sets up the detekt cli
 83 |     - name: Setup Detekt
 84 |       run: |
 85 |         dest=$( mktemp -d )
 86 |         curl --request GET \
 87 |           --url ${{ steps.detekt_info.outputs.download_url }} \
 88 |           --silent \
 89 |           --location \
 90 |           --output $dest/detekt
 91 |         chmod a+x $dest/detekt
 92 |         echo $dest >> $GITHUB_PATH
 93 | 
 94 |     # Performs static analysis using Detekt
 95 |     - name: Run Detekt
 96 |       continue-on-error: true
 97 |       run: |
 98 |         detekt --input ${{ github.workspace }} --report sarif:${{ github.workspace }}/detekt.sarif.json
 99 | 
100 |     # Modifies the SARIF output produced by Detekt so that absolute URIs are relative
101 |     # This is so we can easily map results onto their source files
102 |     # This can be removed once relative URI support lands in Detekt: https://git.io/JLBbA
103 |     - name: Make artifact location URIs relative
104 |       continue-on-error: true
105 |       run: |
106 |         echo "$(
107 |           jq \
108 |             --arg github_workspace ${{ github.workspace }} \
109 |             '. | ( .runs[].results[].locations[].physicalLocation.artifactLocation.uri |= if test($github_workspace) then .[($github_workspace | length | . + 1):] else . end )' \
110 |             ${{ github.workspace }}/detekt.sarif.json
111 |         )" > ${{ github.workspace }}/detekt.sarif.json
112 | 
113 |     # Uploads results to GitHub repository using the upload-sarif action
114 |     - uses: github/codeql-action/upload-sarif@v2
115 |       with:
116 |         # Path to SARIF file relative to the root of the repository
117 |         sarif_file: ${{ github.workspace }}/detekt.sarif.json
118 |         checkout_path: ${{ github.workspace }}
119 | 
--------------------------------------------------------------------------------
/.github/workflows/gradle-publish.yml:
--------------------------------------------------------------------------------
 1 | # This workflow uses actions that are not certified by GitHub.
 2 | # They are provided by a third-party and are governed by
 3 | # separate terms of service, privacy policy, and support
 4 | # documentation.
 5 | # This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
 6 | # For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle
 7 | 
 8 | name: Gradle Package
 9 | 
10 | on:
11 |   release:
12 |     types: [created]
13 | 
14 | jobs:
15 |   build:
16 | 
17 |     runs-on: ubuntu-latest
18 |     permissions:
19 |       contents: read
20 |       packages: write
21 | 
22 |     steps:
23 |     - uses: actions/checkout@v3
24 |     - name: Set up JDK 11
25 |       uses: actions/setup-java@v3
26 |       with:
27 |         java-version: '11'
28 |         distribution: 'temurin'
29 |         server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
30 |         settings-path: ${{ github.workspace }} # location for the settings.xml file
31 | 
32 |     - name: Build with Gradle
33 |       uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
34 |       with:
35 |         arguments: build
36 | 
37 |     # The USERNAME and TOKEN need to correspond to the credentials environment variables used in
38 |     # the publishing section of your build.gradle
39 |     - name: Publish to GitHub Packages
40 |       uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
41 |       with:
42 |         arguments: publish
43 |       env:
44 |         USERNAME: ${{ github.actor }}
45 |         TOKEN: ${{ secrets.GITHUB_TOKEN }}
46 | 
--------------------------------------------------------------------------------
/.github/workflows/gradle.yml:
--------------------------------------------------------------------------------
 1 | # This workflow uses actions that are not certified by GitHub.
 2 | # They are provided by a third-party and are governed by
 3 | # separate terms of service, privacy policy, and support
 4 | # documentation.
 5 | # This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
 6 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
 7 | 
 8 | name: Java CI with Gradle
 9 | 
10 | on:
11 |   push:
12 |     branches: [ "master" ]
13 |   pull_request:
14 |     branches: [ "master" ]
15 | 
16 | permissions:
17 |   contents: read
18 | 
19 | jobs:
20 |   build:
21 | 
22 |     runs-on: ubuntu-latest
23 | 
24 |     steps:
25 |     - uses: actions/checkout@v3
26 |     - name: Set up JDK 11
27 |       uses: actions/setup-java@v3
28 |       with:
29 |         java-version: '11'
30 |         distribution: 'temurin'
31 |     - name: Build with Gradle
32 |       uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
33 |       with:
34 |         arguments: build
35 | 
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
 1 | *.iml
 2 | .gradle
 3 | /local.properties
 4 | /.idea/caches
 5 | /.idea/libraries
 6 | /.idea/modules.xml
 7 | /.idea/workspace.xml
 8 | /.idea/navEditor.xml
 9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 | local.properties
16 | 
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 | 
--------------------------------------------------------------------------------
/.idea/.name:
--------------------------------------------------------------------------------
1 | demo_app
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 | 
2 | 
3 |   
4 |     
5 |   
6 | 
--------------------------------------------------------------------------------
/.idea/deploymentTargetDropDown.xml:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 |   
 4 |     
 5 |       
 6 |         
 7 |         
 8 |           
 9 |             
10 |             
11 |           
12 |         
13 |       
14 |     
15 |     
16 |     
17 |       
18 |         
19 |         
20 |           
21 |             
22 |             
23 |           
24 |         
25 |       
26 |     
27 |   
28 | 
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 |   
 4 |   
 5 |     
19 |   
20 | 
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 |   
 4 |     
 5 |       
26 |     
27 |   
28 |   
29 |     
30 |   
31 |   
32 |     
33 |   
34 | 
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 | 
2 | 
3 |   
4 |     
5 |   
6 | 
--------------------------------------------------------------------------------
/ART/Home.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JahidHasanCO/SeatBookView/a6339723c608e10029826c5db7c6ac410f21fc27/ART/Home.jpg
--------------------------------------------------------------------------------
/ART/cover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JahidHasanCO/SeatBookView/a6339723c608e10029826c5db7c6ac410f21fc27/ART/cover.png
--------------------------------------------------------------------------------
/ATTRS.md:
--------------------------------------------------------------------------------
 1 | **All Attributes of this Library**
 2 | 
 3 | |  XML Attributes  | Description   |
 4 | | ------------ | ------------ |
 5 | | app:available_seat_background  | This attribute used to set background of non booked seat for any Drawable file.  |
 6 | | app:reserved_seat_background  | This attribute used to set background of reserved seat for any Drawable file.    |
 7 | | app:booked_seat_background  | This attribute used to set background of  booked seat for any Drawable file.    |
 8 | | app:selected_seats_background  | This attribute used to set background of selected seat for any Drawable file.    |
 9 | | app:reserved_seats_text_color  | Color of the reserved seat text.   |
10 | | app:booked_seats_text_color  | Color of the booked seat text.  |
11 | | app:available_seats_text_color  | Color of the non booked seat text.  |
12 | | app:seat_size  | Size of the Seat  |
13 | | app:seat_size_by_seats_column  | This attribute assigns an "importance" value to a seat in terms of how much space it should occupy on the screen. A larger weight value allows it to expand to fill any remaining space in the parent view.   | |
14 | 
15 | 
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
  1 | # Contributor Covenant Code of Conduct
  2 | 
  3 | ## Our Pledge
  4 | 
  5 | We as members, contributors, and leaders pledge to make participation in our
  6 | community a harassment-free experience for everyone, regardless of age, body
  7 | size, visible or invisible disability, ethnicity, sex characteristics, gender
  8 | identity and expression, level of experience, education, socio-economic status,
  9 | nationality, personal appearance, race, religion, or sexual identity
 10 | and orientation.
 11 | 
 12 | We pledge to act and interact in ways that contribute to an open, welcoming,
 13 | diverse, inclusive, and healthy community.
 14 | 
 15 | ## Our Standards
 16 | 
 17 | Examples of behavior that contributes to a positive environment for our
 18 | community include:
 19 | 
 20 | * Demonstrating empathy and kindness toward other people
 21 | * Being respectful of differing opinions, viewpoints, and experiences
 22 | * Giving and gracefully accepting constructive feedback
 23 | * Accepting responsibility and apologizing to those affected by our mistakes,
 24 |   and learning from the experience
 25 | * Focusing on what is best not just for us as individuals, but for the
 26 |   overall community
 27 | 
 28 | Examples of unacceptable behavior include:
 29 | 
 30 | * The use of sexualized language or imagery, and sexual attention or
 31 |   advances of any kind
 32 | * Trolling, insulting or derogatory comments, and personal or political attacks
 33 | * Public or private harassment
 34 | * Publishing others' private information, such as a physical or email
 35 |   address, without their explicit permission
 36 | * Other conduct which could reasonably be considered inappropriate in a
 37 |   professional setting
 38 | 
 39 | ## Enforcement Responsibilities
 40 | 
 41 | Community leaders are responsible for clarifying and enforcing our standards of
 42 | acceptable behavior and will take appropriate and fair corrective action in
 43 | response to any behavior that they deem inappropriate, threatening, offensive,
 44 | or harmful.
 45 | 
 46 | Community leaders have the right and responsibility to remove, edit, or reject
 47 | comments, commits, code, wiki edits, issues, and other contributions that are
 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation
 49 | decisions when appropriate.
 50 | 
 51 | ## Scope
 52 | 
 53 | This Code of Conduct applies within all community spaces, and also applies when
 54 | an individual is officially representing the community in public spaces.
 55 | Examples of representing our community include using an official e-mail address,
 56 | posting via an official social media account, or acting as an appointed
 57 | representative at an online or offline event.
 58 | 
 59 | ## Enforcement
 60 | 
 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
 62 | reported to the community leaders responsible for enforcement at
 63 | vdjsovaj@gmail.com.
 64 | All complaints will be reviewed and investigated promptly and fairly.
 65 | 
 66 | All community leaders are obligated to respect the privacy and security of the
 67 | reporter of any incident.
 68 | 
 69 | ## Enforcement Guidelines
 70 | 
 71 | Community leaders will follow these Community Impact Guidelines in determining
 72 | the consequences for any action they deem in violation of this Code of Conduct:
 73 | 
 74 | ### 1. Correction
 75 | 
 76 | **Community Impact**: Use of inappropriate language or other behavior deemed
 77 | unprofessional or unwelcome in the community.
 78 | 
 79 | **Consequence**: A private, written warning from community leaders, providing
 80 | clarity around the nature of the violation and an explanation of why the
 81 | behavior was inappropriate. A public apology may be requested.
 82 | 
 83 | ### 2. Warning
 84 | 
 85 | **Community Impact**: A violation through a single incident or series
 86 | of actions.
 87 | 
 88 | **Consequence**: A warning with consequences for continued behavior. No
 89 | interaction with the people involved, including unsolicited interaction with
 90 | those enforcing the Code of Conduct, for a specified period of time. This
 91 | includes avoiding interactions in community spaces as well as external channels
 92 | like social media. Violating these terms may lead to a temporary or
 93 | permanent ban.
 94 | 
 95 | ### 3. Temporary Ban
 96 | 
 97 | **Community Impact**: A serious violation of community standards, including
 98 | sustained inappropriate behavior.
 99 | 
100 | **Consequence**: A temporary ban from any sort of interaction or public
101 | communication with the community for a specified period of time. No public or
102 | private interaction with the people involved, including unsolicited interaction
103 | with those enforcing the Code of Conduct, is allowed during this period.
104 | Violating these terms may lead to a permanent ban.
105 | 
106 | ### 4. Permanent Ban
107 | 
108 | **Community Impact**: Demonstrating a pattern of violation of community
109 | standards, including sustained inappropriate behavior,  harassment of an
110 | individual, or aggression toward or disparagement of classes of individuals.
111 | 
112 | **Consequence**: A permanent ban from any sort of public interaction within
113 | the community.
114 | 
115 | ## Attribution
116 | 
117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118 | version 2.0, available at
119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120 | 
121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct
122 | enforcement ladder](https://github.com/mozilla/diversity).
123 | 
124 | [homepage]: https://www.contributor-covenant.org
125 | 
126 | For answers to common questions about this code of conduct, see the FAQ at
127 | https://www.contributor-covenant.org/faq. Translations are available at
128 | https://www.contributor-covenant.org/translations.
129 | 
--------------------------------------------------------------------------------
/KT_ATTRS.md:
--------------------------------------------------------------------------------
 1 | **All Functions of this Library**
 2 | 
 3 | | Functions  | Description  |
 4 | | ------------ | ------------ |
 5 | | isCustomTitle(r: Boolean)  | use to set custom title on seat title.  |
 6 | | setCustomTitle(titles: List)  | To set custom titles this function needs ArrayList of String.  |
 7 | | setSelectSeatLimit(limit: Int)  | Use to set selected seat limit.  |
 8 | | setSeatGaping(size: Int)  | use for each seat margin.  |
 9 | | setSeatLayoutPadding(size: Int) | Use to set Container Layout Padding. |
10 | | setSeatSize(size: Int) | Use to set seat size. This size uses for height and weight. |
11 | | setSeatSizeBySeatsColumn(seatsInColumn: Int) | This function assigns an "importance" value to a seat in terms of how much space it should occupy on the screen. A larger weight value allows it to expand to fill any remaining space in the parent view. | |
12 | 
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
 1 | MIT License
 2 | 
 3 | Copyright (c) 2022 Md. Zahidul Islam
 4 | 
 5 | Permission is hereby granted, free of charge, to any person obtaining a copy
 6 | of this software and associated documentation files (the "Software"), to deal
 7 | in the Software without restriction, including without limitation the rights
 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 | 
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 | 
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 | 
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
  1 | 
  2 | # SeatBookView
  3 | SeatBookView is an Android Studio Library that helps to make it easier to create Bus 🚍, Train 🚉, Cinema Theater Seat UI and all functionalities are given. Based on [varunjohn/Booking-Seats-Layout-Sample](https://github.com/varunjohn/Booking-Seats-Layout-Sample) [](https://jitpack.io/#JahidHasanCO/SeatBookView)
  4 | 
  5 | 
  6 | ## Preview 
  7 |  8 | 
  9 | # Installation
 10 | **For Gradle:**
 11 | 
 12 | **Step 1:** Add the JitPack repository to your build file
 13 | Add it in your root build.gradle at the end of repositories:
 14 | ```sh
 15 | 	allprojects {
 16 | 		repositories {
 17 | 			...
 18 | 			maven { url 'https://jitpack.io' }
 19 | 		}
 20 | 	}
 21 | ```
 22 | 
 23 | **Step 2:** Add the dependency
 24 | ```sh
 25 | dependencies {
 26 | 	       implementation 'com.github.JahidHasanCO:SeatBookView:1.0.4'
 27 | 	}
 28 | ```
 29 | 
 30 | **For Maven:**
 31 | 
 32 | To get a Git project into your build:
 33 | **Step 1:**  Add the JitPack repository to your build file
 34 | 
 35 | ```sh
 36 | 
 37 | 		
 38 | 		    jitpack.io
 39 | 		    https://jitpack.io
 40 | 		
 41 | 	
 42 | ```
 43 | 
 44 | **Step 2:** Add the dependency
 45 | 
 46 | ```
 47 | 	
 48 | 	    com.github.JahidHasanCO
 49 | 	    SeatBookView
 50 | 	    Tag
 51 | 	
 52 | ```
 53 | 
 54 | # Usage
 55 | 
 56 | ```xml
 57 |         
 70 | ```
 71 | 
 72 | 
 73 | **Attributes of this Library**
 74 | 
 75 | |  XML Attributes  | Description   |
 76 | | ------------ | ------------ |
 77 | | app:available_seat_background  | This attribute used to set background of non booked seat for any Drawable file.  |
 78 | | app:reserved_seat_background  | This attribute used to set background of reserved seat for any Drawable file.    |
 79 | | app:booked_seat_background  | This attribute used to set background of  booked seat for any Drawable file.    |
 80 | | app:selected_seats_background  | This attribute used to set background of selected seat for any Drawable file.    |
 81 | | app:reserved_seats_text_color  | Color of the reserved seat text.   |
 82 | | app:booked_seats_text_color  | Color of the booked seat text.  |
 83 | | app:available_seats_text_color  | Color of the non booked seat text.  |
 84 | | app:seat_size  | Size of the Seat  ||
 85 | 
 86 | Check All XML Attributes [here](https://github.com/JahidHasanCO/SeatBookView/blob/master/ATTRS.md)
 87 | 
 88 | ------------
 89 | 
 90 | 
 91 | For creating a seat system you have to create a String for your seat position.
 92 | ```kotlin
 93 |     private var seats = (
 94 |             "/U___S" +
 95 |                     "/_____" +
 96 |                     "/AA_AA" +
 97 |                     "/UA_AR" +
 98 |                     "/AA_AA" +
 99 |                     "/RU_AA" +
100 |                     "/AA_AR" +
101 |                     "/AU_AA" +
102 |                     "/AA_AA" +
103 |                     "/AAAAA"
104 |             )
105 | ```
106 | | Symbol | Uses For |
107 | | ------ | ------ |
108 | | A | Use to create a seat that hasn't book |
109 | | R | Use to create a seat that is already reserved. |
110 | | U | Use to create a seat that is already booked. |
111 | | S | Use to create an empty seat that you can assign Drawable. |
112 | | / | Use to create a new row. |
113 | | _ | Use to create a space.|
114 | 
115 | ---
116 | 
117 | 
118 | For setting the custom title of a seat, you need to create an ArrayList and set the value by index (You need to add value the same as your seat plan).
119 | ```kotlin
120 |     private var title = listOf(
121 |         "/", "I1", "", "", "", "E5",
122 |         "/", "", "", "", "", "",
123 |         "/", "A1", "A2", "", "A3", "A4",
124 |         "/", "B1", "B2", "", "B3", "B4",
125 |         "/", "C1", "C2", "", "C3", "C4",
126 |         "/", "D1", "D2", "", "D3", "D4",
127 |         "/", "E1", "E2", "", "E3", "E4",
128 |         "/", "F1", "F2", "", "F3", "F4",
129 |         "/", "G1", "G2", "", "G3", "G4",
130 |         "/", "H1", "H2", "H3", "H4", "H5"
131 |     )
132 | ```
133 | 
134 | Create SeatBookView Object and set Layout, Titles, Seat String, and some Attributes.
135 | ```kotlin
136 |     private lateinit var seatBookView: SeatBookView
137 |         
138 |         seatBookView = findViewById(R.id.layoutSeat)
139 |         seatBookView.setSeatsLayoutString(seats)
140 |             .isCustomTitle(true)
141 |             .setCustomTitle(title)
142 |             .setSeatLayoutPadding(2)
143 |             .setSeatSizeBySeatsColumnAndLayoutWidth(5, -1)
144 |         //ParentLayoutWeight -1 if Your seatBookView layout_width = match_parent / wrap_content
145 | 
146 | 
147 |         seatBookView.show()
148 | 
149 | ```
150 | 
151 | **Functions of this Library**
152 | 
153 | | Functions  | Description  |
154 | | ------------ | ------------ |
155 | | isCustomTitle(r: Boolean)  | use to set custom title on seat title.  |
156 | | setCustomTitle(titles: List)  | To set custom titles this function needs ArrayList of String.  |
157 | | setSelectSeatLimit(limit: Int)  | Use to set selected seat limit.  |
158 | | setSeatGaping(size: Int)  | use for each seat margin.  |
159 | | setSeatLayoutPadding(size: Int) | Use to set Container Layout Padding. |
160 | | setSeatSize(size: Int) | Use to set seat size. This size uses for height and weight. |
161 | | setSeatSizeBySeatsColumnAndLayoutWidth(seatsInColumn: Int, parentLayoutWeight: Int)  | Note: ParentLayoutWeight -1 if Your seatBookView layout_width = match_parent / wrap_content | |
162 | 
163 | Check all functions [here](https://github.com/JahidHasanCO/SeatBookView/blob/master/KT_ATTRS.md)
164 | 
165 | ------------
166 | 
167 | 
168 | For track click on seat to call setSeatLongClickListener()
169 | 
170 | ```kotlin
171 |         seatBookView.setSeatClickListener(object : SeatBookView.SeatClickListener {
172 |             override fun onAvailableSeatClick(selectedIdList: List, view: View) {
173 |             }
174 |             override fun onBookedSeatClick(view: View) {
175 |             }
176 |             override fun onReservedSeatClick(view: View) {
177 |             }
178 |         })
179 | ```
180 | 
181 | ------------
182 | 
183 | 
184 | For track Long press on seat to call setSeatLongClickListener()
185 | 
186 | ```kotlin
187 |     seatBookView.setSeatLongClickListener(object:SeatBookView.SeatLongClickListener{
188 |             override fun onAvailableSeatLongClick(view: View) {
189 |                 Toast.makeText(this@MainActivity,"Long Pressed",Toast.LENGTH_SHORT).show()
190 |             }
191 |             override fun onBookedSeatLongClick(view: View) {
192 |             }
193 |             override fun onReservedSeatLongClick(view: View) {
194 |             }
195 |         })
196 | ```
197 | 
198 | 
199 | ## LICENSE
200 | 
201 | 
202 | This project is distributed under the MIT license, check the license for more info.
203 | 
204 | 
205 | ```
206 | MIT License
207 | 
208 | Copyright (c) 2022 Md. Zahidul Islam
209 | 
210 | Permission is hereby granted, free of charge, to any person obtaining a copy
211 | of this software and associated documentation files (the "Software"), to deal
212 | in the Software without restriction, including without limitation the rights
213 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
214 | copies of the Software, and to permit persons to whom the Software is
215 | furnished to do so, subject to the following conditions:
216 | 
217 | The above copyright notice and this permission notice shall be included in all
218 | copies or substantial portions of the Software.
219 | 
220 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
221 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
222 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
223 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
224 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
225 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
226 | SOFTWARE.
227 | ```
228 | 
229 | 
230 | ### Contributing 💡
231 | If you want to contribute to this project and make it better with new ideas, your pull request is very welcomed.
232 | If you find any issue just put it in the repository issue section, thank you.
233 | 
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
 1 | # Security Policy
 2 | 
 3 | ## Supported Versions
 4 | 
 5 | Use this section to tell people about which versions of your project are
 6 | currently being supported with security updates.
 7 | 
 8 | | Version | Supported          |
 9 | | ------- | ------------------ |
10 | | 5.1.x   | :white_check_mark: |
11 | | 5.0.x   | :x:                |
12 | | 4.0.x   | :white_check_mark: |
13 | | < 4.0   | :x:                |
14 | 
15 | ## Reporting a Vulnerability
16 | 
17 | Use this section to tell people how to report a vulnerability.
18 | 
19 | Tell them where to go, how often they can expect to get an update on a
20 | reported vulnerability, what to expect if the vulnerability is accepted or
21 | declined, etc.
22 | 
--------------------------------------------------------------------------------
/SeatBookView/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/SeatBookView/build.gradle:
--------------------------------------------------------------------------------
 1 | plugins {
 2 |     id 'com.android.library'
 3 |     id 'org.jetbrains.kotlin.android'
 4 | }
 5 | 
 6 | android {
 7 |     compileSdk 32
 8 | 
 9 |     defaultConfig {
10 |         minSdk 21
11 |         targetSdk 32
12 | 
13 |         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
14 |         consumerProguardFiles "consumer-rules.pro"
15 |     }
16 | 
17 |     buildTypes {
18 |         release {
19 |             minifyEnabled false
20 |             proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
21 |         }
22 |     }
23 |     compileOptions {
24 |         sourceCompatibility JavaVersion.VERSION_1_8
25 |         targetCompatibility JavaVersion.VERSION_1_8
26 |     }
27 |     kotlinOptions {
28 |         jvmTarget = '1.8'
29 |     }
30 | }
31 | 
32 | dependencies {
33 | 
34 |     implementation 'androidx.core:core-ktx:1.8.0'
35 |     implementation 'androidx.appcompat:appcompat:1.5.0'
36 |     implementation 'com.google.android.material:material:1.6.1'
37 |     testImplementation 'junit:junit:4.13.2'
38 |     androidTestImplementation 'androidx.test.ext:junit:1.1.3'
39 |     androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
40 | }
--------------------------------------------------------------------------------
/SeatBookView/consumer-rules.pro:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JahidHasanCO/SeatBookView/a6339723c608e10029826c5db7c6ac410f21fc27/SeatBookView/consumer-rules.pro
--------------------------------------------------------------------------------
/SeatBookView/proguard-rules.pro:
--------------------------------------------------------------------------------
 1 | # Add project specific ProGuard rules here.
 2 | # You can control the set of applied configuration files using the
 3 | # proguardFiles setting in build.gradle.
 4 | #
 5 | # For more details, see
 6 | #   http://developer.android.com/guide/developing/tools/proguard.html
 7 | 
 8 | # If your project uses WebView with JS, uncomment the following
 9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | #   public *;
13 | #}
14 | 
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 | 
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/SeatBookView/src/androidTest/java/dev/jahidhasanco/seatbookview/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
 1 | package dev.jahidhasanco.seatbookview
 2 | 
 3 | import androidx.test.platform.app.InstrumentationRegistry
 4 | import androidx.test.ext.junit.runners.AndroidJUnit4
 5 | 
 6 | import org.junit.Test
 7 | import org.junit.runner.RunWith
 8 | 
 9 | import org.junit.Assert.*
10 | 
11 | /**
12 |  * Instrumented test, which will execute on an Android device.
13 |  *
14 |  * See [testing documentation](http://d.android.com/tools/testing).
15 |  */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 |     @Test
19 |     fun useAppContext() {
20 |         // Context of the app under test.
21 |         val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 |         assertEquals("dev.jahidhasanco.seatbookview.test", appContext.packageName)
23 |     }
24 | }
--------------------------------------------------------------------------------
/SeatBookView/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 | 
2 | 
4 | 
5 | 
--------------------------------------------------------------------------------
/SeatBookView/src/main/java/dev/jahidhasanco/seatbookview/SeatBookView.kt:
--------------------------------------------------------------------------------
  1 | package dev.jahidhasanco.seatbookview
  2 | 
  3 | 
  4 | import android.content.Context
  5 | import android.graphics.Color
  6 | import android.util.AttributeSet
  7 | import android.util.TypedValue
  8 | import android.view.Gravity
  9 | import android.view.View
 10 | import android.view.ViewGroup
 11 | import android.widget.LinearLayout
 12 | import android.widget.TextView
 13 | import androidx.core.content.withStyledAttributes
 14 | 
 15 | 
 16 | class SeatBookView
 17 | @JvmOverloads
 18 | constructor(context: Context, attrs: AttributeSet? = null) :
 19 |     LinearLayout(context, attrs) {
 20 | 
 21 |     private var viewGroupLayout: ViewGroup
 22 |     private var seats = ""
 23 | 
 24 |     private var title = listOf()
 25 | 
 26 |     private var selectedIdList: ArrayList = arrayListOf()
 27 |     private var bookedIdList: ArrayList = arrayListOf()
 28 |     private var reservedIdList: ArrayList = arrayListOf()
 29 | 
 30 |     private var selectSeatLimit = Int.MAX_VALUE
 31 |     private var selectedSeats = 0
 32 |     private var isOnlyShow = false
 33 | 
 34 |     private var isCustomTitle = false
 35 |     private var count = 0
 36 | 
 37 |     private var seatViewList: ArrayList = arrayListOf()
 38 |     private var seatSize = 0
 39 |     private var seatGaping = 0
 40 |     private var layout_padding = 0
 41 | 
 42 |     private val STATUS_AVAILABLE = 1
 43 |     private val STATUS_BOOKED = 2
 44 |     private val STATUS_RESERVED = 3
 45 | 
 46 | 
 47 |     //displayMetrics .density ... display size
 48 |     private var pxWidth = 0
 49 |     private var pxHeight = 0
 50 |     private var scaledDensity = 0f
 51 |     private var density = 0f
 52 | 
 53 |     // seats Drawable
 54 |     private var bookDrawable = R.drawable.seats_book
 55 |     private var bookedDrawable = R.drawable.seats_booked
 56 |     private var reservedDrawable = R.drawable.seats_reserved
 57 |     private var selectedDrawable = R.drawable.seats_selected
 58 | 
 59 | 
 60 |     // Seat Text
 61 |     private var textSize = 0f
 62 |     private var reservedTextColor = Color.WHITE
 63 |     private var bookTextColor = Color.BLACK
 64 |     private var bookedTextColor = Color.WHITE
 65 | 
 66 | 
 67 |     private var listener: SeatClickListener? = null
 68 |     private var listenerLong: SeatLongClickListener? = null
 69 | 
 70 | 
 71 |     init {
 72 | 
 73 |         inflate(context, R.layout.layout_view_group, this)
 74 |         viewGroupLayout = findViewById(R.id.layout_viewGroup)
 75 | 
 76 |         getViewSize()
 77 | 
 78 |         if (attrs != null) {
 79 |             context.withStyledAttributes(attrs, R.styleable.SeatBookView, 0, 0) {
 80 | 
 81 |                 textSize =
 82 |                     getDimensionPixelSize(
 83 |                         R.styleable.SeatBookView_seat_text_size,
 84 |                         15
 85 |                     ).toFloat() / scaledDensity
 86 | 
 87 |                 seatSize = (getDimensionPixelSize(
 88 |                     R.styleable.SeatBookView_seat_size,
 89 |                     250
 90 |                 ) / density).toInt()
 91 | 
 92 |                 seatGaping = (getDimensionPixelSize(
 93 |                     R.styleable.SeatBookView_seat_gaping,
 94 |                     10
 95 |                 ) / density).toInt()
 96 | 
 97 |                 reservedDrawable = getResourceId(
 98 |                     R.styleable.SeatBookView_reserved_seat_background,
 99 |                     reservedDrawable
100 |                 )
101 | 
102 |                 bookDrawable =
103 |                     getResourceId(
104 |                         R.styleable.SeatBookView_available_seat_background,
105 |                         bookDrawable
106 |                     )
107 | 
108 |                 bookedDrawable =
109 |                     getResourceId(
110 |                         R.styleable.SeatBookView_booked_seat_background,
111 |                         bookedDrawable
112 |                     )
113 | 
114 |                 selectedDrawable =
115 |                     getResourceId(
116 |                         R.styleable.SeatBookView_selected_seats_background,
117 |                         selectedDrawable
118 |                     )
119 | 
120 |                 reservedTextColor =
121 |                     getColor(
122 |                         R.styleable.SeatBookView_reserved_seats_text_color,
123 |                         reservedTextColor
124 |                     )
125 | 
126 |                 bookTextColor =
127 |                     getColor(
128 |                         R.styleable.SeatBookView_available_seats_text_color,
129 |                         bookTextColor
130 |                     )
131 | 
132 |                 bookedTextColor =
133 |                     getColor(
134 |                         R.styleable.SeatBookView_booked_seats_text_color,
135 |                         bookedTextColor
136 |                     )
137 | 
138 |                 selectSeatLimit = getInt(R.styleable.SeatBookView_seat_select_limit, Int.MAX_VALUE)
139 |             }
140 |         }
141 | 
142 | 
143 |     }
144 | 
145 | 
146 |     private fun getViewSize() {
147 | 
148 |         val displayMetrics = context.resources.displayMetrics
149 |         pxWidth = displayMetrics.widthPixels
150 |         pxHeight = displayMetrics.heightPixels
151 |         scaledDensity = displayMetrics.scaledDensity
152 |         density = displayMetrics.density
153 | 
154 | 
155 |     }
156 | 
157 |     fun isCustomTitle(r: Boolean): SeatBookView {
158 |         isCustomTitle = r
159 |         return this
160 |     }
161 | 
162 |     fun setCustomTitle(titles: List): SeatBookView {
163 |         title = titles
164 |         return this
165 |     }
166 | 
167 |     fun setSelectSeatLimit(limit: Int): SeatBookView {
168 |         selectSeatLimit = limit
169 |         return this
170 |     }
171 | 
172 | 
173 |     fun setSeatGaping(size: Int): SeatBookView {
174 |         seatGaping = (size / density).toInt()
175 |         return this
176 |     }
177 | 
178 |     fun setSeatLayoutPadding(size: Int): SeatBookView {
179 |         layout_padding = (size / density).toInt()
180 |         return this
181 |     }
182 | 
183 |     fun setSeatSize(size: Int): SeatBookView {
184 |         seatSize = (size / density).toInt()
185 |         return this
186 |     }
187 | 
188 |     fun setSeatSizeBySeatsColumnAndLayoutWidth(seatsInColumn: Int, parentLayoutWeight: Int) {
189 |         seatSize = if (parentLayoutWeight != -1) {
190 |             (parentLayoutWeight / seatsInColumn) - ((seatGaping * (seatsInColumn - 1)) + (layout_padding * 2))
191 |         } else {
192 |             (pxWidth / seatsInColumn) - ((seatGaping * (seatsInColumn - 1)) + (layout_padding * 2))
193 |         }
194 |     }
195 | 
196 |     fun setSeatsLayoutString(seats: String): SeatBookView {
197 |         this.seats = seats
198 |         return this
199 |     }
200 | 
201 | 
202 |     fun getSelectedIdList(): List {
203 |         return selectedIdList
204 |     }
205 | 
206 |     fun getBookedIdList(): List {
207 |         return bookedIdList
208 |     }
209 | 
210 |     fun getReservedIdList(): List {
211 |         return reservedIdList
212 |     }
213 | 
214 |     fun setBookedIdList(list: List) {
215 |         for (id in list) {
216 |             markAsBooked(seatViewList[id - 1])
217 |         }
218 |     }
219 | 
220 |     fun setAvailableIdList(list: List) {
221 |         for (id in list) {
222 |             markAsAvailable(seatViewList[id - 1])
223 |         }
224 |     }
225 | 
226 |     fun setReservedIdList(list: List) {
227 |         for (id in list) {
228 |             markAsReserved(seatViewList[id - 1])
229 |         }
230 |     }
231 | 
232 | 
233 |     fun setAvailableSeatsBackground(drawable: Int): SeatBookView {
234 |         bookDrawable = drawable
235 |         return this
236 |     }
237 | 
238 |     fun setIsOnlyShow(r: Boolean) {
239 |         isOnlyShow = r
240 |     }
241 | 
242 |     fun setBookedSeatsBackground(drawable: Int): SeatBookView {
243 |         bookedDrawable = drawable
244 |         return this
245 |     }
246 | 
247 |     fun setReservedSeatsBackground(drawable: Int): SeatBookView {
248 |         reservedDrawable = drawable
249 |         return this
250 |     }
251 | 
252 |     fun setSelectedSeatsBackground(drawable: Int): SeatBookView {
253 |         selectedDrawable = drawable
254 |         return this
255 |     }
256 | 
257 |     fun setSeatTextSize(size: Float) {
258 |         textSize = size / scaledDensity
259 |     }
260 | 
261 | 
262 |     fun setReservedSeatsTextColor(color: Int): SeatBookView {
263 |         reservedTextColor = color
264 |         return this
265 |     }
266 | 
267 |     fun setAvailableSeatsTextColor(color: Int): SeatBookView {
268 |         bookTextColor = color
269 |         return this
270 |     }
271 | 
272 |     fun setBookedSeatsTextColor(color: Int): SeatBookView {
273 |         bookedTextColor = color
274 |         return this
275 |     }
276 | 
277 |     fun getSeatView(id: Int): View {
278 |         return seatViewList[id - 1]
279 |     }
280 | 
281 |     public fun setSeatClickListener(listener: SeatClickListener) {
282 |         this.listener = listener
283 |     }
284 | 
285 |     public fun setSeatLongClickListener(listener: SeatLongClickListener) {
286 |         this.listenerLong = listener
287 |     }
288 | 
289 | 
290 |     fun show() {
291 |         val layoutSeat = LinearLayout(context)
292 |         val params = LinearLayout.LayoutParams(
293 |             ViewGroup.LayoutParams.WRAP_CONTENT,
294 |             ViewGroup.LayoutParams.WRAP_CONTENT
295 |         )
296 |         layoutSeat.orientation = LinearLayout.VERTICAL
297 |         layoutSeat.layoutParams = params
298 |         layoutSeat.setPadding(
299 |             layout_padding * seatGaping,
300 |             layout_padding * seatGaping,
301 |             layout_padding * seatGaping,
302 |             layout_padding * seatGaping
303 |         )
304 |         viewGroupLayout.addView(layoutSeat)
305 | 
306 |         var layout: LinearLayout? = null
307 |         for (index in seats.indices) {
308 |             if (seats[index] == '/') {
309 |                 layout = LinearLayout(context)
310 |                 val paramsV = LinearLayout.LayoutParams(
311 |                     ViewGroup.LayoutParams.WRAP_CONTENT,
312 |                     ViewGroup.LayoutParams.WRAP_CONTENT
313 |                 )
314 |                 layout.layoutParams = paramsV
315 |                 layout.orientation = LinearLayout.HORIZONTAL
316 |                 layout.gravity = Gravity.CENTER
317 | 
318 |                 layoutSeat.addView(layout)
319 |             } else if (seats[index] == 'U') {
320 |                 count++
321 |                 val view = TextView(context)
322 |                 setSeatAttrs(index, view, layout)
323 |                 markAsBooked(view)
324 | 
325 |             } else if (seats[index] == 'A') {
326 |                 count++
327 |                 val view = TextView(context)
328 |                 setSeatAttrs(index, view, layout)
329 |                 markAsAvailable(view)
330 |             } else if (seats[index] == 'R') {
331 |                 count++
332 |                 val view = TextView(context)
333 |                 setSeatAttrs(index, view, layout)
334 |                 markAsReserved(view)
335 | 
336 | 
337 |             } else if (seats[index] == 'S') {
338 |                 count++
339 |                 val view = TextView(context)
340 |                 setSeatAttrs(index, view, layout)
341 |                 markAsTransparentSeat(view)
342 |             } else if (seats[index] == '_') {
343 |                 val view = TextView(context)
344 |                 val layoutParams = LinearLayout.LayoutParams(seatSize, seatSize)
345 |                 layoutParams.setMargins(seatGaping, seatGaping, seatGaping, seatGaping)
346 |                 view.layoutParams = layoutParams
347 |                 view.setBackgroundColor(Color.TRANSPARENT)
348 |                 view.text = ""
349 |                 layout!!.addView(view)
350 |             }
351 |         }
352 | 
353 |     }
354 | 
355 |     private fun setSeatAttrs(index: Int, view: TextView, layout: LinearLayout?) {
356 |         val layoutParams = LinearLayout.LayoutParams(seatSize, seatSize)
357 |         layoutParams.setMargins(seatGaping, seatGaping, seatGaping, seatGaping)
358 |         view.layoutParams = layoutParams
359 |         view.gravity = Gravity.CENTER
360 |         view.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize)
361 |         seatViewList.add(view)
362 |         layout!!.addView(view)
363 |         view.id = count
364 |         if (isCustomTitle) {
365 |             view.text = title[index]
366 |         } else {
367 |             view.text = "$count"
368 |         }
369 | 
370 |         view.setOnClickListener {
371 |             if (!isOnlyShow) {
372 |                 seatClick(it)
373 |             }
374 |         }
375 | 
376 |         view.setOnLongClickListener {
377 |             if (!isOnlyShow) {
378 |                 seatLongClick(it)
379 |                 true
380 |             } else {
381 |                 false
382 |             }
383 |         }
384 | 
385 |     }
386 | 
387 |     fun markAsBooked(view: TextView) {
388 |         view.setBackgroundResource(bookedDrawable)
389 |         view.setTextColor(bookedTextColor)
390 |         view.tag = STATUS_BOOKED
391 |     }
392 | 
393 |     fun markAsAvailable(view: TextView) {
394 |         view.setBackgroundResource(bookDrawable)
395 |         view.setTextColor(bookTextColor)
396 |         view.tag = STATUS_AVAILABLE
397 |     }
398 | 
399 |     fun markAsReserved(view: TextView) {
400 |         view.setBackgroundResource(reservedDrawable)
401 |         view.setTextColor(reservedTextColor)
402 |         view.tag = STATUS_RESERVED
403 |     }
404 | 
405 |     fun markAsTransparentSeat(view: TextView) {
406 |         view.setBackgroundColor(Color.TRANSPARENT)
407 |         view.text = ""
408 |         view.tag = 0
409 |     }
410 | 
411 |     private fun seatClick(view: View) {
412 |         if (view.tag as Int == STATUS_AVAILABLE) {
413 |             if (view.id in selectedIdList) {
414 |                 selectedIdList.remove(view.id)
415 |                 view.setBackgroundResource(bookDrawable)
416 |                 selectedSeats--
417 | 
418 |                 listener?.onAvailableSeatClick(selectedIdList, view)
419 | 
420 |             } else {
421 |                 if (selectedSeats < selectSeatLimit) {
422 |                     selectedIdList.add(view.id)
423 |                     view.setBackgroundResource(selectedDrawable)
424 |                     selectedSeats++
425 | 
426 |                     listener?.onAvailableSeatClick(selectedIdList, view)
427 | 
428 |                 }
429 | 
430 |             }
431 |         } else if (view.tag as Int == STATUS_BOOKED) {
432 |             listener?.onBookedSeatClick(view)
433 | 
434 |         } else if (view.tag as Int == STATUS_RESERVED) {
435 |             listener?.onReservedSeatClick(view)
436 |         }
437 |     }
438 | 
439 |     private fun seatLongClick(view: View): Boolean {
440 |         if (view.tag as Int == STATUS_AVAILABLE) {
441 |             listenerLong?.onAvailableSeatLongClick(view)
442 |             return true
443 |         } else if (view.tag as Int == STATUS_BOOKED) {
444 |             listenerLong?.onBookedSeatLongClick(view)
445 |             return true
446 |         } else if (view.tag as Int == STATUS_RESERVED) {
447 |             listenerLong?.onReservedSeatLongClick(view)
448 |             return true
449 |         }
450 |         return false
451 |     }
452 | 
453 | 
454 | }
455 | 
456 | 
457 | 
--------------------------------------------------------------------------------
/SeatBookView/src/main/java/dev/jahidhasanco/seatbookview/SeatClickListener.kt:
--------------------------------------------------------------------------------
 1 | package dev.jahidhasanco.seatbookview
 2 | 
 3 | import android.view.View
 4 | 
 5 | 
 6 | interface SeatClickListener {
 7 |     fun onAvailableSeatClick(selectedIdList: List, view: View)
 8 |     fun onBookedSeatClick(view: View)
 9 |     fun onReservedSeatClick(view: View)
10 | }
11 | 
12 | 
--------------------------------------------------------------------------------
/SeatBookView/src/main/java/dev/jahidhasanco/seatbookview/SeatLongClickListener.kt:
--------------------------------------------------------------------------------
1 | package dev.jahidhasanco.seatbookview
2 | 
3 | import android.view.View
4 | 
5 | interface SeatLongClickListener {
6 |     fun onAvailableSeatLongClick(view: View)
7 |     fun onBookedSeatLongClick(view: View)
8 |     fun onReservedSeatLongClick(view: View)
9 | }
--------------------------------------------------------------------------------
/SeatBookView/src/main/res/drawable/seats_book.xml:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 5 |
 
  8 | 
  9 | # Installation
 10 | **For Gradle:**
 11 | 
 12 | **Step 1:** Add the JitPack repository to your build file
 13 | Add it in your root build.gradle at the end of repositories:
 14 | ```sh
 15 | 	allprojects {
 16 | 		repositories {
 17 | 			...
 18 | 			maven { url 'https://jitpack.io' }
 19 | 		}
 20 | 	}
 21 | ```
 22 | 
 23 | **Step 2:** Add the dependency
 24 | ```sh
 25 | dependencies {
 26 | 	       implementation 'com.github.JahidHasanCO:SeatBookView:1.0.4'
 27 | 	}
 28 | ```
 29 | 
 30 | **For Maven:**
 31 | 
 32 | To get a Git project into your build:
 33 | **Step 1:**  Add the JitPack repository to your build file
 34 | 
 35 | ```sh
 36 | 
 37 | 		
 38 | 		    jitpack.io
 39 | 		    https://jitpack.io
 40 | 		
 41 | 	
 42 | ```
 43 | 
 44 | **Step 2:** Add the dependency
 45 | 
 46 | ```
 47 | 	
 48 | 	    com.github.JahidHasanCO
 49 | 	    SeatBookView
 50 | 	    Tag
 51 | 	
 52 | ```
 53 | 
 54 | # Usage
 55 | 
 56 | ```xml
 57 |         
 70 | ```
 71 | 
 72 | 
 73 | **Attributes of this Library**
 74 | 
 75 | |  XML Attributes  | Description   |
 76 | | ------------ | ------------ |
 77 | | app:available_seat_background  | This attribute used to set background of non booked seat for any Drawable file.  |
 78 | | app:reserved_seat_background  | This attribute used to set background of reserved seat for any Drawable file.    |
 79 | | app:booked_seat_background  | This attribute used to set background of  booked seat for any Drawable file.    |
 80 | | app:selected_seats_background  | This attribute used to set background of selected seat for any Drawable file.    |
 81 | | app:reserved_seats_text_color  | Color of the reserved seat text.   |
 82 | | app:booked_seats_text_color  | Color of the booked seat text.  |
 83 | | app:available_seats_text_color  | Color of the non booked seat text.  |
 84 | | app:seat_size  | Size of the Seat  ||
 85 | 
 86 | Check All XML Attributes [here](https://github.com/JahidHasanCO/SeatBookView/blob/master/ATTRS.md)
 87 | 
 88 | ------------
 89 | 
 90 | 
 91 | For creating a seat system you have to create a String for your seat position.
 92 | ```kotlin
 93 |     private var seats = (
 94 |             "/U___S" +
 95 |                     "/_____" +
 96 |                     "/AA_AA" +
 97 |                     "/UA_AR" +
 98 |                     "/AA_AA" +
 99 |                     "/RU_AA" +
100 |                     "/AA_AR" +
101 |                     "/AU_AA" +
102 |                     "/AA_AA" +
103 |                     "/AAAAA"
104 |             )
105 | ```
106 | | Symbol | Uses For |
107 | | ------ | ------ |
108 | | A | Use to create a seat that hasn't book |
109 | | R | Use to create a seat that is already reserved. |
110 | | U | Use to create a seat that is already booked. |
111 | | S | Use to create an empty seat that you can assign Drawable. |
112 | | / | Use to create a new row. |
113 | | _ | Use to create a space.|
114 | 
115 | ---
116 | 
117 | 
118 | For setting the custom title of a seat, you need to create an ArrayList and set the value by index (You need to add value the same as your seat plan).
119 | ```kotlin
120 |     private var title = listOf(
121 |         "/", "I1", "", "", "", "E5",
122 |         "/", "", "", "", "", "",
123 |         "/", "A1", "A2", "", "A3", "A4",
124 |         "/", "B1", "B2", "", "B3", "B4",
125 |         "/", "C1", "C2", "", "C3", "C4",
126 |         "/", "D1", "D2", "", "D3", "D4",
127 |         "/", "E1", "E2", "", "E3", "E4",
128 |         "/", "F1", "F2", "", "F3", "F4",
129 |         "/", "G1", "G2", "", "G3", "G4",
130 |         "/", "H1", "H2", "H3", "H4", "H5"
131 |     )
132 | ```
133 | 
134 | Create SeatBookView Object and set Layout, Titles, Seat String, and some Attributes.
135 | ```kotlin
136 |     private lateinit var seatBookView: SeatBookView
137 |         
138 |         seatBookView = findViewById(R.id.layoutSeat)
139 |         seatBookView.setSeatsLayoutString(seats)
140 |             .isCustomTitle(true)
141 |             .setCustomTitle(title)
142 |             .setSeatLayoutPadding(2)
143 |             .setSeatSizeBySeatsColumnAndLayoutWidth(5, -1)
144 |         //ParentLayoutWeight -1 if Your seatBookView layout_width = match_parent / wrap_content
145 | 
146 | 
147 |         seatBookView.show()
148 | 
149 | ```
150 | 
151 | **Functions of this Library**
152 | 
153 | | Functions  | Description  |
154 | | ------------ | ------------ |
155 | | isCustomTitle(r: Boolean)  | use to set custom title on seat title.  |
156 | | setCustomTitle(titles: List)  | To set custom titles this function needs ArrayList of String.  |
157 | | setSelectSeatLimit(limit: Int)  | Use to set selected seat limit.  |
158 | | setSeatGaping(size: Int)  | use for each seat margin.  |
159 | | setSeatLayoutPadding(size: Int) | Use to set Container Layout Padding. |
160 | | setSeatSize(size: Int) | Use to set seat size. This size uses for height and weight. |
161 | | setSeatSizeBySeatsColumnAndLayoutWidth(seatsInColumn: Int, parentLayoutWeight: Int)  | Note: ParentLayoutWeight -1 if Your seatBookView layout_width = match_parent / wrap_content | |
162 | 
163 | Check all functions [here](https://github.com/JahidHasanCO/SeatBookView/blob/master/KT_ATTRS.md)
164 | 
165 | ------------
166 | 
167 | 
168 | For track click on seat to call setSeatLongClickListener()
169 | 
170 | ```kotlin
171 |         seatBookView.setSeatClickListener(object : SeatBookView.SeatClickListener {
172 |             override fun onAvailableSeatClick(selectedIdList: List, view: View) {
173 |             }
174 |             override fun onBookedSeatClick(view: View) {
175 |             }
176 |             override fun onReservedSeatClick(view: View) {
177 |             }
178 |         })
179 | ```
180 | 
181 | ------------
182 | 
183 | 
184 | For track Long press on seat to call setSeatLongClickListener()
185 | 
186 | ```kotlin
187 |     seatBookView.setSeatLongClickListener(object:SeatBookView.SeatLongClickListener{
188 |             override fun onAvailableSeatLongClick(view: View) {
189 |                 Toast.makeText(this@MainActivity,"Long Pressed",Toast.LENGTH_SHORT).show()
190 |             }
191 |             override fun onBookedSeatLongClick(view: View) {
192 |             }
193 |             override fun onReservedSeatLongClick(view: View) {
194 |             }
195 |         })
196 | ```
197 | 
198 | 
199 | ## LICENSE
200 | 
201 | 
202 | This project is distributed under the MIT license, check the license for more info.
203 | 
204 | 
205 | ```
206 | MIT License
207 | 
208 | Copyright (c) 2022 Md. Zahidul Islam
209 | 
210 | Permission is hereby granted, free of charge, to any person obtaining a copy
211 | of this software and associated documentation files (the "Software"), to deal
212 | in the Software without restriction, including without limitation the rights
213 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
214 | copies of the Software, and to permit persons to whom the Software is
215 | furnished to do so, subject to the following conditions:
216 | 
217 | The above copyright notice and this permission notice shall be included in all
218 | copies or substantial portions of the Software.
219 | 
220 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
221 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
222 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
223 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
224 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
225 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
226 | SOFTWARE.
227 | ```
228 | 
229 | 
230 | ### Contributing 💡
231 | If you want to contribute to this project and make it better with new ideas, your pull request is very welcomed.
232 | If you find any issue just put it in the repository issue section, thank you.
233 | 
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
 1 | # Security Policy
 2 | 
 3 | ## Supported Versions
 4 | 
 5 | Use this section to tell people about which versions of your project are
 6 | currently being supported with security updates.
 7 | 
 8 | | Version | Supported          |
 9 | | ------- | ------------------ |
10 | | 5.1.x   | :white_check_mark: |
11 | | 5.0.x   | :x:                |
12 | | 4.0.x   | :white_check_mark: |
13 | | < 4.0   | :x:                |
14 | 
15 | ## Reporting a Vulnerability
16 | 
17 | Use this section to tell people how to report a vulnerability.
18 | 
19 | Tell them where to go, how often they can expect to get an update on a
20 | reported vulnerability, what to expect if the vulnerability is accepted or
21 | declined, etc.
22 | 
--------------------------------------------------------------------------------
/SeatBookView/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/SeatBookView/build.gradle:
--------------------------------------------------------------------------------
 1 | plugins {
 2 |     id 'com.android.library'
 3 |     id 'org.jetbrains.kotlin.android'
 4 | }
 5 | 
 6 | android {
 7 |     compileSdk 32
 8 | 
 9 |     defaultConfig {
10 |         minSdk 21
11 |         targetSdk 32
12 | 
13 |         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
14 |         consumerProguardFiles "consumer-rules.pro"
15 |     }
16 | 
17 |     buildTypes {
18 |         release {
19 |             minifyEnabled false
20 |             proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
21 |         }
22 |     }
23 |     compileOptions {
24 |         sourceCompatibility JavaVersion.VERSION_1_8
25 |         targetCompatibility JavaVersion.VERSION_1_8
26 |     }
27 |     kotlinOptions {
28 |         jvmTarget = '1.8'
29 |     }
30 | }
31 | 
32 | dependencies {
33 | 
34 |     implementation 'androidx.core:core-ktx:1.8.0'
35 |     implementation 'androidx.appcompat:appcompat:1.5.0'
36 |     implementation 'com.google.android.material:material:1.6.1'
37 |     testImplementation 'junit:junit:4.13.2'
38 |     androidTestImplementation 'androidx.test.ext:junit:1.1.3'
39 |     androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
40 | }
--------------------------------------------------------------------------------
/SeatBookView/consumer-rules.pro:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JahidHasanCO/SeatBookView/a6339723c608e10029826c5db7c6ac410f21fc27/SeatBookView/consumer-rules.pro
--------------------------------------------------------------------------------
/SeatBookView/proguard-rules.pro:
--------------------------------------------------------------------------------
 1 | # Add project specific ProGuard rules here.
 2 | # You can control the set of applied configuration files using the
 3 | # proguardFiles setting in build.gradle.
 4 | #
 5 | # For more details, see
 6 | #   http://developer.android.com/guide/developing/tools/proguard.html
 7 | 
 8 | # If your project uses WebView with JS, uncomment the following
 9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | #   public *;
13 | #}
14 | 
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 | 
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/SeatBookView/src/androidTest/java/dev/jahidhasanco/seatbookview/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
 1 | package dev.jahidhasanco.seatbookview
 2 | 
 3 | import androidx.test.platform.app.InstrumentationRegistry
 4 | import androidx.test.ext.junit.runners.AndroidJUnit4
 5 | 
 6 | import org.junit.Test
 7 | import org.junit.runner.RunWith
 8 | 
 9 | import org.junit.Assert.*
10 | 
11 | /**
12 |  * Instrumented test, which will execute on an Android device.
13 |  *
14 |  * See [testing documentation](http://d.android.com/tools/testing).
15 |  */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 |     @Test
19 |     fun useAppContext() {
20 |         // Context of the app under test.
21 |         val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 |         assertEquals("dev.jahidhasanco.seatbookview.test", appContext.packageName)
23 |     }
24 | }
--------------------------------------------------------------------------------
/SeatBookView/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 | 
2 | 
4 | 
5 | 
--------------------------------------------------------------------------------
/SeatBookView/src/main/java/dev/jahidhasanco/seatbookview/SeatBookView.kt:
--------------------------------------------------------------------------------
  1 | package dev.jahidhasanco.seatbookview
  2 | 
  3 | 
  4 | import android.content.Context
  5 | import android.graphics.Color
  6 | import android.util.AttributeSet
  7 | import android.util.TypedValue
  8 | import android.view.Gravity
  9 | import android.view.View
 10 | import android.view.ViewGroup
 11 | import android.widget.LinearLayout
 12 | import android.widget.TextView
 13 | import androidx.core.content.withStyledAttributes
 14 | 
 15 | 
 16 | class SeatBookView
 17 | @JvmOverloads
 18 | constructor(context: Context, attrs: AttributeSet? = null) :
 19 |     LinearLayout(context, attrs) {
 20 | 
 21 |     private var viewGroupLayout: ViewGroup
 22 |     private var seats = ""
 23 | 
 24 |     private var title = listOf()
 25 | 
 26 |     private var selectedIdList: ArrayList = arrayListOf()
 27 |     private var bookedIdList: ArrayList = arrayListOf()
 28 |     private var reservedIdList: ArrayList = arrayListOf()
 29 | 
 30 |     private var selectSeatLimit = Int.MAX_VALUE
 31 |     private var selectedSeats = 0
 32 |     private var isOnlyShow = false
 33 | 
 34 |     private var isCustomTitle = false
 35 |     private var count = 0
 36 | 
 37 |     private var seatViewList: ArrayList = arrayListOf()
 38 |     private var seatSize = 0
 39 |     private var seatGaping = 0
 40 |     private var layout_padding = 0
 41 | 
 42 |     private val STATUS_AVAILABLE = 1
 43 |     private val STATUS_BOOKED = 2
 44 |     private val STATUS_RESERVED = 3
 45 | 
 46 | 
 47 |     //displayMetrics .density ... display size
 48 |     private var pxWidth = 0
 49 |     private var pxHeight = 0
 50 |     private var scaledDensity = 0f
 51 |     private var density = 0f
 52 | 
 53 |     // seats Drawable
 54 |     private var bookDrawable = R.drawable.seats_book
 55 |     private var bookedDrawable = R.drawable.seats_booked
 56 |     private var reservedDrawable = R.drawable.seats_reserved
 57 |     private var selectedDrawable = R.drawable.seats_selected
 58 | 
 59 | 
 60 |     // Seat Text
 61 |     private var textSize = 0f
 62 |     private var reservedTextColor = Color.WHITE
 63 |     private var bookTextColor = Color.BLACK
 64 |     private var bookedTextColor = Color.WHITE
 65 | 
 66 | 
 67 |     private var listener: SeatClickListener? = null
 68 |     private var listenerLong: SeatLongClickListener? = null
 69 | 
 70 | 
 71 |     init {
 72 | 
 73 |         inflate(context, R.layout.layout_view_group, this)
 74 |         viewGroupLayout = findViewById(R.id.layout_viewGroup)
 75 | 
 76 |         getViewSize()
 77 | 
 78 |         if (attrs != null) {
 79 |             context.withStyledAttributes(attrs, R.styleable.SeatBookView, 0, 0) {
 80 | 
 81 |                 textSize =
 82 |                     getDimensionPixelSize(
 83 |                         R.styleable.SeatBookView_seat_text_size,
 84 |                         15
 85 |                     ).toFloat() / scaledDensity
 86 | 
 87 |                 seatSize = (getDimensionPixelSize(
 88 |                     R.styleable.SeatBookView_seat_size,
 89 |                     250
 90 |                 ) / density).toInt()
 91 | 
 92 |                 seatGaping = (getDimensionPixelSize(
 93 |                     R.styleable.SeatBookView_seat_gaping,
 94 |                     10
 95 |                 ) / density).toInt()
 96 | 
 97 |                 reservedDrawable = getResourceId(
 98 |                     R.styleable.SeatBookView_reserved_seat_background,
 99 |                     reservedDrawable
100 |                 )
101 | 
102 |                 bookDrawable =
103 |                     getResourceId(
104 |                         R.styleable.SeatBookView_available_seat_background,
105 |                         bookDrawable
106 |                     )
107 | 
108 |                 bookedDrawable =
109 |                     getResourceId(
110 |                         R.styleable.SeatBookView_booked_seat_background,
111 |                         bookedDrawable
112 |                     )
113 | 
114 |                 selectedDrawable =
115 |                     getResourceId(
116 |                         R.styleable.SeatBookView_selected_seats_background,
117 |                         selectedDrawable
118 |                     )
119 | 
120 |                 reservedTextColor =
121 |                     getColor(
122 |                         R.styleable.SeatBookView_reserved_seats_text_color,
123 |                         reservedTextColor
124 |                     )
125 | 
126 |                 bookTextColor =
127 |                     getColor(
128 |                         R.styleable.SeatBookView_available_seats_text_color,
129 |                         bookTextColor
130 |                     )
131 | 
132 |                 bookedTextColor =
133 |                     getColor(
134 |                         R.styleable.SeatBookView_booked_seats_text_color,
135 |                         bookedTextColor
136 |                     )
137 | 
138 |                 selectSeatLimit = getInt(R.styleable.SeatBookView_seat_select_limit, Int.MAX_VALUE)
139 |             }
140 |         }
141 | 
142 | 
143 |     }
144 | 
145 | 
146 |     private fun getViewSize() {
147 | 
148 |         val displayMetrics = context.resources.displayMetrics
149 |         pxWidth = displayMetrics.widthPixels
150 |         pxHeight = displayMetrics.heightPixels
151 |         scaledDensity = displayMetrics.scaledDensity
152 |         density = displayMetrics.density
153 | 
154 | 
155 |     }
156 | 
157 |     fun isCustomTitle(r: Boolean): SeatBookView {
158 |         isCustomTitle = r
159 |         return this
160 |     }
161 | 
162 |     fun setCustomTitle(titles: List): SeatBookView {
163 |         title = titles
164 |         return this
165 |     }
166 | 
167 |     fun setSelectSeatLimit(limit: Int): SeatBookView {
168 |         selectSeatLimit = limit
169 |         return this
170 |     }
171 | 
172 | 
173 |     fun setSeatGaping(size: Int): SeatBookView {
174 |         seatGaping = (size / density).toInt()
175 |         return this
176 |     }
177 | 
178 |     fun setSeatLayoutPadding(size: Int): SeatBookView {
179 |         layout_padding = (size / density).toInt()
180 |         return this
181 |     }
182 | 
183 |     fun setSeatSize(size: Int): SeatBookView {
184 |         seatSize = (size / density).toInt()
185 |         return this
186 |     }
187 | 
188 |     fun setSeatSizeBySeatsColumnAndLayoutWidth(seatsInColumn: Int, parentLayoutWeight: Int) {
189 |         seatSize = if (parentLayoutWeight != -1) {
190 |             (parentLayoutWeight / seatsInColumn) - ((seatGaping * (seatsInColumn - 1)) + (layout_padding * 2))
191 |         } else {
192 |             (pxWidth / seatsInColumn) - ((seatGaping * (seatsInColumn - 1)) + (layout_padding * 2))
193 |         }
194 |     }
195 | 
196 |     fun setSeatsLayoutString(seats: String): SeatBookView {
197 |         this.seats = seats
198 |         return this
199 |     }
200 | 
201 | 
202 |     fun getSelectedIdList(): List {
203 |         return selectedIdList
204 |     }
205 | 
206 |     fun getBookedIdList(): List {
207 |         return bookedIdList
208 |     }
209 | 
210 |     fun getReservedIdList(): List {
211 |         return reservedIdList
212 |     }
213 | 
214 |     fun setBookedIdList(list: List) {
215 |         for (id in list) {
216 |             markAsBooked(seatViewList[id - 1])
217 |         }
218 |     }
219 | 
220 |     fun setAvailableIdList(list: List) {
221 |         for (id in list) {
222 |             markAsAvailable(seatViewList[id - 1])
223 |         }
224 |     }
225 | 
226 |     fun setReservedIdList(list: List) {
227 |         for (id in list) {
228 |             markAsReserved(seatViewList[id - 1])
229 |         }
230 |     }
231 | 
232 | 
233 |     fun setAvailableSeatsBackground(drawable: Int): SeatBookView {
234 |         bookDrawable = drawable
235 |         return this
236 |     }
237 | 
238 |     fun setIsOnlyShow(r: Boolean) {
239 |         isOnlyShow = r
240 |     }
241 | 
242 |     fun setBookedSeatsBackground(drawable: Int): SeatBookView {
243 |         bookedDrawable = drawable
244 |         return this
245 |     }
246 | 
247 |     fun setReservedSeatsBackground(drawable: Int): SeatBookView {
248 |         reservedDrawable = drawable
249 |         return this
250 |     }
251 | 
252 |     fun setSelectedSeatsBackground(drawable: Int): SeatBookView {
253 |         selectedDrawable = drawable
254 |         return this
255 |     }
256 | 
257 |     fun setSeatTextSize(size: Float) {
258 |         textSize = size / scaledDensity
259 |     }
260 | 
261 | 
262 |     fun setReservedSeatsTextColor(color: Int): SeatBookView {
263 |         reservedTextColor = color
264 |         return this
265 |     }
266 | 
267 |     fun setAvailableSeatsTextColor(color: Int): SeatBookView {
268 |         bookTextColor = color
269 |         return this
270 |     }
271 | 
272 |     fun setBookedSeatsTextColor(color: Int): SeatBookView {
273 |         bookedTextColor = color
274 |         return this
275 |     }
276 | 
277 |     fun getSeatView(id: Int): View {
278 |         return seatViewList[id - 1]
279 |     }
280 | 
281 |     public fun setSeatClickListener(listener: SeatClickListener) {
282 |         this.listener = listener
283 |     }
284 | 
285 |     public fun setSeatLongClickListener(listener: SeatLongClickListener) {
286 |         this.listenerLong = listener
287 |     }
288 | 
289 | 
290 |     fun show() {
291 |         val layoutSeat = LinearLayout(context)
292 |         val params = LinearLayout.LayoutParams(
293 |             ViewGroup.LayoutParams.WRAP_CONTENT,
294 |             ViewGroup.LayoutParams.WRAP_CONTENT
295 |         )
296 |         layoutSeat.orientation = LinearLayout.VERTICAL
297 |         layoutSeat.layoutParams = params
298 |         layoutSeat.setPadding(
299 |             layout_padding * seatGaping,
300 |             layout_padding * seatGaping,
301 |             layout_padding * seatGaping,
302 |             layout_padding * seatGaping
303 |         )
304 |         viewGroupLayout.addView(layoutSeat)
305 | 
306 |         var layout: LinearLayout? = null
307 |         for (index in seats.indices) {
308 |             if (seats[index] == '/') {
309 |                 layout = LinearLayout(context)
310 |                 val paramsV = LinearLayout.LayoutParams(
311 |                     ViewGroup.LayoutParams.WRAP_CONTENT,
312 |                     ViewGroup.LayoutParams.WRAP_CONTENT
313 |                 )
314 |                 layout.layoutParams = paramsV
315 |                 layout.orientation = LinearLayout.HORIZONTAL
316 |                 layout.gravity = Gravity.CENTER
317 | 
318 |                 layoutSeat.addView(layout)
319 |             } else if (seats[index] == 'U') {
320 |                 count++
321 |                 val view = TextView(context)
322 |                 setSeatAttrs(index, view, layout)
323 |                 markAsBooked(view)
324 | 
325 |             } else if (seats[index] == 'A') {
326 |                 count++
327 |                 val view = TextView(context)
328 |                 setSeatAttrs(index, view, layout)
329 |                 markAsAvailable(view)
330 |             } else if (seats[index] == 'R') {
331 |                 count++
332 |                 val view = TextView(context)
333 |                 setSeatAttrs(index, view, layout)
334 |                 markAsReserved(view)
335 | 
336 | 
337 |             } else if (seats[index] == 'S') {
338 |                 count++
339 |                 val view = TextView(context)
340 |                 setSeatAttrs(index, view, layout)
341 |                 markAsTransparentSeat(view)
342 |             } else if (seats[index] == '_') {
343 |                 val view = TextView(context)
344 |                 val layoutParams = LinearLayout.LayoutParams(seatSize, seatSize)
345 |                 layoutParams.setMargins(seatGaping, seatGaping, seatGaping, seatGaping)
346 |                 view.layoutParams = layoutParams
347 |                 view.setBackgroundColor(Color.TRANSPARENT)
348 |                 view.text = ""
349 |                 layout!!.addView(view)
350 |             }
351 |         }
352 | 
353 |     }
354 | 
355 |     private fun setSeatAttrs(index: Int, view: TextView, layout: LinearLayout?) {
356 |         val layoutParams = LinearLayout.LayoutParams(seatSize, seatSize)
357 |         layoutParams.setMargins(seatGaping, seatGaping, seatGaping, seatGaping)
358 |         view.layoutParams = layoutParams
359 |         view.gravity = Gravity.CENTER
360 |         view.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize)
361 |         seatViewList.add(view)
362 |         layout!!.addView(view)
363 |         view.id = count
364 |         if (isCustomTitle) {
365 |             view.text = title[index]
366 |         } else {
367 |             view.text = "$count"
368 |         }
369 | 
370 |         view.setOnClickListener {
371 |             if (!isOnlyShow) {
372 |                 seatClick(it)
373 |             }
374 |         }
375 | 
376 |         view.setOnLongClickListener {
377 |             if (!isOnlyShow) {
378 |                 seatLongClick(it)
379 |                 true
380 |             } else {
381 |                 false
382 |             }
383 |         }
384 | 
385 |     }
386 | 
387 |     fun markAsBooked(view: TextView) {
388 |         view.setBackgroundResource(bookedDrawable)
389 |         view.setTextColor(bookedTextColor)
390 |         view.tag = STATUS_BOOKED
391 |     }
392 | 
393 |     fun markAsAvailable(view: TextView) {
394 |         view.setBackgroundResource(bookDrawable)
395 |         view.setTextColor(bookTextColor)
396 |         view.tag = STATUS_AVAILABLE
397 |     }
398 | 
399 |     fun markAsReserved(view: TextView) {
400 |         view.setBackgroundResource(reservedDrawable)
401 |         view.setTextColor(reservedTextColor)
402 |         view.tag = STATUS_RESERVED
403 |     }
404 | 
405 |     fun markAsTransparentSeat(view: TextView) {
406 |         view.setBackgroundColor(Color.TRANSPARENT)
407 |         view.text = ""
408 |         view.tag = 0
409 |     }
410 | 
411 |     private fun seatClick(view: View) {
412 |         if (view.tag as Int == STATUS_AVAILABLE) {
413 |             if (view.id in selectedIdList) {
414 |                 selectedIdList.remove(view.id)
415 |                 view.setBackgroundResource(bookDrawable)
416 |                 selectedSeats--
417 | 
418 |                 listener?.onAvailableSeatClick(selectedIdList, view)
419 | 
420 |             } else {
421 |                 if (selectedSeats < selectSeatLimit) {
422 |                     selectedIdList.add(view.id)
423 |                     view.setBackgroundResource(selectedDrawable)
424 |                     selectedSeats++
425 | 
426 |                     listener?.onAvailableSeatClick(selectedIdList, view)
427 | 
428 |                 }
429 | 
430 |             }
431 |         } else if (view.tag as Int == STATUS_BOOKED) {
432 |             listener?.onBookedSeatClick(view)
433 | 
434 |         } else if (view.tag as Int == STATUS_RESERVED) {
435 |             listener?.onReservedSeatClick(view)
436 |         }
437 |     }
438 | 
439 |     private fun seatLongClick(view: View): Boolean {
440 |         if (view.tag as Int == STATUS_AVAILABLE) {
441 |             listenerLong?.onAvailableSeatLongClick(view)
442 |             return true
443 |         } else if (view.tag as Int == STATUS_BOOKED) {
444 |             listenerLong?.onBookedSeatLongClick(view)
445 |             return true
446 |         } else if (view.tag as Int == STATUS_RESERVED) {
447 |             listenerLong?.onReservedSeatLongClick(view)
448 |             return true
449 |         }
450 |         return false
451 |     }
452 | 
453 | 
454 | }
455 | 
456 | 
457 | 
--------------------------------------------------------------------------------
/SeatBookView/src/main/java/dev/jahidhasanco/seatbookview/SeatClickListener.kt:
--------------------------------------------------------------------------------
 1 | package dev.jahidhasanco.seatbookview
 2 | 
 3 | import android.view.View
 4 | 
 5 | 
 6 | interface SeatClickListener {
 7 |     fun onAvailableSeatClick(selectedIdList: List, view: View)
 8 |     fun onBookedSeatClick(view: View)
 9 |     fun onReservedSeatClick(view: View)
10 | }
11 | 
12 | 
--------------------------------------------------------------------------------
/SeatBookView/src/main/java/dev/jahidhasanco/seatbookview/SeatLongClickListener.kt:
--------------------------------------------------------------------------------
1 | package dev.jahidhasanco.seatbookview
2 | 
3 | import android.view.View
4 | 
5 | interface SeatLongClickListener {
6 |     fun onAvailableSeatLongClick(view: View)
7 |     fun onBookedSeatLongClick(view: View)
8 |     fun onReservedSeatLongClick(view: View)
9 | }
--------------------------------------------------------------------------------
/SeatBookView/src/main/res/drawable/seats_book.xml:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 5 |     - 
 6 |         
 7 |             
 8 |             
 9 |         
10 |     11 | 
12 | 
13 | 
--------------------------------------------------------------------------------
/SeatBookView/src/main/res/drawable/seats_booked.xml:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 5 |
- 
 6 |         
 7 |             
 8 |             
 9 |         
10 |     11 | 
12 | 
13 | 
--------------------------------------------------------------------------------
/SeatBookView/src/main/res/drawable/seats_reserved.xml:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 5 |
- 
 6 |         
 7 |             
 8 |             
 9 |         
10 |     11 | 
12 | 
13 | 
--------------------------------------------------------------------------------
/SeatBookView/src/main/res/drawable/seats_selected.xml:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 5 |
- 
 6 |         
 7 |             
 8 |             
 9 |         
10 |     11 | 
12 | 
13 | 
--------------------------------------------------------------------------------
/SeatBookView/src/main/res/layout/layout_view_group.xml:
--------------------------------------------------------------------------------
1 | 
2 | 
8 | 
9 | 
--------------------------------------------------------------------------------
/SeatBookView/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 |     
 4 |         
 5 |         
 6 |         
 7 |         
 8 |         
 9 |         
10 |         
11 |         
12 |         
13 |         
14 |         
15 |     
16 | 
--------------------------------------------------------------------------------
/SeatBookView/src/test/java/dev/jahidhasanco/seatbookview/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
 1 | package dev.jahidhasanco.seatbookview
 2 | 
 3 | import org.junit.Test
 4 | 
 5 | import org.junit.Assert.*
 6 | 
 7 | /**
 8 |  * Example local unit test, which will execute on the development machine (host).
 9 |  *
10 |  * See [testing documentation](http://d.android.com/tools/testing).
11 |  */
12 | class ExampleUnitTest {
13 |     @Test
14 |     fun addition_isCorrect() {
15 |         assertEquals(4, 2 + 2)
16 |     }
17 | }
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
 1 | plugins {
 2 |     id 'com.android.application'
 3 |     id 'org.jetbrains.kotlin.android'
 4 | }
 5 | 
 6 | android {
 7 |     compileSdk 32
 8 | 
 9 |     defaultConfig {
10 |         applicationId "dev.jahidhasanco.demo_app"
11 |         minSdk 21
12 |         targetSdk 32
13 |         versionCode 1
14 |         versionName "1.0"
15 | 
16 |         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17 |     }
18 | 
19 |     buildTypes {
20 |         release {
21 |             minifyEnabled false
22 |             proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23 |         }
24 |     }
25 |     compileOptions {
26 |         sourceCompatibility JavaVersion.VERSION_1_8
27 |         targetCompatibility JavaVersion.VERSION_1_8
28 |     }
29 |     kotlinOptions {
30 |         jvmTarget = '1.8'
31 |     }
32 | }
33 | 
34 | dependencies {
35 | 
36 |     implementation 'androidx.core:core-ktx:1.8.0'
37 |     implementation 'androidx.appcompat:appcompat:1.5.0'
38 |     implementation 'com.google.android.material:material:1.6.1'
39 |     implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
40 |     implementation project(path: ':SeatBookView')
41 |     testImplementation 'junit:junit:4.13.2'
42 |     androidTestImplementation 'androidx.test.ext:junit:1.1.3'
43 |     androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
44 | }
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
 1 | # Add project specific ProGuard rules here.
 2 | # You can control the set of applied configuration files using the
 3 | # proguardFiles setting in build.gradle.
 4 | #
 5 | # For more details, see
 6 | #   http://developer.android.com/guide/developing/tools/proguard.html
 7 | 
 8 | # If your project uses WebView with JS, uncomment the following
 9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | #   public *;
13 | #}
14 | 
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 | 
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/app/src/androidTest/java/dev/jahidhasanco/demo_app/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
 1 | package dev.jahidhasanco.demo_app
 2 | 
 3 | import androidx.test.platform.app.InstrumentationRegistry
 4 | import androidx.test.ext.junit.runners.AndroidJUnit4
 5 | 
 6 | import org.junit.Test
 7 | import org.junit.runner.RunWith
 8 | 
 9 | import org.junit.Assert.*
10 | 
11 | /**
12 |  * Instrumented test, which will execute on an Android device.
13 |  *
14 |  * See [testing documentation](http://d.android.com/tools/testing).
15 |  */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 |     @Test
19 |     fun useAppContext() {
20 |         // Context of the app under test.
21 |         val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 |         assertEquals("dev.jahidhasanco.demo_app", appContext.packageName)
23 |     }
24 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 5 | 
 6 |     
16 |         
19 |             
20 |                 
21 | 
22 |                 
23 |             
24 |         
25 |     
26 | 
27 | 
--------------------------------------------------------------------------------
/app/src/main/java/dev/jahidhasanco/demo_app/MainActivity.kt:
--------------------------------------------------------------------------------
  1 | package dev.jahidhasanco.demo_app
  2 | 
  3 | 
  4 | import android.os.Bundle
  5 | import android.view.View
  6 | import android.widget.TextView
  7 | import android.widget.Toast
  8 | import androidx.appcompat.app.AppCompatActivity
  9 | import androidx.core.view.setPadding
 10 | import dev.jahidhasanco.seatbookview.SeatBookView
 11 | import dev.jahidhasanco.seatbookview.SeatClickListener
 12 | import dev.jahidhasanco.seatbookview.SeatLongClickListener
 13 | 
 14 | 
 15 | class MainActivity : AppCompatActivity() {
 16 | 
 17 |     private lateinit var seatBookView: SeatBookView
 18 |     private var seats = (
 19 |             "/U___S" +
 20 |                     "/_____" +
 21 |                     "/AA_AA" +
 22 |                     "/UA_AR" +
 23 |                     "/AA_AA" +
 24 |                     "/RU_AA" +
 25 |                     "/AA_AR" +
 26 |                     "/AU_AA" +
 27 |                     "/AA_AA" +
 28 |                     "/AA_AA" +
 29 |                     "/RU_AA" +
 30 |                     "/AA_AR" +
 31 |                     "/AU_AA" +
 32 |                     "/AA_AA" +
 33 |                     "/AAAAA"
 34 | 
 35 |             )
 36 | 
 37 | 
 38 |     private var title = listOf(
 39 |         "/", "I1", "", "", "", "E5",
 40 |         "/", "", "", "", "", "",
 41 |         "/", "A1", "A2", "", "A3", "A4",
 42 |         "/", "B1", "B2", "", "B3", "B4",
 43 |         "/", "C1", "C2", "", "C3", "C4",
 44 |         "/", "D1", "D2", "", "D3", "D4",
 45 |         "/", "E1", "E2", "", "E3", "E4",
 46 |         "/", "F1", "F2", "", "F3", "F4",
 47 |         "/", "G1", "G2", "", "G3", "G4",
 48 |         "/", "C1", "C2", "", "C3", "C4",
 49 |         "/", "D1", "D2", "", "D3", "D4",
 50 |         "/", "E1", "E2", "", "E3", "E4",
 51 |         "/", "F1", "F2", "", "F3", "F4",
 52 |         "/", "G1", "G2", "", "G3", "G4",
 53 |         "/", "H1", "H2", "H3", "H4", "H5"
 54 |     )
 55 | 
 56 | 
 57 |     override fun onCreate(savedInstanceState: Bundle?) {
 58 |         super.onCreate(savedInstanceState)
 59 |         setContentView(R.layout.activity_main)
 60 | 
 61 |         seatBookView = findViewById(R.id.layoutSeat)
 62 |         seatBookView.setSeatsLayoutString(seats)
 63 |             .isCustomTitle(true)
 64 |             .setCustomTitle(title)
 65 |             .setSeatLayoutPadding(2)
 66 |             .setSeatSizeBySeatsColumnAndLayoutWidth(5, -1)
 67 |         //ParentLayoutWeight -1 if Your seatBookView layout_width = match_parent / wrap_content
 68 | 
 69 | 
 70 |         seatBookView.show()
 71 | 
 72 | 
 73 |         seatBookView.getSeatView(2).apply {
 74 |             seatBookView.markAsTransparentSeat(this as TextView)
 75 |             this.setBackgroundResource(R.drawable.ic_steering)
 76 |             this.setPadding(5)
 77 |         }
 78 | 
 79 |         seatBookView.setSeatClickListener(object : SeatClickListener {
 80 | 
 81 |             override fun onAvailableSeatClick(selectedIdList: List, view: View) {
 82 | 
 83 |             }
 84 | 
 85 |             override fun onBookedSeatClick(view: View) {
 86 | 
 87 |             }
 88 | 
 89 |             override fun onReservedSeatClick(view: View) {
 90 | 
 91 |             }
 92 | 
 93 | 
 94 |         })
 95 | 
 96 |         seatBookView.setSeatLongClickListener(object : SeatLongClickListener {
 97 | 
 98 |             override fun onAvailableSeatLongClick(view: View) {
 99 |                 Toast.makeText(this@MainActivity, "Long Pressed", Toast.LENGTH_SHORT).show()
100 |             }
101 | 
102 |             override fun onBookedSeatLongClick(view: View) {
103 | 
104 |             }
105 | 
106 |             override fun onReservedSeatLongClick(view: View) {
107 | 
108 |             }
109 | 
110 |         })
111 | 
112 |     }
113 | 
114 | 
115 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
 1 | 
 7 |     
 8 |         
 9 |             
15 |
18 |
21 |             
22 |         
23 |     
24 |     
30 | 
--------------------------------------------------------------------------------
/app/src/main/res/drawable/book.xml:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 5 |
- 
 6 |     
 7 |         
 8 |         
 9 |     
10 | 11 | 
12 | 
13 | 
--------------------------------------------------------------------------------
/app/src/main/res/drawable/booked.xml:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 5 |
- 
 6 |     
 7 |         
 8 |         
 9 |     
10 | 11 | 
12 | 
13 | 
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_baseline_drive_eta_24.xml:
--------------------------------------------------------------------------------
1 | 
4 |     
5 | 
6 | 
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_bike.xml:
--------------------------------------------------------------------------------
1 | 
4 |     
5 | 
6 | 
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
  1 | 
  2 | 
  7 |     
 10 |     
 15 |     
 20 |     
 25 |     
 30 |     
 35 |     
 40 |     
 45 |     
 50 |     
 55 |     
 60 |     
 65 |     
 70 |     
 75 |     
 80 |     
 85 |     
 90 |     
 95 |     
100 |     
105 |     
110 |     
115 |     
120 |     
125 |     
130 |     
135 |     
140 |     
145 |     
150 |     
155 |     
160 |     
165 |     
170 | 
171 | 
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_steering.xml:
--------------------------------------------------------------------------------
 1 | 
 6 |   
 9 | 
10 | 
--------------------------------------------------------------------------------
/app/src/main/res/drawable/reserved.xml:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 5 |
- 
 6 |     
 7 |         
 8 |         
 9 |     
10 | 11 | 
12 | 
13 | 
--------------------------------------------------------------------------------
/app/src/main/res/drawable/selected.xml:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 5 |
- 
 6 |     
 7 |         
 8 |         
 9 |     
10 | 11 | 
12 | 
13 | 
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 9 | 
10 |     
15 | 
16 |         
29 | 
30 |     
31 | 
32 | 
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 | 
2 | 
3 |     
4 |     
5 | 
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 | 
2 | 
3 |     
4 |     
5 | 
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JahidHasanCO/SeatBookView/a6339723c608e10029826c5db7c6ac410f21fc27/app/src/main/res/mipmap-hdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JahidHasanCO/SeatBookView/a6339723c608e10029826c5db7c6ac410f21fc27/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JahidHasanCO/SeatBookView/a6339723c608e10029826c5db7c6ac410f21fc27/app/src/main/res/mipmap-mdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JahidHasanCO/SeatBookView/a6339723c608e10029826c5db7c6ac410f21fc27/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JahidHasanCO/SeatBookView/a6339723c608e10029826c5db7c6ac410f21fc27/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JahidHasanCO/SeatBookView/a6339723c608e10029826c5db7c6ac410f21fc27/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JahidHasanCO/SeatBookView/a6339723c608e10029826c5db7c6ac410f21fc27/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JahidHasanCO/SeatBookView/a6339723c608e10029826c5db7c6ac410f21fc27/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JahidHasanCO/SeatBookView/a6339723c608e10029826c5db7c6ac410f21fc27/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JahidHasanCO/SeatBookView/a6339723c608e10029826c5db7c6ac410f21fc27/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/values-night/themes.xml:
--------------------------------------------------------------------------------
 1 | 
 2 |     
 3 |     
16 | 
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 |     #FFBB86FC
 4 |     #FF6200EE
 5 |     #FF3700B3
 6 |     #FF03DAC5
 7 |     #FF018786
 8 |     #FF000000
 9 |     #FFFFFFFF
10 | 
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 | 
2 |     demo_app
3 | 
--------------------------------------------------------------------------------
/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
 1 | 
 2 |     
 3 |     
16 | 
--------------------------------------------------------------------------------
/app/src/main/res/xml/backup_rules.xml:
--------------------------------------------------------------------------------
 1 | 
 8 | 
 9 |     
13 | 
--------------------------------------------------------------------------------
/app/src/main/res/xml/data_extraction_rules.xml:
--------------------------------------------------------------------------------
 1 | 
 6 | 
 7 |     
 8 |         
12 |     
13 |     
19 | 
--------------------------------------------------------------------------------
/app/src/test/java/dev/jahidhasanco/demo_app/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
 1 | package dev.jahidhasanco.demo_app
 2 | 
 3 | import org.junit.Test
 4 | 
 5 | import org.junit.Assert.*
 6 | 
 7 | /**
 8 |  * Example local unit test, which will execute on the development machine (host).
 9 |  *
10 |  * See [testing documentation](http://d.android.com/tools/testing).
11 |  */
12 | class ExampleUnitTest {
13 |     @Test
14 |     fun addition_isCorrect() {
15 |         assertEquals(4, 2 + 2)
16 |     }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
 2 | plugins {
 3 |     id 'com.android.application' version '7.2.2' apply false
 4 |     id 'com.android.library' version '7.2.2' apply false
 5 |     id 'org.jetbrains.kotlin.android' version '1.7.10' apply false
 6 | }
 7 | 
 8 | task clean(type: Delete) {
 9 |     delete rootProject.buildDir
10 | }
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
 1 | # Project-wide Gradle settings.
 2 | # IDE (e.g. Android Studio) users:
 3 | # Gradle settings configured through the IDE *will override*
 4 | # any settings specified in this file.
 5 | # For more details on how to configure your build environment visit
 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
 7 | # Specifies the JVM arguments used for the daemon process.
 8 | # The setting is particularly useful for tweaking memory settings.
 9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app"s APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Kotlin code style for this project: "official" or "obsolete":
19 | kotlin.code.style=official
20 | # Enables namespacing of each library's R class so that its R class includes only the
21 | # resources declared in the library itself and none from the library's dependencies,
22 | # thereby reducing the size of the R class for that library
23 | android.nonTransitiveRClass=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JahidHasanCO/SeatBookView/a6339723c608e10029826c5db7c6ac410f21fc27/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Aug 22 14:15:44 BDT 2022
2 | distributionBase=GRADLE_USER_HOME
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
4 | distributionPath=wrapper/dists
5 | zipStorePath=wrapper/dists
6 | zipStoreBase=GRADLE_USER_HOME
7 | 
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
  1 | #!/usr/bin/env sh
  2 | 
  3 | #
  4 | # Copyright 2015 the original author or authors.
  5 | #
  6 | # Licensed under the Apache License, Version 2.0 (the "License");
  7 | # you may not use this file except in compliance with the License.
  8 | # You may obtain a copy of the License at
  9 | #
 10 | #      https://www.apache.org/licenses/LICENSE-2.0
 11 | #
 12 | # Unless required by applicable law or agreed to in writing, software
 13 | # distributed under the License is distributed on an "AS IS" BASIS,
 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15 | # See the License for the specific language governing permissions and
 16 | # limitations under the License.
 17 | #
 18 | 
 19 | ##############################################################################
 20 | ##
 21 | ##  Gradle start up script for UN*X
 22 | ##
 23 | ##############################################################################
 24 | 
 25 | # Attempt to set APP_HOME
 26 | # Resolve links: $0 may be a link
 27 | PRG="$0"
 28 | # Need this for relative symlinks.
 29 | while [ -h "$PRG" ] ; do
 30 |     ls=`ls -ld "$PRG"`
 31 |     link=`expr "$ls" : '.*-> \(.*\)$'`
 32 |     if expr "$link" : '/.*' > /dev/null; then
 33 |         PRG="$link"
 34 |     else
 35 |         PRG=`dirname "$PRG"`"/$link"
 36 |     fi
 37 | done
 38 | SAVED="`pwd`"
 39 | cd "`dirname \"$PRG\"`/" >/dev/null
 40 | APP_HOME="`pwd -P`"
 41 | cd "$SAVED" >/dev/null
 42 | 
 43 | APP_NAME="Gradle"
 44 | APP_BASE_NAME=`basename "$0"`
 45 | 
 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
 48 | 
 49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
 50 | MAX_FD="maximum"
 51 | 
 52 | warn () {
 53 |     echo "$*"
 54 | }
 55 | 
 56 | die () {
 57 |     echo
 58 |     echo "$*"
 59 |     echo
 60 |     exit 1
 61 | }
 62 | 
 63 | # OS specific support (must be 'true' or 'false').
 64 | cygwin=false
 65 | msys=false
 66 | darwin=false
 67 | nonstop=false
 68 | case "`uname`" in
 69 |   CYGWIN* )
 70 |     cygwin=true
 71 |     ;;
 72 |   Darwin* )
 73 |     darwin=true
 74 |     ;;
 75 |   MINGW* )
 76 |     msys=true
 77 |     ;;
 78 |   NONSTOP* )
 79 |     nonstop=true
 80 |     ;;
 81 | esac
 82 | 
 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
 84 | 
 85 | 
 86 | # Determine the Java command to use to start the JVM.
 87 | if [ -n "$JAVA_HOME" ] ; then
 88 |     if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
 89 |         # IBM's JDK on AIX uses strange locations for the executables
 90 |         JAVACMD="$JAVA_HOME/jre/sh/java"
 91 |     else
 92 |         JAVACMD="$JAVA_HOME/bin/java"
 93 |     fi
 94 |     if [ ! -x "$JAVACMD" ] ; then
 95 |         die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
 96 | 
 97 | Please set the JAVA_HOME variable in your environment to match the
 98 | location of your Java installation."
 99 |     fi
100 | else
101 |     JAVACMD="java"
102 |     which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 | 
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 | 
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 |     MAX_FD_LIMIT=`ulimit -H -n`
111 |     if [ $? -eq 0 ] ; then
112 |         if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 |             MAX_FD="$MAX_FD_LIMIT"
114 |         fi
115 |         ulimit -n $MAX_FD
116 |         if [ $? -ne 0 ] ; then
117 |             warn "Could not set maximum file descriptor limit: $MAX_FD"
118 |         fi
119 |     else
120 |         warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 |     fi
122 | fi
123 | 
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 |     GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 | 
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 |     APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 |     CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 | 
134 |     JAVACMD=`cygpath --unix "$JAVACMD"`
135 | 
136 |     # We build the pattern for arguments to be converted via cygpath
137 |     ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 |     SEP=""
139 |     for dir in $ROOTDIRSRAW ; do
140 |         ROOTDIRS="$ROOTDIRS$SEP$dir"
141 |         SEP="|"
142 |     done
143 |     OURCYGPATTERN="(^($ROOTDIRS))"
144 |     # Add a user-defined pattern to the cygpath arguments
145 |     if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 |         OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 |     fi
148 |     # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 |     i=0
150 |     for arg in "$@" ; do
151 |         CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 |         CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
153 | 
154 |         if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
155 |             eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 |         else
157 |             eval `echo args$i`="\"$arg\""
158 |         fi
159 |         i=`expr $i + 1`
160 |     done
161 |     case $i in
162 |         0) set -- ;;
163 |         1) set -- "$args0" ;;
164 |         2) set -- "$args0" "$args1" ;;
165 |         3) set -- "$args0" "$args1" "$args2" ;;
166 |         4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 |         5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 |         6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 |         7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 |         8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 |         9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 |     esac
173 | fi
174 | 
175 | # Escape application args
176 | save () {
177 |     for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 |     echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 | 
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 | 
185 | exec "$JAVACMD" "$@"
186 | 
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
 1 | @rem
 2 | @rem Copyright 2015 the original author or authors.
 3 | @rem
 4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
 5 | @rem you may not use this file except in compliance with the License.
 6 | @rem You may obtain a copy of the License at
 7 | @rem
 8 | @rem      https://www.apache.org/licenses/LICENSE-2.0
 9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 | 
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem  Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 | 
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 | 
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 | 
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 | 
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 | 
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 | 
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 | 
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 | 
51 | goto fail
52 | 
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 | 
57 | if exist "%JAVA_EXE%" goto execute
58 | 
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 | 
65 | goto fail
66 | 
67 | :execute
68 | @rem Setup the command line
69 | 
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 | 
72 | 
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 | 
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 | 
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 | 
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 | 
89 | :omega
90 | 
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
 1 | pluginManagement {
 2 |     repositories {
 3 |         gradlePluginPortal()
 4 |         google()
 5 |         mavenCentral()
 6 |     }
 7 | }
 8 | dependencyResolutionManagement {
 9 |     repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
10 |     repositories {
11 |         google()
12 |         mavenCentral()
13 |     }
14 | }
15 | rootProject.name = "demo_app"
16 | include ':app'
17 | include ':SeatBookView'
18 | 
--------------------------------------------------------------------------------