Skip to content
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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

wuwbobo2021
Copy link
Contributor

@wuwbobo2021 wuwbobo2021 commented Dec 24, 2024

Fixes #7182 and part of #7203.

Note: #4973 may be closed by checking this version of Android build tools: #6695.

@wuwbobo2021 wuwbobo2021 changed the title Fixed for older Android versions, fixed soft input prompting on startup, modified material style Fixed text input on Android, fixed for older Android versions, modified material style Dec 25, 2024
@wuwbobo2021
Copy link
Contributor Author

I've modified the build script of the android activity backend crate, #4920 can be closed. (I had been using the method provided in this issue)

Copy link
Member

@ogoffart ogoffart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the PR. I'll need to try it out.
This is great because I don't have much experience with older Android and you seem to know better than me.
Perhaps in order to make the review simpler and if it's not too much to ask, could you split the PR in 3 different PR:

  • The material changes
  • The Support for old android
  • The fix for the text input.

So that we can merge the changes independently and some may be easier than others.
Thanks!

// 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")));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope this also work on windows without the .exe

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I have tested it, it works on Windows 10 indeed.

@@ -29,13 +29,13 @@ export global Elevation {

export global MaterialPalette {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the change to the material style can be extracted into a different PR?


for (utf8_index, c) in in_str.char_indices() {
if utf16_counter >= utf16_index {
for (utf8_index, _) in in_str.char_indices() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could be implemented with in_str.char_indices().skip(char_index).0 or something like that.

But are you sure UTF-32 is the right encoding in Java? I was under the impression it was UTF-16

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I made a mistake. I recovered it according to your original code.

@wuwbobo2021
Copy link
Contributor Author

I have recovered the material style. Are my seperated commits clear enough?

@wuwbobo2021
Copy link
Contributor Author

wuwbobo2021 commented Dec 27, 2024

I have failed to fix the last bug described in #7203 which is related to Unicode index handling, and will not make further modifications in my branch (and posts in the issue), unless it is really required to do something.

I am not really good at Android application development. Support for old Android versions is done by asking Copilot (which had omitted a few things before I found them by myself), checking the documentation, modifying the Java code by myself, then trying to compile the Java helper with android-23 (commenting out imports and if branches for higher versions temporarily), running it on Android 6.0.

PS: I will not use the Copilot anymore.

@wuwbobo2021 wuwbobo2021 changed the title Fixed text input on Android, fixed for older Android versions, modified material style Fixed text input on Android, fixed for older Android versions Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants