Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (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: foo@bar.com"
- :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)))))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement