Android soft keyboard show numbers view first - android

I have a login screen on my app which accepts a CPF as login (CPF is an unique number identification that every Brazilian citizen have, e.g: 10546819546), but it can also accept passport numbers as the login, and these may have letters on it.
My problem is that I want the keyboard, when it pops up, to show to number/symbols "view" before the default alphabet one. Changing the inputMethod to phone or number does not solve my problem, because as I said, the login may contain letters.
I've seen some explanations to questions somewhat similar to mine but all of them either didn't solve my problem or it was too overcomplicated.
This is merely a small adjust to slightly improve user experience and entertain me developing the app, so if the solution is something like "override the default keyboard, make a custom component" etc, I'll just leave it alone.
TL;DR: I want to show the number/symbol soft keyboard before the letters one.

Unfortunately when it comes to the soft keyboard you are somewhat at the mercy of whoever made the one the user has their device set to. Lots of devices come pre-loaded and defaulted to the swype keyboard. But many others have soft keyboards that were made by the manufacturer of that device. It it up to whoever created it to decide how the keyboard reacts to the android:inputType that you pass to it. It is possible that some of the ones out there right now actual have the behavior you are looking for when you set them to number or phone. I just checked it out on my sidekick and found that it was the same as yours both number and phone provided no way to input letters.

Related

Is there a way to restrict the Android soft keyboard to allow ONLY emoji characters?

I have an EditText that can ONLY be a SINGLE Emoji character. I've added code and a filter to ensure this, but I still have a usability problem because the keyboard pops up in NORMAL text mode. It's not obvious to the user that only an Emoji character is allowed.
<EditText
android:id="#+id/activity_emoji"
style="#style/Material.Widget.EditText.Light"
android:layout_width="30dp"
android:layout_height="wrap_content"
android:textColor="#FF000000"
android:text="😎"
android:clickable="true"
android:focusable="true"
android:focusableInTouchMode="true" />
Ideally I could disable all input except Emoji, but that appears to be impossible. Another option would be to have the keyboard pop up already on the Emoji page instead of on the normal alphabet. Is it possible to do that, and if so how?
Seems to me the simple solution would be supporting:
android:inputType="Emoji"
I've added code and a filter to ensure this
Since there is no requirement for an input method editor to offer emoji, you have a slight problem.
I still have a usability problem because the keyboard pops up in NORMAL text mode
Many input method editors only have what you consider to be normal text mode.
Please understand that there are over 26,000 Android device models. These ship with dozens, if not hundreds, of pre-installed keyboards. Users can also install others from the Play Store, F-Droid, and elsewhere. None have to offer emoji. I would expect that relatively few do, though the ones that do (like GBoard) will be the most widely-used ones.
Also, please bear in mind that not all Android devices use soft keyboards. Sometimes, that's a fairly permanent state (e.g., Chromebooks). Sometimes, it is a temporary state (Bluetooth keyboard enabled, USB keyboard plugged in, other assistive device attached).
Is it possible to do that, and if so how?
No, sorry.

How to remove numbers displayed on top of the softkeyboard?

I've tried a lot of InputFilter combinations to no avail.
The numbers I'm referring to are these in the first row:
I need this for an EditText that will receive a person's name. I already managed to disable the word suggestions with InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD, however this enabled the first row displayed in the image above.
There are dozens, if not hundreds, of input method editors (soft keyboards) pre-installed on Android devices. There are many more available for users to download and install, from app distribution channels like the Play Store.
You, as the app developer, do not have absolute control over them. At best, you provide some hints as to your desired behavior, such as what you are doing with TYPE_TEXT_VARIATION_VISIBLE_PASSWORD.
However:
There is no requirement for any input method editor to disable word suggestions because you requested TYPE_TEXT_VARIATION_VISIBLE_PASSWORD
There is no option to say "please do not show that row of numbers", and even if there were, there is no requirement for any input method editor to honor that request
I cannot rule out the possibility that there is some option that happens to remove those numbers on the one device that you are testing on. Just don't expect any of this to work for all devices and all users.

Android display # sign with phone soft keyboard

I'm trying to make an a soft keyboard which an EditText presents have a layout of a phone keyboard but also with a "." and "#" signs.
What I tried was this on the edit text:
android:inputType="textEmailAddress|phone"
android:digits="0123456789.#"
I'm seeing the keyboard like I want as a phone layout in general and with the "." symbol but without the "#" symbol.. how can I add it to the keyboard?
I'm trying to make an a soft keyboard which an EditText presents have a layout of a phone keyboard but also with a "." and "#" signs.
There is nothing in the specifications that supports this.
android:inputType="textEmailAddress|phone"
Quoting the documentation for android:inputType: "Generally you can select a single value, though some can be combined together as indicated." The docs do not suggest that textEmailAddress can be combined with phone.
android:digits="0123456789.#"
This stipulates what characters are allowed. I am not aware that an InputMethod even finds out about this attribute; one certainly does not have to somehow magically adjust its keyboard layout to accommodate it.
how can I add it to the keyboard?
You don't, except perhaps by writing your own InputMethod, then forcing people at gunpoint to use it.
Please understand that there are over 8,000 Android device models. Dozens, if not hundreds, of input methods will be shipped on these devices, and others can be installed by users separately. These are written by independent developers. There is no requirement for any of them to even have keys, as evidenced by Graffiti Pro. And they certainly do not have to handle some arbitrary set of keys that an app developer wants.
android:inputType gives you a chance to supply a hint to the input method for how it should optimize the layout for the user. android:inputType specifically limits things to a few classes to keep things sane for the developers of the input methods. Furthermore, android:inputType is a hint, not a demand; as Graffiti Pro illustrates, not all input methods will necessarily change based upon android:inputType, at least for all possible types.

Dynamically communicate with Android soft keyboard

I am developing an simple game using soft keyboard where people play with characters. So I want to change the background color of keys during the game. I know that there are tones of tutorials and questions out there answering to changing background and color of keys but my question is a bit different. Because I want to do it dynamically and I have had a hard time to figure out that how can I do it. I am using Android soft-keyboard but I don't know where and how can I add a listener to change the corresponding key's background. And how my game-engine sends this signal to the keyboard? Could you help me what should I do?
Thanks
Changing the appearance of the soft keyboard from your app will likely be impossible, especially on a per-key level as you describe.
The most feasible option would be to create a custom keyboard specifically for your application.
You could possibly get in touch with the developer of a keyboard app but it's unlikely they'd be willing to add a back door just for your game- and even if they were, your users would then be required to install that keyboard to play your game, which is not ideal.

Android: How to intercept keydown globally (on hardware keyboard)

Is there a possibility for an android app to run as a service in the background, intercept keydown events from the hardware keyboard and change behavior (i.e. the resulting character) in some special cases?
The idea in mind is to have sort of a keyboard layout fix, mainly making important special characters available using an alternative keymap instead of having to select from a huge grid on the touch screen. Sometimes, the default keymap of a mobile devices do not represent all important characters, even more when it comes to non-english languages.
Thanks for inspiration :)
Peter
EDIT: additionally emphasized hardware
What you are describing is in fact not a service in background but replacing the keyboard app itself..take a look at the SWype app.
You do not have to create a service to do this as you want just the your own keyboard layout coming up when entering text, etc.
The sample of replacing a default app in the sdk is the homescreen but the keyboard app can be replaced as well..

Categories

Resources