Skip to content

Commit

Permalink
feat (doc) : mise à jour du readme & de la javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
mslimani committed Nov 17, 2015
1 parent 59e1fd9 commit 6662ed4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 13 deletions.
21 changes: 10 additions & 11 deletions README.md
Expand Up @@ -11,7 +11,7 @@ Smoothy is inspired of [Butterknife][0] By [@JakeWharton][1]
```java
class SecondActivity extends Activity {
@BindExtra String username;
@BindExtra int count;
@BindExtra(optional = true) int count; // required by default

@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -29,9 +29,11 @@ class FirstActivity extends Activity {

public void displaySecondActivity() {
// SecondActivityBuilder is generated by Smoothy with @BindExtra

Intent intent = new SecondActivityBuilder()
.username("mslimani")


// required field in constructor
// optional field in setter name
Intent intent = new SecondActivityBuilder("mslimani")
.count(10000)
.build(this);

Expand All @@ -41,12 +43,9 @@ class FirstActivity extends Activity {
}
```

Next Steps for v1.0.5
Next Step v1.0.6
--------
- Add optional fields
- Add default value
- Add @BindExtra for others types : SparseArray, List<String>, BooleanArray, ByteArray, CharArray, DoubleArray, IntArray, StringArray, IBinder

Optimisation, unit test

Download
--------
Expand All @@ -63,8 +62,8 @@ buildscript {
apply plugin: 'com.neenbedankt.android-apt'
dependencies {
compile 'com.github.mslimani:smoothy:1.0.4'
apt 'com.github.mslimani:smoothy-compiler:1.0.4'
compile 'com.github.mslimani:smoothy:1.0.5'
apt 'com.github.mslimani:smoothy-compiler:1.0.5'
}
```

Expand Down
20 changes: 18 additions & 2 deletions smoothy-annotations/src/main/java/smoothy/BindExtra.java
Expand Up @@ -9,8 +9,24 @@
@Target(ElementType.FIELD)
public @interface BindExtra {

/**
* @return true field in constructor builder else in setter name
*/
boolean optional() default false;
String value() default "";
//String defaultValue() default ""; // not implemented

/**
* <blockquote><pre>
* {@code
* class MyActivity extends Activity {
* @BindExtra(value = "intValue", optional = true) public int mInt;
* }
*
* Intent intent = MyActivityBuilder()
* .intValue(2)
* .build();
* }
* </pre></blockquote>
* @return default name for field in builder and setter name
*/
String value() default "";
}

0 comments on commit 6662ed4

Please sign in to comment.