Advertisement
Guest User

Untitled

a guest
Dec 20th, 2014
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. (ns com.mlatu.clojure.test.main
  2. (:use [neko.activity :only [defactivity set-content-view! *a]]
  3. [neko.threading :only [on-ui]]
  4. [neko.notify]
  5. [neko.resource]))
  6.  
  7.  
  8. (fire (*a) :notification
  9. (notification :icon (get-resource (*a) :drawable :ic-launcher)
  10. :ticker-text "You've got mail"
  11. :content-title "One new message"
  12. :content-text "FROM: foo@bar.com"
  13. :action [:activity "com.mlatu.clojure.test.ACTION"]))
  14.  
  15. (cancel (*a) :notification)
  16.  
  17. (defn make-button [i]
  18. [:button {:text (str "This is a button " i)
  19. :tag (str i)
  20. :on-click (fn [view] (show-toast view))}])
  21.  
  22. (defn unroll [s]
  23. (vec (flatten s)))
  24.  
  25. (defn show-toast [view]
  26. (toast (str (System/currentTimeMillis) "---" (.getTag view))
  27. :long))
  28.  
  29. (defactivity com.mlatu.clojure.test.MainActivity
  30. :key :main
  31. :on-create
  32. (fn [this bundle]
  33. (on-ui
  34. (set-content-view! (*a)
  35. (make-ui
  36. (let [layout [:linear-layout {:orientation :vertical}
  37. [:text-view {:text "A text view"} ]]
  38. buttons (for [i (range 5)]
  39. (make-button i))]
  40. (concat layout buttons)))))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement