Merge: Fix app.nit Calc example
authorJean Privat <jean@pryen.org>
Mon, 24 Aug 2015 17:56:50 +0000 (13:56 -0400)
committerJean Privat <jean@pryen.org>
Mon, 24 Aug 2015 17:56:50 +0000 (13:56 -0400)
commit283e1122db0800895153a365873c5eccd40952de
treea49d863cc74d3f23b1a3be2cd05096f307faf016
parent1f1aaec1da5e0c61022b902ffbd497687c3074c5
parent2908013181c791c5c8547567e2de5d737deafac3
Merge: Fix app.nit Calc example

Partial revert of cbbb5225 because the Android version of Calc need only `android::ui` and not `android`. The default entry point of `android` use `native_app_glue` as base activity/framework, whereas UI apps use `nit_activity`. This caused the apk file to show 2 activities in the launch menu.

Also recent changes (probably) make calling `to_i` and thus `to_n` on empty strings crash. I've updated the calculator to avoid this with a new friendlier behavior in such cases.

I've also updated `to_n` to return 0 on empty strings. This preserve the old behavior, it is a neutral fallback value and it fits with `"".is_numeric == true`. I did not touch `to_i`.

Pull-Request: #1649
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>