|
1 | 1 | # QRActivity
|
2 | 2 |
|
3 |
| -> Creating README. Please check back after a while |
| 3 | +[  ](https://bintray.com/chtgupta/QRUtils/chtgupta.qrutils.qractivity/_latestVersion) |
| 4 | + |
| 5 | +<img src="../img/ic_logo.png" width="25%" height="25%" /> |
| 6 | + |
| 7 | +Say hi to QRActivity! A customizable, pre-built activity ready to launch and read QR codes with a few lines of code. Equipped with essential features like flashlight toggle, an image picker to get and read QR codes from image files. Enjoy the first ever ready-made QR mechanism for Android. |
| 8 | + |
| 9 | +* **Stuffed w/ features:** Image picker, flashlight toggle, autofocus and much more |
| 10 | +* **Fast:** You can expect it to lauch, read the QR and return the result within a second |
| 11 | +* **Customizable:** Restrict image picker usage, autofocus interval, toggle fullscreen 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:qractivity: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 | +```xml |
| 35 | + <dependency> |
| 36 | + <groupId>chtgupta.qrutils</groupId> |
| 37 | + <artifactId>qractivity</artifactId> |
| 38 | + <version>0.1.0</version> |
| 39 | + <type>pom</type> |
| 40 | + </dependency> |
| 41 | +``` |
| 42 | + |
| 43 | +## Usage |
| 44 | + |
| 45 | +#### Step I: Start the QRActivity for result with desired params |
| 46 | + |
| 47 | +```java |
| 48 | + |
| 49 | +private final int QR_SCAN_REQUEST_CODE = 123; |
| 50 | + |
| 51 | +... |
| 52 | + |
| 53 | +startActivityForResult( |
| 54 | + new QRScanner(getBaseContext()) // required |
| 55 | + .setFullScreen(false) // optional |
| 56 | + .setAutoFocusInterval(2000) // optional |
| 57 | + .setFocusOnTouchEnabled(true) // optional |
| 58 | + .setImagePickerEnabled(true) // optional |
| 59 | + .build(), QR_SCAN_REQUEST_CODE // required |
| 60 | + ); |
| 61 | + |
| 62 | +``` |
| 63 | + |
| 64 | +#### Step II: Get the result returned by the QRActivity |
| 65 | + |
| 66 | +```java |
| 67 | + |
| 68 | +@Override |
| 69 | + protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { |
| 70 | + |
| 71 | + if (requestCode == QR_SCAN_REQUEST_CODE) { |
| 72 | + |
| 73 | + if (resultCode == Activity.RESULT_OK) { |
| 74 | + |
| 75 | + String qrData = data.getStringExtra("qrData"); // getting scanned QR data |
| 76 | + Toast.makeText(getBaseContext(), qrData, Toast.LENGTH_LONG).show(); |
| 77 | + |
| 78 | + } else if (resultCode == RESULT_CANCELED) { |
| 79 | + |
| 80 | + String error = data.getStringExtra("error"); // getting the error message (in case one occurs) |
| 81 | + Toast.makeText(getBaseContext(), error, Toast.LENGTH_LONG).show(); |
| 82 | + } |
| 83 | + } |
| 84 | + } |
| 85 | +``` |
| 86 | + |
| 87 | +## Release History |
| 88 | + |
| 89 | +* 0.1.0 |
| 90 | + * Initial release |
| 91 | + |
| 92 | +## Meta |
| 93 | + |
| 94 | +Chahat Gupta – [@chtgupta](https://chtgupta.github.io) – admin@speakapp.me |
| 95 | + |
| 96 | +Distributed under the APACHE 2.0 license. See ``LICENSE`` for more information. |
| 97 | + |
| 98 | +[https://github.com/chtgupta/QRUtils-Android/](https://github.com/chtgupta/QRUtils-Android/) |
| 99 | + |
| 100 | +## Contributing |
| 101 | + |
| 102 | +1. **Fork** it |
| 103 | +2. **Clone** the project to your own machine |
| 104 | +3. **Commit** changes to your own branch |
| 105 | +4. **Push** your work back up to your fork |
| 106 | +5. Submit a **Pull request** so that I can review changes |
| 107 | + |
| 108 | +## Support |
| 109 | + |
| 110 | +* Liked my work? **Star** it to show support! |
| 111 | +* Used it in your app? Let me know and I'll include your app name, logo and link in this repository. |
| 112 | +* Want to take this to another level? Read ``CONTRIBUTING`` again! |
0 commit comments