This file contains hidden or 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 wisnu on 13/01/2017. | |
*/ | |
public class Rumah { | |
private String kamarMandi; | |
private String ruangTamu; | |
private String tempatTidur; | |
//variabel opsional | |
private String kolamRenang; |
This file contains hidden or 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 wisnu on 13/01/2017. | |
*/ | |
public class Rumah { | |
private String kamarMandi; | |
private String ruangTamu; | |
private String tempatTidur; | |
//optional parameter | |
private String garasi; | |
private String kolamRenang; |
This file contains hidden or 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 static void main(String[] args) { | |
Rumah rumah1 = new RumahBuilder("KM","RT", "TD") | |
.setGarasi("GR").setKolamRenang("KR").build(); | |
Rumah rumah2 = new RumahBuilder("KM","RT", "TD") | |
.setGarasi("GR").build(); | |
Rumah rumah3 = new RumahBuilder("KM","RT", "TD") | |
.build(); | |
} |
This file contains hidden or 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 wisnu on 14/01/2017. | |
*/ | |
public class DataRepo { | |
@SerializedName("login") | |
String login; | |
@SerializedName("contributions") | |
int contributions; |
This file contains hidden or 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 wisnu on 14/01/2017. | |
*/ | |
public class DataSearch { | |
@SerializedName("items") | |
List<Item> items; | |
public List<Item> getItems() { | |
return items; | |
} |
This file contains hidden or 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 wisnu on 14/01/2017. | |
*/ | |
public class Item { | |
@SerializedName("full_name") | |
String repoName; | |
@SerializedName("url") | |
String url; |
This file contains hidden or 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 wisnu on 12/01/2017. | |
* Ini buat endpoint | |
*/ | |
public interface ServiceApi { | |
@GET("/repos/{owner}/{repo}/contributors") | |
Call<List<DataRepo>> contributors( | |
@Path("owner") String owner, | |
@Path("repo") String repo | |
); |
This file contains hidden or 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 wisnu on 12/01/2017. | |
*/ | |
public class ClientApi { | |
public static final String API_BASE_URL = "https://api.github.com"; | |
private static OkHttpClient.Builder httpClient = new OkHttpClient.Builder(); | |
private static Retrofit.Builder builder = | |
new Retrofit.Builder() |
This file contains hidden or 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 wisnu on 12/01/2017. | |
*/ | |
public class Test { | |
public static void main(String... args) { | |
ServiceApi client = ClientApi.createService(ServiceApi.class); | |
Call<List<DataRepo>> call = client.contributors("vmg", "redcarpet"); | |
Call<DataSearch> call1 = client.searching("jadwalsholat", "stars"); |
This file contains hidden or 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 Pager<I, O> { | |
private static final Observable FINISH_SEQUENCE = Observable.never(); | |
private PublishSubject<Observable<I>> pages; | |
private Observable<I> nextPage = finish(); | |
private Subscription subscription = Subscriptions.empty(); | |
private final PagingFunction<I> pagingFunction; | |
private final Func1<I, O> pageTransformer; |
OlderNewer