damonkohler / sl4a

SL4A brings scripting languages to Android by allowing you to edit and execute scripts and interactive interpreters directly on the Android device.
Apache License 2.0
2.44k stars 800 forks source link

dialogGetInput should call up numeric soft keyboard when number input is expected #151

Open damonkohler opened 9 years ago

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:29

I'd like to see dialogGetInput automatically call up the soft keyboard in 
number mode, not alphabet mode, when a program needs numeric input.

Here's how this came up. I am a pediatrician.  Our hospital uses metric 
measurements of babies, 
in grams, instead of pounds and ounces. Every day a mother will ask me 
to convert from grams to pounds and ounces.  I realize there are a 
gazillion programs out there to convert kilos or grams to pounds.  The 
ones I see report the result as something like "7.5 pounds" instead of 
what mothers seem to want to hear, that is, 7 pounds 8 ounces. With my 
meager programming talent, I was able to write a python script to do 
what I want.  The program prompts me to enter the infant's weight in 
grams, and converts it to the pounds and ounces format I want.  It 
works fine. 
The glitch is, the when I use dialogGetInput to enter the infant's 
weight in grams, it brings up a software keyboard in alphabet mode. I 
have to press the keyboard shift into number mode. 
I know this is a trivial application, and a trivial problem for you 
professional programmers.  But, can you tell me how I can call up the 
keyboard in a mode ready to accept number input?

Original issue reported on code.google.com by DrMikeGa...@gmail.com on 16 Apr 2011 at 12:47

Copied from original issue: damonkohler/android-scripting#541