 
 ;; ### Notifications
 
-(def ^:private default-notification-icon (atom nil))
-
-(defn set-default-notification-icon! [icon]
-  (reset! default-notification-icon icon))
-
 (defn- ^NotificationManager notification-manager
   "Returns the notification manager instance."
-  [^Context context]
-  (.getSystemService context Context/NOTIFICATION_SERVICE))
+  ([^Context context]
+   (.getSystemService context Context/NOTIFICATION_SERVICE)))
 
 (defn construct-pending-intent
   "Creates a PendingIntent instance from a vector where the first

(ns neko.notify
  "Provides convenient wrappers for Toast and Notification APIs."
  (:use [neko.context :only [context]])
  (:import android.content.Context android.widget.Toast
           android.app.Notification android.content.Intent
           android.app.PendingIntent android.app.NotificationManager))

;; ### Toasts

(defn toast
  "Creates a Toast object using a text message and a keyword representing how
  long a toast should be visible (`:short` or `:long`). Two-argument version
  takes only message and assumes length to be :long."
  {:forms '([context message] [context message length])}
  ([message]
     (println "One-argument version is deprecated. Please use (toast context message)")
     (toast context message :long))
  ([arg1 arg2]
     (if (instance? Context arg1)
       (toast arg1 arg2 :long)
       (do (println "Context-less version is deprecated. Please use (toast context message length)")
           (toast context arg1 arg2))))
  ([^Context context, ^String message, length]
   {:pre [(or (= length :short) (= length :long))]}
   (.show

(defn notification
  "Creates a Notification instance. If icon is not provided uses the
  default notification icon."
  ([options]
   (notification App/instance options))
  ([context {:keys [icon ticker-text when content-title content-text action]
             :or {icon android.R$drawable/ic_dialog_info
                  when (System/currentTimeMillis)}}]
   (let [notification (Notification. icon ticker-text when)]
     (.setLatestEventInfo notification context content-title content-text
                          (construct-pending-intent context action))
     notification)))

(defn fire
  "Sends the notification to the status bar. ID can be an integer or a keyword."
  ([id notification]
   (fire App/instance id notification))
  ([context id notification]
   (let [id (if (keyword? id)
              (Math/abs (.hashCode id))
              id)]
     (.notify (notification-manager context) id notification))))

(defn cancel
  "Removes a notification by the given ID from the status bar."
  ([id]
   (cancel App/instance id))
  ([context id]
   (.cancel (notification-manager context) (if (keyword? id)
                                             (Math/abs (.hashCode id))
                                             id))))
