NeoMAD 4.5 release notes

June 13, 2018

Android lifecycle, menu, dialog and screen parameters major update

A large part of the NeoMAD API was updated for Android in order to improve performance, fix minor bugs and facilitate maintenance. For most modifications your code does not require to be changed to have the benefit of the new implementation. However some very specific part of the API must have been modified and requires your attention (see Compatibility changes).

Android Http

The com.neomades.io.http API does not use the Apache HTTP library anymore. It now relies on the java.net API as recommended by Google. This improvement is transparent for NeoMAD users: nothing must be changed in your source code.

Location request improvements

com.neomades.location.LocationManager has two new methods to perform a location request with a timeout. This can be useful in cases you do not want the user to wait too much time for a response (in cases the GPS does not find satelites for example):

  • requestMyLocation(long timeout, Criteria criteria, LocationListener locationListener): registers for a single location update using a Criteria.
  • requestMyLocation(long timeout, LocationListener locationListener): registers for a single location update using the default Criteria.

The com.neomades.location.LocationListener has a new callback onLocationFailed(LocationErrorStatus locationErrorStatus) to handle error cases: location disabled by user, unknown error during location search or timeout reach.

NB. if your code already implements a com.neomades.location.LocationListener, you must implement the new callback otherwise the code won’t build.

Boolean

Boolean class has been completed with some missing Java 1.5 methods:

  • Constructor: new Boolean(String bool): allocates a Boolean object representing the value true if the string argument is not null and is equal, ignoring case, to the string “true”
  • valueOf(boolean b): returns a Boolean``instance representing the specified ``boolean value.
  • valueOf(String s): returns a Boolean with a value represented by the specified string.
  • Comparable<Boolean> interface implementation CompareTo(Object obj): compares this Boolean instance with another.

Math

Math class has been completed with some missing Java 1.5 methods:

  • acos(double a)
  • asin(double a)
  • atan(double a)
  • atan2(double a)
  • cbrt(double a)
  • cosh(double x)
  • exp(double a)
  • expm1(double x)
  • hypot(double x, double y)
  • IEEEremainder(double f1, double f2)
  • log(double a)
  • log10(double a)
  • log1p(double x)
  • pow(double a, double b)
  • rint(double a)
  • round(double a)
  • round(float a)
  • signum(double d)
  • signum(float f)
  • sinh(double x)
  • tanh(double x)
  • ulp(double d)
  • ulp(float f)

Compatibility changes

Android minimum API level

According to the Android market share and store usage statisitics, NeoMAD does not support Android devices with an API level below 19 (Android 4.4) anymore. API level 19 is still supported.

Command line option -gp (-generate-project)

The command line option -gp was deprecated in NeoMAD 4.2.0. The option was useless since the native project was always generated with the binary in the output folder after a build with NeoMAD.

It is now removed from NeoMAD and cannot be used anymore. Builds using this option will now crash: just remove the option from your build options.

Command line option -e

The command line option -e is not accessible anymore. To see all available targets please refer to the NeoMAD help message using the -h option.

ScreenParams

ScreenParams class can not be inherited anymore. Use composition instead of inheritance if you want to have specifc ScreenParams classes.

HttpRequest

HttpRequest.setMethod(String method) now throws a ProtocolException if the method parameter is not a valid HTTP method. Your code must be updated to catch this error case.

SlideScreen

SlideScreen.setContent(int layoutResId) and SlideScreen.setContent(View content) cannot be use to insert the content of a SlideScreen. It was already the case in previous NeoMAD version but now it will throw an IllegalStateException on all platforms if one of the method is call for a SlideScreen.

LocationListener

The com.neomades.location.LocationListener has a new callback onLocationFailed(LocationErrorStatus locationErrorStatus) to handle error cases: location disabled by user, unknown error during location search or timeout reach.

If your code already implements a com.neomades.location.LocationListener, you must implement the new callback otherwise the code won’t build.

Removal of deprecated methods

Following methods were deprecated in previous NeoMAD versions. They are now removed from the API:

  • Application.requestBackground() and Application.requestForeground(): they already did nothing and can be removed from your code if they were used.
  • Screen.onReceiveResponse(ContentResponse response) and Screen.onReceiveError(ErrorEvent error): respectively use Screen.onContentResponse(ContentResponse response) and Screen.onContentError(ContentError error) instead.
  • PinchListener.onPinchGestureBegin(Pinch pinch, View view) and PinchListener.onPinchGestureEnd(Pinch pinch, View view): use PinchListener.onPinchGesture(Pinch pinch, View view) with Pinch.getState() instead.
  • Font.STYLE_UNDERLINED, Font.STYLE_DOTTED_UNDERLINED and Font.isUnderlined(): use the method setUnderlineThickness(int) in the views where it is available instead. NB. these styles cannot be set anymore when declaring fonts in a xml resource.
  • FileStorage.getPrivateDir() and FileStorage.getExternalDir(): respectively use FileStorage.getApplicationDir() and FileStorage.getExternalApplicationDir() instead.
  • Network.TYPE_BLACKBERRY_MDS: constant is no longer supported.
  • Marker.setHue(int hue) and Marker.getHue(): use MarkerIconFactory.defaultIcon(int hue) to get the platform default marker with the hue in parameter applied and then Marker.setIcon(MarkerIcon markerIcon) to apply the color to the marker. Hue default color values have been moved from Marker class to MarkerIconFactory class.
  • Marker.setIcon(Image icon): use MarkerIconFactory.fromImage(Image image) and Marker.setIcon(MarkerIcon icon) to change the image of a marker.
  • Camera.setCaptureActionText(String text), Camera.setCaptureActionText(int textResID), Camera.setRetryActionText(String text), Camera.setRetryActionText(int textResID), Camera.setConfirmPictureSelectionText(String text), Camera.setConfirmPictureSelectionText(int textResID), Camera.setConfirmVideoSelectionText(String text) and Camera.setConfirmVideoSelectionText(int textResID): they already did nothing and can be removed from your code if they were used.
  • Notification.setActionText(String actionText) and Notification.setActionText(int actionText): these methods were used for iOS 5.1 which is no longer supported by NeoMAD.
  • GLES20.GL_STENCIL_INDEX: constant is no longer supported (was not used before).
  • TextEdit.setEditMode(int mode) (and all modes): use TextEdit.setTextMode(TextMode), TextEdit.setCapitalizeMode(CapitalizeMode) and TextEdit.setAutoCorrect(boolean) instead.
  • LinearLayout.setBackgroundColorFocused(Color backgroundColorFocused) and LinearLayout.isFocused(): they already did nothing and can be removed from your code if they were used.
  • ScrollView.addView(View child), ScrollView.removeView(View child), ScrollView.removeAllViews() and ScrollView.getViewsCount(): use ScrollView.setContent(Layout layout) and then work on the content layout to add, remove or count views.
  • WaitView.setStyle(int style): use WaitView.setIndicatorStyle(int) instead.
  • DeviceInfo.getName(): use DeviceInfo.getModel() or DeviceInfo.getDeviceName() instead.
  • Remove old deprecated constants of DeviceInfo: Blackberry, JavaME, Windows Phone 7, Android up to version 2.2 and iOS up to version 7.0.
  • Remove old useless constants in TargetInfo: keep only target name and target OS constants.

Depreciations

  • DeviceInfo: Android version constants up to API level 19 were deprecated since these versions are no longer supported by NeoMAD. Same thing for iOS version constants up to iOS 9.0.
  • ScreenParams.putObject(String key, Object value) and ScreenParams.getObject(String key): do not pass Object as ScreenParams. Memory problems or crashes may occur sometimes on some platforms. Use other “put” methods that use String or primitive types and build again your complex object with that.

Fixes

  • Android:
    • Fix HTTP PATCH method that was taken into account under Android 5.0
    • Fix default support of TLS 1.2 for HttpRequest for all Android versions
    • Fix strange behavior in screen Menu that may occur in phablets: some menu items may be duplicated in the title bar
    • Fix a black screen or a strange visual effect that may occur when performing a Controller.resetScreenStack(Class screen) on some Android devices
    • Improve application automatic restart after a crash: sometimes the application restart may cause the application to crash again
  • iOS:
    • Fix declaration of icons and launch images in Xcode generated project. Images were copied in the native project but not correctly included.