-
Notifications
You must be signed in to change notification settings - Fork 5
Android support #53
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
base: master
Are you sure you want to change the base?
Android support #53
Conversation
RUNTIME.set(self, f) | ||
} | ||
|
||
pub fn block_on<F: Future>(&self, future: F) -> F::Output { |
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.
Please refer to winio-pollable
and winio-ui-winui
for a correct implementation of block_on
.
- We don't alloc for
future
. We just callspawn_unchecked
. - We need to poll the driver fd and the app event together. If it's not possible, we poll the driver fd in another thread. Your current implementation is enough for GUI to run correctly, but the IO operations will not complete.
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.
- Please rebase the PR.
- Please add
.idea
to.gitignore
.
I have left some comments. The runtime needs to be modified to make sure compio
works well.
mobile-examples/android/run.bat
Outdated
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.
Just a suggestion: maybe better to use Makefile?
winio-ui-android/src/ui/label.rs
Outdated
// 通过JNI设置TextView的文本对齐方式 | ||
RUNTIME.with(|rt| { | ||
let view = self.tv.clone(); | ||
rt.vm_exec(|mut env, _act| { |
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.
Just comment: seems too painful to implement.
@@ -31,7 +31,10 @@ winio-ui-winui = { workspace = true, optional = true } | |||
[target.'cfg(target_os = "macos")'.dependencies] | |||
winio-ui-app-kit = { workspace = true } | |||
|
|||
[target.'cfg(not(any(windows, target_os = "macos")))'.dependencies] | |||
[target.'cfg(target_os="android")'.dependencies] | |||
winio-ui-android = { workspace = true, optional = true } |
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.
It doesn't have to be an optional dependency.
Okay, I need some time to study. |
Co-authored-by: Yuyi Wang <[email protected]>
Take it easy. You have done tremendous work. It's just some small problems (and a lot of Does the java vm have to be executed every time in each method? Could we just execute the vm in |
It can run in block_on. However, I found that when calling some Android APIs, they are very strict with thread checking (android_activity::AndroidApp creates a separate sub thread when the application starts, and android_main runs in this separate thread, requiring us to complete UI update operations in this sub thread). In our own block_on method, it seems that it is not this thread (for example, calling the WindowManager.addView method will fail): |
I understand about the thread checking. But anyway the future is running on the same thread as |
|
If it's not the correct thread, how do you call |
I should have investigated thoroughly, it's not a block_on issue. |
# Conflicts: # Cargo.toml # winio-elm/src/lib.rs # winio-handle/src/lib.rs
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.
Please remove the changes not relative to Android support.
@@ -20,7 +20,7 @@ members = [ | |||
resolver = "2" | |||
|
|||
[workspace.package] | |||
edition = "2021" | |||
edition = "2024" |
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.
Better not. It's not recommended to use edition = 2024 in libs, because it limits the supported rustc version.
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.
It's okay, edition2024 will be compatible with older versions of Rustc, and many of the new features it brings are very practical.
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.
Please explain with more details that why do you need edition 2024.
…e method definitions
…ove Edit text handling
# Conflicts: # winio-ui-win32/src/ui/edit.rs
…nctionality refactor(android): cleanup TODOs and implement missing Progress methods feat(examples): add widgets example for Android and update hello example fix(layout): fix macro syntax for expr patterns Signed-off-by: SmileSky <[email protected]>
…onality refactor(android): cleanup TODOs and implement missing methods for widgets feat(android): add event handling for ComboBox change and select events refactor(android): improve widget conversion and add Option<usize> support Signed-off-by: SmileSky <[email protected]>
…Edit widgets refactor(android): rename ComboBox event methods to past tense (on_change -> on_changed) feat(android): add Tooltip implementation with accessibility support fix(android): implement missing Progress and RadioButton widget methods feat(android): add text change events for Edit and TextBox widgets Signed-off-by: SmileSky <[email protected]>
…s, pens, paths, and images Signed-off-by: SmileSky <[email protected]>
This is an initial commit that only implements the Runtime on Android.