Skip to content

Instantly share code, notes, and snippets.

View eduardb's full-sized avatar

Eduard-Cristian Boloș eduardb

View GitHub Profile
@eduardb
eduardb / keybase.md
Created April 7, 2020 13:55
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 August 25, 2015 09:53
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
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 April 4, 2018 08:40
Uploading a file with a progress displayed using Apache's HttpClient
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 May 26, 2023 00:07
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;