Fork of svg-android +SVN history +Maven +more

Related tags

Utility svg-android
Overview

Status: Unmaintained. Discontinued.

This project is no longer being developed or maintained.

_

This is forked from the awesome but unmaintained: http://code.google.com/p/svg-android/

Changes

  • Mavenised.
  • Added SVGBuilder to allow easy specification of SVG parsing & rendering options.
  • ColorFilters can now be applied.
  • Layer opacity and hiding is now supported.
  • This library now works with Robolectric.
  • SVG viewBox attribute is now handled.
  • Numbers with exponents are handled.
  • SVGZ (gzipped svg) auto-detected and supported. (Thank @josefpavlik & @mstevens83)
  • Performance enhancements.
  • Has most community patches applied. Great work to josefpavlik and mrn

Maven

Add this to your Android project's pom.xml:

<dependency>
  <groupId>com.github.japgolly.android</groupId>
  <artifactId>svg-android</artifactId>
	<version>2.0.6</version>
</dependency>

Usage

Firstly, store your SVGs in res/raw or assets.

// Load and parse a SVG
SVG svg = new SVGBuilder()
            .readFromResource(getResources(), R.raw.someSvgResource) // if svg in res/raw
            .readFromAsset(getAssets(), "somePicture.svg")           // if svg in assets
            // .setWhiteMode(true) // draw fills in white, doesn't draw strokes
            // .setColorSwap(0xFF008800, 0xFF33AAFF) // swap a single colour
            // .setColorFilter(filter) // run through a colour filter
            // .set[Stroke|Fill]ColorFilter(filter) // apply a colour filter to only the stroke or fill
            .build();

// Draw onto a canvas
canvas.drawPicture(svg.getPicture());

// Turn into a drawable
Drawable drawable = svg.createDrawable();
// drawable.draw(canvas);
// imageView.setImageDrawable(drawable);
Comments
  • Added support for SVGZ (i.e. GZIPed SVG).

    Added support for SVGZ (i.e. GZIPed SVG).

    Hello,

    I forked your svg-android project and added support for SVGZ files (i.e. GZIPed SVGs). The requires only a small amount of code added in SVGBuilder. I've based this on work by josefpavlik (https://github.com/josefpavlik/svg-android/commit/fc0522b2e1). However I made an improvement by decorating the InputStream with a BufferedInputStream when mark/reset are not supported. Josef's version failed in some cases because of that reason.

    I hope you'll merge this in your project such that maven users can start using this.

    Best,

    Matthias

    opened by mstevens83 2
  • change opacity as well as color

    change opacity as well as color

    if you use .setOverideOpacity(true) on your SVGBuilder before build()

    the alpha of the color you specified in setColorSwap() will be combined to the current opacity.

    opened by jeremie-seguin 2
  • Fixing of  stroke attribute in doStroke

    Fixing of stroke attribute in doStroke

    In method doStroke need udpate condition:

    if ("none".equals(atts.getString("display"))) { return false; }

    to

    if ("none".equals(atts.getString("display")) || "none".equals(atts.getString("stroke")) || atts.getString("stroke") == null ) { return false; }

    opened by Dragues 0
  • Support nested svg elements with or without viewBox attributes.  Prev…

    Support nested svg elements with or without viewBox attributes. Prev…

    Prevents underflow on restoreToCount. On Lollipop when Picture.beginRecording has a saveCount of 1 which causes the canvasRestoreCount to be set to 2. This doesn't work if I have nested svg elements, the out one does not have a viewBox and the inner one does.

    I've created a deQue for the canvasRestoreCount and the canvas so they are scoped to the svg element.

    opened by daviditkin 0
  • Fixed alpha gradient bug

    Fixed alpha gradient bug

    Fixed bug that prevented gradients with varying alpha from being displayed properly.

    Commit d1f6374 unintentionally broke gradient fills that change in opacity because the call to Color.parseColor () implicitly set the alpha value of the colour to FF. The stop-opacity is applied with a bitwise OR, so the FF would overrule the 'true' value.

    opened by benelliott 0
  • Load Path data rather than Drawable from SVG file

    Load Path data rather than Drawable from SVG file

    Refactor SVGParser and SVGHandler into smaller components. Provided PathHandler alternative to load path data instead of a drawable.

    This data might be useful for various techniques, including Romain Guy's path tracing: http://www.curious-creature.org/2013/12/21/android-recipe-4-path-tracing/

    opened by funkthemonk 0
Owner
David Barri
David Barri
Sample android setup for deploying libraries on maven central

Perfect-android-library-template This is how I prefer my android setup. This setup has a sample app and a deployable library that deploys to maven cen

Stefan Wärting 3 Dec 23, 2022
Useful helpers that make it easier to implement maven-plugin mojos with kotlin

A library that makes writing powerful maven plugins even easier by providing kotlin extensions and convenience functions for common use cases.

TOOListicon 1 Nov 4, 2022
A fork of nb-javac for Android.

nb-javac-android nb-javac is a patched version of OpenJDK "javac", i.e., the Java compiler. This has long been part of NetBeans, providing a highly tu

Akash Yadav 18 Dec 25, 2022
Highly optimized Airplane fork focusing on stability and performance.

Sugarcane Highly optimized Airplane fork focusing on stability and performance. NOTE: We borrow some patches from Yatopia Reminder This project is sti

SugarcaneMC 93 Dec 15, 2022
Android Shared preference wrapper than encrypts the values of Shared Preferences. It's not bullet proof security but rather a quick win for incrementally making your android app more secure.

Secure-preferences - Deprecated Please use EncryptedSharedPreferences from androidx.security in preferenced to secure-preference. (There are no active

Scott Alexander-Bown 1.5k Dec 24, 2022
Create a simple and more understandable Android logs.

DebugLog Create a simple and more understandable Android logs. #Why? android.util.Log is the most usable library of the Android. But, when the app rel

mf 418 Nov 25, 2022
Simple Keyboard can adjustable keyboard height for more screen space

Simple Keyboard About Features: Small size (<1MB) Adjustable keyboard height for more screen space Number row Swipe space to move pointer Delete swipe

Raimondas Rimkus 681 Dec 27, 2022
📭 Extension to Ktor’s routing system to add object oriented routing and much more. 💜

?? Ktor Routing Extensions Extension to Ktor’s routing system to add object-oriented routing and much more. ?? Why? This extension library was created

Noelware 6 Dec 28, 2022
Little utilities for more pleasant immutable data in Kotlin

What can KopyKat do? Mutable copy Nested mutation Nested collections Mapping copyMap copy for sealed hierarchies copy from supertypes copy for type al

KopyKat 193 Dec 19, 2022
Android library which makes it easy to handle the different obstacles while calling an API (Web Service) in Android App.

API Calling Flow API Calling Flow is a Android library which can help you to simplify handling different conditions while calling an API (Web Service)

Rohit Surwase 19 Nov 9, 2021
Gesture detector framework for multitouch handling on Android, based on Android's ScaleGestureDetector

Android Gesture Detectors Framework Introduction Since I was amazed Android has a ScaleGestureDetector since API level 8 but (still) no such thing as

null 1.1k Nov 30, 2022
Use Android as Rubber Ducky against another Android device

Use Android as Rubber Ducky against another Android device

null 1.4k Jan 9, 2023
Android Utilities Library build in kotlin Provide user 100 of pre defined method to create advanced native android app.

Android Utilities Library build in kotlin Provide user 100 of pre defined method to create advanced native android app.

Shahid Iqbal 4 Nov 29, 2022
A util for setting status bar style on Android App.

StatusBarUtil A util for setting status bar style on Android App. It can work above API 19(KitKat 4.4). 中文版点我 Sample Download StatusBarUtil-Demo Chang

Jaeger 8.8k Jan 6, 2023
A logger with a small, extensible API which provides utility on top of Android's normal Log class.

This is a logger with a small, extensible API which provides utility on top of Android's normal Log class. I copy this class into all the little apps

Jake Wharton 9.8k Dec 30, 2022
Java implementation of a Disk-based LRU cache which specifically targets Android compatibility.

Disk LRU Cache A cache that uses a bounded amount of space on a filesystem. Each cache entry has a string key and a fixed number of values. Each key m

Jake Wharton 5.7k Dec 31, 2022
a simple cache for android and java

ASimpleCache ASimpleCache 是一个为android制定的 轻量级的 开源缓存框架。轻量到只有一个java文件(由十几个类精简而来)。 1、它可以缓存什么东西? 普通的字符串、JsonObject、JsonArray、Bitmap、Drawable、序列化的java对象,和 b

Michael Yang 3.7k Dec 14, 2022
gRPC and protocol buffers for Android, Kotlin, and Java.

Wire “A man got to have a code!” - Omar Little See the project website for documentation and APIs. As our teams and programs grow, the variety and vol

Square 3.9k Dec 31, 2022
✔️ Secure, simple key-value storage for Android

Hawk 2.0 Secure, simple key-value storage for android Important Note This version has no backward compatibility with Hawk 1+ versions. If you still wa

Orhan Obut 3.9k Dec 20, 2022