HeliBoard
                                
                                
                                
                                    HeliBoard copied to clipboard
                            
                            
                            
                        toast notifications
This PR adds toast notifications.
In Android 12L and below, there is no need for notification permission (which Heliboard currently does not have), so the toasts will be displayed natively.
For newer Android versions, a "fake" toast will be shown instead. Here's how it would look (inspired by OneUI):
Light theme:
Dark theme:
It has a 300ms fade in/out animation to make the transition smoother. The view does not prevent pressing the keys it covers.
In Android versions older than 13, a toast notification will now be shown for 2 seconds when content is copied to the clipboard (can be triggered by pressing the copy/cut toolbar keys). In Android 13+, most devices already show some kind of notification whenever the clipboard is set, so there is no need to display another one.
However, it will be possible to use it for other purposes like indicating an image URI could not be pasted to an input field (#722), or that the clipboard history has been cleared (#679). If you have any other ideas please let me know.
Fixes #545
Not sure whether it works, but having the fake toast in default device style is worth trying. Could you try making a Toast without showing it on Android 13+ and extract the background drawable and text color?
According to https://stackoverflow.com/a/9432923 Toast.getView() should contain a TextView accessible via TextView v = (TextView) toast.getView().findViewById(android.R.id.message);
Then you could get background and text color using v.getBackground() and v.getCurrentTextColor().
Shouldn't this notification be a little lower? 🤔 Most often I saw them just above the spacebar.
It looks better than on the keyboard, but I think that for some people such a notification in the middle of the screen can be annoying. Maybe it's better to place it just above the keyboard?
I find the position somewhat awkward comparing to normal toast messages, but showing some amount above the keyboard definitely is a good idea, as this is a. not covering the text field (assuming it's a single line), and b. not at a place that might be covered with fingers.
The inability to copy the system toast style is unfortunate. Though maybe we could derive toast colors from the keyboard colors...
@codokie do you plan to move the notification to the place above the input field, or do you consider this PR done?
I think it might work when you do it in input_view.xml.
But this might also end up increasing size of the input view, which would be bad. If that doesn't work out, I'll have a look later.
You could try something like android:drawableLeft="@drawable/ic_launcher_round" in the TextView.
like in a real toast
This is highly dependent on the Android version though, device manufacturers may style the toast, and some custom roms also do this, or let the user tune the toast. I just want to say that sticking to specific style is not necessary, as it cannot fit with toast style of all devices.
Having the message centered may be a (minor) issue in some cases. E.g. in landscape mode it will be on the keyboard, or when height scale is very low it will be far above the keyboard. But handling the window insets is probably too much, at least in scope of this PR.
I don't really like the way how some parts of the toast are being handled though.
- When 
showToastis called, it should really show a toast; thefallbackthing is out of place. When it should actually not show thetoast_msg_clipboard_copytoast, then just don't callshowToast(have that logic incopyText) - I don't think 
showToastshould be inLatinIME,KeyboardSwitcheralready has a relevant part of that code. Then you could also call it usingKeyboardSwitcher.getInstance().showToast