Generate inflater classes for view binding, store them and easy to access.
First, add the pump-gradle-plugin plugin to your project's root build.gradle file:
buildscript {
repositories {
google()
jcenter()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.1"
classpath "com.shenghaiyang.pump:pump-gradle-plugin:4.0.1-r1-SNAPSHOT"
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}
}
Then, apply the Gradle plugin and add these dependencies in your app/build.gradle file:
apply plugin: 'com.android.application'
apply plugin: 'com.shenghaiyang.pump'
dependencies {
implementation "com.shenghaiyang.pump:pump:4.0.1-r1-SNAPSHOT"
}
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityMainBinding mainBinding = Pump.inflate(ActivityMainBinding.class, getLayoutInflater());
setContentView(mainBinding.getRoot());
}
}
- incremental support
Copyright 2020 shenghaiyang
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.