While I'm hacking the GSoC away, I finally released the first alpha version of the fourth Neko iteration. Plenty of things has changed, so I suggest looking through the post and start updating your projects. You can always check a sample project to see if it works for you.
The following library versions are the newest and proved to work together:
neko.App that takes care of Neko initialization. To use it you must specify
it is an application class in AndroidManifest (example). If you are using a
custom Application class, then extend
neko.App with it.
neko.App contains a static field
instance that reliably stores the
Application context. It means context accessible from anywhere, woot!
neko.App, SplashActivity is less cluttered now (example).
What has changed is how you define methods. Example:
(defactivity your.package.name.MainActivity :key :main :features [:no-title] (onCreate [this bundle] (.superOnCreate this bundle) ...) (onResume [this] (.superOnResume this) ...))
A few points to note here:
onStopetc.) require a super call, and some of the others. Some methods though don't need a super call, or require them as a default case (
onCreateOptionsMenu), and you have to explicitly make sure it happens.
MainActivity-onSomethingmethods. That approach might still work in regular builds, but will break Skummet.
(add-hook 'clojure-mode-hook (lambda () (put 'defactivity 'clojure-backtracking-indent '(4 (2)))))
Overall, the new
defactivity expects some more SDK knowledge, but is less
magical and more predictable.
The latest release of
org.clojure-android/clojure handles dynamic
compilation initialization by itself, and
neko.App takes care of Neko
initialization. So there is no need anymore for those two namespaces.
neko.data namespace now only contains the
like-map function. Utilities
for working with SharedPreferences were moved to
First of all, there is a new cool way to work with SharedPreferences which
was invented by @Malabarba. It is called
(defpreferences pref-atom "some_sharedprefs_file")
This creates an atom called
pref-atom that is bound to the SP file.
Whenever an atom changes, the underlying SP file changes accordingly. In
other words, it is an atom that preserves its state between restarts! See
more information here.
Nevertheless, the low-level functions like
still here if you need them. But some of them have changed too:
assoc!was renamed to
putto match with Android API.
get-arbitrarywere removed. If you want to put an arbitrary data type into SharedPreferences, you can still
read-stringmanually, but it is no longer encouraged. For storing bigger data chunks it is better to use SQLite.
neko.intent/intent enables more convenient creation of Intent objects.
See the description here.
This namespace is finally rewritten, and now conforms the rest of Neko. Example of usage.
Since I'm working on CoA testing framework as my GSoC proposal, Neko received some test treatment too. I will describe my progress in more detail in the upcoming post, but for now let's just say that Neko is automatically tested on Travis CI, with coverage no less.
This is all I have for now. As always, please report bugs and ask questions
#clojure-android channel at Freenode, on the mailing list, or in