This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Retrofit Interface | |
@GET("/group/{id}/users") | |
List<User> groupList(@Path("id") int groupId); | |
// Chamada ao Endpoint com retorno em JSON | |
RestAdapter restAdapter = new RestAdapter.Builder() | |
.setEndpoint("https://api.github.com") | |
.setRequestInterceptor(requestInterceptor) | |
.build(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@GET("/user/{id}/photo") | |
Observable<Photo> getUserPhoto(@Path("id") int id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class House implements Parcelable { | |
private Integer rooms; | |
private String color; | |
protected House(Parcel in) { | |
rooms = in.readByte() == 0x00 ? null : in.readInt(); | |
color = in.readString(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def myVar = {String str, int num -> println "$str : $num" } | |
//execute closure | |
myVar('age', 30) | |
#output: age : 30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task myTask { | |
println "Configuration stage" // Configuration stage | |
doLast { | |
println "Execution stage" // Execution stage | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
repositories { | |
jcenter() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:1.2.3' | |
} | |
} | |
allprojects { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!- activity_main.xml -> | |
<android.support.v7.widget.RecyclerView | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
android:id="@+id/recycler_view" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:padding="8dp" | |
android:clipToPadding="false"/> | |
<!- item.xml -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by andersonl on 6/18/15. | |
*/ | |
public class GridLettersAdapter extends RecyclerView.Adapter<Letter> { | |
char[] alphabet = "abcdefghijklmnopqrstuvwxyz".toCharArray(); | |
private List<String> letters; | |
public GridLettersAdapter() { | |
int count = alphabet.length; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends ActionBarActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view); | |
recyclerView.setLayoutManager(new GridLayoutManager(this, 3)); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by andersonl on 6/18/15. | |
*/ | |
public class GridDecoration extends RecyclerView.ItemDecoration { | |
private int margin; | |
public GridDecoration(Context context) { | |
margin = context.getResources().getDimensionPixelSize(R.dimen.item_margin); | |
} |
OlderNewer