Skip to content

Instantly share code, notes, and snippets.

Avatar
🤒
Out sick

Rany Albeg Wein RanyAlbegWein

🤒
Out sick
View GitHub Profile
@alexfu
alexfu / EqualSpacingItemDecoration.java
Last active Oct 1, 2020
Add equal spacing to RecyclerView items automatically. Can handle horizontal, vertical, and grid display modes
View EqualSpacingItemDecoration.java
import android.graphics.Rect;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
public class EqualSpacingItemDecoration extends RecyclerView.ItemDecoration {
private final int spacing;
private int displayMode;
public static final int HORIZONTAL = 0;
@cesarferreira
cesarferreira / RxJava.md
Last active Jan 8, 2020
Party tricks with RxJava, RxAndroid & Retrolambda
View RxJava.md

View Click

Instead of the verbose setOnClickListener:

RxView.clicks(submitButton).subscribe(o -> log("submit button clicked!"));

Filter even numbers

Observable
    .just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
@nickbutcher
nickbutcher / 1 search_bar.xml
Last active Sep 15, 2020
Demonstrating morphing a search icon into a search field. To do this we use an AnimatedVectorDrawable (https://developer.android.com/reference/android/graphics/drawable/AnimatedVectorDrawable.html) made up of two paths. The first is the search icon (as a single line) the second is the horizontal bar. We then animate the 'trimPathStart' property …
View 1 search_bar.xml
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project
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
@MarsVard
MarsVard / README
Last active Jun 22, 2020
android drawable to imitate google cards.
View README
put card.xml in your drawables directory, put colors.xml in your values directory or add the colors to your colors.xml file.
set the background of a view to card,
as you can see in card.xml the drawable handles the card margin, so you don't have to add a margin to your view
``` xml
<View
android:layout_width="fill_parent"
You can’t perform that action at this time.