Skip to content

Instantly share code, notes, and snippets.

View renanferrari's full-sized avatar
🏴‍☠️

Renan Ferrari renanferrari

🏴‍☠️
View GitHub Profile
@renanferrari
renanferrari / CheckableImageView.java
Last active May 2, 2018 23:01
A checkable ImageView for Android
import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v7.widget.AppCompatImageView;
import android.util.AttributeSet;
import android.widget.Checkable;
public class CheckableImageView extends AppCompatImageView implements Checkable {
private boolean checked;
private boolean broadcasting;
@renanferrari
renanferrari / README.md
Created February 20, 2018 17:24 — 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.

All hex value from 100% to 0% alpha:

Unless specified otherwise, all of the below tinting applies to both Lollipop and pre-Lollipop using AppCompat v21.
To use the support version of these attributes, remove the android namespace.
For instance, "android:colorControlNormal" becomes "colorControlNormal".
These attributes will be propagated to their corresponding attributes within the android namespace
for devices running Lollipop. Any exceptions to this will be noted by including the "android:" prefix.
All Clickable Views:
-----------
@renanferrari
renanferrari / dumpapp-example.md
Created January 24, 2018 16:19
Stetho dumpapp example
@renanferrari
renanferrari / RxFirebaseUtils.java
Created November 29, 2016 12:41
RxFirebaseUtils
public class RxFirebaseUtils {
public static <T> Observable<T> observeTask(final Task<T> task) {
return Observable.<T>create(subscriber -> RxHandler.assignOnTask(subscriber, task)).observeOn(
Schedulers.io());
}
public static Observable<List<DataSnapshot>> join(final DatabaseReference keysRef,
final DatabaseReference objectsRef) {
return RxFirebaseDatabase.observeValueEvent(keysRef)
@renanferrari
renanferrari / SmsReceiver.java
Created October 21, 2015 02:08
SmsReceiver for Android
public class SmsReceiver extends BroadcastReceiver {
public static final String SMS_RECEIVED_ACTION = "android.provider.Telephony.SMS_RECEIVED";
private static final String KEY_PDUS = "pdus";
@Override public void onReceive(final Context context, final Intent intent) {
if (getActionFromIntent(intent).equals(SMS_RECEIVED_ACTION)) {
final Intent smsServiceIntent = new Intent(context, SmsService.class);
smsServiceIntent.putExtra(SmsService.KEY_SMS, getSmsFromIntent(intent));
@renanferrari
renanferrari / .gitignore
Created September 19, 2015 15:45
Android .gitignore
# Built application files
*.apk
*.ap_
*.jar
# Do not remove ('app' = app's module name)
!gradle/wrapper/gradle-wrapper.jar
!app/libs/**/*.jar
# Files for the dex VM
@renanferrari
renanferrari / two_line_item_layout.xml
Last active July 7, 2020 17:03
Android Material Design List Item Layouts (based on http://stackoverflow.com/a/27661786/518179)
<!-- Clickable and selectableItemBackground are optional -->
<RelativeLayout
android:id="@+id/two_line_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:clickable="true"
android:minHeight="72dp"
android:paddingEnd="?listPreferredItemPaddingRight"
android:paddingLeft="?listPreferredItemPaddingLeft"