View README.md

Centralize the firebase libraries dependencies in gradle

ext {
      firebaseVersion = '9.0.0';

      firebaseDependencies = [
              core :         "com.google.firebase:firebase-core:${firebaseVersion}",
              database :     "com.google.firebase:firebase-database:${firebaseVersion}",
              storage :      "com.google.firebase:firebase-storage:${firebaseVersion}",
View README.md

Centralize the support libraries dependencies in gradle

Working with multi-modules project, it is very useful to centralize the dependencies, especially the support libraries.

A very good way is to separate gradle build files, defining something like:

root
  --gradleScript
  ----dependencies.gradle
View ColoredSnackBar.java
public class ColoredSnackBar {
private static final int red = 0xfff44336;
private static final int green = 0xff4caf50;
private static final int blue = 0xff2195f3;
private static final int orange = 0xffffc107;
private static View getSnackBarLayout(Snackbar snackbar) {
if (snackbar != null) {
View README.md

You can use this class to realize a simple sectioned grid RecyclerView.Adapter without changing your code.

Screen

The RecyclerView has to use a GridLayoutManager.

This is a porting of the class SimpleSectionedListAdapter provided by Google

If you are looking for a sectioned list RecyclerView.Adapter you can take a look here

View gist:10716d3a7c0089f3c034
//Create a Card, set the title over the image and set the thumbnail
CustomMaterialLargeImageCard card = (CustomMaterialLargeImageCard)
CustomMaterialLargeImageCard.with(getActivity())
.setTextOverImage("Italian Beaches "+i)
.setTitle("This is my favorite local beach "+i)
.setSubTitle("A wonderful place")
.useDrawableId(R.drawable.sea)
.setupSupplementalActions(R.layout.carddemo_native_material_supplemental_actions_large, actions)
//It is important to use this build method
.build(new CustomMaterialLargeImageCard(getActivity()));
View MainActivity.java
ImageView imageView = (ImageView) findViewById(R.id.card_thumbnail_image);
Bitmap mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.rose);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
//Default
imageView.setBackgroundResource(R.drawable.rose);
} else {
//RoundCorners
RoundCornersDrawable round = new RoundCornersDrawable(mBitmap,
getResources().getDimension(R.dimen.cardview_default_radius), 0); //or your custom radius
View build.gradle
repositories {
mavenCentral()
//snapshot for rc1
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
dependencies {
//Core card library
compile 'com.github.gabrielemariotti.cards:cardslib-core:2.0.0-RC1-SNAPSHOT'
View Readme.md

These layouts provide a simple undo bar with Material Design.

This gist does not contain any Android L API.

undobar with action undobar mobile
Screen Screen
View HelperUtil.java
public class HelperUtil {
private final HelperUtilImpl mImpl;
public HelperUtil (Context context) {
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) {
mImpl = new HelperUtilImplL(context);
} else if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
mImpl = new HelperUtilImplKK(context);
View HelperUtil.java
public class HelperUtil {
public static HelperUtilBase getInstance(Context context) {
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) {
return new HelperUtilL(context);
} else if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
return new HelperUtilKK(context);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
return new HelperUtilJB(context);