|
4 | 4 |
|
5 | 5 | <img src="../img/ic_logo.png" width="25%" height="25%" /> |
6 | 6 |
|
7 | | -Say hi to QRView! A custom View that draws QR codes on the screen easily and efficiently. |
| 7 | +Say hi to QRView! A custom View that draws QR codes on the screen easily and efficiently.It is the first ever library that deals with drawing QR codes on the layout. |
8 | 8 |
|
9 | | -QRView is the first library which deals with drawing QR codes in the layout. |
10 | | -Efficient: Creates a QR code in just 3 lines of code |
11 | | -Flexible: Can generate QR codes directly from XML attributes |
| 9 | +* **Efficient:** Creates a QR code in just 3 lines of code |
| 10 | +* **Flexible:** Can generate QR codes directly from XML attributes |
| 11 | +* **Customizable:** Can play around with colours, error correction levels and more |
| 12 | + |
| 13 | +## Installation |
| 14 | + |
| 15 | +### Gradle |
| 16 | + |
| 17 | +In your `app/build.gradle` file add a dependency on one of the QRUtils libraries. |
| 18 | + |
| 19 | +```groovy |
| 20 | +
|
| 21 | + dependencies { |
| 22 | +
|
| 23 | + implementation 'chtgupta.qrutils:qrview:0.1.0' |
| 24 | + } |
| 25 | +
|
| 26 | +``` |
| 27 | + |
| 28 | +### Maven |
| 29 | + |
| 30 | +Step 1. Add the JitPack repository to your build file |
| 31 | + |
| 32 | +Add the dependency |
| 33 | + |
| 34 | +```sh |
| 35 | + <dependency> |
| 36 | + <groupId>chtgupta.qrutils</groupId> |
| 37 | + <artifactId>qrview</artifactId> |
| 38 | + <version>0.1.0</version> |
| 39 | + <type>pom</type> |
| 40 | + </dependency> |
| 41 | +``` |
| 42 | + |
| 43 | +## Usage |
| 44 | + |
| 45 | +#### Case I: Creating QR directly from XML |
| 46 | + |
| 47 | +```xml |
| 48 | +<chtgupta.qrutils.qrview.QRView |
| 49 | + android:id="@+id/qrView" |
| 50 | + android:layout_width="wrap_content" |
| 51 | + android:layout_height="wrap_content" |
| 52 | + android:layout_gravity="center" |
| 53 | + |
| 54 | + app:QR_size="96dp" |
| 55 | + app:QR_data="chtgupta.github.io" |
| 56 | + app:QR_errorCorrectionLevel="M" |
| 57 | + app:QR_foregroundColor="@android:color/black" |
| 58 | + app:QR_backgroundColor="@android:color/white"/> |
| 59 | +``` |
| 60 | + |
| 61 | +### Case II: Creating QR in Java file |
| 62 | + |
| 63 | +```java |
| 64 | + |
| 65 | + QRView qrView = findViewById(R.id.qrView); |
| 66 | + |
| 67 | + qrView.setData(data) |
| 68 | + .setSize(Integer.parseInt(size.getText().toString()), (QRParams) sizeSpinner.getSelectedItem()) |
| 69 | + .setErrorCorrectionLevel((ErrorCorrection) errorCorrectionSpinner.getSelectedItem()) |
| 70 | + .setQRForegroundColor(foregroundColor) |
| 71 | + .setQRBackgroundColor(backgroundColor) |
| 72 | + .addListener(new QRViewListener() { |
| 73 | + @Override |
| 74 | + public void onQRInitiated() { |
| 75 | + qrView.setVisibility(View.GONE); |
| 76 | + progressBar.setVisibility(View.VISIBLE); |
| 77 | + } |
| 78 | + |
| 79 | + @Override |
| 80 | + public void onQRGenerating() { |
| 81 | + |
| 82 | + } |
| 83 | + |
| 84 | + @Override |
| 85 | + public void onQRGenerated(Bitmap qrBitmap) { |
| 86 | + progressBar.setVisibility(View.GONE); |
| 87 | + qrView.setVisibility(View.VISIBLE); |
| 88 | + } |
| 89 | + |
| 90 | + @Override |
| 91 | + public void onError() { |
| 92 | + |
| 93 | + } |
| 94 | + }) |
| 95 | + .build(); |
| 96 | + |
| 97 | +``` |
| 98 | + |
| 99 | +## Release History |
| 100 | + |
| 101 | +* 0.1.0 |
| 102 | + * Initial release |
| 103 | + |
| 104 | +## Meta |
| 105 | + |
| 106 | +Chahat Gupta – [@chtgupta](https://chtgupta.github.io) – admin@speakapp.me |
| 107 | + |
| 108 | +Distributed under the MIT license. See ``LICENSE`` for more information. |
| 109 | + |
| 110 | +[https://github.com/chtgupta/FadeInTextView-Android/](https://github.com/chtgupta/FadeInTextView-Android/) |
| 111 | + |
| 112 | +## Contributing |
| 113 | + |
| 114 | +1. **Fork** it |
| 115 | +2. **Clone** the project to your own machine |
| 116 | +3. **Commit** changes to your own branch |
| 117 | +4. **Push** your work back up to your fork |
| 118 | +5. Submit a **Pull request** so that I can review changes |
| 119 | + |
| 120 | +## Support |
| 121 | + |
| 122 | +* Liked my work? **Star** it to show support! |
| 123 | +* Used it in your app? Let me know and I'll include your app name, logo and link in this repository. |
| 124 | +* Want to take this to another level? Read ``CONTRIBUTING`` again! |
0 commit comments