Permalink
Browse files

Add :on-editor-action trait

  • Loading branch information...
1 parent a485b8e commit 11d7f841a823440ec757e01175e1b5ddb0a6ca67 @BartAdv BartAdv committed Mar 16, 2014
Showing with 9 additions and 1 deletion.
  1. +1 −1 src/clojure/neko/ui/mapping.clj
  2. +8 −0 src/clojure/neko/ui/traits.clj
@@ -49,7 +49,7 @@
:inherits :view
:value-namespaces
{:ellipsize android.text.TextUtils$TruncateAt}
- :traits [:text :text-size]}
+ :traits [:text :text-size :on-editor-action]}
:list-view {:classname android.widget.ListView
:inherits :view-group}
:search-view {:classname android.widget.SearchView
@@ -15,6 +15,7 @@
[neko.resource :as res]
[neko.context :as context]
[neko.listeners.view :as view-listeners]
+ [neko.listeners.text-view :as text-view-listeners]
neko.listeners.search-view)
(:use [neko.-utils :only [memoized]])
(:import [android.widget LinearLayout$LayoutParams TextView SearchView
@@ -396,6 +397,13 @@ next-level elements."
(fn [q] (on-query-text-submit q menu-item))
on-query-text-submit))))
+(deftrait :on-editor-action
+ "Takes :on-editor-action attribute, which should be function
+ of three arguments, and sets it as OnEditorAction for the
+ TexView widget"
+ [^TextView wdg, {:keys [on-editor-action]}]
+ (.setOnEditorActionListener wdg (text-view-listeners/on-editor-action-call on-editor-action)))
+
;; ### ID storing traits
(deftrait :id-holder

0 comments on commit 11d7f84

Please sign in to comment.