clojure-android / neko

The Clojure/Android Toolkit
Other
297 stars 36 forks source link

Problem calling neko.ui.config on a LinearLayout #16

Closed ghost closed 11 years ago

ghost commented 11 years ago

Came across this as I was going through Kris's tutorial. Here is the code in question:

(declare ^android.widget.LinearLayout mylayout)
(declare add-event)

(defn get-elmt [elmt]
  (elmt (.getTag mylayout)))

(defn set-elmt [elmt s]
  (on-ui (config (elmt (.getTag mylayout)) :text s)))

(defn add-event []
  (set-elmt ::listing "TEST SETTING TEXT"))

(def main-layout [:linear-layout {:orientation :vertical,
                                  :id-holder :true
                                  :def `mylayout}
                  [:edit-text {:hint "Event name",
                               :id ::name}]
                  [:edit-text {:hint "Event location",
                               :text "Partay Town!"
                               :id ::location}]
                  [:button {:text "+ Event"
                            :on-click (fn [_] (add-event))}]
                  [:text-view {:text @listing
                               :id ::listing}]])

Calling add-event in the activity crashes the app, with the error: java.lang.ClassCastException: android.view.ViewGroup$LayoutParams cannot be cast to android.widget.LinearLayout$LayoutParams

alexander-yakushev commented 11 years ago

Sorry, a regression happened after one of the recent commits. Can you please try again with neko 3.0.0-SNAPSHOT and lein-droid 0.2.0-SNAPSHOT? Thank you!

ghost commented 11 years ago

Ah yup, that works now. Thanks!

ghost commented 11 years ago

If it's helpful, I was using lein-droid 0.2.0-preview2 and neko 3.0.0-preview3 when that bug was generated.

alexander-yakushev commented 11 years ago

Great! Thank you for reporting it, I would be very said if it made it to release:-) .