An Android Library used to implement TicketView based on vipulasri/TicketView Library in android with normal, rounded and scallop corners + some extra exciting features.
For information : checkout Sample App Code in repository.
Using Gradle
dependencies {
implementation 'com.passid.android:ticketview:1.0.0'
}
Using Maven
<dependency>
<groupId>com.passid.android</groupId>
<artifactId>ticketview</artifactId>
<version>1.0.0</version>
<type>pom</type>
</dependency>
- In XML Layout :
<com.passid.android.ticketview.TicketView
android:layout_width="match_parent"
android:layout_height="160dp"
android:layout_marginTop="60dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:id="@+id/ticketView"
app:ticketBackgroundColor="@color/grey"
app:ticketCornerRadius="8dp"
app:ticketCornerType="rounded"
app:ticketDividerColor="#FFFFFF"
app:ticketDividerDesign="color"
app:ticketDividerLocation="left"
app:ticketDividerPadding="5dp"
app:ticketDividerType="dash"
app:ticketDividerWidth="1dp"
app:ticketElevation="0dp"
app:ticketOrientation="horizontal"
app:ticketPunchLocation="left|right"
app:ticketPunchRadius="12dp"
app:ticketScallopRadius="0dp"
app:ticketShowBorder="false"
app:ticketShowDivider="true"
app:view="@id/anchoredViewId">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="64dp"
android:background="?selectableItemBackground">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:paddingStart="24dp"
android:text="Group Ticket."
android:textColor="#fff"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent" />
<FrameLayout
android:id="@+id/anchoredViewId"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="end"
android:paddingStart="22dp"
android:paddingEnd="22dp"
app:layout_constraintEnd_toEndOf="parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#f00"
android:gravity="center"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:text="USD $200"
android:textColor="#000"
android:textSize="14sp"
android:textStyle="bold" />
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.passid.android.ticketview.TicketView>
-
Configure using xml attributes or setters in code:
Attribute Name Default Value Description app:ticketOrientation="vertical" horizontal sets orientation of divider and scallop app:ticketBackgroundColor="@android:color/black" white sets background color app:ticketScallopRadius="10dp" 20dp sets scallop radius app:ticketShowBorder="false" false shows border if `true` app:ticketBorderWidth="4dp" 2dp sets border width app:ticketBorderColor="@color/grey" black sets border color app:ticketShowDivider="true" false shows divider if `true` app:ticketDividerType="dash" normal sets type of divider ie `normal` or `dash` app:ticketDividerDesign="punch" 0dp sets the design of the designer either `color` or `punch` (punch will show as cut through displaying the background behind the ticketView. app:ticketDividerColor="@color/colorAccent" dark gray sets divider color app:ticketDividerWidth="2dp" 2dp sets divider width app:ticketDividerPadding="0dp" 10dp sets divider padding app:ticketDividerDashGap="4dp" 4dp sets divider dash gap app:ticketDividerDashLength="8dp" 8dp sets divider dash length app:ticketCornerType="rounded" normal sets type of corner ie `normal` or `rounded` or `scallop` app:ticketCornerRadius="15dp" 4dp sets corner radius if corner rounder or scallop app:ticketElevation="14dp" 0dp sets elevation to ticket view on android jellybean and above app:ticketDividerLocation="none|left|right|top|bottom" none sets the location of the divider and scallops with regards to the anchored view app:view app:view="@id/anchoredViewId" @null sets the view id in which the divider will be anchored to based on flags of app:ticketDividerLocation and ticketOrientation app:ticketPunchLocation="none|left|right|top|bottom" none Set the location where a punch through holes will be drawn on the sides of the ticket app:ticketPunchRadius="12dp" 0dp sets the radius of the punch through holes.
Copyright 2017 Vipul Asri
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.