Skip to content

Instantly share code, notes, and snippets.

View sergibc's full-sized avatar

sergibc

View GitHub Profile
@sergibc
sergibc / RootDetectionUtils.java
Created July 18, 2016 08:44
Util class to detect when the device is rooted using more than one methods.
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
/**
* Class to detect when the device is rooted
*/
public class RootDetectionUtils {
@sergibc
sergibc / DensityUtils.java
Last active May 10, 2016 09:07
Class with util methods about screen size and density
/**
* Class with util methods about screen size and density
*/
public class DensityUtils {
/**
* Converts the given device independent pixels (DIP) value into the corresponding pixels
* value for the current screen.
*
* @param context Context instance
@sergibc
sergibc / StringUtils.java
Created May 6, 2016 09:22
String utils methods to check if a string is contained inside another string or list of strings with case insensitive
/**
* This method is used to search a string in a list of strings with case insensitive
*
* @param search text to search
* @param list list of string where to search
*
* @return true if it is contained in the list
*/
public static boolean stringListContainsCaseInsensitive(String search, List<String> list) {
boolean contains = false;
@sergibc
sergibc / .gitignore
Created March 14, 2016 11:47
Git ignore file to add in the root of the project and in all of the modules.
###Android###
# built application files
*.apk
*.ap_
# files for the dex VM
*.dex
# Java class files
@sergibc
sergibc / OpenAppUtils.java
Last active March 14, 2016 14:55
Class to open an installed application or launch the Play Store to download it.
import com.tempos21.android.commons.utils.T21Log;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
public class OpenAppUtils {
@sergibc
sergibc / smartphone_compatible_screens.xml
Last active February 10, 2016 17:32
compatible-screens tag to release an app only for smartphones and for tablet. Remember be care with the permissions as well.
<compatible-screens>
<!-- small size screens -->
<screen
android:screenDensity="mdpi"
android:screenSize="small"/>
<screen
android:screenDensity="hdpi"
android:screenSize="small"/>
<screen
android:screenDensity="xhdpi"
@sergibc
sergibc / 0_reuse_code.js
Created December 4, 2015 15:37
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console