Builder Bundle for activities, fragments, services for Android
Field binding for Android bundle which uses annotation processing (@BindExtra).
Smoothy is inspired of Butterknife By @JakeWharton
class SecondActivity extends Activity {
@BindExtra String username;
@BindExtra(optional = true) int count; // required by default
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.simple_activity);
SmoothyBundle.bind(this);
// TODO Use fields...
}
}
class FirstActivity extends Activity {
public void displaySecondActivity() {
// SecondActivityBuilder is generated by Smoothy with @BindExtra
// required field in constructor
// optional field in setter name
Intent intent = new SecondActivityBuilder("mslimani")
.count(10000)
.build(this);
startActivity(intent);
}
}
Optimisation, unit test
Download via Gradle:
buildscript {
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}
apply plugin: 'com.neenbedankt.android-apt'
dependencies {
compile 'com.github.mslimani:smoothy:1.0.5'
apt 'com.github.mslimani:smoothy-compiler:1.0.5'
}
Copyright 2015 Mehdi Slimani
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.