SkillAgentSearch skills...

PreInflater

:8ball: Android 性能优化:布局预加载,提前 AsyncInflater Layout,用于提升布局加载速度

Install / Use

/learn @JarvisGG/PreInflater
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

PreInflater

Platform SDK

Android 性能优化:布局预加载,提前 AsyncInflater Layout,用于提升布局加载速度


|Author|Jarvis| |---|--- |E-mail|yang4130qq@gmail.com


Usage

Step 1:


buildscript {
    repositories {
        // ...
        jcenter()
        maven { url 'https://jitpack.io' }
    }
        
    dependencies {
        // ...
        classpath 'com.github.JarvisGG.PreInflater:buildSrc:1.0-SNAPSHORT'
        classpath "com.jakewharton:butterknife-gradle-plugin:9.0.0"
    }
}

Step2:

apply plugin: 'preinflater-plugin'
apply plugin: 'com.jakewharton.butterknife'

repositories {
    // ...
    maven { url "https://jitpack.io" }
}

dependencies {
    api 'com.github.JarvisGG.PreInflater:annotation:1.0.2-SNAPSHORT'
    annotationProcessor 'com.github.JarvisGG.PreInflater:compiler:1.0.2-SNAPSHORT'
    
    api 'com.github.JarvisGG.PreInflater:library:1.0.2-SNAPSHORT'
}

Step3:

android {
    // ...
    defaultConfig {
        // ...
        javaCompileOptions {
            annotationProcessorOptions {
                arguments = [
                     moduleNameOfPreInflater: 'testmodule1'
                ]
            }
        }
    }
    // ...
}

假如希望对当前 Activity 的加载布局都可以使用预加载,需要在 Activity 加一个 空方法,preinflater-plugin 插件会帮你 hook 这个方法,并替换你的 LayoutInflater

@Override
protected void attachBaseContext(Context newBase) {
}

Tip

star star star !!!!:blush:

LICENSE

This library is under the MIT license. check the LICENSE file for more detail.

Copyright (c) 2019 Jarvis

View on GitHub
GitHub Stars17
CategoryDevelopment
Updated10mo ago
Forks2

Languages

Java

Security Score

67/100

Audited on May 5, 2025

No findings