victor


Source link: https://github.com/trello/victor

victor

What's our vector, Victor? -Captain Oveur

Use SVGs as resources in Android!

With this plugin, you can define source folders for SVGs and they will automatically be rasterized/included in your build without messing with your source code.

Installation

Add the following to your build.gradle:

buildscript {

  repositories {

jcenter()
  
}

  dependencies {

classpath 'com.trello:victor:1.0.0'
  
}
 
}
  apply plugin: 'com.android.application'  // Make sure to apply this plugin *after* the Android plugin apply plugin: 'com.trello.victor'

Also, your Android Gradle plugin ( com.android.tools.build:gradle) must be at least version 1.1.+

Usage

Victor adds the svg source set to the Android plugin. You can define where your SVG folders are in the same way you define any other source sets:

android {

  sourceSets {

main {

 svg.srcDir 'src/main/svg'

}

  
}
 
}

You can have multiple SVG folders for a variety of build types/product flavors; or you can just use 'main' to cover them all.

Additional configuration can be done in the victor closure:

victor {

  // Any assets defined in relative terms needs a base DPI specified
  svgDpi = 72

// Do not generate these densities for SVG assets
  excludeDensities = [ 'ldpi', 'xxxhdpi' ]

// WARNING: EXPERIMENTAL
  // Generates Android drawables instead of PNGs.
  //
  // This is known not to work on only a subset of SVGs (e.g., does not support any value besides px).
  generateVectorDrawables = true 
}

OSX Issues

When using Android Studio on OSX, you might see this error:

Toolkit not found: apple.awt.CToolkit

This occurs because Batik, the SVG toolkit Victor uses, requires a working version of AWT.

If this happens you should install and use JDK 1.7 for your instance of Android Studio. For instructions how, consult the "Mac OS X" section of this article.

Known Issues

  • Android Studio doesn't recognize generated resources in XML, so autocomplete doesn't work and you get warnings (even though the code works fine). Generated resources should be fully supported in future versions of the Android Gradle plugin.

  • Android Studio doesn't automatically rebuild if the SVG folder is modified (like it does with other resources). Therefore, if you add SVGs you will have to manually rebuild before they will be generated.

  • Due to bugs in Batik, the SVG toolkit used by Victor, some SVGs containing 'mask="url(#mask-2)"' references are not rasterized correctly. Sketch and other tools occasionally produce assets with these references.

Planned Features

  • 9-patch support

Resources

Nice and simple DSL for Espresso in Kotlin.

A simple cool animated edit text with a expandable animation.

Group of useful kotlin extension I made for application development in kotlin language which helps in day to day life of android developers!

Custom Android view with video player, play/stop, loader and placeholder image.

The old "spinner" style DatePicker for newer Android devices. Allows styling of text and colors.

Almost every app has a login and signup, so why do we re-write code everytime? Let robin handle that for you.

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