Making home page: https://github.com/hss01248

Top priorities:

So whatever third party library you’re using, you’re going to have to wrap another layer of YOUR own API and you’re not going to have to use the API of the third party library, right

The log print

Best practices for a log library are:

  • I can print to logcat, and I can print to a file
  • Print all objects, and print them easily for viewing: arrays, collections, JSON, XML, HTML, Java Objects, and Android-specific objects
  • No need to pass in the tag, can automatically get
  • Stack information, and clicking can jump directly to the corresponding class
  • Thread information
  • Object inheritance and properties
  • – Support for string.format concatenation of strings

The contestants

  • Logger: The oldest and forerunner of the log world,7600+star, can’t print collections and arbitrary objects, has many improved libraries, such as LogDelegate
  • Timber is a file, is the upper API package, the bottom layer only provides to print to logcat implementation, print to the file needs to implement their own interface. You can use this to design the top-level API in your own app
  • Logback – Android Logback implementation on Android, XML configuration. No, I haven’t
  • XLog 1300STAR, all expected functionality, and 0 dependencies
  • LogUtils 600 + star, all expected features are available, relying on OKio
  • KLog: 1400+ STAR, not as rich as xlog

Log print demo contrast see: https://github.com/hss01248/TestTools

Final choice

In summary, the winning player is LogDelegate, and TIMBER can be used as a reference for re-encapsulation of the in-app API. Or you could just wrap it up.

Network request

The goal I want to achieve is to make a configuration call to the API chain against the interface document, and a request is done. I don’t want to remember the classes and annotations in the specific framework, and I don’t even want to get involved in the complex content of HTTP protocol, such as cache control -> I can choose the cache mode into a few int values, I don’t want to consider the request header and response header when using it. In a word, dumb-ass use. So, from that perspective, Retrofit is not a good choice.

Okhttp + chuck to okhttp encapsulation: https://github.com/hss01248/HttpUtilForAndroid: I spend most of the energy to maintain a library of depth with the consideration of the characteristics of the android platform when using cool to fly up.

https://github.com/jeasonlzy/okhttp-OkGo a lot of people use, is also a fool.

https://github.com/jgilfelt/chuck through interceptors got the request and response information, then displayed in a single activity is caught in application

tool

  • Mock request: Postman (need to go to chrome store to download and install) or Fiddler
  • Phone/computer grab: Fiddler.
  • Apk in-app packet capture: Chuck
  • HTTPS packet capture: Fiddler latest version + Fiddler certificate generation plug-in
  • Weak network simulation: Fiddler simulates low ADSL speeds, but not TCP packet loss
  • Log printing: LoggingInterceptor

Image to load

Including ordinary picture a larger load and load, and a larger wheel, as well as pictures of some of the special effects, such as rounded corners, rounded, gaussian blur, and so on. https://github.com/hss01248/ImageLoader Based on Glide and Fresco packaging, this library implements special effects common to images. Optimized the sumsamplingImageView large image rotation, so that the rotation memory is always maintained at the level of 20M. Configure all chained API calls

Local image selection, cropping, compression

System intent is homebred ROM do not use, various compatibility bugs, must use https://github.com/hss01248/PhotoOut framework using chain API on several excellent open source libraries, thus on the whole process.

https://github.com/crazycodeboy/TakePhoto/ this star has a lot of, also is the entire process together.

The UI of presentation

toast:

Toasty: https://github.com/hss01248/Toasty toast with state, have succes. The error, warn, info, five kinds of normal, and debug a popup) (only in debug mode.

dialog :

DialogUtil: https://github.com/hss01248/DialogUtil includes all common general-purpose dialog, both ios and android style. An ios style dialog can be displayed without an activity reference. https://github.com/saiwu-bigkoo/Android-AlertView

notification

Chain NotifyUtil: https://github.com/hss01248/NotifyUtil API calls, get rid of the difficult of native API. Encapsulates common notification patterns.

Must-use UI widgets

Selector:

https://github.com/Bigkoo/Android-PickerView

There’s a built-in date and time selector, there’s a lot of UI customization and there’s a level 3, level 2, level 1 linkage selector

https://github.com/gzu-liyujiang/AndroidPicker

A variety of rich built-in selectors: including date selector, time selector, single selector, city address selector, plate number selector, number selector, constellation selector, zodiac selector, color selector, file selector, directory selector, etc

https://github.com/yangxu4536/MeiTuanLocateCity Meituan city selection interface, can be directly used in actual project

An alphabetical sorting library, https://github.com/Bigkoo/EasySideBar has good city encapsulate data, style of copy Meituan, can be customized.

Multi-condition filter menu

https://github.com/dongjunkun/DropDownMenu similar Meituan iQIYI ticket drop-down menu

Coupon effect

https://github.com/dongjunkun/CouponView

Shuffling figure

https://github.com/glassLake/AndroidImageSliderByFresco for the first time into the fast scroll two bugs

https://github.com/saiwu-bigkoo/Android-ConvenientBanner

https://github.com/youth5201314/banner Android advertising pictures of different models, shuffling controls, support an infinite loop and a variety of topics, you can set by style, animation, shuffling and switch time, location, and image loading frame!

Quick grouping sidebar

https://github.com/saiwu-bigkoo/Android-QuickSideBar https://github.com/CaMnter/EasyRecyclerViewSidebar https://github.com/gjiazhe/WaveSideBar

Label the picture

https://github.com/saiwu-bigkoo/Android-PictureTagView

Rolling scale

https://github.com/LichFaker/ScaleView

The plus and minus sign controls the increase and decrease of numbers

https://github.com/saiwu-bigkoo/Android-SnappingStepper

Advertising popups

https://github.com/yipianfengye/android-adDialog features

Status bar color change/transparent status bar/immersion

  • SystemBarTint old library, but not updated for a long time, Huawei mobile phone status bar will have a translucent API encapsulation, simplified use: statusBarutil.java
  • ImmersionBar high degree of customization, scene rich 3.6K SATR
  • StatusBarCompat Full transparency 1.7K STAR
  • Status-bar-compat transparent 500+ STAR
  • StatusBarUtil Translucent 5.6K STAR

File download

By focusing on https://github.com/lingochamp/FileDownloader file download all kinds of advanced features. This method is suitable for projects that have high requirements on file download services

The database

Good greendao too difficult to use, or ormlite. https://github.com/j256/ormlite-android https://github.com/Raizlabs/DBFlow this API design more elegant

Database debugging method: without root. In the browser directly view and by means of the HTTP request database operation, fast and convenient at https://github.com/amitshekhariitbhu/Android-Debug-Database

Page State Management

https://github.com/hss01248/PageStateManager I for my own use, based on the company’s foreign libraries to improve https://github.com/arieridwan8/pageloader https://github.com/weavey/LoadingLayoutDemo

Tool library

This no doubt is the tall, whole library: https://github.com/Blankj/AndroidUtilCode

Rx buckets

Why isn’t Retrofit? Because its API is too hard to use. The design is beautiful, but the use of too many pits, and cumbersome.

RxAndroid

Lets you switch threads at will

RxBinding

Get rid of the annoyance of repeated operations caused by frequent clicks

RxLifecycle

Life cycle management to reduce memory leaks

RxPermissions

6.0 Runtime permissions

Rx Preferences

SharedPreferences are accessed using RxJava

onactivityResult

https://github.com/VictorAlbertos/RxActivityResult will receive the result code and open the activity together on, cohesive sense is very strong, and can be converted into observables.

Keyboard monitor

Keyboard listening is one of android’s biggest bugs. To prevent automatic pop-up keyboard: add android activity tag: windowSoftInputMode = “stateHidden | stateAlwaysHidden”

https://github.com/yshrsmz/KeyboardVisibilityEvent

Network change event monitoring

https://github.com/pwittchen/NetworkEvents

Screen adaptation

https://github.com/hongyangAndroid/AndroidAutoLayout

UI effects

shadows

https://github.com/wangjiegulu/ShadowViewHelper 1.0.4 effect is not stable, suggest using 1.0.2.

There are always some compatibility issues with third-party libraries, but the most reliable one is drawable: check this out: shadow.xml

Water ripple effect

https://github.com/traex/RippleEffect click after produce water ripple, compatible to api9 added: found in huawei tablet will collapse…

animation

https://github.com/florent37/ViewAnimator A fluent Android animation library API packages simplify use

https://github.com/airbnb/lottie-android parses Adobe After Effects animations exported as json with Bodymovin and renders them natively on mobile

https://github.com/lgvalle/Material-Animations

Loading animation

https://github.com/race604/WaveLoading : provides a wave loading animation as a Drawable. That is, it can be set to any view as the background

Change skin theme

A key to https://github.com/hongyangAndroid/ChangeSkin in the skin

https://github.com/garretyoder/Colorful at any time can dynamically modify the theme color code, liberated from the constraints of the XML

Play textView out of shape

The animation of the https://github.com/thoughtbot/stencil appear gradually

Files are cache related

https://github.com/vincentbrison/dualcache This android library provide a cache with 2 layers, one in RAM in top of one disk.

https://github.com/baoyongzhang/Treasure Very easy to use wrapper library for Android SharePreferences

content-provider

https://github.com/EverythingMe/easy-content-providers

Extensions to native components

edittext

https://github.com/rengwuxian/MaterialEditText https://github.com/bufferapp/BufferTextInputLayout An extension to TextInputLayout in the Design package

Native EditText works differently on different Android versions and should never be used.

  • You can use AppCompatEditText in the AppCompat package,
  • Or use TextInputEditText in the Design package.
  • If the UI is your own, use TextInputLayout+TextInputEditText directly, various prompts UI, display hidden passwords, basic verification are integrated. Easy to use, see here :TextInput details · Material Design Part 1

button

Write so many selector that really bores me to death, and use this one instead: https://github.com/niniloveyou/StateButton

viewpager

https://github.com/Devlight/InfiniteCycleViewPager

No sliding left or right

@Override
    public boolean onTouchEvent(MotionEvent event) {
        return this.isCanScroll && super.onTouchEvent(event);
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent event) {
        return this.isCanScroll && super.onInterceptTouchEvent(event);
    }
Copy the code

Four pages are internally recycled when the page type is the same

https://github.com/AlexMofer/RecyclePagerAdapter

The shape and the selector

It’s too cumbersome to write XML, so let’s just use Java code: define shape/selector in code

Listview and recycleview

https://github.com/CymChad/BaseRecyclerViewAdapterHelper’s support for multi-type so-so? https://github.com/EvilBT/SherlockAdapter

https://github.com/WuXiaolong/PullLoadMoreRecyclerView less customization, quick learning https://github.com/hongyangAndroid/baseAdapter hon the great god Open source LayoutManager for Android RecyclerView

Dynamic LinearLayout or scrollView nested listView

  • Using encapsulated dynamic LinearLayout: ListViewLinearLayout
  • Or use the encapsulated universal Adapter: all-base Adapter

The drop-down refresh

See that summary: https://github.com/android-cjj/BeautifulRefreshLayout

Third party sharing and login, statistics

Use umENG’s SDK and then wrap another layer see 3rd Party Login/Share Best Practices wrap one yourself: https://github.com/hss01248/UmengUtil to share umeng, third-party login and statistics of the API encapsulation, avoid again API changes substantially the full source code. Note: Some of the best practices above have not been integrated into this library, so far only qq, Weixin, Sina integration of three.

Third-party push

Integrated third-party push best practice in a word, Xiaomi ROM with Xiaomi push, other friends push, more detailed, can also be Huawei ROM with Huawei push open source library: OnePush

Permission to apply for

Permission to apply for suspension under 6.0 a window, and judgment: https://github.com/hss01248/FloatWindowPermission 6.0 above, the runtime permissions, also including the floating window permissions, read and write and sd card authority (the runtime, but huawei mobile phones and tablet requirement) : RxPermissions: https://github.com/tbruyelle/RxPermissions

Qr code scanning

Basically all are based on Z-XING encapsulation

BGAQRCode-Android I use this barcodescanner which is also recommended by many people

Audio recording and playback

Audio recording

Cross-platform MP3 format, of course:

https://github.com/hss01248/AndroidMP3Recorder

AndroidMP3Recorder based on start the most project improvements, has withstood a practical online project two years of test characteristics: recording side to code, pause can be broadcast, method security, callback rich,6.0 permissions are also adapted

Audio playback

Mediaplayer is killing you, isn’t it? Path Settings for many ROMs do not recognize each other. Unsafe operation methods, all kinds of anomalies. It’s all wrapped for you:

https://github.com/hss01248/SafeMediaPlayer

Video related

Short video recording and playing:

Third-party Qupai already charges 50,000 yuan a year, which is a bit expensive. The following is one of the better ones in open source, but without special effects.

https://github.com/mabeijianxi/small-video-record

There is a charge for special effects, such as this one. There are filters during recording, post-recording textures, and music.

https://github.com/rdsdk/rdVideoEditSDK-for-Android

Video playback

  • Vitamio supports multiple formats, high stability, high performance, powerful features and low development difficulty. Free for personal use, charge for commercial use. But, has stopped updating. https://github.com/yixia/VitamioBundle
  • Ijkplayer at present domestic the most fire, bilibili open source. https://github.com/Bilibili/ijkplayer is based on the abundant function of ijk encapsulation library: https://github.com/CarGuo/GSYVideoPlayer ijk based interface encapsulation: (as a rich) on https://github.com/jjdxmashl/jjdxm_ijkplayer

bluetooth

FastBle https://github.com/Jasonchenlijian/FastBle

The camera is compatible with taking pictures and videos

Android camera compatibility problem is very big, if just take pictures, try to call the system camera, if you need to preview and take video stream, then can be based on this open source library development:

  • https://github.com/google/cameraview for a long time not updated
  • https://github.com/wonderkiln/CameraKit-Android slow, poor compatibility
  • https://github.com/Fotoapparat/Fotoapparat opened the crash, a bug
  • https://github.com/natario1/CameraView good compatibility, responsive
  • https://github.com/florent37/CameraFragment view there is no good, what kind of fragments, bad review
  • https://github.com/hujiaweibujidao/cameraview based on Google/cameraview modify, corresponding to the blog

Finally suggested use: https://github.com/natario1/CameraView

Build a lightweight HTTP server on Android

The org.apache. HTTP package is used to parse HTTP related information, and then write severlet itself.

https://github.com/yanzhenjie/AndServer

Process to keep alive

After comparing github’s several star libraries, we finally chose HelloDaemon, which is an improvement on the other two libraries.

Related theoretical articles: Research and practice of Android process survival (2) —- details the use of Android system mechanism survival means

  • HelloDaemon: Good preservation and callback handling
  • MarsDaemon can’t start itself even if it allows it to
  • AndroidDaemonService cannot start from itself even if it is allowed

Code optimization

Findbugs + PMD plugin + configuration CheckStyles (standard code format) + alibaba check plugin code See https://juejin.cn/post/6844903471288680456

Channel packaging

  • 360 reinforcement treasure: fast, will also add some of 360’s own statistics function
  • Packer-ng-plugin: Claims to be the next generation Android packaging tool, 100 channel packages in 10 seconds. But I haven’t actually used it

Crash Log Statistics

To avoid collapse Use https://github.com/jenly1314/NeverCrash, but the code later some logic to think about Log statistics: Tencent bugly, or youmeng statistics.360 reinforcement can also choose the log statistics function, real-time send rather than the next send, than youmeng to complete some

Apk updates and hot fixes

yourself

You can build your own server, write background management APK version, and provide API for detecting new version and downloading new version, app side check version number, download APK, verify MD5, and install. https://github.com/hss01248/ApkUpdater

Hot Update: Tinker configuration is a bit cumbersome

Take advantage of Bugly’s update and hotfix features

Register an account, integrate SDK, and configure it according to the document. It is relatively simple. Recommended. Its hot repair is through tinker SDK + management background document: https://bugly.qq.com/docs/user-guide/instruction-manual-android-hotfix/

Cloud storage

  • Seven niuyun: the cloud picture processing function is really niubi on the sky. There was also a utility class wrapped around their API :QiniuUtils
  • Ali Cloud: see API documentation, there are some cloud processing functions, but I have not actually used them. Has it ever worked? Say that see

Debugging Tools

Code intrusion type:

Direct network and database debugging on stetho Web requires init in onCreate of Application. For network, add an interceptor to okHTTP.

Network caught

https://github.com/jgilfelt/chuck by adding okhttp interceptor way to get the request and response information, then displayed on a single activity on the phone, don’t need and computer networking, json formatted, very clear

Database debugging

Android-debug-database Is similar to stetho’s Database view function. It is also on the Web and needs to be connected to a computer.

The inasieness

Network caught

  • Packet capture tool – Packet Capture Create a VPN on the mobile phone and import the certificate. Can capture all mobile PHONE HTTP and HTTPS traffic. However, the JSON file is not formatted.

  • PC – Fiddler requires the mobile phone and computer to be on the same LAN (difficult to achieve). An agent is set on the mobile phone and the computer can surf the Internet as an agent. Note that HTTPS packet capture requires the installation of a certificate creation plug-in. The built-in creation tool has a bug, and the certificate created is not recognized by the system.

View the top-level activity

https://github.com/hss01248/DemoCollections/tree/master/ViewDebugHelper mobile global view the top-level activity.

Some really cool tricks

This is a summary of the methods, classes, and interfaces you’ve come across in Android development that you’ve never seen before: android-tricks-cn corelink

Summary of tools to improve development efficiency

Android Siege Lion – Full set of essential Magic tools (development, plugins, efficiency)

The following is not a technical selection, just a memo

Several fully integrated rapid development frameworks – learning coding skill

https://github.com/meikoz/Basic https://github.com/minggo620/Pluto-Android

Others summed up the open source project package

https://github.com/Tim9Liu9/TimLiu-Android https://github.com/Lafree317/ShareAndroidResource https://github.com/limedroid/XDroid/wiki https://github.com/aritraroy/UltimateAndroidReference

Save Instance automation

android-state 600+ star SaveState 100 + star

System intent to open some resource

android-intents