Skip to content

Conversation

m1ga
Copy link
Contributor

@m1ga m1ga commented Apr 29, 2025

currently only for testing

const win = Titanium.UI.createWindow({});
win.open();

console.log("isFoldable: " + Ti.App.Android.isFoldable);

Ti.App.addEventListener("windowState", function(e) {
	console.log("--------------------------------");
	console.log("folding state: " + e.state)
	console.log("folding occlusionType: " + e.occlusionType)
	console.log("folding orientation: " + e.orientation)
	console.log("folding isSeparating: " + e.isSeparating)
	console.log("--------------------------------");
})
  • new event windowState that will fire when the window state of a foldable is changing (opening up)
  • new property Ti.App.Android.isFoldable that will be true if there is a hinge (so a foldable)

Note:
Not sure if it is an emulator thing or not: it only works when you start the app in the open state. If it is closed it won't attach the listener and shows a warning that the size doesn't match 🤷 And the "closed" state is never fired, only the open and half open state.
Have to do some more tests here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant