app.nit & android: move on_create & on_destroy to Android only
authorAlexis Laferrière <alexis.laf@xymus.net>
Thu, 28 Jul 2016 20:13:23 +0000 (16:13 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Fri, 29 Jul 2016 15:50:53 +0000 (11:50 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/android/nit_activity.nit
lib/android/ui/ui.nit
lib/app/app_base.nit
lib/app/ui.nit

index 1668147..18fd432 100644 (file)
@@ -207,6 +207,14 @@ redef class App
        end
 end
 
+redef class AppComponent
+       # The application is starting or restarting, it is visible to the user
+       fun on_start do end
+
+       # The application is being destroyed
+       fun on_destroy do end
+end
+
 # An Android activity
 #
 # You must implement the callbacks (prefixed with `on_`) to follow the
index 7e14b19..66791c7 100644 (file)
@@ -79,6 +79,16 @@ redef class App
                native_activity.show_fragment(root_layout_id, window.native)
                super
        end
+
+       redef fun on_start do window.on_start
+
+       redef fun on_destroy do window.on_destroy
+end
+
+redef class CompositeControl
+       redef fun on_start do for i in items do i.on_start
+
+       redef fun on_destroy do for i in items do i.on_destroy
 end
 
 redef class Activity
index e709e84..e1f8d78 100644 (file)
@@ -52,9 +52,6 @@ abstract class AppComponent
        # You should build the UI at this time.
        fun on_create do end
 
-       # The application is starting or restarting, it is visible to the user
-       fun on_start do end
-
        # The application enters the active state, it is in the foreground and interactive
        fun on_resume do end
 
@@ -69,9 +66,6 @@ abstract class AppComponent
        # It may then be destroyed (`on_destroy`) or go back to `on_start`.
        fun on_stop do end
 
-       # The application is being destroyed
-       fun on_destroy do end
-
        # The application may be destroyed soon, save its state for a future `on_restore_state`
        fun on_save_state do end
 
index 5f66ab4..1fdf801 100644 (file)
@@ -56,16 +56,12 @@ redef class App
 
        redef fun on_create do window.on_create
 
-       redef fun on_start do window.on_start
-
        redef fun on_resume do window.on_resume
 
        redef fun on_pause do window.on_pause
 
        redef fun on_stop do window.on_stop
 
-       redef fun on_destroy do window.on_destroy
-
        redef fun on_restore_state do window.on_restore_state
 
        redef fun on_save_state do window.on_save_state
@@ -165,16 +161,12 @@ class CompositeControl
 
        redef fun on_create do for i in items do i.on_create
 
-       redef fun on_start do for i in items do i.on_start
-
        redef fun on_resume do for i in items do i.on_resume
 
        redef fun on_pause do for i in items do i.on_pause
 
        redef fun on_stop do for i in items do i.on_stop
 
-       redef fun on_destroy do for i in items do i.on_destroy
-
        redef fun on_restore_state do for i in items do i.on_restore_state
 
        redef fun on_save_state do for i in items do i.on_save_state