Skip to content

Instantly share code, notes, and snippets.

@ryanamaral
ryanamaral / PaddingItemDecoration.java
Created May 25, 2015 15:18
RecyclerView.ItemDecoration implementation for equal padding between the list items except first and last items.
/**
* ItemDecoration implementation for equal padding between the list items except first and last items.
* @author Ryan Amaral
* @version 1.0
*/
public class PaddingItemDecoration extends RecyclerView.ItemDecoration {
private int mPaddingPx;
private int mPaddingEdgesPx;
@duncandee
duncandee / RoboActionBarActivity.java
Created August 5, 2013 05:50
RoboActionBarActivity for AppCompact.
public class RoboActionBarActivity extends ActionBarActivity implements RoboContext {
protected EventManager eventManager;
protected HashMap<Key<?>, Object> scopedObjects = new HashMap<Key<?>, Object>();
@Inject
ContentViewListener ignored; // BUG find a better place to put this
@Override
protected void onCreate(Bundle savedInstanceState) {
@jieyu
jieyu / AndroidViewInvalidation.md
Created March 9, 2013 21:24
Describe how View.invalidate() is processed in Android to refresh a widget.

How View.invalidate() is processed in Android

This document is based on the code of android-4.1.1_r6 (Jelly Bean).

First, the invalidate() call will be propagated back to the root of the view hierarchy. During the propagation, the system determines the dirty area that needs to be redrawn. The propagation will eventually reach ViewRootImpl.

frameworks/base/core/java/android/view/View.java

10219   void invalidate(boolean invalidateCache) {

... ...