QrCardParsing


Source link: https://github.com/RurioLuca/QrCardParsing

QrCardParsing

Android Libraries to parsing and generate MeCard, VCard, VEvent and WifiCard content string.

Requirements

The library requires Android API Level 9+.

Import

in build.gradle

allprojects {

  repositories {

jcenter()
  
}
 
}
 
dependencies {
 compile 'it.auron:mecard-parser:1.1.0' 
}

How to use

Generate MeCard content


  MeCard meCard =new MeCard();

meCard.setName("Luca");

meCard.setSurname("Rurio");

meCard.setDate("1989-07-19");

meCard.setEmail("[email protected]");

meCard.setNote("generate MeCard string content!");

meCard.addTelephone("+39 3486454313");

meCard.addTelephone("+39 3476512321");

meCard.setUrl("https://github.com/RurioLuca");

meCard.setAddress("via del corso , Rome , Italy");

meCard.setOrg("your company");

String meCardContent=meCard.buildString();

//sample using QrGen to generate QrCode bitmap

imageView.setImageBitmap(QRCode.from(meCardcontent).bitmap());

Parsing MeCard content

String meCardString = "MECARD:N:Rurio,Luca;TEL:+39 3486454313;EMAIL:[email protected];URL:https://github.com/RurioLuca;NOTE:generate MeCard!;BDAY:1989-07-19;ADR:via del corso , Rome , Italy;ORG:your company;";

MeCard meCard = MeCardParser.parse(meCardString);

  String name = meCard.getName();

  //output :Luca
  String name = meCard.getEmail();

//output :[email protected]

  meCard.setDate("1989-07-19");

String meCardContent=meCard.buildString();

 //sample using QrGen to generate QrCode bitmap
imageView.setImageBitmap(QRCode.from(meCardcontent).bitmap());

Generate VCard content


  VCard vCard=new VCard();

vCard.setName("Luca");

vCard.setAddress("via del corso");

vCard.setCompany("freelancer");

vCard.addEmail("[email protected]");

vCard.addTelephone("+39 3486454314");

vCard.setFormattedName("Rurio Luca");

vCard.setTitle("Developer");

vCard.setUrl("https://github.com/RurioLuca/MeCardParsing/");

imageView.setImageBitmap(QRCode.from(vCard.buildString()).bitmap());

Parsing VCard content

 String vCardString = "BEGIN:VCARD\n" +

  "N:Luca\n" +

  "FN:Rurio Luca\n" +

  "ORG:freelancer\n" +

  "TITLE:Developer\n" +

  "EMAIL:[email protected]\n" +

  "URL:https://yoursite.com\n" +

  "END:VCARD";

 VCard vCard = VCardParser.parse(vCardString);

 vCard.setNote("vCard generate and modified!");

vCard.addTelephone("+39 3486454314");

String vCardcontent = vCard.buildString();

//sample generate bitmap using QrGen

imageView.setImageBitmap(QRCode.from(vCardcontent).bitmap());
  

Generate Wifi content


  WifiCard wifiCard = new WifiCard();

wifiCard.setSid("Vodafone Wifi32341");

wifiCard.setPassword("administrator");

wifiCard.setType("WPA");

 //sample generate Qr code using Qrgen

imageView.setImageBitmap(QRCode.from(wifiCard.buildString()).bitmap());

Parsing Wifi content


  String wifiString = "WIFI:S:Vodafone Wifi32341;T:WPA;P:administrator;;";

WifiCard wifiCard = WifiCardParser.parse(wifiString);

 wifiCard.setPassword("administrator2016");

  String wifiCardcontent = wifiCard.buildString();

 //sample generate Qr code using Qrgen

imageView.setImageBitmap(QRCode.from(wifiCardcontent).bitmap());
  

Generate VEvent content


  VEvent vEvent = new VEvent();

vEvent.Summary("Google IO");

vEvent.Location("Shoreline Amphitheatre Mountain View, California");

vEvent.Url("www.sample.com");

vEvent.setDtStart("20170611T130000Z");

vEvent.setDtEnd("20170611T153400Z");

 //sample generate Qr code using Qrgen

imageView.setImageBitmap(QRCode.from(vEvent.buildString()).bitmap());

Parsing VEvent content


  String vEventString = "BEGIN:VEVENT\n" +

  "SUMMARY:Google IO\n" +

  "LOCATION:Shoreline Amphitheatre Mountain View, California\n" +

  "DTSTART:20170611T130000Z\n" +

  "DTEND:20170611T153400Z\n" +

  "END:VEVENT";

 VEvent vEvent = VEventParser.parse(vEventString);

  vEvent.setSummary("Google I/O");

  SimpleDateFormat simpleDateFormat = new SimpleDateFormat(VEventCostant.DATE_FORMAT);

try {

 Calendar calendar = Calendar.getInstance();

 calendar.setTime(simpleDateFormat.parse(vEvent.getDtEnd()));

 calendar.set(Calendar.DAY_OF_MONTH, 12);

 calendar.set(Calendar.HOUR_OF_DAY, 14);

 calendar.set(Calendar.MINUTE, 00);

 vEvent.setDtEnd(simpleDateFormat.format(calendar.getTime()));

}
 catch (ParseException e) {

 e.printStackTrace();

}

  String vEventcontent = vEvent.buildString();

 //sample generate Qr code using Qrgen

imageView.setImageBitmap(QRCode.from(vEventcontent).bitmap());
  

Developed By

Rurio Luca- [email protected]

App using QrCardParsing

send me your apps! [email protected]

License

The MIT License (MIT)

Copyright (c) 2016 Rurio Luca

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Resources

IconButton is an Android button widget that allows you to center both the button's text and an icon.

mini-equalizer-library-android is created to let you use an animated equalizer inside your music related apps.

An interesting sliding layout.

Collection Picker is an Android View library which looks like Foursquare Tastes picker.

Database Migrations Made Easy.

This library provides 9-patch based drop shadow for view elements.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes