Rany Albeg Wein

Creating a custom CoordinatorLayout Behavior

1. Intro

Trust me, it's not as complicated as it might first look like. You either drink too much coffee, or need to take your face off of the screen for a while.

A CoordinatorLayout is this thing:

public class CoordinatorLayout extends ViewGroup implements NestedScrollingParent { ... } 

from the support library ( compile . . .

Read More

September 27, 2017

Writing a basic RecyclerView.Adapter

and how it is similar to a typical getView() implementation

In my previous article, ListView and ViewHolder, I discussed about the ViewHolder pattern and how it should be combined to be a part of an adapter for a ListView, or more specifically - a part of an adapter's getView() method.
We had a simple model named Profile, which describes some basic information of a person. It has an image, a name . . .

Read More

December 02, 2016

ListView and ViewHolder

Enhance ListView's performance to reduce strain from the UI thread

One of the main concerns an Android developer should have is reducing strain from the main thread, also known as the UI thread.

ListView is one of the most common views in Android and it is important to know how to write a fast adapter for it. One of the ways to enahnce your ListView performance is by using a ViewHolder pattern.

Assume we . . .

Read More

November 25, 2016


Not very fancy and nothing that you can't write yourself in several minutes or so, EmailCompletionEditText is a helpful component I wrote for a project I'm currently working on.
Just a simple EditText that will help you type in some Email accounts in a CSV format.


A drop-down list will open while you're typing and will help you . . .

Read More

January 25, 2016


A standard AutoCompleteTextView, but a bit nicer

What can be nice about an AutoCompleteTextView ?

  • It tells you whether the user selected an item from its drop down list, or simply typed some text ignoring auto-complete suggestions.
  • It will performFiltering(CharSequence,int) immediately onTouchEvent(MotionEvent).
  • It is available for download in this Gist :-)

Yes, instead you can . . .

Read More

December 24, 2015


A helper class for handling RecyclerView's click events

At the time of writing this article, there is no support for RecyclerView's long-item-click event.
In a need to detect and capture such an event, I decided to create RecyclerViewItemTouchListener, and recently extended it to support single and double click events.
RecyclerViewItemTouchListener wraps a GestureDetector and uses it to detect . . .

Read More

December 22, 2015