examples: annotate examples
[nit.git] / lib / app / examples / http_request_example.nit
index 65c3db8..a121f6c 100644 (file)
 # limitations under the License.
 
 # Example for the `app::http_request` main service `AsyncHttpRequest`
-module http_request_example
+module http_request_example is
+       example
+       app_name "app.nit HTTP"
+       app_namespace "org.nitlanguage.http_example"
+       android_api_target 15
+end
 
 import app::ui
 import app::http_request
+import android::aware # for android_api_target
 
 # Simple asynchronous HTTP request to http://example.com/ displaying feedback to the window
 class MyHttpRequest
@@ -51,12 +57,12 @@ class MyHttpRequest
        redef fun after do win.button_request.enabled = true
 end
 
-# Simpe window with a label and a button
+# Simple window with a label and a button
 class HttpRequestClientWindow
        super Window
 
        # Root layout
-       var layout = new VerticalLayout(parent=self)
+       var layout = new ListLayout(parent=self)
 
        # Button to send request
        var button_request = new Button(parent=layout, text="Press to send HTTP request")
@@ -76,11 +82,4 @@ class HttpRequestClientWindow
        end
 end
 
-redef class App
-       redef fun on_create
-       do
-               # Create the main window
-               push_window new HttpRequestClientWindow
-               super
-       end
-end
+redef fun root_window do return new HttpRequestClientWindow