-
Notifications
You must be signed in to change notification settings - Fork 627
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
Fixed text input on Android, fixed for older Android versions #7204
Changes from 5 commits
ba4b017
383bef9
e27d0ca
e12ecb5
a02aede
37ea1eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,16 +27,14 @@ fn main() { | |
let classpath = find_latest_version(android_home.join("platforms"), "android.jar") | ||
.expect("No Android platforms found"); | ||
|
||
// Try to locate javac | ||
let javac_path = match env_var("JAVA_HOME") { | ||
Ok(val) => { | ||
if cfg!(windows) { | ||
format!("{}\\bin\\javac.exe", val) | ||
} else { | ||
format!("{}/bin/javac", val) | ||
} | ||
} | ||
Err(_) => String::from("javac"), | ||
// Try to locate javac and java | ||
let javac_java = env_var("JAVA_HOME") | ||
.map(|home| PathBuf::from(home).join("bin")) | ||
.map(|bin| (bin.join("javac"), bin.join("java"))); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I hope this also work on windows without the .exe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I have tested it, it works on Windows 10 indeed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did another test under a non-ASCII path with a space and it works too. |
||
let (javac_path, java_path) = if let Ok(ref javac_java) = javac_java { | ||
(javac_java.0.to_str().unwrap(), javac_java.1.to_str().unwrap()) | ||
} else { | ||
("javac", "java") | ||
}; | ||
|
||
let handle_java_err = |err: std::io::Error| { | ||
|
@@ -87,11 +85,9 @@ fn main() { | |
} | ||
|
||
// Convert the .class file into a .dex file | ||
let d8_path = find_latest_version( | ||
android_home.join("build-tools"), | ||
if cfg!(windows) { "d8.bat" } else { "d8" }, | ||
) | ||
.expect("d8 tool not found"); | ||
let d8_path = find_latest_version(android_home.join("build-tools"), "lib") | ||
.map(|path| path.join("d8.jar")) | ||
.expect("d8 tool not found"); | ||
|
||
// collect all the *.class files | ||
let classes = fs::read_dir(&out_class) | ||
|
@@ -101,12 +97,18 @@ fn main() { | |
.map(|entry| entry.path()) | ||
.collect::<Vec<_>>(); | ||
|
||
let o = Command::new(&d8_path) | ||
let o = Command::new(&java_path) | ||
// class path of D8 itself | ||
.arg("-classpath") | ||
.arg(&d8_path) | ||
.arg("com.android.tools.r8.D8") | ||
// class path of D8's input | ||
.arg("--classpath") | ||
.arg(&out_class) | ||
.args(&classes) | ||
.arg("--output") | ||
.arg(out_dir.as_os_str()) | ||
// workaround for the DexClassLoader in Android 7.x | ||
.arg("--min-api") | ||
.arg("20") | ||
.output() | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Modifications in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Modifications in |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reduced leaked class object reference in Added There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The latest forced pushing https://github.com/slint-ui/slint/compare/c0de25edad9b7d524123d061230a848cdcce594c..a02aeded5cdbc24e4fccd219614b2bd4a7f285f8 removes 2 lines of outdated "safety" comments. |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some bug existing elsewhere in the Skia module may be fixed in the future to eliminate this check. |
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.
Is it only on some version of android?
Is it because there is a text field with the focus on startup?
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.
Oh sorry, I tested an application without any text box, without this modification, the virtual keyboard isn't shown on Android 11.0, but it's shown on Android 6.0 and 8.0. I haven't tested Android 9.0 and 10.0 yet.