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 / 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 / CountingFileRequestBody.java
Created December 13, 2015 09:25 — forked from eduardb/CountingFileRequestBody.java
Uploading a file with a progress displayed using OkHttp
public class CountingFileRequestBody extends RequestBody {
private static final int SEGMENT_SIZE = 2048; // okio.Segment.SIZE
private final File file;
private final ProgressListener listener;
private final String contentType;
public CountingFileRequestBody(File file, String contentType, ProgressListener listener) {
this.file = file;
/*
* Copyright 2014 Chris Banes
*
* 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

Simple RecyclerView Divider

Simple Horizontal Divider Item Decoration for RecyclerView

    mRecyclerView.addItemDecoration(new SimpleDividerItemDecoration(
            getApplicationContext()
    	));

NOTE: Add item decoration prior to setting the adapter