 (declare date-picker)
 (declare time-picker)
 
-;(def my-handler (Handler.))
+(defn create-counter-class [text-time-view millis-in-future countdown-timer-interval]
+  (proxy [CountDownTimer] [millis-in-future countdown-timer-interval]
+    (onTick [millis-until-finished]
+      (on-ui
+        (config
+          text-time-view
+          :text
+          (str (format "%02d:%02d:%02d"
+                       (.toHours TimeUnit/MICROSECONDS millis-until-finished)
+                       (- (.toMinutes TimeUnit/MICROSECONDS millis-until-finished) (.toMinutes TimeUnit/HOURS (.toHours TimeUnit/MICROSECONDS millis-until-finished)))
+                       (- (.toSeconds TimeUnit/MICROSECONDS millis-until-finished) (.toSeconds TimeUnit/MINUTES (.toMinutes TimeUnit/MICROSECONDS millis-until-finished))))))))
+    (onFinish []
+      (on-ui config text-time-view :text "Completed."))))
 
 (defrecord Task [date name duration date-index])
 

            event-text-view (find-view event-linear-layout-view ::event-tv)
            event-timer-view (find-view event-linear-layout-view ::time-tv)
            event-button-view (find-view event-linear-layout-view ::event-btn)
            my-handler (Handler.)]
        ;symptom of mutability
        (config date-text-view :visibility (if (= (:date-index task) 0) View/VISIBLE View/GONE))
        (config date-text-view :text (str (:date task)))

        (config event-button-view :on-click (fn [_] (.postDelayed my-handler (create-update-timer-method event-timer-view 0 0) 0)))
        (config event-text-view :text (str (:name task) " " (:duration task) " " (:date-index task)))))
    listing
    sorted-map-array-to-array-task))

                          (into [] (map-indexed (fn [i ele] (apply ->Task (concat [(first sorted-map-data)] ele [i]))) (second sorted-map-data))))
                        lst)))

(defn make-date-adapter []
  (adapters/ref-adapter
    (fn [_]
      [:linear-layout {:id-holder   true
                       :orientation :vertical}
       [:text-view {:id ::date-tv}]
       [:linear-layout {:id          ::event-ll
                        :id-holder   true
                        :orientation :horizontal}
        [:text-view {:id ::event-tv}]
        [:text-view {:id ::time-tv}]
        [:button {:id   ::event-btn
                  :text "start",
                  ;:on-click
                  }]
        ]])
