Skip to content
This repository was archived by the owner on Apr 25, 2024. It is now read-only.

Generate reverse mapping #72

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions src/clojure/neko/ui/mapping.clj
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,11 @@

(def ^{:private true} reverse-mapping
(atom
{android.widget.Button :button
android.widget.LinearLayout :linear-layout
android.widget.RelativeLayout :relative-layout
android.widget.FrameLayout :frame-layout
android.widget.EditText :edit-text
android.widget.TextView :text-view
android.widget.ListView :list-view
android.widget.ImageView :image-view
android.webkit.WebView :web-view
android.widget.ScrollView :scroll-view
android.widget.Gallery :gallery
android.widget.GridView :grid-view
android.widget.ProgressBar :progress-bar
android.app.ProgressDialog :progress-dialog}))
(into {}
(keep (fn [[kw {classname :classname}]]
(when classname
[classname kw]))
(get-keyword-mapping)))))

(defn set-classname!
"Connects the given keyword to the classname."
Expand Down
7 changes: 7 additions & 0 deletions test/neko/ui/t_mapping.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(ns neko.ui.t-mapping
(:require [clojure.test :refer :all]
[neko.ui.mapping :refer :all :as m])
(:import android.widget.TextView))

(deftest reverse-mapping
(is (= (@@#'m/reverse-mapping android.widget.TextView) :text-view)))