Created
December 21, 2014 01:06
-
-
Save defHLT/bbfe12377f70f1f79601 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns com.mlatu.clojure.test.main | |
(:use [neko.activity :only [defactivity set-content-view! *a]] | |
[neko.threading :only [on-ui]] | |
[neko.notify] | |
[neko.resource])) | |
(fire (*a) :notification | |
(notification :icon (get-resource (*a) :drawable :ic-launcher) | |
:ticker-text "You've got mail" | |
:content-title "One new message" | |
:content-text "FROM: [email protected]" | |
:action [:activity "com.mlatu.clojure.test.ACTION"])) | |
(cancel (*a) :notification) | |
(defn make-button [i] | |
[:button {:text (str "This is a button " i) | |
:tag (str i) | |
:on-click (fn [view] (show-toast view))}]) | |
(defn unroll [s] | |
(vec (flatten s))) | |
(defn show-toast [view] | |
(toast (str (System/currentTimeMillis) "---" (.getTag view)) | |
:long)) | |
(defactivity com.mlatu.clojure.test.MainActivity | |
:key :main | |
:on-create | |
(fn [this bundle] | |
(on-ui | |
(set-content-view! (*a) | |
(make-ui | |
(let [layout [:linear-layout {:orientation :vertical} | |
[:text-view {:text "A text view"} ]] | |
buttons (for [i (range 5)] | |
(make-button i))] | |
(concat layout buttons))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment