Skip to content

Instantly share code, notes, and snippets.

Avatar

Eduard-Cristian Boloș eduardb

  • Wave Mobile Money
  • Barcelona
  • Twitter @EdyBolos
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am eduardb on github.
  • I am eduardcb (https://keybase.io/eduardcb) on keybase.
  • I have a public key ASDa-r3vz_hG8xFfpAHG1AvluchNlQDjmg8YfBcdOZwKWQo

To claim this, I am signing this object:

@eduardb
eduardb / ContextCompat.java
Created Aug 25, 2015
Helper class to conveniently get a handle to a system-level service by class, similar to android.content.Context#getSystemService(Class)} that was introduced in API level 23
View ContextCompat.java
package com.deveddy.contextcompat;
import android.annotation.SuppressLint;
import android.app.ActivityManager;
import android.app.AlarmManager;
import android.app.DownloadManager;
import android.app.KeyguardManager;
import android.app.NotificationManager;
import android.app.SearchManager;
import android.app.UiModeManager;
@eduardb
eduardb / CustomMultiPartEntity.java
Last active Apr 4, 2018
Uploading a file with a progress displayed using Apache's HttpClient
View CustomMultiPartEntity.java
public class CustomMultiPartEntity implements HttpEntity
{
private final ProgressListener progressListener;
private HttpEntity mHttpEntity;
public CustomMultiPartEntity(ProgressListener progressListener, HttpEntity httpEntity)
{
this.progressListener = progressListener;
mHttpEntity = httpEntity;
@eduardb
eduardb / CountingFileRequestBody.java
Last active Sep 22, 2022
Uploading a file with a progress displayed using OkHttp
View CountingFileRequestBody.java
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;