klausw / hackerskeyboard

Hacker's Keyboard (official)
https://play.google.com/store/apps/details?id=org.pocketworkstation.pckeyboard
Apache License 2.0
1.87k stars 443 forks source link

Auto suggestions disappeared after upgrading to Android 13 #901

Open blochl opened 2 years ago

blochl commented 2 years ago

WARNING: This is a rather ancient project that was originally developed back in 2011 based on the Android 2.3 (Gingerbread) AOSP keyboard. While it still works as-is for many users, it would need some major rewrites to work with newer APIs, and some features such as language switching or popup keys don't work right on modern Android systems. I'm not currently planning on significant updates, and it's possible that it will stop working on modern devices or will no longer be updateable via the Google Play store due to minimum API level requirements. Play Store requires targeting API level 29 (Android 10), while the code was written for API level 9 (Android 2.3) from 2011.

I am aware it's an old project, but I absolutely love it, and didn't find a suitable alternative for years now.

Describe the bug After upgrading to Android 13, the word suggestions disappeared. I do have the dictionaries installed.

To Reproduce Start typing a message - no orange suggestions appear above the keyboard.

Expected behavior Once typing a message, word suggestions appear above the keyboard. Even before typing - suggestions for punctuation marks appear.

Screenshots no-suggestions

Smartphone (please complete the following information):

mansr commented 2 years ago

I've noticed the same thing on Pixel 5. The predictions seem to be generated since space/punctuation completes the word as expected.

AeSix commented 2 years ago

S22 Ultra, same issue. So, not just the pixel

MrSent commented 1 year ago

Same on the Galaxy Note20

acidstout commented 1 year ago

This happens on all devices running Android 13 afaik. It would be a shame if this kinda kills Hacker's Keyboard, because it's the world's best keyboard ever. Seriously, if anyone's able to fix it, please do so. I would try to fix it if I could. Unfortunately my knowledge of developing Android apps is pretty much non-existing. :(

Foo-Manroot commented 1 year ago

It looks like there was a change in Android 13 that affected all soft keyboards, not only this one.

According to https://issuetracker.google.com/issues/246132117 , this issue is assigned; so there should be an Android update at some point that will fix it (hopefully soon). I tried the workaround that they mention, setCandidatesViewShown(true);, but the issue persists. Maybe I did it wrong, idk, I'm not familiar with soft keyboard development, nor with this codebase...

There's also a recent StackOverflow question which might be related, it can be worth keeping an eye on it: https://stackoverflow.com/questions/75353455/from-android-12-onward-candidateview-or-suggestion-list-not-showing-up-in-custom

ecm-pushbx commented 1 year ago

I believe I fixed this. It isn't pretty but it seems to work fine for now. Patch is at https://github.com/klausw/hackerskeyboard/commit/c504b79f3783cbf1f6228014fdd0bad288ad0d2c

I also fixed an incompatibility between new ConnectBot versions and Hacker's Keyboard, refer to https://github.com/connectbot/connectbot/issues/1038 -- patch is at https://github.com/klausw/hackerskeyboard/commit/d5a4ef1bb59bf09a5c8e5f78c5f70fa454b4450a

ecm-pushbx commented 1 year ago

Added another fix to avoid the "double tap on Back needed for some applications" problem of my prior patch, this was mentioned in https://issuetracker.google.com/issues/246132117#comment18

https://github.com/ecm-pushbx/hackerskeyboard/commit/859b0d490603aa013e15dc53adfc1d7bf4a80234

ecm-pushbx commented 1 year ago

If someone wants to try without having to build from the sources, I uploaded debug APKs that work on my device, a Nothing Phone (1), to https://pushbx.org/ecm/test/20230325/

Foo-Manroot commented 1 year ago

Hi

Thank you very much for taking the time! I'm not quite sure what I did wrong, because setCandidatesViewShown() does indeed work correctly... Maybe I just added it to the wrong subclass, idk

In any case, I confirm this fixes the issue on LineageOS 20.0. Now I can see the suggestions again

ecm-pushbx commented 1 year ago

It's important to call super.setCandidatesViewShown. In my testing it appears you only need to call the super. prefixed function actually, and not the ones provided by our class. I'm just learning all of this so it is trial and error.

Also, there still are bugs around this, for example whenever I send a message in the blabber.im app the keyboard disappears and immediately re-appears.

ecm-pushbx commented 1 year ago

Updated with another bugfix to address the last problem I mentioned, https://github.com/ecm-pushbx/hackerskeyboard/commit/b12891bb5836d935320606280ece130e912a8f0d

ecm-pushbx commented 1 year ago

I wrote about my bugfixes on my blog: https://pushbx.org/ecm/dokuwiki/doku.php?id=blog:pushbx:2023:0326_more_ldebug_getinput_work_hacker_s_keyboard_app_modding (This also contains a description of what I had to do to make the app build.)

blochl commented 1 year ago

Any chance that it will be updated on Google Play?

ecm-pushbx commented 1 year ago

Any chance that it will be updated on Google Play?

Hi, just wanted to quickly reply. I think that the targeted Android platform version is too old for the Play store. I don't know how much work it would be to update that. I also don't know generally what is entailed in getting an app published there. This is the very first time I did any work on an Android app.

TPS commented 1 year ago

@ecm-pushbx Still, if you were to open a PR here for @klausw to review & approve, it would make it to F-droid, where HK's a mainstay.

Kl3nch commented 10 months ago

Just a note to flag up that I'm having the same issue on a Nokia X30 running Android 13, stock not rooted.

SelenaSaberWind commented 8 months ago

I wrote about my bugfixes on my blog: https://pushbx.org/ecm/dokuwiki/doku.php?id=blog:pushbx:2023:0326_more_ldebug_getinput_work_hacker_s_keyboard_app_modding (This also contains a description of what I had to do to make the app build.)

If you have a moment, would you be so kind as to tell me how to implement your fix please? I'm not a programmer/developer, so this is new territory for me. TYSM!

TPS commented 8 months ago

If someone wants to try without having to build from the sources, I uploaded debug APKs that work on my device, a Nothing Phone (1), to https://pushbx.org/ecm/test/20230325/

@SelenaSaberWind Did you try the build uploaded here?

nabijaczleweli commented 6 months ago

I can reproduce this (at least I think this is the same thing): on Lineage 16 (Android 9), I see the punctuation bar populated: and on Lineage 21 (Android 14), it's still there, but empty:

Installing @ecm-pushbx's fork (building android programs is insurmountable for me, so from https://pushbx.org/ecm/test/20230325/20230326.1.apk (thanks for linking the page in the blog post, sorry for scraping it for the newest version)) fixed it :)

nabijaczleweli commented 6 months ago

Or not; it actually works everywhere except for ConnectBot where clicking on the text to pop up the esc/ctrl/left/&c. controls hides the keyboard and it's sometimes difficult to pull up again.

nabijaczleweli commented 6 months ago

With minor issues (https://101010.pl/@nabijaczleweli/112320802836461846) I found the bug in @ecm-pushbx's fix (https://github.com/nabijaczleweli/hackerskeyboard/commit/d9a4041e463e5b9da9fd7b690d41fcc1c9435754), yielding 1041006.apk in https://lfs.nabijaczleweli.xyz/0019-org.pocketworkstation.pckeyboard (cf. bisect in INDEX and branches/tags on https://github.com/nabijaczleweli/hackerskeyboard).

TPS commented 6 months ago

@nabijaczleweli: https://github.com/SeventhM/hackerskeyboard seems to be the most active current fork. Maybe PR there so @SeventhM might review?

SeventhM commented 6 months ago

Note: after some testing around, ecm-pushbx's fix only kinda works on my fork. I managed to break viewing candidates. Probably something to do with how I updated to AndroidX though I need to do a bit more follow ups. I also realized that particularly fix causes issues in some apps (notably chromium based browsers) where the keyboard gets shown, but hidden, requiring a use of the back button to dismiss it despite the keyboard not being entirely on the screen. I think I know what the relevant issue is here, but again, I need to do some follow up checks to understand what I broke about the candidates

SeventhM commented 6 months ago

For anyone wanting to follow along with figuring out what I might've broke by accident: https://github.com/SeventhM/hackerskeyboard/issues/4

This would be a lot easier if I had a dictionary that worked. I know HK is supposed to work with AnySoft dictionaries, but they no longer release those as a separate app. I think(?) almost the whole app can be found here, so that might be an avenue to check. But I suspect that'll be a dead end. Plus it would likely be a better idea to implement the dictionary within the app as a default (while simply allowing external dictionaries as well) so we don't have this issue in the future

nabijaczleweli commented 6 months ago

Somehow I don't think this is at all related to dictionaries, given that I'm (was) affected by this and don't use a dictionary.

AeSix commented 6 months ago

I'm pretty sure even though you don't use dictionaries for spell checking, that a dict is used for the suggested words. Since that's an integral part of the top bar, if that's not working properly - that bar may misbehave.

nabijaczleweli commented 6 months ago

It can't really be an integral part of the top bar if i haven't seen a word suggestion in the last five years and the bar works perfectly and as-expected. Probably.

SeventhM commented 6 months ago

Turns out dictionaries wasn't entirely relevant, but getting them working is still helpful for me