Skip to content

Commit ca99bca

Browse files
UI: improve swipes
- UI: only show back and down gesture icons on swipe, not on tap - UI: double size of back and down swipe gesture starting areas for easier gestures
1 parent d368db1 commit ca99bca

File tree

4 files changed

+46
-22
lines changed

4 files changed

+46
-22
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
0.4.1
2+
=====
3+
- MposKeyboard: fix q, Q, 1 and ~ button unclickable bug
4+
- OSUpdate app: simplify by using ConnectivityManager
5+
- API: add facilities for instrumentation (screengrabs, mouse clicks)
6+
- UI: pass clicks on invisible "gesture swipe start" are to underlying widget
7+
- UI: only show back and down gesture icons on swipe, not on tap
8+
- UI: double size of back and down swipe gesture starting areas for easier gestures
9+
110
0.4.0
211
=====
312
- Add custom MposKeyboard with more than 50% bigger buttons, great for tiny touch screens!

internal_filesystem/builtin/apps/com.micropythonos.osupdate/META-INF/MANIFEST.JSON

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"publisher": "MicroPythonOS",
44
"short_description": "Operating System Updater",
55
"long_description": "Updates the operating system in a safe way, to a secondary partition. After the update, the device is restarted. If the system starts up successfully, it is marked as valid and kept. Otherwise, a rollback to the old, primary partition is performed.",
6-
"icon_url": "https://apps.micropythonos.com/apps/com.micropythonos.osupdate/icons/com.micropythonos.osupdate_0.0.9_64x64.png",
7-
"download_url": "https://apps.micropythonos.com/apps/com.micropythonos.osupdate/mpks/com.micropythonos.osupdate_0.0.9.mpk",
6+
"icon_url": "https://apps.micropythonos.com/apps/com.micropythonos.osupdate/icons/com.micropythonos.osupdate_0.0.10_64x64.png",
7+
"download_url": "https://apps.micropythonos.com/apps/com.micropythonos.osupdate/mpks/com.micropythonos.osupdate_0.0.10.mpk",
88
"fullname": "com.micropythonos.osupdate",
9-
"version": "0.0.9",
9+
"version": "0.0.10",
1010
"category": "osupdate",
1111
"activities": [
1212
{

internal_filesystem/builtin/apps/com.micropythonos.wifi/META-INF/MANIFEST.JSON

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"publisher": "MicroPythonOS",
44
"short_description": "WiFi Network Configuration",
55
"long_description": "Scans for wireless networks, shows a list of SSIDs, allows for password entry, and connecting.",
6-
"icon_url": "https://apps.micropythonos.com/apps/com.micropythonos.wifi/icons/com.micropythonos.wifi_0.0.9_64x64.png",
7-
"download_url": "https://apps.micropythonos.com/apps/com.micropythonos.wifi/mpks/com.micropythonos.wifi_0.0.9.mpk",
6+
"icon_url": "https://apps.micropythonos.com/apps/com.micropythonos.wifi/icons/com.micropythonos.wifi_0.0.10_64x64.png",
7+
"download_url": "https://apps.micropythonos.com/apps/com.micropythonos.wifi/mpks/com.micropythonos.wifi_0.0.10.mpk",
88
"fullname": "com.micropythonos.wifi",
9-
"version": "0.0.9",
9+
"version": "0.0.10",
1010
"category": "networking",
1111
"activities": [
1212
{

internal_filesystem/lib/mpos/ui/gesture_navigation.py

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,18 @@
1111
back_start_y = 0
1212
back_start_x = 0
1313
short_movement_threshold = 10
14+
backbutton_visible = False
15+
downbutton_visible = False
16+
17+
def is_short_movement(dx, dy):
18+
return dx < short_movement_threshold and dy < short_movement_threshold
1419

1520
def _back_swipe_cb(event):
1621
if drawer_open:
1722
print("ignoring back gesture because drawer is open")
1823
return
1924

20-
global backbutton, back_start_y, back_start_x
25+
global backbutton, back_start_y, back_start_x, backbutton_visible
2126
event_code = event.get_code()
2227
indev = lv.indev_active()
2328
if not indev:
@@ -26,21 +31,25 @@ def _back_swipe_cb(event):
2631
indev.get_point(point)
2732
x = point.x
2833
y = point.y
34+
dx = abs(x - back_start_x)
35+
dy = abs(y - back_start_y)
2936
#print(f"visual_back_swipe_cb event_code={event_code} and event_name={name} and pos: {x}, {y}")
3037
if event_code == lv.EVENT.PRESSED:
31-
smooth_show(backbutton)
3238
back_start_y = y
3339
back_start_x = x
3440
elif event_code == lv.EVENT.PRESSING:
35-
magnetic_x = round(x / 10)
36-
backbutton.set_pos(magnetic_x,back_start_y)
41+
should_show = not is_short_movement(dx, dy)
42+
if should_show != backbutton_visible:
43+
backbutton_visible = should_show
44+
smooth_show(backbutton) if should_show else smooth_hide(backbutton)
45+
backbutton.set_pos(round(x / 10), back_start_y)
3746
elif event_code == lv.EVENT.RELEASED:
38-
smooth_hide(backbutton)
39-
dx = abs(x - back_start_x)
40-
dy = abs(y - back_start_y)
47+
if backbutton_visible:
48+
backbutton_visible = False
49+
smooth_hide(backbutton)
4150
if x > min(100, get_display_width() / 4):
4251
back_screen()
43-
elif dx < short_movement_threshold and dy < short_movement_threshold:
52+
elif is_short_movement(dx, dy):
4453
# print("Short movement - treating as tap")
4554
obj = lv.indev_search_obj(lv.screen_active(), lv.point_t({'x': x, 'y': y}))
4655
# print(f"Found object: {obj}")
@@ -62,7 +71,7 @@ def _top_swipe_cb(event):
6271
print("ignoring top swipe gesture because drawer is open")
6372
return
6473

65-
global downbutton, down_start_x, down_start_y
74+
global downbutton, down_start_x, down_start_y, downbutton_visible
6675
event_code = event.get_code()
6776
indev = lv.indev_active()
6877
if not indev:
@@ -71,21 +80,27 @@ def _top_swipe_cb(event):
7180
indev.get_point(point)
7281
x = point.x
7382
y = point.y
83+
dx = abs(x - down_start_x)
84+
dy = abs(y - down_start_y)
7485
# print(f"visual_back_swipe_cb event_code={event_code} and event_name={name} and pos: {x}, {y}")
7586
if event_code == lv.EVENT.PRESSED:
76-
smooth_show(downbutton)
7787
down_start_x = x
7888
down_start_y = y
7989
elif event_code == lv.EVENT.PRESSING:
80-
magnetic_y = round(y/ 10)
81-
downbutton.set_pos(down_start_x,magnetic_y)
90+
should_show = not is_short_movement(dx, dy)
91+
if should_show != downbutton_visible:
92+
downbutton_visible = should_show
93+
smooth_show(downbutton) if should_show else smooth_hide(downbutton)
94+
downbutton.set_pos(down_start_x, round(y / 10))
8295
elif event_code == lv.EVENT.RELEASED:
83-
smooth_hide(downbutton)
96+
if downbutton_visible:
97+
downbutton_visible = False
98+
smooth_hide(downbutton)
8499
dx = abs(x - down_start_x)
85100
dy = abs(y - down_start_y)
86101
if y > min(80, get_display_height() / 4):
87102
open_drawer()
88-
elif dx < short_movement_threshold and dy < short_movement_threshold:
103+
elif is_short_movement(dx, dy):
89104
# print("Short movement - treating as tap")
90105
obj = lv.indev_search_obj(lv.screen_active(), lv.point_t({'x': x, 'y': y}))
91106
# print(f"Found object: {obj}")
@@ -105,7 +120,7 @@ def _top_swipe_cb(event):
105120
def handle_back_swipe():
106121
global backbutton
107122
rect = lv.obj(lv.layer_top())
108-
rect.set_size(round(NOTIFICATION_BAR_HEIGHT/2), lv.layer_top().get_height()-NOTIFICATION_BAR_HEIGHT) # narrow because it overlaps buttons
123+
rect.set_size(NOTIFICATION_BAR_HEIGHT, lv.layer_top().get_height()-NOTIFICATION_BAR_HEIGHT) # narrow because it overlaps buttons
109124
rect.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
110125
rect.set_scroll_dir(lv.DIR.NONE)
111126
rect.set_pos(0, NOTIFICATION_BAR_HEIGHT)
@@ -139,7 +154,7 @@ def handle_back_swipe():
139154
def handle_top_swipe():
140155
global downbutton
141156
rect = lv.obj(lv.layer_top())
142-
rect.set_size(lv.pct(100), round(NOTIFICATION_BAR_HEIGHT*2/3))
157+
rect.set_size(lv.pct(100), NOTIFICATION_BAR_HEIGHT)
143158
rect.set_pos(0, 0)
144159
rect.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF)
145160
style = lv.style_t()

0 commit comments

Comments
 (0)