Skip to content
Midhun Harikumar edited this page Aug 22, 2023 · 18 revisions

Summary

Due to change in structure of the project, the following tips would help anyone using pre v4.0 library to be able to migrate to the latest version.

There are some changes for version 5 of the library, as we migrate to newer versions of gradle, android gradle plugin and use maven publish.

This guide is still being updated and is subject to modification as the APIs are being finalized.

Table of Contents

  1. Prerequisites
  2. Java Components
    1. Package Name
    2. Modules
    3. Models
    4. Access SMS API
    5. Access Contacts API
  3. Resources
    1. Resource File
    2. Dimensions
    3. Colors

Prerequisites

Please make sure the following items are taken into account when migrating to this version of the library.

  • Use the gradle build system / Android Studio Project Format
  • Use AndroidX libraries instead of the support libraries

Java Components

Package Name Change

Previously all the java components were available under the package com.ae.apps.common. Starting from version 4.0, these would be available under com.ae.apps.lib.

The major factor for the change is it was confusing at times to differentiate from application specific code and library code.

Modules

All the functionality provided by the library are separated into different modules. The dependencies between the modules is defined in the Architecture page.

Presently the following modules are present as part of the library.

  • core
    • common models
    • custom views
  • sms api
  • contacts api
  • multicontact
  • database helpers
  • runtime permissions
  • billing client
  • mocks
  • utilities

Either all the modules could be referenced by a project or just the modules that are required.

Note: mocks module contains mock implementations and utils that are mainly used for Unit Tests. It is used as a test dependency whenever possible.

Models

The models have been renamed from VO to Models, Follow the below table for

Value Object Name Model Name
com.ae.apps.common.vo.ContactVo com.ae.apps.lib.common.models.ContactInfo
com.ae.apps.common.vo.MessageVo com.ae.apps.lib.common.models.MessageInfo
com.ae.apps.common.vo.PhoneNumberVo com.ae.apps.lib.common.models.PhoneNumberInfo
com.ae.apps.common.vo.ContactMessageVo None

Access SMS API

Include the core library and change the implementation as documented below.

implementation 'com.github.midhunhk.lib-aeapps:core:<version>'

Old Component New Component
com.ae.apps.common.managers.SMSManager com.ae.apps.lib.api.sms.SmsApiGateway

The old implementation used the name as SMSManager, which is the same name as a core Android class. As well as since it is not "managing any SMS", it was decided to change the naming to ApiGateway and re-architect the implementation.

Access Contacts API

Include the contacts-api library and change the implementation as documented below.

implementation 'com.github.midhunhk.lib-aeapps:contacts-api:<version>'

Old Component New Component
com.ae.apps.common.managers.ContactManager com.ae.apps.lib.api.contacts.ContactApiGateway

Since the old implementation didn't actually "manage any contacts", it has been re-architected as an ApiGateway since it provides an abstraction over the Contacts API of Android.

Call one of the initialize methods to have the library read and cache all contacts locally and then perform other operation on the API.

▲Top

Resources

Views

Custom Views have also changed their package.

Old Name New Name
com.ae.apps.common.views.EmptyRecyclerView com.ae.apps.lib.custom.views.EmptyRecyclerView

Resource file

The following animation resources were renamed to be consistent.

Old name New name
fade_in.xml anim_fade_in.xml
slide_in_top.xml anim_slide_in_top.xml

Dimensions

The dimension values that were supplied from the library were inconsistent and same values were being used for both margin and padding. Refer to the below tables to see a comparison of the old and new values.

Old Dimen Value
margin_small 6dp
margin_medium 12dp
margin_large 18dp
margin_extra_large 32dp
margin_extra_extra_large 48dp
padding_small 6dp
padding_medium 12dp
padding_large 18dp
margin_horizontal 30dp
card_margin 6dp
card_padding 3dp
New Dimen Value
unit_xxs 1dp
unit_xs 2dp
unit_s 4dp
unit_m 8dp
unit_l 16dp
unit_xl 32dp
unit_xxl 48dp

These dimensions are set for mobile screen densities, and could easily be overridden in the values-xxx for larger screens like tablets.

Colors

Colors that were named inconsistently have been removed and standardized as below.

color name
color_white
color_black
color_red
color_silver
color_bright_orange
color_grey_dark
color_grey_light
color_almost_white
color_slate_blue_dark
color_lime_green
color_blue_dark

Additional Colors that are added.

color name hex value
color_lavender #E82D9E
color_bright_red #E1000A
color_blue_grey #ff21272b

▲Top