Skip to content

Instantly share code, notes, and snippets.

View rubenpla-develop's full-sized avatar

Ruben Pla Ferrero rubenpla-develop

  • Barcelona, Spain.
View GitHub Profile
/*
* 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
/*
* 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
/*
* Copyright (C) 2006 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
@rubenpla-develop
rubenpla-develop / WebviewArticlePresenter.java
Created September 12, 2016 14:45 — forked from rupertbates/WebviewArticlePresenter.java
Work out the maximum scroll extent of an Android WebView
int maxScrollExtent = (int) ((mOverlayTop.getContentHeight() * mOverlayTop.getScale()) - mOverlayTop.getHeight());
@rubenpla-develop
rubenpla-develop / introrx.md
Created December 26, 2017 16:51 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@rubenpla-develop
rubenpla-develop / TmdbApi.kt
Last active May 23, 2019 01:38
#Kotlin #Android Retrofit2 singleton instance sample
package rubenpla.develop.privtmdbendlesslist.data.api
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.http.GET
import retrofit2.http.Query
import rubenpla.develop.privtmdbendlesslist.data.model.MoviesResultsItem
interface TmdbApi {
@rubenpla-develop
rubenpla-develop / AutoCompleteTextViewWithDelay.kt
Last active March 2, 2018 10:51
CUstom view based on AutoCompleteTexview, with automatic delay and progress bar included. #Kotlin #CustomView #Android
package rubenpla.develop.autocompletetextview_sample
import android.annotation.SuppressLint
import android.content.Context
import android.os.Handler
import android.os.Message
import android.util.AttributeSet
import android.view.View
import android.widget.AutoCompleteTextView
import android.widget.ProgressBar
@rubenpla-develop
rubenpla-develop / ScaleToFitWHTransformation.java
Created May 14, 2018 22:12 — forked from jpardogo/ScaleToFitWHTransformation.java
Resize a bitmap respecting the aspect radio. I use a custom transformations with Picasso library. This transformation calculate the new dimension of the bitmap scaling it to fit a specific width or height that we pass as a parameter (usually the biggest size of the imageView where we wanna set the bitmap).
public class ScaleToFitWidthHeightTransform implements Transformation {
private int mSize;
private boolean isHeightScale;
public ScaleToFitWidthHeightTransform(int size, boolean isHeightScale){
mSize =size;
this.isHeightScale = isHeightScale;
}
@rubenpla-develop
rubenpla-develop / EncryptionKeyStore.java
Created October 15, 2018 16:08 — forked from mgiaccone/EncryptionKeyStore.java
Securely generate and store Realm (or any other) encryption key with Android Keystore (API 18+)
package com.ubiqueworks.android.security;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.security.KeyPairGeneratorSpec;
import android.security.keystore.KeyGenParameterSpec;
import android.security.keystore.KeyProperties;
@rubenpla-develop
rubenpla-develop / KoinJavaUtils.kt
Created October 24, 2018 16:35 — forked from fredy-mederos/KoinJavaUtils.kt
Koin java utility functions to inject components and properties in java classes.
package com.common.utils
import org.koin.KoinContext
import org.koin.standalone.StandAloneContext
import kotlin.jvm.internal.Reflection
/**
* @author @fredy_mederos
*/