mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-14 10:28:36 -07:00
Update apps
This commit is contained in:
@@ -1 +1,2 @@
|
||||
ADD_SCENE(flipp_pomodoro, info, Info)
|
||||
ADD_SCENE(flipp_pomodoro, timer, Timer)
|
||||
@@ -1,3 +1,4 @@
|
||||
#pragma once
|
||||
#include <gui/scene_manager.h>
|
||||
|
||||
// Generate scene id and total number
|
||||
|
||||
59
applications/external/pomodoro/scenes/flipp_pomodoro_scene_info.c
vendored
Normal file
59
applications/external/pomodoro/scenes/flipp_pomodoro_scene_info.c
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
#include <furi.h>
|
||||
#include <gui/view_dispatcher.h>
|
||||
#include <gui/scene_manager.h>
|
||||
#include "flipp_pomodoro_scene.h"
|
||||
#include "../flipp_pomodoro_app.h"
|
||||
#include "../views/flipp_pomodoro_info_view.h"
|
||||
|
||||
enum { SceneEventConusmed = true, SceneEventNotConusmed = false };
|
||||
|
||||
void flipp_pomodoro_scene_info_on_back_to_timer(void* ctx) {
|
||||
furi_assert(ctx);
|
||||
FlippPomodoroApp* app = ctx;
|
||||
|
||||
view_dispatcher_send_custom_event(
|
||||
app->view_dispatcher, FlippPomodoroAppCustomEventResumeTimer);
|
||||
};
|
||||
|
||||
void flipp_pomodoro_scene_info_on_enter(void* ctx) {
|
||||
furi_assert(ctx);
|
||||
FlippPomodoroApp* app = ctx;
|
||||
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, FlippPomodoroAppViewInfo);
|
||||
flipp_pomodoro_info_view_set_pomodoros_completed(
|
||||
flipp_pomodoro_info_view_get_view(app->info_view),
|
||||
flipp_pomodoro_statistics__get_focus_stages_completed(app->statistics));
|
||||
flipp_pomodoro_info_view_set_mode(
|
||||
flipp_pomodoro_info_view_get_view(app->info_view), FlippPomodoroInfoViewModeStats);
|
||||
flipp_pomodoro_info_view_set_resume_timer_cb(
|
||||
app->info_view, flipp_pomodoro_scene_info_on_back_to_timer, app);
|
||||
};
|
||||
|
||||
void flipp_pomodoro_scene_info_handle_custom_event(
|
||||
FlippPomodoroApp* app,
|
||||
FlippPomodoroAppCustomEvent custom_event) {
|
||||
if(custom_event == FlippPomodoroAppCustomEventResumeTimer) {
|
||||
scene_manager_next_scene(app->scene_manager, FlippPomodoroSceneTimer);
|
||||
}
|
||||
};
|
||||
|
||||
bool flipp_pomodoro_scene_info_on_event(void* ctx, SceneManagerEvent event) {
|
||||
furi_assert(ctx);
|
||||
FlippPomodoroApp* app = ctx;
|
||||
|
||||
switch(event.type) {
|
||||
case SceneManagerEventTypeBack:
|
||||
view_dispatcher_stop(app->view_dispatcher);
|
||||
return SceneEventConusmed;
|
||||
case SceneManagerEventTypeCustom:
|
||||
flipp_pomodoro_scene_info_handle_custom_event(app, event.event);
|
||||
return SceneEventConusmed;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
return SceneEventNotConusmed;
|
||||
};
|
||||
|
||||
void flipp_pomodoro_scene_info_on_exit(void* ctx) {
|
||||
UNUSED(ctx);
|
||||
};
|
||||
@@ -1,13 +1,13 @@
|
||||
#include <furi.h>
|
||||
#include <gui/scene_manager.h>
|
||||
#include <gui/view_dispatcher.h>
|
||||
#include <gui/scene_manager.h>
|
||||
#include "flipp_pomodoro_scene.h"
|
||||
#include "../flipp_pomodoro_app.h"
|
||||
#include "../views/flipp_pomodoro_timer_view.h"
|
||||
|
||||
enum { SceneEventConusmed = true, SceneEventNotConusmed = false };
|
||||
|
||||
uint8_t ExitSignal = 0;
|
||||
|
||||
void flipp_pomodoro_scene_timer_sync_view_state(void* ctx) {
|
||||
furi_assert(ctx);
|
||||
|
||||
@@ -30,6 +30,11 @@ void flipp_pomodoro_scene_timer_on_enter(void* ctx) {
|
||||
|
||||
FlippPomodoroApp* app = ctx;
|
||||
|
||||
if(flipp_pomodoro__is_stage_expired(app->state)) {
|
||||
flipp_pomodoro__destroy(app->state);
|
||||
app->state = flipp_pomodoro__new();
|
||||
}
|
||||
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, FlippPomodoroAppViewTimer);
|
||||
flipp_pomodoro_scene_timer_sync_view_state(app);
|
||||
flipp_pomodoro_view_timer_set_on_right_cb(
|
||||
@@ -59,7 +64,8 @@ bool flipp_pomodoro_scene_timer_on_event(void* ctx, SceneManagerEvent event) {
|
||||
flipp_pomodoro_scene_timer_handle_custom_event(app, event.event);
|
||||
return SceneEventConusmed;
|
||||
case SceneManagerEventTypeBack:
|
||||
return ExitSignal;
|
||||
scene_manager_next_scene(app->scene_manager, FlippPomodoroSceneInfo);
|
||||
return SceneEventConusmed;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user