Skip to content

Instantly share code, notes, and snippets.

Gabriele Mariotti gabrielemariotti

Block or report user

Report or block gabrielemariotti

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
gabrielemariotti / README.MD
Last active Mar 28, 2020
How to use the ShapeableImageView.

The Material Components Library introduced with the 1.2.0-alpha03 the new ShapeableImageView.

In your layout you can use:

      app:srcCompat="@drawable/..." />

Then in your code apply the ShapeAppearanceModel to define your custom corners:

gabrielemariotti /
Last active Jan 24, 2019
How to manage the firebase libraries in a multi-module projects

Centralize the firebase libraries dependencies in gradle

ext {
      firebaseVersion = '9.0.0';

      firebaseDependencies = [
              core :         "${firebaseVersion}",
              database :     "${firebaseVersion}",
              storage :      "${firebaseVersion}",
gabrielemariotti /
Last active Feb 20, 2020
How to manage the support libraries in a multi-module projects. Thanks to Fernando Cejas (

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:

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) {
gabrielemariotti /
Last active Apr 3, 2020
A SectionedGridRecyclerViewAdapter: use this class to realize a simple sectioned grid `RecyclerView.Adapter`.

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


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

gabrielemariotti / gist:10716d3a7c0089f3c034
Created Jan 14, 2015
How to customize the MaterialLargeImageCard with a own class (requires cardslib 2.1.+)
View gist:10716d3a7c0089f3c034
//Create a Card, set the title over the image and set the thumbnail
CustomMaterialLargeImageCard card = (CustomMaterialLargeImageCard)
.setTextOverImage("Italian Beaches "+i)
.setTitle("This is my favorite local beach "+i)
.setSubTitle("A wonderful place")
.setupSupplementalActions(R.layout.carddemo_native_material_supplemental_actions_large, actions)
//It is important to use this build method
.build(new CustomMaterialLargeImageCard(getActivity()));
gabrielemariotti /
Last active Mar 6, 2020
How to obtain a CardView (support library) with a Image and rounded corners for API<21
ImageView imageView = (ImageView) findViewById(;
Bitmap mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.rose);
} else {
RoundCornersDrawable round = new RoundCornersDrawable(mBitmap,
getResources().getDimension(R.dimen.cardview_default_radius), 0); //or your custom radius
gabrielemariotti / build.gradle
Created Oct 25, 2014
Gist for cardslib 2.0.0.RC1
View build.gradle
repositories {
//snapshot for rc1
maven { url "" }
dependencies {
//Core card library
compile ''
gabrielemariotti /
Last active Dec 22, 2016
UndoBar with Material Design

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
public class HelperUtil {
private final HelperUtilImpl mImpl;
public HelperUtil (Context context) {
mImpl = new HelperUtilImplL(context);
mImpl = new HelperUtilImplKK(context);
You can’t perform that action at this time.