Introduction to six recommended android (android) open source frameworks

  • 2020-06-01 11:01:25
  • OfStack

1, volley

Project address https: / / github com/smanikandan14 / Volley - demo
(1) asynchronous downloading of JSON, images, etc.;
(2) sorting of network requests (scheduling)
(3) priority processing of network requests
(4) cache
(5) multi-level cancellation request
(6) linkage with Activity and life cycle (cancel all network requests at the end of Activity)

2, android async -- http

Address of the project: https: / / github com/loopj android async -- http
Document is introduced: http: / / loopj com/android - async - http /
(1) process the request result in the anonymous callback
(2) make http requests outside the UI thread
(3) file breakpoint upload
(4) intelligent retry
(5) default gzip compression
(6) support parsing into Json format
(7) you can persist Cookies to SharedPreferences

3. Afinal framework

Address of the project: https: / / github com/yangfuhai/afinal
There are four major modules:
(1) database module: orm framework in android USES thread pool to operate on sqlite.
(2) annotation module: ioc framework in android, UI binding and event binding can be carried out in full annotation mode. No need for findViewById, setClickListener, etc.
(3) network module: encapsulate the data request of http through httpclient, support the loading of ajax, and support the functions of downloading and uploading files.
(4) image cache module: when loading bitmap through FinalBitmap and imageview, it is not necessary to consider the phenomenon of image displacement when oom and android containers slide quickly during loading bitmap.
FinalBitmap can configure thread load thread count, cache size, cache path, load display animation, etc. The memory management of FinalBitmap USES the lru algorithm,
Weak references are not used (after android2.3, google is no longer recommended to use weak references; after android2.3, soft references and weak references are forcibly recovered, please refer to android's official documents for details),
Better management of bitmap memory. FinalBitmap can be customized to extend other protocols to display network images, such as ftp. You can also customize the bitmap display,
Play animations when imageview displays images, etc. (the default is to display the gradient animation).

4. xUtils framework

Address of the project: https: / / github com/wyouflf/xUtils
There are four major modules:
(1) database module: orm framework in android, one line of code can be added, deleted, changed and checked;
Support transactions, closed by default;
Customizable table name, column name, foreign key, exclusive constraint, NOT NULL constraint, CHECK constraint, etc. (please annotate table name and column name if you need to be confused);
Support foreign key binding, when saving the entity foreign key associated entity automatically save or update;
Automatic loading of foreign key associated entities, support for delayed loading;
Support for chained expression queries for more intuitive query semantics, refer to the following introduction or examples in sample.
(2) annotation module: ioc framework in android, which can be fully annotated in UI, resource and event binding;
The new event binding method can work normally after using the obfuscation tool.
Currently used 20 kinds of support event, see ViewCommonEventListener class and package com. lidroid. xutils. view. annotation. event.
(3) network module: support synchronous and asynchronous requests;
Support large file upload, large file upload will not oom;
Support GET, POST, PUT, MOVE, COPY, DELETE, HEAD, OPTIONS, TRACE, CONNECT requests;
Download support 301/302 redirection, support setting whether to rename the downloaded file according to Content-Disposition;
Requests that return textual content (only GET requests are enabled by default) support caching, and you can set the default expiration time and the expiration time for the current request.
(4) image cache module: when loading bitmap, it is not necessary to consider the phenomenon of image dislocation when bitmap container slides rapidly when oom and android containers are loaded.
Support loading network images and local images;
Memory management USES lru algorithm to better manage bitmap memory;
Configurable thread load thread count, cache size, cache path, load display animation...

5, ThinkAndroid

Address of the project: https: / / github com/white - cat/ThinkAndroid
There are mainly the following modules:
(1) MVC module: realize the separation of view and model.
(2) ioc module: ioc module in android can be fully annotated for UI binding, reading of resources in res, and initialization of objects.
(3) database module: orm framework in android USES thread pool to operate on sqlite.
(4) http module: encapsulate http data request through httpclient, and support asynchronous and synchronous loading.
(5) cache module: the cache can be well implemented through simple configuration and design, and the cache can be configured at will
(6) image cache module: when loading images by imageview, it is not necessary to consider the phenomenon of image dislocation when oom and android containers slide quickly in the loading process.
(7) configurator module: it can easily implement the operation of paired configuration. Currently, the configuration file can support Preference and Properties to access the configuration.
(8) log printing module: log printing can be realized quickly and easily, and the extension of log printing is supported. Currently, local printing and console printing for sdcard are supported
(9) downloader module: it can simply realize multi-threaded download, background download, breakpoint continuation, download control, such as start, pause, delete and so on.
(10) network state detection module: check the network state when it changes

6, LoonAndroid

Address of the project: https: / / github com/gdpancheng/LoonAndroid
There are mainly the following modules:
(1) automatic injection framework (only application within the inheritance framework is required)
(2) picture loading framework (multiple caching, automatic recovery, maximum memory security)
(3) network request module (inherits basically all current http requests)
(4) eventbus (integration of an open source framework)
(5) validation framework (integrated open source framework)
(6) json parsing (support parsing into sets or objects)
(7) database (I don't know who wrote it, I forgot)
(8) multi-threaded breakpoint download (automatically judge whether multithreading is supported and whether it is redirected)
(9) automatically update the module
(10) 1 series of tool classes

Among them, volley has been studied in 2013, which is very expandable and has my favorite style. Others, such as android-async-http and Afinal, are also quite good.


Related articles: