This article is designed to document handy plug-in/utility dependencies during Android development

  • Practical rely on
      • Snackbar
      • PercentFrameLayout
      • LeakCancry
      • OpeningStartAnimation
      • MPAndroidChart
      • DataBinding
      • BaseQuickAdapte
  • Easy to use plug-in
      • Android Drawable Preview

      • Plug-in 2: Translate

      • Lifecycle Sorter

      • Plug-in 4: CodeGlance

      • Android Postfix Completion

      • Plug-in six: WakaTime

      • Seven: plug-in GsonFormatPlus

      • Plug-in 8: ScreenMatch

      • JsonToKotlin

      • Alibaba java Coding Guideline

Practical rely on

Dependency 1: Snackbar

AndroidX bringing dependent: implementation ‘com. Google. Android. Material: material: 1.2.1’

Usage:

 Snackbar.make(viewDataBinding.getRoot(), "Don't you dare touch me?", Snackbar.LENGTH_SHORT)
                .setAction("The point he!".new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Toast.makeText(DataBindingActivity.this."How comfortable!",
                                Toast.LENGTH_SHORT).show();
                    }
                }).show();
Copy the code

Practical dependency renderings (1.1):


Relying on two: PercentFrameLayout

Android Percentage Layout (AndroidX support)

Depends on three: LeakCancry

Memory leak detection debugImplementation ‘com. Squareup. Leakcanary: leakcanary – android: 2.5’

[Bug Mc-10898] – Add dependencies after Androix, debug will prompt memory leaks

Memory leak code:

// There is a leak here
    public  void test(a) {
        new Thread(new Runnable() {
            @Override
            public void run(a) {
                while (true) {
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }).start();
    }
Copy the code

Turn on the screen rotation, and rotate the screen rapidly and continuously, so that the thread keeps executing, and there is no time for GC collection, resulting in memory leaks.

\

Memory leak, refer to documentation

Note: Declaration cycles are created repeatedly while scrolling!


Dependency 4: OpeningStartAnimation

Android boot practical animation

Android boot animation


Rely on five: MPAndroidChart: v3.0.3

Chart (multiple lines can be set)

Add warehouse maven {url} “jitpack. IO” / / add more curves depend on implementation ‘com. Making. PhilJay: MPAndroidChart: v3.0.3’

MPAndroidChart reference documentation

(Test effect):

Depends on six: DataBinding

Android official data Binding (save the findViewById() step)

DataBinding Reference documentation

Rely on seven: BaseQuickAdapter

Universal Adapter for RecyclerView (Simplified Adapter)

BaseQuickAdapter Reference documentation

Easy to use plug-in

Android Drawable Preview

To download the plugin: File -> Settings -> Pulgins -> Android Drawable Preview

Before using the plugin, the image looks like this:

\

After use :\

\

As you can see, the image is displayed on the left, which makes it easy to view the image without clicking on it


Plug-in 2: Translate

File -> Settings -> Pulgins -> Translate

Select Alt +C to translate 🙁Alt +C is my own shortcut)



Modify shortcut keys:


Lifecycle Sorter

Automatically sort Activity/Fragment Lifecycle file -> Settings -> Pulgins -> Lifecycle Sorter

Shortcut keys :Ctrl + Alt + K


Plug-in 4: CodeGlance

The code on the right shows File -> Settings -> Pulgins -> CodeGlance

Android Postfix Completion

Follow the suffixes to quickly complete the code File -> Settings -> Pulgins -> Android Postfix Completion

Images from the Internet:


Plug-in six: WakaTime

File -> Settings -> Pulgins -> WakaTime

Simple understanding: download this plug-in on AS, enter the key of the official website, then log in the official website, you can see your learning history on the official website!

Official login (it is bound to GitHub and can also log in to GitHub)

Step 1: Login account:

The second step: Select your tool :(I use Android Studio)

The third stepYou can get the key directly from the API key.

The first time you restart Android Studio after downloading the plugin, it will ask you to fill in this key. Just copy it!

Step 4: Check the details


Plugin 7: GsonFormatPlus

File -> Settings -> Pulgins -> GsonFormatPlus Json -> Entity class

Plugin “GsonFormat” is incompatible (supported only in IntelliJ IDEA)

Plugin “GsonFormat” not compatible (only supported in IntelliJ IDEA)

Shortcut key: CTRL + S


Plug-in 8:ScreenMatch

File -> Settings -> Pulgins -> ScreenMatch

A dimens. XML file is now prepared in the values folder by default

Baidu web disk download

Extraction code: TR80

Then click ScreenMatch anywhere in the directoryUse:

Plug-in 9: JsonToKotlin

File -> Settings -> Pulgins -> JsonToKotlin quickly generates the KotlinBean class

Shortcut key Alt + K


Alibaba Java Coding Guideline

File -> Settings -> Pulgins -> Alibaba Java Coding Guideline

Demonstration:




Enable/disable detection: