rdoeffinger / Dictionary

"QuickDic" offline Dictionary App for Android. Provided downloadable dictionaries are based on Wiktionaries but can also be created from other sources (see DictionaryPC). Remember to use --recursive when cloning! Fork of project that used to be hosted at code.google.com/p/quickdic-dictionary.
Apache License 2.0
322 stars 69 forks source link

Switching Dictionaries Doesn't Autosearch Current Search Term #120

Closed landry314 closed 4 years ago

landry314 commented 4 years ago

I use multiple translation dictionaries and straight English dictionaries too. Many times I enter a word and then I notice it is the wrong dictionary so I then switch dictionaries and the word remains in the search field but QuickDic does not use it to search. I have to delete the last character of the word then type it again to get the app to search the word.

It would make more sense when a dictionary is changed with an active search term that it then automatically searches that term.

To reproduce: 1) Enter a word and watch it automatically search that word 2) Switch dictionaries 3) Delete last letter of the search term 4) Put that letter back

Now it autosearches.

Autosearch should autosearch immediately after dictionary switch.

This should be easy to code. Just add one line to search after dictionary switch.

rdoeffinger commented 4 years ago

I cannot reproduce, and I am fairly sure I fixed that. Are you sure you use the latest version? 5.5.1 preferably? If yes, it might be an issue specific to certain versions of Android or certain devices. Please provide more detail in that case, but if I am not able to reproduce the issue that greatly reduces the chances of a fix.

landry314 commented 4 years ago

I am using QuickDic 5.5.1 and yes, it is the same issue for me, it has not been fixed.

I am using Lineage OS 16.0 (Android 9) on a Pixel 2 (walleye).

rdoeffinger commented 4 years ago

I have tested with Lineage OS 15.1 on LG G4 and Android 9 on a Sony XZ1 and the emulator images. I start the app, press the x next to the search to clear the previous one, enter "test", tap the flag on the top left, then tap some other flag in the popup list. It immediately jumps to test/testament whatever is closest in the new dictionary. Anything you do differently that would explain why you see the issue and I don't?

landry314 commented 4 years ago

The dictionaries I am using are English and English-French, English-Spanish, English-German, and many more. When I hit the flag for English or any of its pairs it fails to search. Instead it stays at the top of the dictionary like you had not entered anything.

It is very strange it doesn't work for me but does for you.

I am wondering if more people have the reaction you have or if more people have my issue.

Maybe uninstalling the app and reinstalling it from F-Droid would fix it...

landry314 commented 4 years ago

No, I just uninstalled QuickDic and reinstalled it from F-Droid and downloaded the dictionaries again and it has the same issue... it will not autosearch the current term after dictionary switch.

QuickDic 5.5.1 (ID 106)

This is quite strange...

Are there any google dependencies? I am using open gapps pico...

rdoeffinger commented 4 years ago

I tried with the F-Droid version to be sure, but it also is fine with that. No Google stuff is used by the app, so that should not be it. However I wonder if it might be related to the keyboard in use. I have "Android Keyboard (AOSP)" and SwiftKey in use currently. The other option if you are comfortable with it would be to capture a debug level logcat, which should show a whole lot of printouts related to the search that should be auto-triggered when switching languages. Which might help me find some code to review in more detail.

rdoeffinger commented 4 years ago

Funny, I did find a comment though: // Without this extra delay, the call to jumpToRow that this // invokes doesn't always actually have any effect. That extra delay is implemented via postDelayed, but the comment is on a different piece of code...

rdoeffinger commented 4 years ago

Ah, I could reproduce it now, by reducing a couple of random delays in the code.

rdoeffinger commented 4 years ago

I am not sure this issue is 100% fixable, it feels like a race condition deep in the ListView code, where if it has not entirely processed a setAdapter call it fails to set the position in the list. But I've seen some improvements with the change, so it would be good if the new build could be tested: Dictionary-issue120.zip

landry314 commented 4 years ago

So, I changed keyboards to AOSP and the search now works fine in 5.5.1.

I was using AnySoftKeyboard. I had no idea searching could be related to the keyboard.

I just tried the new prerelease version above with AnySoftKeyboard and it also works! So, it looks like you fixed the problem!

rdoeffinger commented 4 years ago

Fixed version is now in Google Play beta, F-Droid should follow after it got some testing here. Thus closing.