|
| 1 | +# PinLayout ⚬⚬⚬⚬ |
| 2 | +Android PinLayout for auth screens. |
| 3 | + |
| 4 | +<img width="193" alt="Screen Shot 2022-12-04 at 03 42 09" src="https://user-images.githubusercontent.com/15641747/205468291-4aee9855-df47-4887-8ced-b075baf61931.png"> |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | +## Installation |
| 12 | + |
| 13 | +Step 1. Add the JitPack repository to your build file |
| 14 | + |
| 15 | +```gradle |
| 16 | + allprojects { |
| 17 | + repositories { |
| 18 | + ... |
| 19 | + maven { url 'https://jitpack.io' } |
| 20 | + } |
| 21 | + } |
| 22 | +``` |
| 23 | + |
| 24 | +Step 2. Add the dependency |
| 25 | + |
| 26 | +```gradle |
| 27 | + dependencies { |
| 28 | + implementation 'com.github.akndmr:PinLayout:LatestVersion' |
| 29 | + } |
| 30 | +``` |
| 31 | + |
| 32 | + |
| 33 | +## Demo |
| 34 | +https://user-images.githubusercontent.com/15641747/205468372-c6af52be-6ebe-4691-b235-d2252ec1cb2a.mov |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | +## Usage |
| 39 | + |
| 40 | +#### Show a AirySnackbar |
| 41 | + |
| 42 | +You can add pin by providing a data source like keyboard. |
| 43 | +```kotlin |
| 44 | + addPinCode(number) |
| 45 | +``` |
| 46 | + |
| 47 | +You can add whole pin from a clipboard. |
| 48 | +```kotlin |
| 49 | + pasteFullPinCode() |
| 50 | +``` |
| 51 | + |
| 52 | + |
| 53 | +You can remove the last added pin. |
| 54 | +```kotlin |
| 55 | + removePinCode() |
| 56 | +``` |
| 57 | + |
| 58 | +You can clear PinLayout completely. |
| 59 | +```kotlin |
| 60 | + clearPinCode() |
| 61 | +``` |
| 62 | + |
| 63 | +You can register a listener for pin change and pin complete events. |
| 64 | +```kotlin |
| 65 | + setOnPinChangeListener( |
| 66 | + onPinChange = { pin -> |
| 67 | + //todo |
| 68 | + }, |
| 69 | + onPinComplete = { |
| 70 | + //todo |
| 71 | + } |
| 72 | + ) |
| 73 | +``` |
| 74 | + |
| 75 | +You can customize PinLayout with custom attributes. |
| 76 | +```kotlin |
| 77 | + app:pin_count="8" |
| 78 | + app:pin_view_active_color="@color/bg3" |
| 79 | + app:pin_view_gap="12dp" |
| 80 | + app:pin_view_radius="16dp" |
| 81 | + app:pin_view_extra_gap="@dimen/margin_32" |
| 82 | + app:pin_view_extra_gap_index="3" |
| 83 | +``` |
| 84 | + |
| 85 | +## Roadmap |
| 86 | + |
| 87 | +- Add custom animation support. |
| 88 | + |
0 commit comments