forked from flipperdevices/flipperzero-firmware
-
-
Notifications
You must be signed in to change notification settings - Fork 546
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Adds edit playlist section - Adds delete playlist function to edit playlist
- Loading branch information
Showing
7 changed files
with
94 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#include "nfc_playlist.h" | ||
#include "scences/file_edit.h" | ||
|
||
typedef enum { | ||
NfcPlaylistMenuSelection_DeletePlaylist | ||
} NfcPlaylistMenuSelection; | ||
|
||
void nfc_playlist_file_edit_menu_callback(void* context, uint32_t index) { | ||
NfcPlaylist* nfc_playlist = context; | ||
Storage* storage = furi_record_open(RECORD_STORAGE); | ||
switch(index) { | ||
case NfcPlaylistMenuSelection_DeletePlaylist: { | ||
storage_simply_remove(storage, furi_string_get_cstr(nfc_playlist->file_path)); | ||
nfc_playlist->file_selected = false; | ||
nfc_playlist->file_selected_check = false; | ||
nfc_playlist->file_path = nfc_playlist->base_file_path; | ||
scene_manager_previous_scene(nfc_playlist->scene_manager); | ||
break; | ||
} | ||
default: | ||
break; | ||
} | ||
furi_record_close(RECORD_STORAGE); | ||
} | ||
|
||
void nfc_playlist_file_edit_scene_on_enter(void* context) { | ||
NfcPlaylist* nfc_playlist = context; | ||
|
||
submenu_set_header(nfc_playlist->submenu, "Edit Playlist"); | ||
|
||
submenu_add_item( | ||
nfc_playlist->submenu, | ||
"Delete Playlist", | ||
NfcPlaylistMenuSelection_DeletePlaylist, | ||
nfc_playlist_file_edit_menu_callback, | ||
nfc_playlist); | ||
|
||
view_dispatcher_switch_to_view(nfc_playlist->view_dispatcher, NfcPlaylistView_FileEdit); | ||
} | ||
|
||
bool nfc_playlist_file_edit_scene_on_event(void* context, SceneManagerEvent event) { | ||
UNUSED(event); | ||
UNUSED(context); | ||
return false; | ||
} | ||
|
||
void nfc_playlist_file_edit_scene_on_exit(void* context) { | ||
NfcPlaylist* nfc_playlist = context; | ||
submenu_reset(nfc_playlist->submenu); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#pragma once | ||
#include <furi.h> | ||
#include <gui/gui.h> | ||
#include <gui/view_dispatcher.h> | ||
#include <gui/scene_manager.h> | ||
#include <gui/modules/submenu.h> | ||
#include <storage/storage.h> | ||
#include <toolbox/stream/stream.h> | ||
#include <toolbox/stream/file_stream.h> | ||
|
||
void nfc_playlist_file_edit_scene_on_enter(void* context); | ||
bool nfc_playlist_file_edit_scene_on_event(void* context, SceneManagerEvent event); | ||
void nfc_playlist_file_edit_scene_on_exit(void* context); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters