[FL-1995] New dolphin animations (part 1) (#835)

* Desktop Animation (part 1): Ugly naked ohmygod architecture
* fix butthurt, fix locked scene
* Change SD icons, fixes
* Fix level update animation
* Fixes, correct butthurt
* Clean up code
* furi_assert(0) -> furi_crash("msg")
* Gui: rename none layer to desktop, update docs.

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Albert Kharisov
2021-11-24 20:21:12 +04:00
committed by GitHub
parent 92c499b41b
commit 9b8a139e2b
235 changed files with 1869 additions and 661 deletions

View File

@@ -1,5 +1,7 @@
#include "../desktop_i.h"
#include "../views/desktop_locked.h"
#include "desktop/helpers/desktop_animation.h"
#include "desktop/views/desktop_main.h"
#include <furi-hal-lock.h>
void desktop_scene_locked_callback(DesktopLockedEvent event, void* context) {
@@ -7,6 +9,12 @@ void desktop_scene_locked_callback(DesktopLockedEvent event, void* context) {
view_dispatcher_send_custom_event(desktop->view_dispatcher, event);
}
static void desktop_scene_locked_animation_changed_callback(void* context) {
furi_assert(context);
Desktop* desktop = context;
view_dispatcher_send_custom_event(desktop->view_dispatcher, DesktopMainEventUpdateAnimation);
}
void desktop_scene_locked_on_enter(void* context) {
Desktop* desktop = (Desktop*)context;
DesktopLockedView* locked_view = desktop->locked_view;
@@ -14,7 +22,11 @@ void desktop_scene_locked_on_enter(void* context) {
desktop_locked_set_callback(locked_view, desktop_scene_locked_callback, desktop);
desktop_locked_reset_door_pos(locked_view);
desktop_locked_update_hint_timeout(locked_view);
desktop_locked_set_dolphin_animation(locked_view);
desktop_animation_set_animation_changed_callback(
desktop->animation, desktop_scene_locked_animation_changed_callback, desktop);
const Icon* icon = desktop_animation_get_animation(desktop->animation);
desktop_locked_set_dolphin_animation(locked_view, icon);
uint32_t state = scene_manager_get_scene_state(desktop->scene_manager, DesktopViewLocked);
@@ -68,6 +80,12 @@ bool desktop_scene_locked_on_event(void* context, SceneManagerEvent event) {
case DesktopLockedEventInputReset:
desktop->pincode_buffer.length = 0;
break;
case DesktopMainEventUpdateAnimation: {
const Icon* icon = desktop_animation_get_animation(desktop->animation);
desktop_locked_set_dolphin_animation(desktop->locked_view, icon);
consumed = true;
break;
}
default:
if(desktop_scene_locked_check_pin(desktop, event.event)) {
scene_manager_set_scene_state(
@@ -84,6 +102,7 @@ bool desktop_scene_locked_on_event(void* context, SceneManagerEvent event) {
void desktop_scene_locked_on_exit(void* context) {
Desktop* desktop = (Desktop*)context;
desktop_animation_set_animation_changed_callback(desktop->animation, NULL, NULL);
desktop_locked_reset_counter(desktop->locked_view);
osTimerStop(desktop->locked_view->timer);
}