From 850a7f643e1a1a4c0856f13b8214f09398489c8f Mon Sep 17 00:00:00 2001 From: Alexander Yakushev Date: Thu, 11 Jun 2015 14:19:30 +0200 Subject: [PATCH] [n.threading] Finish cleanup --- src/clojure/neko/threading.clj | 48 +++------------------------------- 1 file changed, 3 insertions(+), 45 deletions(-) diff --git a/src/clojure/neko/threading.clj b/src/clojure/neko/threading.clj index 2f67dd1..6bb9789 100644 --- a/src/clojure/neko/threading.clj +++ b/src/clojure/neko/threading.clj @@ -1,22 +1,7 @@ -; Copyright © 2011 Sattvik Software & Technology Resources, Ltd. Co. -; All rights reserved. -; -; This program and the accompanying materials are made available under the -; terms of the Eclipse Public License v1.0 which accompanies this distribution, -; and is available at . -; -; By using this software in any fashion, you are agreeing to be bound by the -; terms of this license. You must not remove this notice, or any other, from -; this software. - (ns neko.threading "Utilities used to manage multiple threads on Android." - {:author "Daniel Solano Gómez"} (:use [neko.debug :only [safe-for-ui]]) - (:import android.app.Activity - android.view.View - clojure.lang.IFn - java.util.concurrent.TimeUnit + (:import android.view.View android.os.Looper android.os.Handler)) @@ -41,41 +26,14 @@ [f] (on-ui (f))) -(defn ^{:deprecated "3.1.0"} post* - "Causes the function to be added to the message queue. The function will - execute on the UI thread. Returns true if successfully placed in the message - queue." - [^View view, f] - (.post view f)) - (defmacro post "Causes the macro body to be added to the message queue. It will execute on the UI thread. Returns true if successfully placed in the message queue." [view & body] - `(post* ~view (fn [] ~@body))) - -(defn ^{:deprecated "3.1.0"} post-delayed* - "Causes the function to be added to the message queue, to be run after the - specified amount of time elapses. The function will execute on the UI - thread. Returns true if successfully placed in the message - queue." - [^View view, millis f] - (.postDelayed view f millis)) + `(.post ^View ~view (fn [] ~@body))) (defmacro post-delayed "Causes the macro body to be added to the message queue. It will execute on the UI thread. Returns true if successfully placed in the message queue." [view millis & body] - `(post-delayed* ~view ~millis (fn [] ~@body))) - -(def ^{:doc "A map of unit keywords to TimeUnit instances." - :private true} - unit-map - {; days/hours/minutes added in API level 9 - ;:days TimeUnit/DAYS - ;:hours TimeUnit/HOURS - ;:minutes TimeUnit/MINUTES - :seconds TimeUnit/SECONDS - :millis TimeUnit/MILLISECONDS - :micros TimeUnit/MICROSECONDS - :nanos TimeUnit/NANOSECONDS}) + `(.postDelayed ^View ~view ~millis (fn [] ~@body)))