Instantly share code, notes, and snippets.

View RxBackPressure.kt
package com.jaynewstrom.rx
import io.reactivex.Flowable
import io.reactivex.Scheduler
import io.reactivex.schedulers.Schedulers
import org.junit.Test
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicLong
View TouchEffectAnimator
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.animation.Animation;
import android.view.animation.DecelerateInterpolator;
View CoundowTextBuilder.java
StringBuilder sb = new StringBuilder();
if (secondsRemaining >= 3600) { // over and hour
long hours = secondsRemaining / 3600;
secondsRemaining %= 3600;
sb.append(hours);
sb.append(":");
if (secondsRemaining < 60) {
sb.append("00:"); // we will skip the minutes stuff, so add it here.
}
}
View ListAdapter.java
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.BaseAdapter;
View README.md

Origionally based off: https://gist.github.com/ignasi/8420671

Setup

chmod +x resizer_xxxhdpi.sh

copy resizer_xxxhdpi.sh to res/drawable-xxxhdpi/resizer_xxxhdpi.sh

Usage

Start with the image you want to resize, we'll call it resize_me.png (remember, android resources can't have caps, or dashes)

View StickyListActivity.java
public class StickyListActivity extends Activity {
@InjectView(R.id.fl_sticky_header_holder) FrameLayout stickyHeaderHolder;
@InjectView(R.id.list_view) ListView listView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.activity_sticky_list);
Butterknife.inject(this);
View HeaderAdapter.java
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;