Deep Singh created CB-5526:
------------------------------

             Summary: Keycodes not getting identified and throws error on 
Android KitKat
                 Key: CB-5526
                 URL: https://issues.apache.org/jira/browse/CB-5526
             Project: Apache Cordova
          Issue Type: Bug
          Components: Android
    Affects Versions: 2.0.0
         Environment: Heres what my app is running on:
 Cordova - 2.0.0
 Jquery Mobile - 1.0
 Android - 4.4 (Kit kat)
 Device - Nexus 5

I have created a sample with Cordova  3.1.0 and issue is still there.
            Reporter: Deep Singh
            Priority: Blocker
             Fix For: 2.0.0


Hi There -

I got Google Nexus 5 phone today and tried to test my app on it. Most of the 
parts work fine but I get following error very frequently. And few parts are 
not working at all. Any idea what this error means? I searched internet but 
only found that Google has changed webkit to chromium. Can you provide more 
details on it or any solution? 

I have been talking phonegap (cordova) support and they confirmed it is an 
issue and I have to log defect here.

11-21 14:49:39.256: E/chromium(5721): 
[ERROR:aw_autofill_manager_delegate.cc(144)] Not implemented reached in virtual 
void 
android_webview::AwAutofillManagerDelegate::UpdateAutofillPopupDataListValues(const
 std::vector >&, const std::vector >&)

I have a custom method created by me for converting user entered values to 
currency format. And the above problem is happening all the time when I press 
delete button from keypad.

Here is the code:

function CurrencyFormatter(object, e, maxLength)
 { try { //alert(e.keyCode); var val = $.trim(object.value); var len = 
val.length + 1; var char = String.fromCharCode(e.keyCode);
 var pattern = new RegExp(/^[0-9]+$/);
    //console.log("char: " + char);
    //console.log(pattern.test(char));

    //console.log(pattern.test(new String(char)));

    if(len <= maxLength && pattern.test(char))
    {           
        //console.log(val);
        if(val == '0'){
            if (val.length > 0 && val.length < 11)
                val = val + char;
        }
        else
            if (val.length < 11)
                val = val + char;

        object.value = formatCurrency(val, "add");
    }
    else if(e.keyCode == 8)
    {           
        //var numBox = document.getElementById('numBox');
        if(val.length > 0){

            //pennies = pennies.substring(0, pennies.length - 1);
            object.value = formatCurrency(val, "del");
        }                                   
    }

    e.preventDefault();
    return false;
}
catch (ex) 
{
    console.log(ex);
}
}

function formatCurrency(amount, type)
 { var i = parseFloat(amount); var i2; //console.log("1: " + i); if(isNaN(i)) { 
i = 0.00; }
if(type == "add")
{
    i = Math.round(i * 1000);
    //console.log("1.5: " + i);     
    i = i / 100;
    //console.log("3: " + i);
}
else if(type == "del")
{
    i = parseInt(i * 100);
    //console.log("2: " + i);
    sub = new String(i);
    //console.log("sub1: " + sub);
    sub = sub.substring(0, sub.length - 1) ;
    sub = sub == ""? 0:sub;
    //console.log("sub2: " + sub);
    i = parseFloat(sub);
    //console.log("del: " + i);
    i = i / 100;
    //console.log("3: " + i);
}

s = new String(i);
if(s.indexOf('.') < 0) { s += '.00'; }
if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
//console.log("4: " + s);
return s;
}

The crash errors will not be on phone screen.

The sample I have provided should work to enter just numbers and format it to 
currency. No special characters should be allowed.

If you can enter special characters then the issue is there.

Heres what my app is running on:
 Cordova - 2.0.0
 Jquery Mobile - 1.0
 Android - 4.4 (Kit kat)
 Device - Nexus 5

Will be waiting for your reply on this as we can't certify our app on Android 
4.4

-Deep



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to