Skip to content

Conversation

@eranl
Copy link
Contributor

@eranl eranl commented Jul 6, 2025

Added a search key to the emoji bottom row. When pressed, if an emoji dictionary for the current language is found, the emoji search activity is launched; otherwise, the settings screen is opened. This is a placeholder for taking the user to the dictionary settings screen, for them to add a dictionary. Should we hide the search button if there's no dictionary instead?
The emoji search activity is displayed in a gap created for it above the keyboard and below the host app using privateImeOptions, and partly obscures the host app. The suggestion/toolbar strip is hidden in this mode.
If the user presses an emoji, the search is finished, in order to insert that emoji into the host app's edit box.
If the user presses the done action button and autocorrect is on, the first suggested emoji is inserted the same way.
As a follow-up, we can change the action button to search, which when pressed, will close the activity, and open a special emoji keyboard containing the search results, which will allow the user to insert multiple emojis.
If the user switches to emoji view or clipboard view during search, the search is aborted. Should we hide these buttons instead?
If the user switches to an unsupported language during search, the search is aborted.
When the activity is stopped, it passes its results to LatinIME.
Fixed emoji descriptions on the emoji keyboard in the case of a Default emoji skin tone setting.

Styling of the title bar and edit box is not done, and I'm not sure how to do it. Heliboard's color system seems to be incompatible with Compose.
Moved the emoji row count -> max key count calculation into DynamicGridKeyboard. As a side effect, also changed config_emoji_keyboard_max_recents_key_count to config_emoji_keyboard_max_recents_row_count. Wasn't sure what values to use there though. If this part is not desired, I'll revert.
Had to use a Compose beta version, in order to get this fix.
Copied SingleDictionaryFacilitator & SuggestionResults changes from #1660.
Displaying the right emojis in the case of a Default emoji skin tone setting should probably be applied to #1660 and to normal emoji suggestions as well.
I used CloseIcon & SearchIcon from the settings package. Should generic compose code like Icons.kt be moved?

Fixes #259.

@maruuk
Copy link

maruuk commented Jul 9, 2025

Thank you very much for this feature! If I may, I'd like to suggest a few changes.

  1. The search shouldn't close after selecting an emoji. The user may want to select more emojis or the same one multiple times.
  2. After closing, the search should reset. It could display the emojis selected via search, rather than the last search result.
  3. It would be ideal if a suggestion bar was displayed just like in Gboard.
  4. Animations should be smoother. Keyboard reloading (which sometimes happens) should be eliminated.

@eranl
Copy link
Contributor Author

eranl commented Jul 9, 2025

Added some colors.

@eranl
Copy link
Contributor Author

eranl commented Jul 9, 2025

@maruuk, thanks for your feedback!

  1. The search shouldn't close after selecting an emoji. The user may want to select more emojis or the same one multiple times.

I agree that this is a limitation of this implementation, but I couldn't find a good way around it, given that we have to close the activity in order to insert the emoji into the host app. This is why I suggested a follow-up improvement. Other ideas I considered and dropped:

  • automatically reopening the search activity after entering an emoji - this seems too confusing
  • adding another view for showing the selected emojis during search - seems like overkill
  1. After closing, the search should reset. It could display the emojis selected via search, rather than the last search result.

This is a workaround for the above limitation. I wanted to make it as easy as possible to insert multiple emojis of the same search without retyping it.

  1. It would be ideal if a suggestion bar was displayed just like in Gboard.

What do you mean by suggestion bar?

  1. Animations should be smoother. Keyboard reloading (which sometimes happens) should be eliminated.

This is another consequence of the fact that I used an activity for the search.

@eranl eranl marked this pull request as ready for review July 9, 2025 22:46
@balintbarna
Copy link

Excited for this feature, thank you for your work! Do you have a screenshot of how it looks?

@maruuk
Copy link

maruuk commented Jul 16, 2025

@eranl I see. I hope you can figure this out with Helium's help. The ability to select multiple emojis is important to me, and certainly not only me. It would be best if we could quickly select emojis from search like in Gboard and FUTO.

What do you mean by suggestion bar?

The toolbar/word suggestion bar you mentioned is invisible in searches. I think it should be available, as it makes entering emoji names easier.

@balintbarna I have it. Out of curiosity I checked what it looks like.
Screenshot_20250716-122153_HeliBoard debug_1

As you can see, the search bar color doesn't quite match the accent color. In my opinion, the entire search appearance should match the keyboard background color, in my case gray. It would be nicer, and the search text would be more visible.

It works quite well, but it needs tweaking. The whole thing should definitely be smoother. Sometimes the search opens but then closes.

The dictionaries also need to be adjusted, as they're currently suggesting strange emojis, but Helium said he could look into that.

@eranl
Copy link
Contributor Author

eranl commented Jul 17, 2025

The ability to select multiple emojis is important to me, and certainly not only me. It would be best if we could quickly select emojis from search like in Gboard and FUTO.

Totally agreed.
Some technical background: putting a search box inside the keyboard has potential issues that we're concerned about. Even Gboard seems to have such issues. So the activity approach seems safer. And the follow-up improvement I proposed may fill the gap.

The toolbar/word suggestion bar you mentioned is invisible in searches. I think it should be available, as it makes entering emoji names easier.

I think that might be confusing, and not that helpful, as search input would likely be short. But I don't have a strong opinion here.

As you can see, the search bar color doesn't quite match the accent color. In my opinion, the entire search appearance should match the keyboard background color, in my case gray. It would be nicer, and the "search" text would be more visible.

I don't have an opinion about which colors to use. I chose the functional key colors just to make the search box noticeable, but I'm happy to change to anything else. Was your screenshot taken with latest code? For some reason it looks different from the functional keys.

Sometimes the search opens but then closes.

I would love to get more details, so I can fix it. I did encounter such bugs, and fixed them. Did you try the latest code?

The dictionaries also need to be adjusted, as they're currently suggesting strange emojis, but Helium said he could look into that.

Are you using a new dictionary? Again, I would love to hear about specific issues, so I can fix them. We've iterated quite a bit on these dictionaries, but issues are certainly possible.

@balintbarna
Copy link

Thank you again for your work. I just tried gboard for comparison and it seems like it does everything quite well: search doesn't disappear, can insert multiple emojis, word suggestions are visible. And many other nice features. The design also fits together quite well.

@maruuk
Copy link

maruuk commented Jul 17, 2025

As a follow-up, we can change the action button to search, which when pressed, will close the activity, and open a special emoji keyboard containing the search results, which will allow the user to insert multiple emojis.

You mean this workaround?

I think that might be confusing, and not that helpful, as search input would likely be short. But I don't have a strong opinion here.

In my opinion, it might be useful. Today, while testing, I typed "keyvoard" instead of "keyboard" and didn't get the correct emoji. The suggestion bar will let me choose the correct word, which will improve emoji suggestions. I remember this bar in Gboard speeding up typing emoji names.

Was your screenshot taken with latest code? For some reason it looks different from the functional keys.

Yes. I checked again more carefully, and it seems that this color doesn't adapt only to the "dynamic colors" theme. It adapts to built-in and custom themes and looks really nice.

I would love to get more details, so I can fix it. I did encounter such bugs, and fixed them. Did you try the latest code?

Yes. I only noticed this in a browser, e.g. Brave search or Google Translate. Sometimes it works, but after a few tries. In general, I have noticed that searching is most problematic in browser input fields, e.g. it opens slowly.

In the other apps, it doesn't close, but I noticed that sometimes it works faster and displays the search and keyboard at once, and other times you have to wait for one or the other. I know it's just a moment, but it would be visually nicer if the search and keyboard were displayed at the same time.

Are you using a new dictionary?

Ah, I was using the old one, I didn't know there was a new one. I checked and it's better, but it still suggests unrelated emojis, e.g. for "whale" it displays 🇵🇭🇹🇭🙀.

@eranl
Copy link
Contributor Author

eranl commented Jul 17, 2025

You mean this workaround?

It's not a workaround. It's a feature Gboard has too. I just think that adding it could alleviate the single-emoji issue.

Yes. I only noticed this in a browser, e.g. Brave search or Google Translate. Sometimes it works, but after a few tries. In general, I have noticed that searching is most problematic in browser input fields, e.g. it opens slowly.

Which browser do you use? I can't reproduce with FF or Chrome.

In the other apps, it doesn't close, but I noticed that sometimes it works faster and displays the search and keyboard at once, and other times you have to wait for one or the other.

You mean in all apps? What's your device/OS?

it still suggests unrelated emojis, e.g. for "whale" it displays 🇵🇭🇹🇭🙀.

The word whale has only two emojis linked to it, but the dictionary library is very "creative" in how it comes up with additional matches. Maybe we should set a score threshold.

@eranl
Copy link
Contributor Author

eranl commented Jul 18, 2025

Now the search activity sets hintLocales based on locales with emoji dictionaries, and emoji search is enabled regardless of the user's current locale, as long as they have any emoji dictionary.

@maruuk
Copy link

maruuk commented Jul 20, 2025

It's not a workaround. It's a feature Gboard has too. I just think that adding it could alleviate the single-emoji issue.

Got it. This will definitely be helpful, but users will probably ask why they can't select more emojis directly from search.

Which browser do you use?

Kiwi Browser, but I'll also check in IronFox.

What's your device/OS?

Motorola One Vision and Android 15 (LineageOS 22.2).

You mean in all apps?

I think so. Maybe it's because I'm using the debug version. It runs much slower than the release version.

The word whale has only two emojis linked to it, but the dictionary library is very "creative" in how it comes up with additional matches. Maybe we should set a score threshold.

In my opinion, only emojis whose name matches the search word should be displayed, like in Gboard. FUTO also suggests strange, unrelated emojis.

@eranl
Copy link
Contributor Author

eranl commented Jul 20, 2025

I think so. Maybe it's because I'm using the debug version. It runs much slower than the release version.

I also use the debug version, and haven't seen this.

In my opinion, only emojis whose name matches the search word should be displayed, like in Gboard.

The nice aspects of it are that it suggests emojis even when you partially type or mistype a word. BTW, have you tried searching with multiple words?

@maruuk
Copy link

maruuk commented Jul 20, 2025

I also use the debug version, and haven't seen this.

Hmm, I don't know what's wrong. If I close and reopen the search a few times, the animation sometimes speeds up.

BTW, have you tried searching with multiple words?

I checked and the suggested emojis are usually for the second word.

@eranl
Copy link
Contributor Author

eranl commented Jul 20, 2025

I checked and the suggested emojis are usually for the second word.

The order doesn't matter. It uses the average score against all words.

@Helium314
Copy link
Owner

@eranl after way too long wait (and finally merging / very soon releasing 1660) I'll go over this. Catching up on the discussion and reading / testing may take a while, hope to be done with a first round this weekend.

@Helium314
Copy link
Owner

Do you have anything against this change?

No, but I'll wait for @Helium314's opinion on this.

I would like to keep it consistent with other UI, but at the same time I'm not opposed. I'm one for functional styling, not for beautiful, so I'm probably the wrong person to ask.

Anyway, how can I actually test it? When using the search button in all the apps I tested the screen flashes dark, then the keyboard goes away.

Log, filtered for emoji:

17:05:36.637 KeyboardState            D  setEmojiKeyboard
17:05:37.392 emoji-search             D  before activity launch
17:05:37.444 emoji-search             D  init start
17:05:37.445 emoji-search             D  screenHeight: 1280
17:05:37.495 emoji-search             D  init end
17:05:37.731 emoji-search             D  imeVisible: false, firstSearchDone: false, imeOpened: false, bottom: 1280, keyboardState: OTHER
17:05:37.840 emoji-search             D  imeVisible: false, firstSearchDone: false, imeOpened: false, bottom: 1280, keyboardState: OTHER
17:05:37.920 emoji-search             D  onEnterAnimationComplete
17:05:37.939 emoji-search             D  initial search done
17:05:38.250 BufferQueueProducer      E  [helium314.keyboard.debug/helium314.keyboard.keyboard.emoji.EmojiSearchActivity#0] disconnect: not connected (req=1)

Finally to the initial questions (I guess some of them might not be relevant any more)

Should we hide the search button if there's no dictionary instead?

Yes, I think that makes sense

I used CloseIcon & SearchIcon from the settings package. Should generic compose code like Icons.kt be moved?

It's not absolutely necessary, but it makes sense.

Heliboard's color system seems to be incompatible with Compose.

I think you long found the solution, but at the same time it should be possible to add some compose-specific functionality.

If the user switches to emoji view or clipboard view during search, the search is aborted. Should we hide these buttons instead?

I'm not sure I understand, possibly because I didn't yet test it. But isn't it good the user can abort the search?

changed config_emoji_keyboard_max_recents_key_count to config_emoji_keyboard_max_recents_row_count. Wasn't sure what values to use there though. If this part is not desired, I'll revert.

Hmm, so the actual number of recent emojis might depend on device orientation now, because rows have different length in landscape and portait. That might be unexpected.

# Conflicts:
#	app/src/main/java/helium314/keyboard/latin/LatinIME.java
@eranl
Copy link
Contributor Author

eranl commented Nov 23, 2025

Anyway, how can I actually test it? When using the search button in all the apps I tested the screen flashes dark, then the keyboard goes away.

Log, filtered for emoji:

Nothing useful here unfortunately. Can you please provide more of the log?

@Helium314
Copy link
Owner

Not sure what is different now, but it's working a little bit: when I press the search button the screen gets darker, the keyboard flashes and doesn't show the strip_container any more.
When pressing the action key I'm back without any emoji.
When entering something initially it works, then things get weird. Looks like emoji search is remembering what I had previously typed.

full log
12:07:38.868 Layer                    E  [Surface(name=AppWindowToken{c3f8eff token=Token{216261e ActivityRecord{3e03a59 u0 helium314.keyboard.debug/helium314.keyboard.settings.SettingsActivity t1276}}})/@0xf09b082 - animation-leash#0] No local sync point found
12:07:40.972 SubtypeSettings          W  selected subtype SettingsSubtype(locale=, extraValues=) /  not found
12:07:41.089 startup                  I  Starting helium314.keyboard.debug version 3.6-beta2 (3601) on Android 10 (SDK 29)
12:07:41.154 InputAttributes          I  InputType.TYPE_NULL is specified
12:07:41.154 Settings                 I  loadSettings
12:07:41.164 SubtypeSettings          W  selected subtype SettingsSubtype(locale=, extraValues=) /  not found
12:07:41.181 .keyboard.debug          W  type=1400 audit(0.0:98128): avc: granted { execute } for path="/data/data/helium314.keyboard.debug/files/libjni_latinime.so" dev="mmcblk0p24" ino=262583 scontext=u:r:untrusted_app:s0:c209,c256,c512,c768 tcontext=u:object_r:app_data_file:s0:c209,c256,c512,c768 tclass=file app=helium314.keyboard.debug
12:07:41.608 LatinIME                 I  Hardware accelerated drawing: true
12:07:41.705 .keyboard.debu           W  Accessing hidden method Landroid/view/accessibility/AccessibilityEvent;-><init>()V (greylist-max-o, linking, denied)
12:07:41.730 InputAttributes          W  No editor info for this field. Bug?
12:07:41.731 Settings                 I  loadSettings
12:07:41.738 SubtypeSettings          W  selected subtype SettingsSubtype(locale=, extraValues=) /  not found
12:07:41.743 Dictionary...itatorImpl  I  resetDictionaries, force reloading main dictionary: false
12:07:41.745 SubtypeSettings          W  selected subtype SettingsSubtype(locale=, extraValues=) /  not found
12:07:41.756 LatinIME:LogUtils        I  Dictionary info: dictionary = userunigram.en-GB ; version = 1763836853 ; date = 1763836853
12:07:41.756 LatinIME:LogUtils        I  Dictionary info: dictionary = UserHistoryDictionary.en-GB ; version = 1763894749 ; date = 1763895930
12:07:41.795 LatinIME:LogUtils        I  Dictionary info: dictionary = emoji:en ; version = 18 ; date = 1752390012
12:07:41.797 LatinIME:LogUtils        I  Dictionary info: dictionary = emoji:en ; version = 18 ; date = 1752390012
12:07:41.798 LatinIME:LogUtils        I  Dictionary info: dictionary = main:en_gb ; version = 54 ; date = 1414726258
12:07:41.799 LatinIME:LogUtils        I  Dictionary info: dictionary = main:en_gb ; version = 54 ; date = 1414726258
12:07:41.846 Choreographer            I  Skipped 63 frames!  The application may be doing too much work on its main thread.
12:07:42.588 .keyboard.debu           W  Accessing hidden method Landroid/view/View;->getViewRootImpl()Landroid/view/ViewRootImpl; (greylist, reflection, allowed)
12:07:42.588 .keyboard.debu           W  Accessing hidden field Landroid/view/View$AttachInfo;->mVisibleInsets:Landroid/graphics/Rect; (greylist, reflection, allowed)
12:07:42.588 .keyboard.debu           W  Accessing hidden field Landroid/view/ViewRootImpl;->mAttachInfo:Landroid/view/View$AttachInfo; (greylist, reflection, allowed)
12:07:42.590 .keyboard.debu           W  Accessing hidden method Landroid/os/SystemProperties;->addChangeCallback(Ljava/lang/Runnable;)V (greylist, reflection, allowed)
12:07:44.199 Gralloc3                 W  mapper 3.x is not supported
12:07:44.214 OpenGLRenderer           I  Davey! duration=3442ms; Flags=1, IntendedVsync=147602249198201, Vsync=147603316994777, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=147603324164040, AnimationStart=147603324241155, PerformTraversalsStart=147603324613001, DrawStart=147605568080384, SyncQueued=147605675913961, SyncStart=147605676206884, IssueDrawCommandsStart=147605676423115, SwapBuffers=147605690752384, FrameCompleted=147605691796654, DequeueBufferDuration=61000, QueueBufferDuration=403000, 
12:07:44.218 LatinIME                 I  ringer mode changed, zen_mode on: false
12:07:44.262 Choreographer            I  Skipped 133 frames!  The application may be doing too much work on its main thread.
12:07:44.273 LatinIME                 D  onInitializeInterface
12:07:44.322 Settings                 I  loadSettings
12:07:44.324 SubtypeSettings          W  selected subtype SettingsSubtype(locale=, extraValues=) /  not found
12:07:44.346 LatinIME                 I  onFinishInput
12:07:45.564 Autofill Status          D  Autofill popup isn't shown because autofill is not available.
                                         
                                         Did you set up autofill?
                                         1. Go to Settings > System > Languages&input > Advanced > Autofill Service
                                         2. Pick a service
                                         
                                         Did you add an account?
                                         1. Go to Settings > System > Languages&input > Advanced
                                         2. Click on the settings icon next to the Autofill Service
                                         3. Add your account
12:07:45.614 .keyboard.debu           I  Background concurrent copying GC freed 41044(4168KB) AllocSpace objects, 7(132KB) LOS objects, 49% free, 4867KB/9735KB, paused 85us total 119.164ms
12:07:45.829 LatinIME                 I  onFinishInput
12:07:46.170 BogusMoveEventDetector   D  needsProximateBogusDownMoveUpEventHack=false smallestScreenWidthDp=399 densityDpi=288 screenMetrics=0
12:07:46.327 chatty                   I  uid=10209(helium314.keyboard.debug) identical 1 line
12:07:46.395 BogusMoveEventDetector   D  needsProximateBogusDownMoveUpEventHack=false smallestScreenWidthDp=399 densityDpi=288 screenMetrics=0
12:07:46.444 SubtypeSettings          W  selected subtype SettingsSubtype(locale=, extraValues=) /  not found
12:07:46.473 LatinIME                 I  Starting input. Cursor position = 0,0
12:07:46.480 LatinIME                 D  editorInfo: inputType: 0x00008001, imeOptions: 0x02000003
12:07:46.480 LatinIME                 D  All caps: false, sentence caps: false, word caps: false
12:07:46.481 Settings                 I  loadSettings
12:07:46.489 SubtypeSettings          W  selected subtype SettingsSubtype(locale=, extraValues=) /  not found
12:07:46.494 LatinIME:LogUtils        I  Dictionary info: dictionary = emoji:en ; version = 18 ; date = 1752390012
12:07:46.495 LatinIME:LogUtils        I  Dictionary info: dictionary = emoji:en ; version = 18 ; date = 1752390012
12:07:46.505 KeyboardState            D  setAlphabetKeyboard: [keyboard=UNSHIFTED shift=RELEASING symbol=RELEASING switch=ALPHA] autoCapsFlags=none recapitalizeMode=undefined
12:07:46.710 KeyboardParser           D  adding key q, 0
...
12:07:46.839 Choreographer            I  Skipped 58 frames!  The application may be doing too much work on its main thread.
12:07:46.888 mali_winsys              D  EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000,  [720x1237]-format:1
12:07:46.899 View                     W  requestLayout() improperly called by android.widget.LinearLayout{f40c39f V.E...... ......ID 0,721-720,1237 #7f0a0099 app:id/main_keyboard_frame} during layout: running second layout pass
12:07:46.968 OpenGLRenderer           I  Davey! duration=1121ms; Flags=1, IntendedVsync=147607324070695, Vsync=147608307121511, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=147608316661575, AnimationStart=147608316744344, PerformTraversalsStart=147608323043498, DrawStart=147608385162613, SyncQueued=147608418170536, SyncStart=147608418501767, IssueDrawCommandsStart=147608420905921, SwapBuffers=147608444570228, FrameCompleted=147608445611921, DequeueBufferDuration=167000, QueueBufferDuration=306000, 
12:07:46.975 OpenGLRenderer           I  Davey! duration=1128ms; Flags=1, IntendedVsync=147607324070695, Vsync=147608307121511, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=147608316661575, AnimationStart=147608316744344, PerformTraversalsStart=147608323043498, DrawStart=147608446596459, SyncQueued=147608449364344, SyncStart=147608449748690, IssueDrawCommandsStart=147608449959344, SwapBuffers=147608452531767, FrameCompleted=147608453291882, DequeueBufferDuration=209000, QueueBufferDuration=246000, 
12:07:47.777 KeyboardState            D  setEmojiKeyboard
12:07:47.916 KeyboardParser           D  adding key alpha, 0
12:07:47.917 KeyboardParser           D  adding key search, 0
12:07:47.918 KeyboardParser           D  adding key space, 0
12:07:47.918 KeyboardParser           D  adding key delete, 0
12:07:47.919 Keyboard.Builder         D  setting size and position for ABC, -201: x 0, w 108
12:07:47.920 Keyboard.Builder         D  setting size and position for search_key, -10050: x 108, w 108
12:07:47.920 Keyboard.Builder         D  setting size and position for space_key, 32: x 216, w 395
12:07:47.920 Keyboard.Builder         D  setting size and position for delete_key, -7: x 612, w 108
12:07:47.923 LatinIME:LogUtils        I  Dictionary info: dictionary = emoji:en ; version = 18 ; date = 1752390012
12:07:47.924 LatinIME:LogUtils        I  Dictionary info: dictionary = emoji:en ; version = 18 ; date = 1752390012
12:07:47.931 ProfileInstaller         D  Installing profile for helium314.keyboard.debug
12:07:48.769 emoji-search             D  before activity launch
12:07:48.802 ActivityThread           W  handleWindowVisibility: no activity for token android.os.BinderProxy@6f9e9e3
12:07:48.818 emoji-search             D  init start
12:07:48.820 emoji-search             D  screenHeight: 1280
12:07:48.974 emoji-search             D  init end
12:07:49.295 mali_winsys              D  EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000,  [720x1280]-format:1
12:07:49.326 emoji-search             D  imeVisible: false, firstSearchDone: false, imeOpened: false, bottom: 1280, keyboardState: OTHER
12:07:49.389 Autofill Status          D  Autofill popup isn't shown because autofill is not available.
                                         
                                         Did you set up autofill?
                                         1. Go to Settings > System > Languages&input > Advanced > Autofill Service
                                         2. Pick a service
                                         
                                         Did you add an account?
                                         1. Go to Settings > System > Languages&input > Advanced
                                         2. Click on the settings icon next to the Autofill Service
                                         3. Add your account
12:07:49.464 emoji-search             D  imeVisible: false, firstSearchDone: false, imeOpened: false, bottom: 1280, keyboardState: OTHER
12:07:49.490 emoji-search             D  onEnterAnimationComplete
12:07:49.492 LatinIME:LogUtils        I  Dictionary info: dictionary = emoji:en ; version = 18 ; date = 1752390012
12:07:49.493 LatinIME:LogUtils        I  Dictionary info: dictionary = emoji:en ; version = 18 ; date = 1752390012
12:07:49.495 emoji-search             D  initial search done
12:07:49.580 LatinIME                 I  onFinishInputView
12:07:49.582 LatinIME                 I  onFinishInput
12:07:49.584 SubtypeSettings          W  selected subtype SettingsSubtype(locale=, extraValues=) /  not found
12:07:49.609 LatinIME                 I  Starting input. Cursor position = -1,-1
12:07:49.610 LatinIME                 D  editorInfo: inputType: 0x00000000, imeOptions: 0x00000000
12:07:49.610 LatinIME                 D  All caps: false, sentence caps: false, word caps: false
12:07:49.611 InputAttributes          I  InputType.TYPE_NULL is specified
12:07:49.611 Settings                 I  loadSettings
12:07:49.618 SubtypeSettings          W  selected subtype SettingsSubtype(locale=, extraValues=) /  not found
12:07:49.625 KeyboardState            D  setAlphabetKeyboard: [keyboard=SYMBOLS shift=RELEASING symbol=RELEASING switch=ALPHA] autoCapsFlags=none recapitalizeMode=undefined
12:07:49.630 KeyboardParser           D  adding key q, 0
...
12:07:49.730 SubtypeSettings          W  selected subtype SettingsSubtype(locale=, extraValues=) /  not found
12:07:49.755 LatinIME                 I  Restarting input. Cursor position = 0,0
12:07:49.755 LatinIME                 D  editorInfo: inputType: 0x00008001, imeOptions: 0x02000006
12:07:49.756 LatinIME                 D  All caps: false, sentence caps: false, word caps: false
12:07:49.757 Settings                 I  loadSettings
12:07:49.758 SubtypeSettings          W  selected subtype SettingsSubtype(locale=, extraValues=) /  not found
12:07:49.766 KeyboardState            D  setAlphabetKeyboard: [keyboard=UNSHIFTED shift=RELEASING symbol=RELEASING switch=ALPHA] autoCapsFlags=none recapitalizeMode=undefined
12:07:49.780 KeyboardParser           D  adding key q, 0
...
12:07:50.045 RichInputConnection      D  setting composing text of length 1
12:07:50.048 LatinIME                 I  onUpdateSelection: oss=0, ose=0, nss=1, nse=1, cs=0, ce=1
12:07:50.196 InputLogic               D  performUpdateSuggestionStripSync()
12:07:50.231 InputLogic               D  performUpdateSuggestionStripSync() : 35 ms to finish
12:07:51.151 BufferQueueProducer      E  [helium314.keyboard.debug/helium314.keyboard.keyboard.emoji.EmojiSearchActivity#0] disconnect: not connected (req=1)
12:07:51.152 libEGL                   W  EGLNativeWindowType 0x714bdaa450 disconnect failed
12:07:51.222 LatinIME                 I  onFinishInputView
12:07:51.223 LatinIME                 I  onFinishInput
12:07:51.225 SubtypeSettings          W  selected subtype SettingsSubtype(locale=, extraValues=) /  not found
12:07:51.251 LatinIME                 I  Starting input. Cursor position = 0,0
12:07:51.252 LatinIME                 D  editorInfo: inputType: 0x00008001, imeOptions: 0x02000003
12:07:51.252 LatinIME                 D  All caps: false, sentence caps: false, word caps: false
12:07:51.253 Settings                 I  loadSettings
12:07:51.255 SubtypeSettings          W  selected subtype SettingsSubtype(locale=, extraValues=) /  not found
12:07:51.259 LatinIME:LogUtils        I  Dictionary info: dictionary = emoji:en ; version = 18 ; date = 1752390012
12:07:51.260 LatinIME:LogUtils        I  Dictionary info: dictionary = emoji:en ; version = 18 ; date = 1752390012
12:07:51.265 KeyboardState            D  setAlphabetKeyboard: [keyboard=UNSHIFTED shift=RELEASING symbol=RELEASING switch=ALPHA] autoCapsFlags=none recapitalizeMode=undefined
12:07:51.295 RichInputConnection      D  committing 3 characters
12:07:51.296 LatinIME                 I  onUpdateSelection: oss=0, ose=0, nss=3, nse=3, cs=-1, ce=-1
12:07:51.552 InputLogic               D  performUpdateSuggestionStripSync()
12:07:51.562 InputLogic               D  performUpdateSuggestionStripSync() : 10 ms to finish

If the user switches to emoji view or clipboard view during search, the search is aborted

To me it looks like the search is still active, and you can even start nested emoji searches (making the screen darker).

@Helium314
Copy link
Owner

Ah, now I see: when dismissing the keyboard during emoji seach, the search is shown at the bottom of the screen. Seems it's stuck at this position even if the keyboard is showing.

@Helium314
Copy link
Owner

Not sure what is different now, but it's working a little bit

The difference seems to be whether you have an emoji dictionary in the current locale. When the subtype auto-switches the search seems to be canceled. I can see the switched keyboard for a very short time.

@eranl
Copy link
Contributor Author

eranl commented Nov 24, 2025

What's your device's API level? I was able to reproduce what you describe on an API 24 virtual device. Apparently, this implementation works on API 30+ only, since it relies on an implementation detail of enableEdgeToEdge that only exists there (window.setDecorFitsSystemWindows). None of the workarounds I've tried so far work. The tricky requirement is that we want the activity to overlap with the IME, but still be partially panned by it.

@Helium314
Copy link
Owner

One device API 29, one API 28. So you probably found the reason.

@Helium314
Copy link
Owner

Adding extra bottom padding to the main Column moves the search UI to be visible, though heightDp is not enough. It also doesn't increase when I enable the navigation bar.
Maybe we can find some bottom padding value that works for old devices, but set it to 0 on API 30+

@eranl
Copy link
Contributor Author

eranl commented Nov 24, 2025

In the end, the fix was pretty simple...

@eranl
Copy link
Contributor Author

eranl commented Nov 25, 2025

Hmm, so the actual number of recent emojis might depend on device orientation now, because rows have different length in landscape and portait. That might be unexpected.

The thing is different configurations have different values, and they each seem to try to achieve a certain number of rows anyway.

@Helium314
Copy link
Owner

The thing is different configurations have different values

But the count only changes with sw, not with orientation. I guess changing smallest width is a rather rare thing. Though maybe not as rare as it was due to foldable phones.

Maybe we should rather have a fixed count instead.

@Helium314
Copy link
Owner

Looks like it works now, though not in landscape mode.
The flashing on start is not nice. It gets much better when using proguard, but doesn't go away completely. Do you see it too, or is the performance difference between our devices too big?

@eranl
Copy link
Contributor Author

eranl commented Nov 26, 2025

Maybe we should rather have a fixed count instead.

You mean of emojis, right?

Looks like it works now, though not in landscape mode.

Fixed. Turns out the required API29- fix was even smaller than I thought.

The flashing on start is not nice. It gets much better when using proguard, but doesn't go away completely. Do you see it too, or is the performance difference between our devices too big?

I see the keyboard closing and reopening quickly. Is that what you mean?

On the virtual devices, I also see the transparent/blank gap appearing first, and then the activity being shown in it.

Haven't found a solution to either yet.

@Helium314
Copy link
Owner

You mean of emojis, right?

Yes. Because the old (implicit) assumption of display having fixed smallest width doesn't hold any more. What do you intend with the change to rows?

I see the keyboard closing and reopening quickly. Is that what you mean?

Yes, you can see the area hidden by the keyboard for a short time.

@Helium314
Copy link
Owner

Even when keeping the keyboard always open (i.e. do nothin on hideWindow) and an empty activity the keyboard disappears for a short time (not 100% always, but usually). I couldn't even find when the flashing happens, other that it's after onResume.

…_keyboard_max_recents_row_count` change, adding two factory methods to `DynamicGridKeyboard`
@eranl
Copy link
Contributor Author

eranl commented Nov 26, 2025

But the count only changes with sw, not with orientation.

Got it. Reverted.

@eranl
Copy link
Contributor Author

eranl commented Nov 26, 2025

Should we hide the search button if there's no dictionary instead?

Yes, I think that makes sense

Done by disabling it. Is there a better way?

I used CloseIcon & SearchIcon from the settings package. Should generic compose code like Icons.kt be moved?

It's not absolutely necessary, but it makes sense.

I prefer doing this in a separate quick PR later, to avoid merge conflicts, as it touches many files.

Heliboard's color system seems to be incompatible with Compose.

I think you long found the solution, but at the same time it should be possible to add some compose-specific functionality.

I think it would make sense to do that if and when there's another compose-based activity that requires this.

@Helium314
Copy link
Owner

Do you understand why the keyboard is disappearing for a short time when starting/switching activities? I didn't find anything to investigate it in inputView or latinIME where I'd assume you see what is happening.

Done by disabling it. Is there a better way?

You could try something similar to the emoji key keyboard_state_selector.

I prefer doing this in a separate quick PR later, to avoid merge conflicts, as it touches many files.

Agree.

@eranl
Copy link
Contributor Author

eranl commented Nov 30, 2025

Do you understand why the keyboard is disappearing for a short time when starting/switching activities? I didn't find anything to investigate it in inputView or latinIME where I'd assume you see what is happening.

From my reading and testing, it appears that the system does that on every activity switch. It seems to be triggered by the search field getting focus.

You could try something similar to the emoji key keyboard_state_selector.

It looks like I would need access to Context in KeyboardStateSelector in order to do that.

@Helium314
Copy link
Owner

Do you understand why the keyboard is disappearing for a short time when starting/switching activities? I didn't find anything to investigate it in inputView or latinIME where I'd assume you see what is happening.

From my reading and testing, it appears that the system does that on every activity switch. It seems to be triggered by the search field getting focus.

This not good... but ok, then there's nothing we can do about it.

You could try something similar to the emoji key keyboard_state_selector.

It looks like I would need access to Context in KeyboardStateSelector in order to do that.

For checking whether emoji dictionaries exist? Hmm, you could do the check in Settings.

@eranl
Copy link
Contributor Author

eranl commented Dec 1, 2025

This not good... but ok, then there's nothing we can do about it.

Unless we want to try the in-IME approach.

You could try something similar to the emoji key keyboard_state_selector.

Done. Did I do it correctly? The KeyboardStateSelector logic is tricky. It's a lot more code, but it looks better.

While testing, I realized that this code doesn't work (even if I export the receiver), so I added a NEW_DICTIONARY_INTENT_ACTION broadcast on dictionary deletion. Should we simplify DictionaryPackInstallBroadcastReceiver to just deal with a DICTIONARY_CHANGE_INTENT_ACTION?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Emoji search function

4 participants