forked from MapComplete/MapComplete
Android: add inset spacers (experimental)
This commit is contained in:
parent
7ce320075d
commit
94949e14a6
5 changed files with 61 additions and 1 deletions
|
|
@ -94,6 +94,37 @@ export class AndroidPolyfill {
|
|||
return token
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets how much padding we should add on top and at the bottom; in pixels
|
||||
*/
|
||||
private static insets: { top: Store<number>, bottom: Store<number> } = undefined
|
||||
|
||||
public static getInsetSizes(): Readonly<{ top: Store<number>, bottom: Store<number> }> {
|
||||
if (AndroidPolyfill.insets) {
|
||||
return AndroidPolyfill.insets
|
||||
}
|
||||
const insets = {
|
||||
top: new UIEventSource(0),
|
||||
bottom: new UIEventSource(0),
|
||||
}
|
||||
AndroidPolyfill.insets = insets
|
||||
|
||||
console.log("Web: requesting inset sizes")
|
||||
DatabridgePluginSingleton.request<{ top: number, bottom: number }>({
|
||||
key: "insets",
|
||||
}).then((result) => {
|
||||
let v = result.value
|
||||
if(typeof v === "string"){
|
||||
v = JSON.parse(v)
|
||||
}
|
||||
console.log("Got inset sizes:", result)
|
||||
insets.bottom.set(v.bottom)
|
||||
insets.top.set(v.top)
|
||||
})
|
||||
|
||||
return insets
|
||||
}
|
||||
|
||||
public static onBackButton(
|
||||
callback: () => boolean,
|
||||
options: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue