Skip to content

Instantly share code, notes, and snippets.

View philipesteiff's full-sized avatar

Philipe Steiff philipesteiff

  • TravelPerk
  • Spain
View GitHub Profile
@philipesteiff
philipesteiff / get_module_names.sh
Created April 10, 2019 16:38
Get feature modules name
#!/usr/bin/env bash
get_module_names() {
array=( $(cat $(pwd)/settings.gradle | grep -o 'feature:[A-z_-]\+') )
for el in ${array[*]}; do
echo $el | grep -o "[A-z_-]\+\$"
done
}
@philipesteiff
philipesteiff / get_module_names.sh
Created April 10, 2019 16:38
Get feature modules name
#!/usr/bin/env bash
get_module_names() {
array=( $(cat $(pwd)/settings.gradle | grep -o 'feature:[A-z_-]\+') )
for el in ${array[*]}; do
echo $el | grep -o "[A-z_-]\+\$"
done
}
@philipesteiff
philipesteiff / RecycleEmptyErrorView.java
Created June 24, 2016 17:58 — forked from henrytao-me/RecycleEmptyErrorView.java
Empty and Error in RecycleView
/*
* Copyright 2015 "Henry Tao <hi@henrytao.me>"
*
* 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
public class FragmentUtils {
public static FragmentTransaction ensureTransaction(final FragmentManager fragmentManager) {
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.setCustomAnimations(R.anim.slide_in_right, R.anim.slide_out_left, R.anim.slide_in_right, R.anim.slide_out_left);
return fragmentTransaction;
}
public static Fragment getFragment(final FragmentManager fragmentManager, final String tag) {
return fragmentManager.findFragmentByTag(tag);
@philipesteiff
philipesteiff / Command.java
Last active September 10, 2015 16:45
LocalBroadcast um pouco mais prático
public interface Command<T extends Parcelable> {
void execute(Context context, T data);
}
[user]
name = <seu_nome>
email = <seu_email>
[color]
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
@philipesteiff
philipesteiff / studio.vmoptions
Created December 28, 2014 00:40
Tunando Android Studio - "/Users/philipesteiff/Library/Preferences/AndroidStudio"
-Xms2560m
-Xmx4500m
-XX:MaxPermSize=5250m
-XX:ReservedCodeCacheSize=960m
-XX:+UseCompressedOops
@philipesteiff
philipesteiff / DrawableAlignedButton
Created April 21, 2014 18:55
Button com texto e leftDrawable alinhado
// http://stackoverflow.com/questions/9968094/android-how-to-create-a-button-with-image-and-text-that-are-both-centred
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.text.TextPaint;
@philipesteiff
philipesteiff / FocusLooserViewPager
Last active August 29, 2015 13:57
Custom ViewPager para Viewpagers aninhados
public class FocusLooserViewPager extends ViewPager {
public FocusLooserViewPager(Context context) {
super(context);
}
public FocusLooserViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
}
@philipesteiff
philipesteiff / gist:5038627
Created February 26, 2013 14:06
[Android] Verifica se existe conexão disponível, retornando TRUE caso haja. Obs: Funciona em smartphone e tablet.
public static boolean isNetworkConnected(Context context){
ConnectivityManager cm = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo network = cm.getActiveNetworkInfo();
if(network != null){
return network.isAvailable();
}
return false;
}