Changing the Keyboard for Specific App on Android - android

I am developing a "Nepali Dictionary Android App" using Cordova. Using jQuery I have been able to map the keyboard character to Devnagari. For example If you pressed the 'k' from keyboard 'क' will be displayed in editable text inputs. Now , I am trying to change the keyboard characters so that the users could see Nepali characters in keyboard.
I don't know If it is possible or not, but I think it should be. I am not a java programmer and using cordova api to build the android applications. I am also planning to create MultiKeyboard Phonegap / Cordova Plugin for android (in future ) if It is possible.
My Question is :
How can I change the android keyboard characters for some specific apps ?
WHAT HAVE I TRIED
I have not started coding for this because I don't know if it is possible or not. Please show me the right way.
Thanks.

You could change char value with different value if the given input values will not be used. What i mean is if 'k' will never be used you could catch that input in for example
var tempChar;
variable and swap it's value from a HashMap, but I don't know if you can change the layout of keyboard using PhoneGap only. If you can't do, you can draw your own keyboard using jQuery Mobile if there is way to disable Android keyboard for your app.

Related

Detect when the user enters/leaves "Swipe to type" mode in TextInput/EditText (Android)

This is an Android question.
Inside my <TextInput> (ReactNative (which renders an EditText in Android)) when the user types "#" and then they use Androids swipe mode to auto-complete a word, it adds a space between the "#" and the autocompleted word. So what I was doing was, onChange of the text, I replace the space between "#" and the word, however while the user is in swift mode, it is really messing things up. The space comes back and the swift autocomplete messes up to another word.
Is there a way in react-native to listen when the user accepts an autocompletion? I want to then check if the previous two chars are a # (hashtag and space) and if so, then replace it with just # (hashtag without space).
I was thinking the onCommitCompletion- https://developer.android.com/reference/android/widget/TextView.html#onCommitCompletion(android.view.inputmethod.CompletionInfo) - fires after a suggested word is accepted - is this true? If it is this would be perfect and I can submit a PR to react-native to accept this for Android.
Here is a video of what's happening: https://gfycat.com/AdmirableGrizzledIrishsetter
Low quality:
This is happening because you are typing a text via Swipe feature of your keyboard. The Swipe feature automatically adds an extra space before and after the String. There is no way to get rid of it, it's an integrated feature of(some) the keyboard. We have no control over it.
Don't worry, the end user is aware of it and all he has to do is type the whole text rather than using Swipe feature to input his text.
Try disabling AutoComplete inside your TextInput , perhaps like <TextInput autoCorrect={false}/>, I'm not sure.
Also, this isn't the problem with Android phones only, try installing GBoard in an Apple Device and you'll face the same problem.
I worked on a major keyboard for 2 years and I have no idea what you mean by "swift mode". But there is no such feature in the generic keyboard API. It may be a feature of some particular keyboard, but there'd be no way to programmatically turn it off.
What you're describing comes closest to sounding like autospacing. This is not a concept that Android has, it would be a concept of each individual keyboard. And since Android knows nothing about it, it can't turn it off (on many keyboards the user could, but that's it).
You might be able to override it (not turn it off, but force the spaces to disappear) if you were to do some work with either overridding the InputConnection or setting a text watcher in Java and altering the text to be inserted, but neither can be done at the react native level- you'd need to write a custom edit text and link that down to react native via a native component.
I think this would be onCommitCompletion - I'm not sure though I am not able to test yet. I think in this callback I would get the position, and see if there is a leading space, and if so then remove that leading space.

StageText and Emoji on Android - AIR Mobile - AS3

I have a big problem and can't find anything about it online.
Using Flex/Air Mobile I do a simple thing, using 2 components:
txt2.text = txt1.text;
If txt1.text contains emoji, they are not taken to txt2. Instead, it creates a mess with weird characters.
What kills me is that when you type it, the emoji are shown correctly. When I capture the value and trace it, the emoji appear on Flash Builder's console (in OSX) correctly, but when you set the value of another StageText (I tried it with raw StageText, created from code to avoid any other class or code from interfering)
Right now I met a dead end, no ideas of what else to do...and I have to release to Android a chatting app that's working like a charm on iOS, and I have this problem.
Ideas? Please?
try this:
txt2.text = decodeURI(txt1.text);
but I am afraid this is because StageText use a native input textfield that on iOS is able to reach the Apple Color Emoji font that is not available on Android

How to get access to the edittext box in the android messenger app

I am trying to make an app to where I can get custom emojis to be added to the edittext field in the android messenger app and I am having a hard time getting access to that edit text field. Can anybody provide any help with this. I am attaching an image.
Androids security model prevents all apps but the currently active keyboard from modifying the text input.
You have several options:
Register your app as keyboard. Users can switch to and from your keyboard, so it can just include the additional symbols you want to add (and doesn't have to be a full-bleed keyboard).
Copy the symbols to the clipboard. Users have to manually paste them.
Use Xposed to inject your code (requires root). This works around the Android security model.

Numeric keyboard as default, but allow text

I'm currently developing an application targeted at android and desktop devices using apache cordova and HTML5.
In order to get the numeric keyboard to pop up I've used input type="number", which works fine.
However, the input field should also accept strings. The current functionality of type=number is that the ui seems to allow for strings to be entered, but the value property of the element is not changed if the input is invalid (e.g not numberic).
Is there a way of getting the numberic keyboard on mobile devices, while still being able to enter text?
My inital tries consisted of capturing the keydown event and manually setting the this.value property. I've tried this using jQuerys .val() and of course the more 'native' approach element.val += char. None of which work. UI is updated, but the change is not reflected in the model.
EDIT
For the next guy trying to achieve this.
1) The HTML solution.
As #LuudJacobs mentions in the comments below; There's currently no way to decide which keyboard is shown except for defining the type-attribute. Though some devices have a button to go back to alphabet keyboard, its not the case for every device. And can not be used reliably.
2) Writing a phonegap/cordova plugin.
It is possible to write a plugin to show and hide the keyboard at will. But, as far as I could find, there is currently no way of programmatically telling it to default to the symbols keyboard. Thus the functionality achieved is similar to using type=number and type=text in the HTML. Another problem with this approach is the diversity of keyboard for android devices, where even users themselves can install their custom keyboard. The functionality of the keyboard can are therefore unknown. What works on one device, may not work on the next.
3) JS/HTML/Canvas solution
Finally... A feasible solution. I suggest taking a look at this walkthrough as it shows an easy way to creating the keyboard using just html and js. Another option would be to use a canvas, and draw the keyboard yourself, but I would imagine that this is more error prone and harder to do.
As explained in the HTML5 spec you can not have anything but valid floats in a input type="number". So You can not. On a sidenote: how would users enter text when they'd only have a numeric keyboard?

show password field value for a moment in phone gap android application

How is it possible to display the input text as it is instead of star for a moment in a password field in a JQM android phonegap application. (This is working in android 4.1 but not in android 2.2)
Thnx
I think it is platform specific. Just checked few apps in my android 2.3 v mobile and there was no character display , when you press it.
I recommend not to go for it. Still some possible solutions would be ( if you are too much bothered about it)
Create an event and show the pressed character for a second using javascript ( but you will have to check the platform and disable this when the app is in 4.1/ other higher versions as there is already a display there)
put an option "show password" ,and show the whole password. ( Standard approach )

Categories

Resources