[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,17 @@
#include "assets_icons.h"
#include "cmsis_os2.h"
#include "desktop/desktop.h"
#include "desktop_i.h"
#include <dolphin/dolphin.h>
#include <furi/pubsub.h>
#include <furi/record.h>
#include "portmacro.h"
#include "storage/filesystem-api-defines.h"
#include "storage/storage.h"
#include <furi-hal-lock.h>
#include <stdint.h>
#include <power/power_service/power.h>
#include "helpers/desktop_animation.h"
static void desktop_lock_icon_callback(Canvas* canvas, void* context) {
furi_assert(canvas);
@@ -25,10 +37,11 @@ Desktop* desktop_alloc() {
desktop->scene_thread = furi_thread_alloc();
desktop->view_dispatcher = view_dispatcher_alloc();
desktop->scene_manager = scene_manager_alloc(&desktop_scene_handlers, desktop);
desktop->animation = desktop_animation_alloc();
view_dispatcher_enable_queue(desktop->view_dispatcher);
view_dispatcher_attach_to_gui(
desktop->view_dispatcher, desktop->gui, ViewDispatcherTypeWindow);
desktop->view_dispatcher, desktop->gui, ViewDispatcherTypeDesktop);
view_dispatcher_set_event_callback_context(desktop->view_dispatcher, desktop);
view_dispatcher_set_custom_event_callback(
@@ -79,6 +92,7 @@ Desktop* desktop_alloc() {
void desktop_free(Desktop* desktop) {
furi_assert(desktop);
desktop_animation_free(desktop->animation);
view_dispatcher_remove_view(desktop->view_dispatcher, DesktopViewMain);
view_dispatcher_remove_view(desktop->view_dispatcher, DesktopViewLockMenu);
view_dispatcher_remove_view(desktop->view_dispatcher, DesktopViewLocked);
@@ -116,8 +130,29 @@ static bool desktop_is_first_start() {
return exists;
}
static void desktop_dolphin_state_changed_callback(const void* message, void* context) {
Desktop* desktop = context;
view_dispatcher_send_custom_event(desktop->view_dispatcher, DesktopMainEventUpdateAnimation);
}
static void desktop_storage_state_changed_callback(const void* message, void* context) {
Desktop* desktop = context;
view_dispatcher_send_custom_event(desktop->view_dispatcher, DesktopMainEventUpdateAnimation);
}
int32_t desktop_srv(void* p) {
Desktop* desktop = desktop_alloc();
Dolphin* dolphin = furi_record_open("dolphin");
FuriPubSub* dolphin_pubsub = dolphin_get_pubsub(dolphin);
FuriPubSubSubscription* dolphin_subscription =
furi_pubsub_subscribe(dolphin_pubsub, desktop_dolphin_state_changed_callback, desktop);
Storage* storage = furi_record_open("storage");
FuriPubSub* storage_pubsub = storage_get_pubsub(storage);
FuriPubSubSubscription* storage_subscription =
furi_pubsub_subscribe(storage_pubsub, desktop_storage_state_changed_callback, desktop);
bool loaded = LOAD_DESKTOP_SETTINGS(&desktop->settings);
if(!loaded) {
furi_hal_lock_set(false);
@@ -143,6 +178,8 @@ int32_t desktop_srv(void* p) {
}
view_dispatcher_run(desktop->view_dispatcher);
furi_pubsub_unsubscribe(dolphin_pubsub, dolphin_subscription);
furi_pubsub_unsubscribe(storage_pubsub, storage_subscription);
desktop_free(desktop);
return 0;