Fix wallpaper transparency, Recents setup guide, and drawer animation
This commit is contained in:
1 parent
2fa7bd745b
commit
216c80252d
14 files changed
+474
-86
No files matched your search
+40
-17
@@ -20,8 +20,6 @@ priv struct PageState {
|
||||
mut placed : String
|
||||
mut excluded : String
|
||||
mut cover_y : Int32
|
||||
mut cover_last : Double
|
||||
mut cover_loop : Bool
|
||||
mut measured : String
|
||||
mut touch : (Double, Double, Double)?
|
||||
mut demo_widget : Int32
|
||||
@@ -43,8 +41,6 @@ fn PageState::new() -> PageState {
|
||||
placed: "",
|
||||
excluded: "[]",
|
||||
cover_y: 0,
|
||||
cover_last: 0.0,
|
||||
cover_loop: false,
|
||||
measured: "",
|
||||
touch: None,
|
||||
demo_widget: 100,
|
||||
@@ -135,14 +131,31 @@ fn exec(e : @app.Effect) -> Unit {
|
||||
}
|
||||
OpenRecents =>
|
||||
if android {
|
||||
h_open_recents()
|
||||
if !h_open_recents() {
|
||||
dispatch(RecentsUnavailable)
|
||||
}
|
||||
} else {
|
||||
toast("Show open windows")
|
||||
}
|
||||
OpenAccessibilitySettings =>
|
||||
if android {
|
||||
h_open_accessibility_settings()
|
||||
} else {
|
||||
toast("Open Accessibility settings")
|
||||
}
|
||||
OpenSelfAppInfo =>
|
||||
if android {
|
||||
h_open_self_app_info()
|
||||
} else {
|
||||
toast("Open App info")
|
||||
}
|
||||
Haptic => h_haptic()
|
||||
LoadApps =>
|
||||
fetch_text("apps.json", fn(ok, text) {
|
||||
dispatch(AppsLoaded(if ok { Some(text) } else { None }))
|
||||
if ok {
|
||||
prewarm_app_icons()
|
||||
}
|
||||
})
|
||||
LoadWidgets =>
|
||||
fetch_text("widgets.json", fn(ok, text) {
|
||||
@@ -251,28 +264,38 @@ fn place() -> Unit {
|
||||
}
|
||||
|
||||
///|
|
||||
/// Native widgets sit above the page, so the drawer can't cover them by itself. While
|
||||
/// it slides down the shell hides them above its bottom edge each frame, a little ahead
|
||||
/// of it (by its speed), since the shell trails a frame.
|
||||
/// Native widgets sit above the page, so the shell hides them while the drawer is open.
|
||||
fn cover() -> Unit {
|
||||
let st = state.val
|
||||
let y = drawer_cover(st.cover_last).to_int()
|
||||
st.cover_last = drawer_bottom()
|
||||
let y = if drawer_covering() { -1 } else { 0 }
|
||||
if y != st.cover_y {
|
||||
st.cover_y = y
|
||||
h_cover_widgets(y)
|
||||
}
|
||||
if y != 0 && y != -1 && !st.cover_loop {
|
||||
st.cover_loop = true
|
||||
request_frame(fn() {
|
||||
state.val.cover_loop = false
|
||||
cover()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// ---- icons -------------------------------------------------------------------------
|
||||
|
||||
///|
|
||||
/// Pre-fetch uncached app icons on Android right after apps.json loads so the drawer
|
||||
/// opens with icons ready instead of popping them in during the first open animation.
|
||||
fn prewarm_app_icons() -> Unit {
|
||||
if !h_has_load_icons() {
|
||||
return
|
||||
}
|
||||
let st = state.val
|
||||
let want : Array[Json] = []
|
||||
for k in model.icon_keys() {
|
||||
if !st.icon_src.contains(k) && !st.icon_asked.contains(k) {
|
||||
st.icon_asked[k] = true
|
||||
want.push(Json::string(k))
|
||||
}
|
||||
}
|
||||
if want.length() > 0 {
|
||||
h_load_icons(Json::array(want).stringify())
|
||||
}
|
||||
}
|
||||
|
||||
///|
|
||||
/// Each `<img class="icon" data-icon=KEY>` gets its src from here. On a phone the shell
|
||||
/// draws icons on its own thread and hands them back as data: URIs in batches, so the
|
||||
|
||||
Reference in new issue
Block a user