pui_sample: stop/destroy current animation before we start a new animation 57/220657/1
authorSung-Jin Park <sj76.park@samsung.com>
Tue, 20 Aug 2019 08:55:08 +0000 (17:55 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Fri, 20 Dec 2019 07:13:29 +0000 (16:13 +0900)
Change-Id: I960113c991297c07455504c2a997b67d9567c4fc
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
samples/PUI_sample.c

index 359fd8e..852ddda 100644 (file)
@@ -83,28 +83,24 @@ ani_collection_play(app_data_t *app)
                return;
        }
 
+       if (app->ani_h)
+       {
+               /* stop animation running already */
+               ani_stop(app);
+               pui_ani_destroy(app->ani_h);
+               app->ani_h = NULL;
+       }
+
        ani_h = pui_ani_create(app->ph, ani_collection[ani_idx].id);
 
        if (!ani_h)
        {
                debug_error("Failed to create new PUI animation handle !\n");
-               return;
-       }
-
-       if (app->ani_h)
-       {
-               /* stop animation running already */
-               e = pui_ani_control(app->ani_h, PUI_ANI_CMD_STOP, 0);
-
-               if (PUI_ERROR_NONE != e)
-               {
-                       debug_error("Failed on stopping an animation !(cmd:%d, repeat:%d)\n", PUI_ANI_CMD_STOP, 0);
-                       return;
-               }
 
-               debug_info("Animation(%s) will be stopped !\n", pui_ani_get_id(ani_h));
+               if (++ani_idx >= n_animation)
+                       ani_idx = 0;
 
-               app->ani_h = NULL;
+               return;
        }
 
        app->ani_h = ani_h;