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
@rubenpla-develop
rubenpla-develop / README.md
Created May 14, 2020 09:14 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@rubenpla-develop
rubenpla-develop / README.md
Created May 14, 2020 09:14 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

Hiding API keys in local.properties

  1. Add the API key to your local.properties file:
apiKey=<value>
  1. Add to the root level of your app-level build.gradle file:
/**
* (C) Copyright 2018 Paulo Vitor Sato 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
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
# https://docs.fastlane.tools/actions
#
# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane
@rubenpla-develop
rubenpla-develop / KeyboardUtils.java
Created February 12, 2019 15:00 — forked from lopspower/KeyboardUtils.java
Force Hide Keyboard Android
import android.app.Activity;
import android.content.Context;
import android.graphics.Rect;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
public class KeyboardUtils {
public static void hideKeyboard(Activity activity) {
View view = activity.findViewById(android.R.id.content);
@rubenpla-develop
rubenpla-develop / IRealmCascade.java
Created October 30, 2018 15:21
Realm Delete Cascade
/**
2) Add interface to your project. If your Realm object implement this interface all child objects will be deleted
after call deleteCascade. If interface not implemented this function delete Realm object but don't delete child objects.
*/
public interface IRealmCascade {
}
@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
*/
@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 / 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;
}