animation_manager.c 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. #include <gui/view_stack.h>
  2. #include <stdint.h>
  3. #include <furi.h>
  4. #include <m-string.h>
  5. #include <portmacro.h>
  6. #include <dolphin/dolphin.h>
  7. #include <power/power_service/power.h>
  8. #include <storage/storage.h>
  9. #include <assets_icons.h>
  10. #include "views/bubble_animation_view.h"
  11. #include "views/one_shot_animation_view.h"
  12. #include "animation_storage.h"
  13. #include "animation_manager.h"
  14. #define TAG "AnimationManager"
  15. #define HARDCODED_ANIMATION_NAME "L1_Tv_128x47"
  16. #define NO_SD_ANIMATION_NAME "L1_NoSd_128x49"
  17. #define BAD_BATTERY_ANIMATION_NAME "L1_BadBattery_128x47"
  18. #define NO_DB_ANIMATION_NAME "L0_NoDb_128x51"
  19. #define BAD_SD_ANIMATION_NAME "L0_SdBad_128x51"
  20. #define SD_OK_ANIMATION_NAME "L0_SdOk_128x51"
  21. #define URL_ANIMATION_NAME "L0_Url_128x51"
  22. #define NEW_MAIL_ANIMATION_NAME "L0_NewMail_128x51"
  23. typedef enum {
  24. AnimationManagerStateIdle,
  25. AnimationManagerStateBlocked,
  26. AnimationManagerStateFreezedIdle,
  27. AnimationManagerStateFreezedBlocked,
  28. } AnimationManagerState;
  29. struct AnimationManager {
  30. bool sd_show_url;
  31. bool sd_shown_no_db;
  32. bool sd_shown_sd_ok;
  33. bool levelup_pending;
  34. bool levelup_active;
  35. AnimationManagerState state;
  36. FuriPubSubSubscription* pubsub_subscription_storage;
  37. FuriPubSubSubscription* pubsub_subscription_dolphin;
  38. BubbleAnimationView* animation_view;
  39. OneShotView* one_shot_view;
  40. osTimerId_t idle_animation_timer;
  41. StorageAnimation* current_animation;
  42. AnimationManagerInteractCallback interact_callback;
  43. AnimationManagerSetNewIdleAnimationCallback new_idle_callback;
  44. AnimationManagerSetNewIdleAnimationCallback check_blocking_callback;
  45. void* context;
  46. string_t freezed_animation_name;
  47. int32_t freezed_animation_time_left;
  48. ViewStack* view_stack;
  49. };
  50. static StorageAnimation*
  51. animation_manager_select_idle_animation(AnimationManager* animation_manager);
  52. static void animation_manager_replace_current_animation(
  53. AnimationManager* animation_manager,
  54. StorageAnimation* storage_animation);
  55. static void animation_manager_start_new_idle(AnimationManager* animation_manager);
  56. static bool animation_manager_check_blocking(AnimationManager* animation_manager);
  57. static bool animation_manager_is_valid_idle_animation(
  58. const StorageAnimationManifestInfo* info,
  59. const DolphinStats* stats);
  60. static void animation_manager_switch_to_one_shot_view(AnimationManager* animation_manager);
  61. static void animation_manager_switch_to_animation_view(AnimationManager* animation_manager);
  62. void animation_manager_set_context(AnimationManager* animation_manager, void* context) {
  63. furi_assert(animation_manager);
  64. animation_manager->context = context;
  65. }
  66. void animation_manager_set_new_idle_callback(
  67. AnimationManager* animation_manager,
  68. AnimationManagerSetNewIdleAnimationCallback callback) {
  69. furi_assert(animation_manager);
  70. animation_manager->new_idle_callback = callback;
  71. }
  72. void animation_manager_set_check_callback(
  73. AnimationManager* animation_manager,
  74. AnimationManagerCheckBlockingCallback callback) {
  75. furi_assert(animation_manager);
  76. animation_manager->check_blocking_callback = callback;
  77. }
  78. void animation_manager_set_interact_callback(
  79. AnimationManager* animation_manager,
  80. AnimationManagerInteractCallback callback) {
  81. furi_assert(animation_manager);
  82. animation_manager->interact_callback = callback;
  83. }
  84. static void animation_manager_check_blocking_callback(const void* message, void* context) {
  85. furi_assert(context);
  86. AnimationManager* animation_manager = context;
  87. if(animation_manager->check_blocking_callback) {
  88. animation_manager->check_blocking_callback(animation_manager->context);
  89. }
  90. }
  91. static void animation_manager_timer_callback(void* context) {
  92. furi_assert(context);
  93. AnimationManager* animation_manager = context;
  94. if(animation_manager->new_idle_callback) {
  95. animation_manager->new_idle_callback(animation_manager->context);
  96. }
  97. }
  98. static void animation_manager_interact_callback(void* context) {
  99. furi_assert(context);
  100. AnimationManager* animation_manager = context;
  101. if(animation_manager->interact_callback) {
  102. animation_manager->interact_callback(animation_manager->context);
  103. }
  104. }
  105. /* reaction to animation_manager->check_blocking_callback() */
  106. void animation_manager_check_blocking_process(AnimationManager* animation_manager) {
  107. furi_assert(animation_manager);
  108. if(animation_manager->state == AnimationManagerStateIdle) {
  109. bool blocked = animation_manager_check_blocking(animation_manager);
  110. if(!blocked) {
  111. Dolphin* dolphin = furi_record_open("dolphin");
  112. DolphinStats stats = dolphin_stats(dolphin);
  113. furi_record_close("dolphin");
  114. const StorageAnimationManifestInfo* manifest_info =
  115. animation_storage_get_meta(animation_manager->current_animation);
  116. bool valid = animation_manager_is_valid_idle_animation(manifest_info, &stats);
  117. if(!valid) {
  118. animation_manager_start_new_idle(animation_manager);
  119. }
  120. }
  121. }
  122. }
  123. /* reaction to animation_manager->new_idle_callback() */
  124. void animation_manager_new_idle_process(AnimationManager* animation_manager) {
  125. furi_assert(animation_manager);
  126. if(animation_manager->state == AnimationManagerStateIdle) {
  127. animation_manager_start_new_idle(animation_manager);
  128. }
  129. }
  130. /* reaction to animation_manager->interact_callback() */
  131. void animation_manager_interact_process(AnimationManager* animation_manager) {
  132. furi_assert(animation_manager);
  133. if(animation_manager->levelup_pending) {
  134. animation_manager->levelup_pending = false;
  135. animation_manager->levelup_active = true;
  136. animation_manager_switch_to_one_shot_view(animation_manager);
  137. Dolphin* dolphin = furi_record_open("dolphin");
  138. dolphin_upgrade_level(dolphin);
  139. furi_record_close("dolphin");
  140. } else if(animation_manager->levelup_active) {
  141. animation_manager->levelup_active = false;
  142. animation_manager_start_new_idle(animation_manager);
  143. animation_manager_switch_to_animation_view(animation_manager);
  144. } else if(animation_manager->state == AnimationManagerStateBlocked) {
  145. bool blocked = animation_manager_check_blocking(animation_manager);
  146. if(!blocked) {
  147. animation_manager_start_new_idle(animation_manager);
  148. }
  149. }
  150. }
  151. static void animation_manager_start_new_idle(AnimationManager* animation_manager) {
  152. furi_assert(animation_manager);
  153. StorageAnimation* new_animation = animation_manager_select_idle_animation(animation_manager);
  154. animation_manager_replace_current_animation(animation_manager, new_animation);
  155. const BubbleAnimation* bubble_animation =
  156. animation_storage_get_bubble_animation(animation_manager->current_animation);
  157. animation_manager->state = AnimationManagerStateIdle;
  158. osTimerStart(animation_manager->idle_animation_timer, bubble_animation->duration * 1000);
  159. }
  160. static bool animation_manager_check_blocking(AnimationManager* animation_manager) {
  161. furi_assert(animation_manager);
  162. StorageAnimation* blocking_animation = NULL;
  163. Storage* storage = furi_record_open("storage");
  164. FS_Error sd_status = storage_sd_status(storage);
  165. if(sd_status == FSE_INTERNAL) {
  166. blocking_animation = animation_storage_find_animation(BAD_SD_ANIMATION_NAME);
  167. furi_assert(blocking_animation);
  168. } else if(sd_status == FSE_NOT_READY) {
  169. animation_manager->sd_shown_sd_ok = false;
  170. animation_manager->sd_shown_no_db = false;
  171. } else if(sd_status == FSE_OK) {
  172. if(!animation_manager->sd_shown_sd_ok) {
  173. blocking_animation = animation_storage_find_animation(SD_OK_ANIMATION_NAME);
  174. furi_assert(blocking_animation);
  175. animation_manager->sd_shown_sd_ok = true;
  176. } else if(!animation_manager->sd_shown_no_db) {
  177. bool db_exists = storage_common_stat(storage, "/ext/Manifest", NULL) == FSE_OK;
  178. if(!db_exists) {
  179. blocking_animation = animation_storage_find_animation(NO_DB_ANIMATION_NAME);
  180. furi_assert(blocking_animation);
  181. animation_manager->sd_shown_no_db = true;
  182. animation_manager->sd_show_url = true;
  183. }
  184. } else if(animation_manager->sd_show_url) {
  185. blocking_animation = animation_storage_find_animation(URL_ANIMATION_NAME);
  186. furi_assert(blocking_animation);
  187. animation_manager->sd_show_url = false;
  188. }
  189. }
  190. Dolphin* dolphin = furi_record_open("dolphin");
  191. DolphinStats stats = dolphin_stats(dolphin);
  192. furi_record_close("dolphin");
  193. if(!blocking_animation && stats.level_up_is_pending) {
  194. blocking_animation = animation_storage_find_animation(NEW_MAIL_ANIMATION_NAME);
  195. furi_assert(blocking_animation);
  196. if(blocking_animation) {
  197. animation_manager->levelup_pending = true;
  198. }
  199. }
  200. if(blocking_animation) {
  201. osTimerStop(animation_manager->idle_animation_timer);
  202. animation_manager_replace_current_animation(animation_manager, blocking_animation);
  203. /* no timer starting because this is blocking animation */
  204. animation_manager->state = AnimationManagerStateBlocked;
  205. }
  206. furi_record_close("storage");
  207. return !!blocking_animation;
  208. }
  209. static void animation_manager_replace_current_animation(
  210. AnimationManager* animation_manager,
  211. StorageAnimation* storage_animation) {
  212. furi_assert(storage_animation);
  213. StorageAnimation* previous_animation = animation_manager->current_animation;
  214. const BubbleAnimation* animation = animation_storage_get_bubble_animation(storage_animation);
  215. bubble_animation_view_set_animation(animation_manager->animation_view, animation);
  216. const char* new_name = animation_storage_get_meta(storage_animation)->name;
  217. FURI_LOG_I(TAG, "Select \'%s\' animation", new_name);
  218. animation_manager->current_animation = storage_animation;
  219. if(previous_animation) {
  220. animation_storage_free_storage_animation(&previous_animation);
  221. }
  222. }
  223. AnimationManager* animation_manager_alloc(void) {
  224. AnimationManager* animation_manager = malloc(sizeof(AnimationManager));
  225. animation_manager->animation_view = bubble_animation_view_alloc();
  226. animation_manager->view_stack = view_stack_alloc();
  227. View* animation_view = bubble_animation_get_view(animation_manager->animation_view);
  228. view_stack_add_view(animation_manager->view_stack, animation_view);
  229. string_init(animation_manager->freezed_animation_name);
  230. animation_manager->idle_animation_timer =
  231. osTimerNew(animation_manager_timer_callback, osTimerOnce, animation_manager, NULL);
  232. bubble_animation_view_set_interact_callback(
  233. animation_manager->animation_view, animation_manager_interact_callback, animation_manager);
  234. Storage* storage = furi_record_open("storage");
  235. animation_manager->pubsub_subscription_storage = furi_pubsub_subscribe(
  236. storage_get_pubsub(storage), animation_manager_check_blocking_callback, animation_manager);
  237. furi_record_close("storage");
  238. Dolphin* dolphin = furi_record_open("dolphin");
  239. animation_manager->pubsub_subscription_dolphin = furi_pubsub_subscribe(
  240. dolphin_get_pubsub(dolphin), animation_manager_check_blocking_callback, animation_manager);
  241. furi_record_close("dolphin");
  242. animation_manager->sd_shown_sd_ok = true;
  243. if(!animation_manager_check_blocking(animation_manager)) {
  244. animation_manager_start_new_idle(animation_manager);
  245. }
  246. return animation_manager;
  247. }
  248. void animation_manager_free(AnimationManager* animation_manager) {
  249. furi_assert(animation_manager);
  250. Dolphin* dolphin = furi_record_open("dolphin");
  251. furi_pubsub_unsubscribe(
  252. dolphin_get_pubsub(dolphin), animation_manager->pubsub_subscription_dolphin);
  253. furi_record_close("dolphin");
  254. Storage* storage = furi_record_open("storage");
  255. furi_pubsub_unsubscribe(
  256. storage_get_pubsub(storage), animation_manager->pubsub_subscription_storage);
  257. furi_record_close("storage");
  258. string_clear(animation_manager->freezed_animation_name);
  259. View* animation_view = bubble_animation_get_view(animation_manager->animation_view);
  260. view_stack_remove_view(animation_manager->view_stack, animation_view);
  261. bubble_animation_view_free(animation_manager->animation_view);
  262. osTimerDelete(animation_manager->idle_animation_timer);
  263. }
  264. View* animation_manager_get_animation_view(AnimationManager* animation_manager) {
  265. furi_assert(animation_manager);
  266. return view_stack_get_view(animation_manager->view_stack);
  267. }
  268. static bool animation_manager_is_valid_idle_animation(
  269. const StorageAnimationManifestInfo* info,
  270. const DolphinStats* stats) {
  271. furi_assert(info);
  272. furi_assert(info->name);
  273. bool result = true;
  274. if(!strcmp(info->name, BAD_BATTERY_ANIMATION_NAME)) {
  275. Power* power = furi_record_open("power");
  276. bool battery_is_well = power_is_battery_healthy(power);
  277. furi_record_close("power");
  278. result = !battery_is_well;
  279. }
  280. if(!strcmp(info->name, NO_SD_ANIMATION_NAME)) {
  281. Storage* storage = furi_record_open("storage");
  282. FS_Error sd_status = storage_sd_status(storage);
  283. furi_record_close("storage");
  284. result = (sd_status == FSE_NOT_READY);
  285. }
  286. if((stats->butthurt < info->min_butthurt) || (stats->butthurt > info->max_butthurt)) {
  287. result = false;
  288. }
  289. if((stats->level < info->min_level) || (stats->level > info->max_level)) {
  290. result = false;
  291. }
  292. return result;
  293. }
  294. static StorageAnimation*
  295. animation_manager_select_idle_animation(AnimationManager* animation_manager) {
  296. StorageAnimationList_t animation_list;
  297. StorageAnimationList_init(animation_list);
  298. animation_storage_fill_animation_list(&animation_list);
  299. Dolphin* dolphin = furi_record_open("dolphin");
  300. DolphinStats stats = dolphin_stats(dolphin);
  301. furi_record_close("dolphin");
  302. uint32_t whole_weight = 0;
  303. StorageAnimationList_it_t it;
  304. for(StorageAnimationList_it(it, animation_list); !StorageAnimationList_end_p(it);) {
  305. StorageAnimation* storage_animation = *StorageAnimationList_ref(it);
  306. const StorageAnimationManifestInfo* manifest_info =
  307. animation_storage_get_meta(storage_animation);
  308. bool valid = animation_manager_is_valid_idle_animation(manifest_info, &stats);
  309. if(valid) {
  310. whole_weight += manifest_info->weight;
  311. StorageAnimationList_next(it);
  312. } else {
  313. animation_storage_free_storage_animation(&storage_animation);
  314. /* remove and increase iterator */
  315. StorageAnimationList_remove(animation_list, it);
  316. }
  317. }
  318. uint32_t lucky_number = random() % whole_weight;
  319. uint32_t weight = 0;
  320. StorageAnimation* selected = NULL;
  321. for
  322. M_EACH(item, animation_list, StorageAnimationList_t) {
  323. if(lucky_number < weight) {
  324. break;
  325. }
  326. weight += animation_storage_get_meta(*item)->weight;
  327. selected = *item;
  328. }
  329. for
  330. M_EACH(item, animation_list, StorageAnimationList_t) {
  331. if(*item != selected) {
  332. animation_storage_free_storage_animation(item);
  333. }
  334. }
  335. StorageAnimationList_clear(animation_list);
  336. /* cache animation, if failed - choose reliable animation */
  337. if(!animation_storage_get_bubble_animation(selected)) {
  338. const char* name = animation_storage_get_meta(selected)->name;
  339. FURI_LOG_E(TAG, "Can't upload animation described in manifest: \'%s\'", name);
  340. animation_storage_free_storage_animation(&selected);
  341. selected = animation_storage_find_animation(HARDCODED_ANIMATION_NAME);
  342. }
  343. furi_assert(selected);
  344. return selected;
  345. }
  346. bool animation_manager_is_animation_loaded(AnimationManager* animation_manager) {
  347. furi_assert(animation_manager);
  348. return animation_manager->current_animation;
  349. }
  350. void animation_manager_unload_and_stall_animation(AnimationManager* animation_manager) {
  351. furi_assert(animation_manager);
  352. furi_assert(animation_manager->current_animation);
  353. furi_assert(!string_size(animation_manager->freezed_animation_name));
  354. furi_assert(
  355. (animation_manager->state == AnimationManagerStateIdle) ||
  356. (animation_manager->state == AnimationManagerStateBlocked));
  357. if(animation_manager->state == AnimationManagerStateBlocked) {
  358. animation_manager->state = AnimationManagerStateFreezedBlocked;
  359. } else if(animation_manager->state == AnimationManagerStateIdle) {
  360. animation_manager->state = AnimationManagerStateFreezedIdle;
  361. animation_manager->freezed_animation_time_left =
  362. xTimerGetExpiryTime(animation_manager->idle_animation_timer) - xTaskGetTickCount();
  363. if(animation_manager->freezed_animation_time_left < 0) {
  364. animation_manager->freezed_animation_time_left = 0;
  365. }
  366. osTimerStop(animation_manager->idle_animation_timer);
  367. } else {
  368. furi_assert(0);
  369. }
  370. FURI_LOG_I(
  371. TAG,
  372. "Unload animation \'%s\'",
  373. animation_storage_get_meta(animation_manager->current_animation)->name);
  374. StorageAnimationManifestInfo* meta =
  375. animation_storage_get_meta(animation_manager->current_animation);
  376. /* copy str, not move, because it can be internal animation */
  377. string_set_str(animation_manager->freezed_animation_name, meta->name);
  378. bubble_animation_freeze(animation_manager->animation_view);
  379. animation_storage_free_storage_animation(&animation_manager->current_animation);
  380. }
  381. void animation_manager_load_and_continue_animation(AnimationManager* animation_manager) {
  382. furi_assert(animation_manager);
  383. furi_assert(!animation_manager->current_animation);
  384. furi_assert(string_size(animation_manager->freezed_animation_name));
  385. furi_assert(
  386. (animation_manager->state == AnimationManagerStateFreezedIdle) ||
  387. (animation_manager->state == AnimationManagerStateFreezedBlocked));
  388. if(animation_manager->state == AnimationManagerStateFreezedBlocked) {
  389. StorageAnimation* restore_animation = animation_storage_find_animation(
  390. string_get_cstr(animation_manager->freezed_animation_name));
  391. /* all blocked animations must be in flipper -> we can
  392. * always find blocking animation */
  393. furi_assert(restore_animation);
  394. animation_manager_replace_current_animation(animation_manager, restore_animation);
  395. animation_manager->state = AnimationManagerStateBlocked;
  396. } else if(animation_manager->state == AnimationManagerStateFreezedIdle) {
  397. /* check if we missed some system notifications, and set current_animation */
  398. bool blocked = animation_manager_check_blocking(animation_manager);
  399. if(!blocked) {
  400. /* if no blocking - try restore last one idle */
  401. StorageAnimation* restore_animation = animation_storage_find_animation(
  402. string_get_cstr(animation_manager->freezed_animation_name));
  403. if(restore_animation) {
  404. Dolphin* dolphin = furi_record_open("dolphin");
  405. DolphinStats stats = dolphin_stats(dolphin);
  406. furi_record_close("dolphin");
  407. const StorageAnimationManifestInfo* manifest_info =
  408. animation_storage_get_meta(restore_animation);
  409. bool valid = animation_manager_is_valid_idle_animation(manifest_info, &stats);
  410. if(valid) {
  411. animation_manager_replace_current_animation(
  412. animation_manager, restore_animation);
  413. animation_manager->state = AnimationManagerStateIdle;
  414. if(animation_manager->freezed_animation_time_left) {
  415. osTimerStart(
  416. animation_manager->idle_animation_timer,
  417. animation_manager->freezed_animation_time_left);
  418. } else {
  419. const BubbleAnimation* animation = animation_storage_get_bubble_animation(
  420. animation_manager->current_animation);
  421. osTimerStart(
  422. animation_manager->idle_animation_timer, animation->duration * 1000);
  423. }
  424. }
  425. } else {
  426. FURI_LOG_E(
  427. TAG,
  428. "Failed to restore \'%s\'",
  429. string_get_cstr(animation_manager->freezed_animation_name));
  430. }
  431. }
  432. } else {
  433. /* Unknown state is an error. But not in release version.*/
  434. furi_assert(0);
  435. }
  436. /* if can't restore previous animation - select new */
  437. if(!animation_manager->current_animation) {
  438. animation_manager_start_new_idle(animation_manager);
  439. }
  440. FURI_LOG_I(
  441. TAG,
  442. "Load animation \'%s\'",
  443. animation_storage_get_meta(animation_manager->current_animation)->name);
  444. bubble_animation_unfreeze(animation_manager->animation_view);
  445. string_reset(animation_manager->freezed_animation_name);
  446. furi_assert(animation_manager->current_animation);
  447. }
  448. static void animation_manager_switch_to_one_shot_view(AnimationManager* animation_manager) {
  449. furi_assert(animation_manager);
  450. furi_assert(!animation_manager->one_shot_view);
  451. Dolphin* dolphin = furi_record_open("dolphin");
  452. DolphinStats stats = dolphin_stats(dolphin);
  453. furi_record_close("dolphin");
  454. animation_manager->one_shot_view = one_shot_view_alloc();
  455. one_shot_view_set_interact_callback(
  456. animation_manager->one_shot_view, animation_manager_interact_callback, animation_manager);
  457. View* prev_view = bubble_animation_get_view(animation_manager->animation_view);
  458. View* next_view = one_shot_view_get_view(animation_manager->one_shot_view);
  459. view_stack_remove_view(animation_manager->view_stack, prev_view);
  460. view_stack_add_view(animation_manager->view_stack, next_view);
  461. if(stats.level == 1) {
  462. one_shot_view_start_animation(animation_manager->one_shot_view, &A_Levelup1_128x64);
  463. } else if(stats.level == 2) {
  464. one_shot_view_start_animation(animation_manager->one_shot_view, &A_Levelup2_128x64);
  465. } else {
  466. furi_assert(0);
  467. }
  468. }
  469. static void animation_manager_switch_to_animation_view(AnimationManager* animation_manager) {
  470. furi_assert(animation_manager);
  471. furi_assert(animation_manager->one_shot_view);
  472. View* prev_view = one_shot_view_get_view(animation_manager->one_shot_view);
  473. View* next_view = bubble_animation_get_view(animation_manager->animation_view);
  474. view_stack_remove_view(animation_manager->view_stack, prev_view);
  475. view_stack_add_view(animation_manager->view_stack, next_view);
  476. one_shot_view_free(animation_manager->one_shot_view);
  477. animation_manager->one_shot_view = NULL;
  478. }