-
Notifications
You must be signed in to change notification settings - Fork 283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android: Native Dialog Addon #1520
Conversation
This function opens a file descriptor to access data under a Universal Resource Identifier.
…ocumentation already suggests that, but we now enforce it.
I've been following this, awesome work! How are things going? About |
Thanks. I've been using it successfully. There was a bit of a challenge concerning concurrency. Allegro defines a blocking interface. This blocking interface creates the possibility of deadlocks linked to display events, which I have documented and addressed. I took extra care so that things work seamlessly.
This utility function returns a file descriptor, which is a well-known mechanism that also works outside of Allegro - e.g., with external libraries. In my point of view, this is the most flexible option possible, and the second best option after file paths. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, it took me some time but I went through all of this. Amazing work! I just had one question, but otherwise this is good to go.
|
||
private Looper myLooper() | ||
{ | ||
try { Looper.prepare(); } catch (Exception e) { ; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to discard exceptions here? Is it worth logging them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looper.prepare()
initializes the current thread as a Looper. As you can see at Looper.java, the method can throw a runtime exception that says "Only one Looper may be created per thread". The class constructor does nothing special. Would you like this logged? It doesn't seem useful and we would have this message show up repeatedly on the logs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See also: MessageQueue.nativeInit. Would you like this logged?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, that makes sense. Could you add a comment about this? Something like // Looper will raise an exception if one already exists in the thread.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
Thanks! |
This is an implementation of the Native Dialog Addon for Android. It includes: message boxes, file chooser and text logs. Text logs are mapped to logcat. Window menus have an empty implementation.
In addition to implementing the Native Dialog Addon, I have also adapted ex_native_filechooser (please apply #1518 before testing).
Considerations about the file chooser:
al_show_native_file_dialog()
is specified as blocking in the Allegro API. Since there is a need to handleALLEGRO_EVENT_DISPLAY_HALT_DRAWING
before that function returns, users must call it from a different thread.al_android_open_fd()
, can be used to get a file descriptor (not a file path) from a content:// URI.Screenshots: