Skip to Content

Blog

Vectoroid 0.82 released

Vectoroid 0.82 was released last week, the big addition being the SVG parser to the open-source library. This was done to allow easy importing/use of SVG into Vectoroid apps, and represents a significant value add for the library. Now developers/designers can design in a Vector graphics editor (AI, Inkscape , …) and then export artwork to SVG and use it in apps directly. The SVG is parsed into the drawing model and can be manipulated in code.

It can be downloaded here : Vectoroid developers

Issues / Workarounds

The SVG parser works reasonably well with the exception that SVG Arc path points are not rendered properly – this is a problem common to other Android SVG parsers as the way Android processes Arcs (via the skia library) is significantly different to the SVG specification and therefore requires conversion. Should be possible to do, but I just have not had time to do it yet. If people request it then it can be done. Or it is definitely a good way to earn a free licence ;)

To work around the afforementioned Arc problem, you can convert and paths with Arcs to bezier paths. To do this in Inkscape select the object and then use Path > Object to path.

Applications

This is what the Twitter infographic app uses to parse and display it’s template which has just be redesigned by a designer (thanks Rachel).

Twitter Infographic builds easy infographic pics for a twitter tag

I am testing a new app called "Twitter Infographic". I have found myself surfing around twitter and finding a number of related tags which I can then read (using the read link in the search popup). It actually does make it easier to see what is happening on Twitter, looking at common hash-tags for Google IO (#io2012, #android, #glass, …) it is amazing to watch and see the spikes that occur. The output can be shared using Andorid sharing.

Use case

The initial use case is for people who want to monitor the tweet volumes for their event – I have been at a few events lately where I have seen organisers trying to get attendees to tweet more, but not really knowing if people are actually doing it. This app can even be left on a TV or screen somewhere and people can see what is coming though and help contribute as well hopefully. Which may in itself help motivate people to spread the word…

#Barclays twitter infographic Twitter Infographic for #Nexus7 Twitter Infographic for #euro2012

Technical info

The app was built using the Vectoroid drawing view, which will make it easy to add editing functions later. There are some instructions on the app Product page. It uses a SVG template for the artwork with IDs set for the dynamic elements in the view. The library is also available for white labelling.

Where to now …

At the moment I am just testing the idea as an MVP (Minimum viable product), it not a finished & polished product. The app can make a lot of requests for twitter data if the tag you are looking at has a lot of tweets, so be careful of your battery for the moment (It’s not too heavy, but constant use for an hour or so will likely run it down).

So if you like the idea, then leave a comment here or on the product/app page – when I get feedback I with build it out into a proper app. This is an app stub, based on Vectoroid to test the idea of using it to generate infographics on all types of data. Because it uses vectoroid it is quite easy to add editing features so people can customise the layout which would be pretty cool. There is also an HTML solution in the works …

The idea for the next few weeks is to build out some of the myriad of ideas I have had for the vectoriod API. It’s getting to the fun stage now – so expect to see some quite diverse ideas. Next up is a presentations tool, and a collaborative drawing tool to fit with it. As well as more developments to the vectoroid mockup API – to help further test out the new MyPOD interface.

… and more infographics (Facebook and G+ seem to be the logical ones).

Vectoroid 0.81 released

I released Vectoroid v0.81 yesterday. This release mainly finalises changes to the Model API and File Format as well as a safe failover for any future changes. Here is the change log. This is the firs release where I would say that the API is finally useable. Get it on vectoroid.com

  • Model API :
    • Changes Point storage to reflect SVG path. Supported PathData(a point), Cubic, QuadricArc is stored, but not renedered (due to differences in SVG and Andorid API arc models).
    • ID & className support for DrawingElement.
    • IDrawingElementCollection for Drawing, Layer and Group. Which supports findById() and flattening stroke processing.
    • Namspaced parameters for all DrawingElements – this allows custom data storage against any DrawingElement.
    • clipRect & opacity field – not supported in renderer yet.
  • Renderer API:
    • Animation HashMap: Allows better animation performance by storing canvas operations against the existing VecRenderObjects (see SuprCardsExploder).
  • File API: Some large changes to the file format – these will be the last refartoring, at least until mroe feedback is obtained. All new apps should use V3 which is the default.
    • SVG Path : All paths are stored in SVG format to improve compatibility with similar HTML API (e.g. svg-edit).
    • As a consequence, file versioning was tightened up, so that future file changes can be integrated seamlessly.
    • Support new model API fields (id, class, clipRect , opacity).
    • New methods for loading from InputStreams and Assets in DrawingFileUtil.
  • Examples: Updates to the Examples (VectoroidExample & SuprCardsExploder) to reflect other updates.

MyPOD website re-design

MyPOD has recently had a full website re-design. Thanks to wise robot for some great design work. I’ll post item as I go on the MyPOD G+ and Facebook profiles.

Home Page

The main aim was for the site to speed up their understanding the MyPOD feature set. The top section of the home page is devoted to the main activities people look for (bieng download, features, reviews and video) in a tab set.

Screen shots

The screen shots section has been turned into a “Screen Explorer” which show info about the screen and help links interactively as you select a screen, to serve as a quick reference.

Feed URL’s

see: MyPOD Feed Link Generator

The feed URL generator serves as a way for people to quickly generate links that MyPOD can understand and intercept when used on an Android device. Its an easy and simple process, the next step will be to integrate it with the feeds catalogue.

The layout was changed to two-column as the page will be displayed if a link is clicked on and the app isn’t installed – so download information needs to be prominent.

Future plans

  • Integrate the MyPOD catalogue into the site, so users can just go to my-pod.org to configure their feeds.
  • Integrate the MyPOD remote interface into the website, so users can manage thier device through the web interface.

So you don’t need me to ask you to give it a whirl – let us know what you think!

Random NoSuchMethodErrors when using proguard with GSON

I switched to GSON for JSON parsing a while back, but it has some special proguard requirements to make it work.

The code below is from the GSON WIKI (I think). But the -allowaccessmodification and -repackageclasses ” flags caused me problems. The NoSuchMethodError – it seems to affect random private methods in classes – I could not figure out the pattern.

So if you are getting seemingly random NoSuchMethodErrors when you use proguard, you should try commenting these out. For me it is OK as all the members I want to serialise are public so I don’t need access modification.

##GSON stuff
#-allowaccessmodification
-keepattributes *Annotation*
#-repackageclasses ''
-keepattributes Signature
-keep class sun.misc.Unsafe { *; }
## Preserve the special static methods that are required in all enumeration classes.
-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}
-keep public class * {
    public protected *;
}

A letter to MEPs on ACTA


This is a quick letter I sent to UK (London) MEP’s on ACTA. Following on from the ORG‘s blog post:

I am writing to voice my concern over the ACTA bill currently being considered by European Parliament. I feel that there are a number of problems which relate to the proposal and it should be dropped.

ACTA might on the surface be about intellectual property, but it has too many ramifications for free speech on the internet. While I sympathise with large companies who need to protect their content (I have software which I protect under copyright law). There are so many use cases where the right to fair use and debate will in practice be infringed because large compaines will no doubt use it as a hammer to sue and take down competitors and critics. The numerous legal cases of music/movie companies suing people for vastly inflated sums of money over the past years, can only lead us to assume that they will use ACTA to do this on a larger scale. The dangers of private policing of the internet will no doubt lead to unfair court cases where the large content companies use ACTA for frivolus cases and revenue generation rather the protect their content or offer it at a competitive price on the open market. Movie and music companies continue to sell their content at very high prices which don’t just aren’t competitive in the internet age, charging a fair price would combat illegal downloading a lot more than ACTA ever will.

The internet has changed the case for copyright law, every webpage we see, is a copy. A fair internet depends on all people being able to publish and use content that is available on the internet – Media companies will use ACTA to stiffle competition and lead to tiered internet where independent publishers can be sued out of existence by large corporations using frivolous copyright cases. Copyright law itself needs revising and ACTA binds us to existing copyright law. Works need to enter the public domain faster than the 70-80 year limit that is prevalent in a lot of countries.

There is also the issue that MEP Gallo’s report cites the European Parliament’s legal services’ opinions on ACTA. But some key elements of the legal services’ opinions on ACTA have not been made public. The EU Parliament refused to publish them in full, unredacted form, saying that it would “seriously interfere with the complex ratification process”. How can this be? we have the right to discuss this legislation, and if the report has flagged problems then WE NEED TO KNOW ABOUT THEM.

To quote MEP Rapporteur Dimitrios Droutsas:

an adoption of ACTA would prematurely strangle the debate and tip the balance on one side, would allow for Member States to experiment on laws that could potentially harm fundamental freedoms and set precedents that could be undesirable for future societies.

I also think that, the more the large content companies continue to re-engineer the copyright playing field, the less useful it will become. People will be afraid to use their content due to legal fears, content will continue to be overpriced and eventually it will kill the demand for their content. These companies need to be “shown the light” that it much better to have higher volumes than higher prices.

Society is changing, and business and government need to adapt, not stifle creativity and innovation. We are entering a period where web technologies will be ubiquitous and we all deserve a level playing field for individuals and companies big AND small.

Android dev tools (adb, aapt, …) : No such file or directory – Linux Mint & Ubuntu install

After my main hard disk corrupted recently, I changed to Linux mint – which is great. But while installing the Android environment I had a weird issue – all the platform-tools were installed, but the executables wouldn’t run with the message:
bash: /home/robert/bin/android-sdk-linux/platform-tools/aapt: No such file or directory

After a bit of head scratching I found this post: http://askubuntu.com/questions/73491/no-such-file-or-directory-for-existing-executable

Turns out the existing Android binaries are 32-bit (64-bit isnt supplied) and the error message is because the executables can load dependent libraries. Fairly simple really – it’s just that the error message is rather mis-leading.

Solution:
apt-get install ia32-libs

Another one (from here) is:
apt-get install --reinstall libc6-i386

Android ICS Holo icons as SVG

Looking at the Android design guide, it seems support for open formats is rather light. I guess it’s understandable since the site is aimed at designers.

I need to start using the standard ICS icons in SuprCards, but in a different colour (and also to backport to earlier Androids). So I had to spend a bit of time converting the AI file to SVG in inkscape – as I don’t have a copy of Illustrator. I had to pull the file apart to see everything, as Inkscape doesn’t have the same layer support as AI. Then group and label the icons, so its easier to find what I am looking for …

It’s definitley not perfect though unfortunatley. There were a few bits left over, which obviously belong with other icons, but all the basic icons are there and the others wont be hard to assemble when you know what you need.

The SVG file is attached below for download. If you have any suggestions/corrections/refinements then please get in contact, or leave a comment below. You can just drag the relevant icon into the centre and export to PNG easily, though you still have to be careful to centre them properly …


All ICS Icons

I spread out the icons and grouped them - so hopefully its easy to find what you are looking for ...

Here is the file – NOTE: The SVG appears blank in the browser – You can move the icons into the view area to render them:
SVG file.

To see what the icons reference check here : Android fireworks Stencil

I need to change the colour of the icons to fit with my white text on dark theme. Possibly it will be best to use the Vectoroid SVG Parser to render them in real time – but it will likely be a bit heavy with the parsing overhead, the rendering and bitmap creation should be fine though. So a script to make the sets of icons at different densities would be a good idea … stay tuned.

Custom notifications across Android SDK’s

When I first built MyPOD way back in the the dark ages, I needed a download progressbar in my first notification – so I used a custom notification for it, and then by default for the rest of the notifications I needed in the app! Oops … It turns out that there is a bit of fragmentation around custom notifications over different SDK releases.

There were reports of the wrong colours on some devices (namely Samsung and ICS devices). After a bit (lot !!) of searching I found the highly informative:

http://stackoverflow.com/questions/4867338/custom-notification-layouts-and-text-colors

Basically the best way is to just use a Standard Android Notification and not try to customise it. Just supporting >=Gingerbread is also not an option for me, as this is about 30% of the total app userbase. If you do need custom (e.g. for my progress bar) then there are a few different things to cater for on different SDKs. An example is below and the table outlines the differences.

The moral of the story: Fragmentation

Thing can be a real nightmare real fast when we have to cater for fragmentation – things have to be tested so much more that it make development slow and tedious.

Android has really done a great job of hiding the immense fragmentation that we could be faced with, even though this rare case occurs, we have to admire the design-effort for such a generalised OS for so many devices.

SDKIssueSolution
>=9Use Event stylesSee Event Styles
<9No Event style presentSee NotificationUpdater in the below custom example.
>=11Non standard background defaultsSee also Custom Notification example.

First you need an intent for the notifiction to fire when pressed:

Intent notificationIntent = new Intent(this, SelectFileActivity.class);
notificationIntent.setAction(Globals.INTENT_DOWNLOAD_ALARM);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);

A Standard Android Notification is created similar to below:

private Notification downloadedNotification(FileDb f,PendingIntent contentIntent){
	Notification ntf = new Notification(
			R.drawable.butt_tick_off_32, 
			"New files downloaded ...", 
			System.currentTimeMillis()
	);
	ntf.setLatestEventInfo(this, "Download complete",  f.title, contentIntent);
	return ntf;
}

Custom Notification Example

This example uses the custom class to set the colour and size of the TextView components.

There is still one problem though, on HoneyComb and ICS the background shows up as grey. I have just set it to black in the example, though the drawable should be in the Holo Theme somewhere.

private Notification getDlNotif(Context c,PendingIntent contentIntent,FileDb file) {
	Notification notification = new Notification(
		R.drawable.butt_dl_on_32, 
		"Downloading ...", 
		System.currentTimeMillis()
	);

	dlNotifContentView = new RemoteViews(getPackageName(), R.layout.download_notification);
	dlNotifContentView.setImageViewResource(R.id.dln_img,R.drawable.butt_dl_on);
	dlNotifContentView.setTextViewText(R.id.dln_dlfile,"Downloading ...");
	dlNotifContentView.setTextViewText(R.id.dln_dlnumber, status);
	dlNotifContentView.setProgressBar(R.id.dln_progress, 100,		 currentDownload.progress:0, false);
	//set text colour and size for the title and text parts of the custom notification (if necessary ...)
	if (getSDK()<10) {
		NotificationUpdater.setTextTitleColourAndSize(this,dlNotifContentView,R.id.dln_dlfile);		
		NotificationUpdater.setTextColourAndSize(this,dlNotifContentView,R.id.dln_dlnumber);
	}
	//set background to black for >= HoneyComb(11)
	if (getSDK()>=11) {
		dlNotifContentView.setInt(R.id.dln_ctnr, "setBackgroundColor", Color.BLACK);
	}
	notification.contentView=dlNotifContentView;
	notification.contentIntent = contentIntent;
	return notification;
}

public static int getSDK() {
	try {
		return Integer.parseInt(Build.VERSION.SDK);
	} catch (Throwable e) {
		return 1;
	}
}

For ginger bread and above we just need to use the relevant Event styles:

In the layout.xml( R.layout.download_notification in this case) …

 
/*For the title:*/

/*For the text:*/

NotificationUpdater

This class is needed for Android SDKs prior to Gingerbread (<9), it extracts the colours and sizes of the title and text in a standard notification, and saves them in statics, so we can use them in a custom one (see the above Custom Notification example). It is a modified version of the example given in the above stack overflow page.


import android.app.Notification;
import android.content.Context;
import android.util.DisplayMetrics;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.RemoteViews;
import android.widget.TextView;

public class NotificationUpdater {
	private static Integer notificationTextColor = null;
	private static Integer notificationTextTitleColor = null;
	private static float notificationTextSize = 11;
	private static float notificationTextTitleSize = 11;
	
	private static final String COLOR_SEARCH_RECURSE_TIP = "TEXT";
	private static final String COLOR_SEARCH_RECURSE_TITLE = "TITLE";
	
	private static void recurseGroup(Context c,ViewGroup gp,DisplayMetrics metrics){
	    final int count = gp.getChildCount();
	    
	    for (int i = 0; i < count; ++i)   {
	        if (gp.getChildAt(i) instanceof TextView)     {
	            final TextView text = (TextView) gp.getChildAt(i);
	            final String szText = text.getText().toString();
	            if (COLOR_SEARCH_RECURSE_TIP.equals(szText)) {
	                notificationTextColor = text.getTextColors().getDefaultColor();
	                notificationTextSize = text.getTextSize()/metrics.scaledDensity;
	            } else if (COLOR_SEARCH_RECURSE_TITLE.equals(szText)) {
	            	notificationTextTitleColor = text.getTextColors().getDefaultColor();
	            	notificationTextTitleSize = text.getTextSize()/metrics.scaledDensity;
	            }
	        } else if (gp.getChildAt(i) instanceof ViewGroup) {
	           recurseGroup(c,(ViewGroup) gp.getChildAt(i),metrics);
	        }
	    }
	}

	private static void extractColors(Context c)
	{
	    try   {
	    	DisplayMetrics metrics = new DisplayMetrics();
	        WindowManager systemWM = (WindowManager)c.getSystemService(Context.WINDOW_SERVICE);
	        systemWM.getDefaultDisplay().getMetrics(metrics);
	        
	        Notification ntf = new Notification();
	        ntf.setLatestEventInfo(c, COLOR_SEARCH_RECURSE_TITLE, COLOR_SEARCH_RECURSE_TIP, null);
	    	LinearLayout group = new LinearLayout(c);
	        ViewGroup event = (ViewGroup) ntf.contentView.apply(c, group);
	        recurseGroup(c,event,metrics);
	        group.removeAllViews();
	    }
	    catch (Exception e)   {
	        notificationTextColor = android.R.color.black;
	        notificationTextTitleColor = android.R.color.black;
	    }
	}
	
	public static void setTextColourAndSize(Context c, RemoteViews v,int i ) {
		if (notificationTextColor==null) {
			extractColors(c);
		}
		v.setTextColor(i, notificationTextColor);
		v.setFloat(i, "setTextSize", notificationTextSize);
	}
	
	public static void setTextTitleColourAndSize(Context c, RemoteViews v,int i ) {
		if (notificationTextColor==null) {
			extractColors(c);
		}
		v.setTextColor(i, notificationTextTitleColor);
		v.setFloat(i, "setTextSize", notificationTextTitleSize);
	}
}

Social Media World Forum 2012 – Wrapup

When I saw the Social Media World Forum advertised, I was wondering if it was for me. It turns out it was an event for all sizes. The Social Media Tech stage had a few interesting speakers, which come back to some similar, over-arching themes in social media marketing:

Don’t be obtuse:
  • Be friendly, talk about anything. people enjoy the one-to-one aspect of SM.
  • DONT oversell. (#1 reason for unlike: no good content, too many posts..)
Concentrate on growing organically:
  • Engagement is key: measureable responses, people share / like good content, click throughs, sales.
  • Creating content & communities: more loyalty, trust.
  • DONT: Buy likes, content : let people who understand your customers do this.
Grow your own content:
  • SM great from testing content. Can be targeted or not.
  • Content creates engagement. The best content is sharable, small & digestable.
  • Measure and test performance of content as you go.
    • Iterate & Optimise. Choose KPI’s: clicks to website, increased downloads.
  • Content can be a lot of things:
    • Blogs, Podcasts, Video, Omages, Communities, Software, Code, Databases, …
    • Writing about these resources shows what you have contributed.
Where the networks are:
  • Facebook: Timeline (not many like it), User stories, Apps as content landing pages.
  • Twitter: Data analysis, clickstream processing, promotion.
  • Google +: API, building content, user engagement.
There were some nice presentations given, notably a presentation by Social Clay (Slide Share) which was a nice introduction to building a Facebook marketing strategy.