Skip to content

Instantly share code, notes, and snippets.

View GulajavaMinistudio's full-sized avatar
:octocat:
Memperbaiki dunia dengan kode kodean

Gulajava Ministudio GulajavaMinistudio

:octocat:
Memperbaiki dunia dengan kode kodean
View GitHub Profile
@GulajavaMinistudio
GulajavaMinistudio / OkHttp3Stack.java
Created January 25, 2016 06:18
Implementasi Okhttp 3.x sebagai lapisan transportasi di Volley
import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.toolbox.HttpStack;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.ProtocolVersion;
import org.apache.http.StatusLine;
import org.apache.http.entity.BasicHttpEntity;
import org.apache.http.message.BasicHeader;
@GulajavaMinistudio
GulajavaMinistudio / gist:ad07947b316113e40daa
Created February 5, 2016 02:35 — forked from alexwen/gist:4b337bc669509a696b5b
OkHttp Observable Callback
public Observable<FilesWrapper> download(List<Thing> things) {
return Observable.from(things)
.flatMap(thing -> {
File file = new File(getExternalCacheDir() + File.separator + thing.getName());
if (file.exists()) {
return Observable.just(file);
}
Request request = new Request.Builder().url(thing.getUrl()).build();
@GulajavaMinistudio
GulajavaMinistudio / JacksonJrConverter.java
Created February 10, 2016 02:11
Jackson Jr Converter class
package gulajava.cekkoinbits.internetan.jrconverters;
import com.fasterxml.jackson.jr.ob.JSON;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Converter;
@GulajavaMinistudio
GulajavaMinistudio / JacksonJrRequestBodyConverter.java
Created February 10, 2016 02:12
Jackson Jr Request Body Converter Class
import com.fasterxml.jackson.jr.ob.JSON;
import java.io.IOException;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import retrofit2.Converter;
public class JacksonJrRequestBodyConverter<T> implements Converter<T, RequestBody> {
private static final MediaType MEDIA_TYPE = MediaType.parse("application/json; charset=UTF-8");
@GulajavaMinistudio
GulajavaMinistudio / JacksonJrResponseArrayConverter.java
Created February 10, 2016 02:13
JacksonJrResponseArrayConverter class for converting JSON Array json
import com.fasterxml.jackson.jr.ob.JSON;
import java.io.IOException;
import java.util.List;
import okhttp3.ResponseBody;
import retrofit2.Converter;
/**
* Created by Gulajava Ministudio on 1/26/16.
@GulajavaMinistudio
GulajavaMinistudio / JacksonJrResponseConverter.java
Created February 10, 2016 02:13
JacksonJrResponseConverter class for converting JSON to JSON Object
import com.fasterxml.jackson.jr.ob.JSON;
import java.io.IOException;
import okhttp3.ResponseBody;
import retrofit2.Converter;
public class JacksonJrResponseConverter<T> implements Converter<ResponseBody, T> {
protected final JSON _jr;
protected final Class<T> _type;
@GulajavaMinistudio
GulajavaMinistudio / proguard-rules.pro
Created February 10, 2016 08:16 — forked from kosiara/proguard-rules.pro
RxJava RxAndroid Proguard rules
#build.gradle
#
# compile 'io.reactivex:rxandroid:1.0.1'
# compile 'io.reactivex:rxjava:1.0.14'
# compile 'io.reactivex:rxjava-math:1.0.0'
# compile 'com.jakewharton.rxbinding:rxbinding:0.2.0'
# rxjava
-keep class rx.schedulers.Schedulers {
public static <methods>;
@GulajavaMinistudio
GulajavaMinistudio / Readme.md
Created February 28, 2016 07:12 — forked from gabrielemariotti/Readme.md
A SimpleSectionedRecyclerViewAdapter: use this class to realize a simple sectioned `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.

The RecyclerView should use a LinearLayoutManager. You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)

This is a porting of the class SimpleSectionedListAdapter provided by Google

Screen

Example:

@GulajavaMinistudio
GulajavaMinistudio / DividerItemDecoration.java
Created March 9, 2016 11:26 — forked from alexfu/DividerItemDecoration.java
An ItemDecoration that draws dividers between items. Pulled from Android support demos.
/*
* Copyright (C) 2014 The Android Open Source Project
*
* 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
@GulajavaMinistudio
GulajavaMinistudio / OkHttp3Stack.java
Created April 20, 2016 02:04 — forked from alashow/OkHttp3Stack.java
An OkHttp backed HttpStack for Volley (okhttp3 version)
/**
* The MIT License (MIT)
*
* Copyright (c) 2015 Circle Internet Financial
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is