An overview of the
Rapid development frameworks are not ready-made frameworks. It is an architecture that integrates base libraries, network libraries, size, color and theme definitions, and proposes a componentized design. It’s more of an SDK + architectural design abstraction. This article also provides component design specifications and integration demos that developers need to define when using.
The target
Fast access to basic libraries and components, greatly reducing the development cycle of new applications. Unified development mode, can bring rapid development, rapid maintenance, stable function experience.
componentization
-
Encapsulates base library components, including basic architecture base classes, activities, Dialogs, dynamic permissions, immersion, utility classes, and so on
-
Encapsulates a set of Design components that contain specified sets of sizes, styles, and themes
-
Define functional components, network components, sharing components, etc
-
Encapsulate component integration, linking components through a unified portal.
App architecture
1. Overall architecture diagram
-
The architecture is mainly business modularization and common function componentization. But not limited to this, can continue to be broken down, business module componentization, plug-in, or process if necessary
-
The module depends on the Baselib component and easyComponent
-
EasyComponent components depend on other functional components
Modular module
2. Modularization of application layer
Business modules use the Architectural pattern of LiveData. Basic architecture within the module:
Basic structure diagram of LiveData:
Basic Components
Based on library baselib
Contains: 1 Life-arch and LiveData package 2 Basic SharePerference package 3 Environment Settings, including the interface environment, 4 Basic Activity/Fragment 5 Dialog, TAB, Statusbar 6 RecyclerView 7 ViewTools 8 Dynamic Permissions 9 Tools 10 Multi-task Rxjava 11 Eventbus
Network component NetworkLib
OKhttp3+Rxjava2+Retrofit2, and designed 6 cache strategies, read-only cache (regardless of expiration time), custom cache time, read network, fixed cache for 1 day, read network and refresh cache, read cache simultaneously request network and write cache.
UI size color specification library Design_style
Contains a set of size and color specifications that push designers to follow. The main goal is to improve development efficiency and uniform size and color experience without thinking as much as possible.
Resize, color values, and theme styles can be used quickly.
The content includes: text size, medium and small specifications; There are only a few margin/padding specifications; The length, width, and color of the dividing line; Text color, primary color, secondary color, least secondary color; Activity Theme, status bar, title bar, background color, cursor color, question color, etc. Dialog theme, rounded corners, margins, background color;
Quick access to component easyComponent
EasyComponent provides access to components
The module is invoked as a chain of responsibilities through the easyComponent component. Such as Easys.net work (). API (). GetUser (observer)
Component design specification
Should include:
1. Minimize dependence on other components
2. Component initialization procedures (such as setting Application)
3. The process of invoking the component
4. Lifecycle management
The integration steps
- Base library components used
The basic library contains most common functions, which will be improved in the future.
- Define the components
Define a new component based on the component specification above. Take Networklib as an example, see source code.
- Supplementary easycomponent
Integrate the implementation of new components, source code has relevant demo, the use of responsibility chain design pattern. Take network library as an example, see:
Network library builder appearance interface
Access network library implementation
Network library call entry
- Reset the Design_style component
Theme, size, color, need to be defined to fit the application of a set of styles. Modify the colors.xml file:
Modify dimens. XML file:
- Test component calls and start your development journey.
Initialize Application:
Your app project relies on:
Calling network components (initialization, and invocation) :