              ~(when key
                 `(.put all-activities ~key ~'this))
              (neko.init/init (.getApplicationContext ~'this))
+             ~(when features
+                `(request-window-features! ~'this ~@features))
              (~on-create ~'this ~'savedInstanceState)))
        ~(when on-create-options-menu
           `(defn ~(symbol (str prefix "onCreateOptionsMenu"))

                      ^View (neko.ui/make-ui-element activity view
                                                     {:id-holder dv})))))

(defn request-window-features!
  "Requests the given features for the activity. The features should be keywords
  such as :no-title or :indeterminate-progress corresponding FEATURE_NO_TITLE
  and FEATURE_INDETERMINATE_PROGRESS, respectively. Returns a sequence of
  boolean values corresponding to each feature, where a true value indicates the
  requested feature is supported and now enabled.

  This function should be called before set-content-view!."
  [^Activity activity & features]
  {:pre  [(activity? activity)
          (every? keyword? features)]}
  (doseq [feat features]
    (try (.requestWindowFeature activity
                                (static-field-value android.view.Window feat
                                                    #(str "FEATURE_" %)))
         (catch NoSuchFieldException _
           (throw (IllegalArgumentException.
                   (format "‘%s’ is not a valid feature." feat)))))))

(defmacro *a [& args]
  `(neko.debug/*a ~@args))

(ns neko.activity
  "Utilities to aid in working with an activity."
  (:require neko.init
            [neko.ui :refer [make-ui]]
            [neko.debug :refer [all-activities]]
            [neko.-utils :refer [keyword->static-field]])
  (:import android.app.Activity
           [android.view View Window]
           android.app.Fragment))

(defn ^View get-decor-view
  "Returns the root view of the given activity."
