GithubHelp home page GithubHelp logo

codeydl / qrcardparsing Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rurioluca/qrcardparsing

0.0 2.0 0.0 1.29 MB

Android Libraries to parsing and generate MeCardContent

License: MIT License

Java 100.00%

qrcardparsing's Introduction

QrCardParsing

Platform (Android) Android Arsenal GitHub license

Download API GitHub stars

Android Libraries to parsing and generate content of:

  • MeCard
  • VCard
  • VEvent
  • WifiCard
  • GeoCard

Screen

Requirements

The library requires Android API Level 9+.

Import

in build.gradle

allprojects {
    repositories {
        jcenter()
    }
}
dependencies {
// ... other dependencies here
implementation 'it.auron:mecard-parser:1.1.3'
}

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());

Generate Geolocation content

        GeoCard geoCard = new GeoCard();

        geoCard.setLat(41.8919300);
        geoCard.setLon(12.5113300);
        
         //sample generate Qr code using Qrgen
        imageView.setImageBitmap(QRCode.from(geoCard.buildString()).bitmap());
        

Parsing Geolocation content

      String geoString = "geo:20.33470,20.39448";
      GeoCard geoCard = GeoCardParser.parse(geoString);
       
       // set Rome location
       geoCard.setLat(41.8919300);
       geoCard.setLon(12.5113300);


        String geoCardcontent = geoCard.buildString();

        //sample generate Qr code using Qrgen
        imageView.setImageBitmap(QRCode.from(geoCardcontent).bitmap());

Developed By

Rurio Luca- [email protected]

Linkedin

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.

qrcardparsing's People

Contributors

rurioluca avatar

Watchers

James Cloos avatar codeydl avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.