SVG2Drawable


Source link: https://github.com/StanKocken/SVG2Drawable

SVG2Drawable

Use a jar executable to create a Drawable class to display a SVG on Android.

This is a standalone library, not a Runtime Android library. You need to use it BEFORE your Android compilation (and only once per SVG file).

Why?

I want to use a scalable image format.

A SVG sounds really good but it's a bit long to load (mainly the time to parse the XML) and I didn't find any library that support the Hardware acceleration.

How does it work?

My main goal is to have a Drawable class:

  • Made a fork of the svg-android library.
  • Replaced any instructions to create a Picture to collect them into a Logger.
  • Print this Logger.
  • Save it to a Drawable java class.

How to use it?

You can read the code but I'm not proud of it. I started to do a POC for a basic usage and now I need to transform the code to make it more readable and robust.

You can simply use the jar provided into this repo by specify:

  • the SVG file
  • the package where you want to put the Drawable
  • the drawable name

You can also specify the output of the script to create a file. By adding "> filename.java".

java -jar svg_converter.jar example.svg com.skocken.svg.example.drawable ExampleDrawable > ExampleDrawable.java 

Now, copy this "ExampleDrawable.java" into your Android project, into the package "com.skocken.svg.example.drawable" (from this example), and add it to your ImageView into your code with:

imageview.setImageDrawable(new ExampleDrawable());
 

License

Contributing

If you found a SVG with a problem, you can open an issue. Please, if possible, let me know if this same SVG work with the library svg-android.

Please fork this repository and contribute back using pull requests.

Any contributions, large or small, major features, bug fixes, additional language translations, unit/integration tests are welcomed and appreciated but will be thoroughly reviewed and discussed.

Resources

This library unifies the user contacts in a compact and user intuitive way allowing the end-user to choose between the contact's available communication options (email/phone number) following Material Design guidelines.

Although there is a standard way to call the contact list in Android, it does not always feel well-integrated in your app Android applications. UnifiedContactPicker is an Android library which allows you to easily integrate contact picking workflow into your application with minimal effort.

This is a powerful little tool that helps converting single or batches of images to Android, iOS, Windows and CSS specific formats and density versions given the source scale factor or target width/height in dp.

It has a graphical and command line interface and supports a wide array of image types for reading and conversion including PNG, JPEG, SVG, PSD and Android 9-patches. Using sophisticated scaling algorithms, it is designed to make conversion of images easy and fast while keeping the image quality high (comparable to PS). To further optimize the output post processors like pngcrush and mozJpeg can be used.

Android Piano Chart View for music theory / music apps.

Android Attitude view for drones, airplanes, rovs and mobile robots.

FireLayout is a CoordinatorLayout linked to its reference on your Firebase Real-Time Database. You can generate your own layout through firebase console.

WaveFileGenerator class let's you generate wave files for specified frequency in android.

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