This library is designed to quickly build a framework for the development of projects and provide more commonly used development tools. You are advised to download it as a dependent library for easy modification. Some functions are only shown in the demo. Please read the demo in detail. (Novice please come in, big god retreat to scatter)…

The following describes the main contents of this library

1. MVP Mode (Variant)

Model: Use Retrofit + OkHttp + RxJava framework

View: the Activity/fragments

Presenter: Executive proxy


1. Inheritance BaseActivity BaseFragment/BaseDialogFragment 2. Create Presenter (optional)Copy the code

The general functions of Base are as follows:

Switch the language 2. Switch the day and night mode 3. Check vertical and horizontal screens 4. Control the RxJava life cycle to prevent memory leaks 7.MVP modeCopy the code

2. Refresh + RecyclerView + Adapter

Refresh the recommended use: SmartRefreshLayout Adapter recommended use: BaseRecyclerViewAdapterHelper, can be directly inherited the objective BaseRVAdapter, more convenient. The SelectedAdapter can be inherited when the selection logic is used.

3. Basic dialogs

BottomListDialog similar BottomSheetDialog, from the bottom of the window selection box LoadingDialog PromptDialog/PromptDialogFragment field loading the boxesCopy the code

4. Common custom View of each foundation

NoScrollViewPager can not slide ViewPager SwipeItemLayout side slide multiple options, similar to QQ ClickImageView can change color shadow ImageView TimerTextView to obtain verification code The countdown to View language processing SquareFrameLayout/SquareLinearLayout available ConstraintLayout insteadCopy the code

5 network load Retrofit + OkHttp + RxJava + Lifecycle

Network loading using Retrofit + OkHttp + RxJava matching scheme, can control the loading box, RxJava life cycle binding, interceptor encryption, data generic parsing.Copy the code

6. Socket communication tool

You can create TCP/UDP connectionsCopy the code

7. Other tools (see files under utils package for details)

1.AppUtil App information, soft keyboard, etc. SPUtil BaseSPManager SharedPreferences Utility class and Management class 3.BitmapUtil 4.ContextUtil Color 5.DisplayUtil ScreenUtil Pixel related 6.EmptyUtil Empty string/array judgment tool 7.ToastUtil toast tool 8.RxPermissionsUtil permission application 9.RegularUtil regularization tool 10.AESUtil, RSAUtil, MD5Util...Copy the code

8. Bluetooth Development (to be updated)

9. Screen adaptation scheme (integrated in base library)

The principle is the same as toutiao adaptation method to use library AndroidAutoSize

Copy the code

Advantages: no invasion, with the use of the close. As long as the layout is written according to the size of the design draft (DP mode, using the unit is DP, SP).

Download the Demo

About template

Two template project localTemplates directory please Copy to AndroidStudio template installation directory path: a dish: AndroidStudio pluginsandroidlibtemplatesactivities installation path. Example: my studio installation path in C: AndroidStudio, find the directory pluginsandroidlibtemplatesactivities, copy in restart sudio can take effectCopy the code

Log Update Log

*2019-2-22 added the Android P HTTP plaintext transmission is restricted video optimization Socket tool class fixed the PromptDialog API caused by the exception of the package name modification notes document *2019-1-11 added the flash screen page, Added WebView general Demo page to the boot page. Modified the package name of Demo to avoid renaming projects. Baselibrary was also modified to optimize Socket tools. Fixed a bug caused by the ToMD5NOKey() method in the MD5Util utility class. *2018-12-9 Simplify MVP mode according to the actual situation, and eliminate tedious Contact. Adjust the framework structure to remove BaseDelegate and add DataBinding usage as examples Increase the AES and RSA encryption algorithm tool * 2018-8-17 update SPUtil the get () method defValue default values cannot be empty RefreshFragment update/RefreshActivity refresh request failure state of the UI automation *2018-8-16 Updated BaseSPManager to add a method to determine whether a new version is available Add screen adaptation solution, The principle is the same as the adaptation method of today's news. The ScreenUtil, BaseActivity and BaseApplication files are modified. Please see article 9 of the document for details TimerTextView: Verification code Countdown View *2018-7-26 ScreenUtil add method getScreenRealWidth() *2018-7-23 Add description document Add template fileCopy the code