HTTPS SSH

Mobile Jazz Vastra

MJ-Android-Core

A Mobile Jazz Android library project to create a standardized way of developing android architectures.

Add it to your project

Repository

First, add the following to your app's build.gradle file:

repositories {
   maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}

Library

dependencies {

    // ... other dependencies here

    compile 'com.mobilejazz.android-core:library:2.0.5-SNAPSHOT'
}

Documentation

1. Application Structure

If we don't think that the application needs a special structure, the applications that we create from scratch will have the following rules in terms of the project structure:

  • The project will just have one module and the name could be app or application
  • The parent package structure will be com.{COMPANY_NAME}.{APPLICATION_NAME} and it will be separated in three big groups / packages application, domain and datasource. The result must be something like this:
    • com.{COMPANY_NAME}.{APPLICATION_NAME}.application
    • com.{COMPANY_NAME}.{APPLICATION_NAME}.domain
    • com.{COMPANY_NAME}.{APPLICATION_NAME}.dataprovider

2. Architecture

All the application is based in three big parts application, domain and dataprovider and each one has their own reponsibility.

2.1 Application

To do

2.1.1 Dependency injection

To do

2.1.2 Model View Presenter

To do

2.1.3 Error management

To do

2.2 Domain

The domain contains all the business logic of the application based in interactors.

2.2.1 Interactors

To do

2.2.2 Threading

To do

2.3 DataProvider

The DataProvider contains all the repositories where the information is provided for the interactors.

2.3.1 Repositories

All the repositories must to implement the following interfaces:

The repositories need to have a standard naming and it's defined as {MODEL_NAME} + {RESPONSABILITY} + DataProvider. You can follow the same pattern as the mj-android-app-documentation project.

If you need some method that the Repository interface doesn't provide, you just need to create another interface and extends from the parent Repository / Repository.Storage / Repository.Network interface and add theses methods that you need.

2.3.2 Mappers

The responsibility of the mappers is map a object from a type to another type and their implement the interface Mapper<From, To> that contains a method that needs to be implemented to transform the object.

To have naming consistency in all the mappers classes that there are a lot of classes. The naming structure is {MODEL_NAME_FROM} + To {MODEN_NAME_TO} + MAPPER.

Examples: CharacterEntityToCharacterMapper CharacterEntityListToCharacterListMapper

2.3.3 Networking

The libraries decided to use for the networking logic are:

The core already contains some classes to build and initialize the required instances for the libraries.

Examples: * TO DO

2.3.3 Storage

The libraries decided to use for the storage and caching logic are:

  • CacheIO (Used just for caching purposes)
  • Realm (Used for a full storage with queries, transactions, etc..)

Examples: * TO DO

License

Copyright 2015 Mobile Jazz

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.