Disable asset compression with Android aapt

Trying to embed all the assets resources into my final apk was not so easy as I tought.. at least using the ADT Eclipse plugin for building project.
In fact, using AssetManager.openFd to return to the C++ code a FileDescriptor does not work with compressed sources.
When aapt compile the resources into the apk file it compress by default all the files which extensions are not recognized and those which recognize as text files.

These are the extensions not compressed:

[cc]
static const char* kNoCompressExt[] = {
“.jpg”, “.jpeg”, “.png”, “.gif”,
“.wav”, “.mp2”, “.mp3”, “.ogg”, “.aac”,
“.mpg”, “.mpeg”, “.mid”, “.midi”, “.smf”, “.jet”,
“.rtttl”, “.imy”, “.xmf”, “.mp4”, “.m4a”,
“.m4v”, “.3gp”, “.3gpp”, “.3g2”, “.3gpp2”,
“.amr”, “.awb”, “.wma”, “.wmv”
};
[/cc]

I was looking into the .project file of my Eclipse project but it seems that changing things inside that file ( like values into the tag ) does not affect the builder.

The first thing I tried was to remap the aapt executable using a shell script ( and renaming the original aapt file into _aapt ):

[cc]
#!/bin/bash

strParams=””
CWD=’dirname $0’

for i in $@; do
if [ $i = “-S” ]; then
strParams=”$(echo $strParams) -v -0 \”\””
fi
strParams=”$(echo $strParams) $i”
done

tool=”$CWD/_aapt $strParams”
$tool 1>&2
[/cc]

In fact, when building the project in eclipse I could see the whole output, but the files are still being compressed, even if I call the same command in a shell the assets aren’t compressed.
I haven’t yet find a solution so for the meantime I decided to use ant to build my project overriding the default “-package-resources” target in this way:

[cce]

Packaging resources
${asset.absolute.dir}
command=”package”
verbose=”${verbose}”
versioncode=”${version.code}”
manifest=”AndroidManifest.xml”
assets=”${asset.absolute.dir}”
androidjar=”${android.jar}”
apkfolder=”${out.absolute.dir}”
resourcefilename=”${resource.package.file.name}”
resourcefilter=”${aapt.resource.filter}”>

[/cce]

In this way the project is being compiled correctly and all my assets are embedded not compressed!

P.S. my claim token is: 7C8AATS7Q5A3

Android: Create your own sharing app

One of the first applications I did for Android was a very simple application which simply takes a picture using Camera and then send it to a remote server. Very simple, but it introduced to me into the android world and the notion of activities and communication between different applications.
A little addition to this application I wanted to make was the possibility to share any of the pictures already taken. To do that I wanted to add the application to the list of the choices which appear when an user click on the “share” button when view an image using the default Gallery application.

Continue reading

Haxe got (awesome) macros!

Hi guys, It has been a while since I posted the last time.
However I felt like it was the right moment to go back on the blog, to talk you about the new awesome Haxe macro system.

As you can read on Nicolas’s blog, they’re only present in the latest SVN update, but they will be included in the next build as soon as they will be perfect.
I must say I’m extremely happy about that addition: one of the most important reasons I’m so happy is the fact that instead of implementing an old-and-bording Macro system ala C/C++, Nicolas decided to go for a much more powerful macro system, which allows typesafe macros and real runtime code generation.

You are not limited to simple stuff like replace a macro call with a block of source code, but you can generate any kind of valid AST expressions that will be evaluated by the macro preprocessor at compile time.
Moreover you have access to almost the whole neko library (io, net, etc) which means you can write extremely powerful code generators and DSL! That’s an awesome feature – really.

Give it a look!

FlexLayout for AsWing

As you may have noticed I’m working with AsWing right now 🙂
Today I proposed a modification of the layout system. That’s because I couldn’t find any layout which satisfied my needs: a container which grows its components in order to fill the entire container size BUT which also keep in mind the component minimum and maximum sizes.
So it will try to grow all the components to the same size, but if a component has defined a specific minimum or maximum size, take that size under consideration.

Here’s a screenshot of the FlexLayout class in action ( click over the image to see the live demo ):

And here’s the code for using the layout:

f.getContentPane().setLayout( new FlexLayout( FlexLayout.VERTICAL, 2 ) );

Continue reading

Master of Alchemy is on the App Store!

After six months of hard development we’re so happy to announce that Master of Alchemy has been finally published in the iTunes App Store last Friday!

I’m sorry to spam again with this topic, but trust me, it has been a bet for all of us!
And actually it’s included into the “New and Noteworthy” section!
You can see Master of Alchemy page at the AppStore

Reviews

Games Uncovered review…without a doubt one of the best iPad games yet.

Simply a fantastic puzzle game that is challenging, deep and graphically stunning. An absolute treasure.

.

Destructoid review:Score: 8.5 — (8s are impressive efforts with a few noticeable problems holding them back. Won’t astound everyone, but is worth your time and cash

AsWing modifications

It’s a bit since I started using AsWing. It’s really a complete ui framework for flash with many useful components.

But as usual, when using a component set there’s always something missing. For this reason I just added to aswing these 2 components: JMultipleSlider and JLabelSlider. The first one is just a slider with the possibility to add multiple thumbs while the second one has a similar behavior to the Adobe’s label slider added in the last CS5 applications.