This is the root framework and is a dependency of several of the others. It is essential for every app.
NNApplication
This file, or a subclass of it, should be declared in the AndroidManifest.xml as:
<application
android:name=".NNApplication"
... >
...
</application>
This means that the entire app will be based on the NNApplication class. This provides core functionality such as:
- getContext() – passes application context into any class
- getInstance() – passes application into any class
- Instantiates Foreground which provides Lifecycle tracking
- Sets up NNActionManager (Singleton) which processes actions, and can restart and kill the app
- Checks the package version number of the app against the prefs version number and consequently:
- Keeps a record of the run mode: FRESH_INSTALL, UPDATE or RUN
- Checks for changes in the Connectivity status of the device e.g. lost internet connection using a Broadcast receiver
Identity
- Determines the platform – Amazon, Blackberry or Google
- Finds the device ID
- Finds the Android ID
Foreground
Tracks the Lifecycle of the application.
NNActionManager/NNActionManagerInterface
Enum Singleton – holds a delegate which is the app specific implementation of the Action Manager. Has functions to restart and kill the app. Most commonly used to process actions. Allows the ability to go to a specified page in the app, based on a specific string e.g. NN4MSF::GOTO_PRODUCT::123-45678-123
- Always begins with NN4M followed by rcode (2-letter client code)
- parts of an action are always split on double colon
:: - the second part decides where to go
- the third part onwards is the data to pass to that page
ContentFilterManager/FilterableContent
Classes for taking JSON response items and filtering them.
DataValidator
Determines validity of String inputs against patterns such as HTML, JSON, Email address.
DiskManager
Handles common file input and output.
PermissionHelper/PermissionCallback
Handles Permission requests
NNTrackingEvent
Tracks events!
utilities folder
Various helpers for general usage. Including:
- CollectionUtils for checking whether a Java collection is empty
- ExceptionLogging – logs exceptions using Fabric/Crashlytics
- NNBitmapHandler – for decoding Bitmaps
- NNUtils – random collection of other helpers
- Prefs – for dealing with the default shared preferences
- Security – encryption/decryption
- UnzipUtility – unzip files
