Skip to content

Commit 4bbf698

Browse files
Hide bar animation works
1 parent 4ed712b commit 4bbf698

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

internal_filesystem/main.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,16 @@ def open_drawer():
5656
global drawer_open
5757
if not drawer_open:
5858
drawer_open=True
59+
notification_bar.set_pos(0,0)
60+
notification_bar.remove_flag(lv.obj.FLAG.HIDDEN)
5961
drawer.remove_flag(lv.obj.FLAG.HIDDEN)
6062

6163
def close_drawer():
6264
global drawer_open
6365
if drawer_open:
6466
drawer_open=False
6567
drawer.add_flag(lv.obj.FLAG.HIDDEN)
68+
animation.start()
6669

6770
def toggle_drawer(event):
6871
global drawer_open
@@ -77,6 +80,7 @@ def toggle_drawer(event):
7780
notification_bar.set_style_bg_color(COLOR_NOTIF_BAR_BG, 0)
7881
notification_bar.set_size(TFT_HOR_RES, NOTIFICATION_BAR_HEIGHT)
7982
notification_bar.set_pos(0, 0)
83+
notification_bar.add_flag(lv.obj.FLAG.HIDDEN)
8084
notification_bar.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
8185
notification_bar.set_scroll_dir(lv.DIR.VER)
8286
notification_bar.set_style_border_width(0, 0)
@@ -150,6 +154,13 @@ def update_memfree(timer):
150154
timer4 = lv.timer_create(update_wifi_icon, WIFI_ICON_UPDATE_INTERVAL, None)
151155
#notification_bar.add_event_cb(toggle_drawer, lv.EVENT.CLICKED, None)
152156

157+
# hide bar animation
158+
animation = lv.anim_t()
159+
animation.init()
160+
animation.set_var(notification_bar)
161+
animation.set_values(0, -NOTIFICATION_BAR_HEIGHT)
162+
animation.set_time(2000)
163+
animation.set_custom_exec_cb(lambda not_used, value : notification_bar.set_y(value))
153164

154165

155166
drawer=lv.obj(lv.layer_top())
@@ -346,7 +357,10 @@ def start_app(app_dir, is_launcher=False):
346357
app_name, start_script = parse_manifest(manifest_path)
347358
start_script_fullpath = f"{app_dir}/{start_script}"
348359
execute_script_new_thread(start_script_fullpath, True, is_launcher, True)
349-
360+
# Show notification bar, then start animation to hide it
361+
notification_bar.set_pos(0,0)
362+
notification_bar.remove_flag(lv.obj.FLAG.HIDDEN)
363+
animation.start()
350364

351365
def restart_launcher():
352366
# The launcher might have been updated from the builtin one, so check that:

0 commit comments

Comments
 (0)