This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void remove(final TodoItem item, final TodoItemAdapterCallback callback, | |
final int adapterPosition) { | |
final ValueAnimator elevateAnimator = ValueAnimator.ofFloat(1f, 1.05f); | |
elevateAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { | |
@Override public void onAnimationUpdate(ValueAnimator animation) { | |
float animatedValue = (float) animation.getAnimatedValue(); | |
ViewCompat.setTranslationZ(cardTodo, animatedValue); | |
ViewCompat.setScaleX(cardTodo, animatedValue); | |
ViewCompat.setScaleY(cardTodo, animatedValue); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void onSelected() { | |
int index = new Random().nextInt(rotationAngles.length); | |
ValueAnimator elevateAnimator = ValueAnimator.ofFloat(1f, 1.03f); | |
elevateAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { | |
@Override public void onAnimationUpdate(ValueAnimator animation) { | |
float animatedValue = (float) animation.getAnimatedValue(); | |
ViewCompat.setScaleX(cardTodo, animatedValue); | |
ViewCompat.setScaleY(cardTodo, animatedValue); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import rx.Observable; | |
import rx.Subscriber; | |
import rx.Subscription; | |
import rx.functions.Action0; | |
import rx.subjects.PublishSubject; | |
import rx.subjects.SerializedSubject; | |
/** | |
* An object reference of EventBus |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import rx.Observable; | |
import rx.Subscriber; | |
import rx.Subscription; | |
import rx.functions.Action0; | |
import rx.subjects.PublishSubject; | |
import rx.subjects.SerializedSubject; | |
/** | |
* An object reference of EventBus |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.concurrent.TimeUnit; | |
import rx.Observable; | |
import rx.Scheduler; | |
import rx.Subscriber; | |
import rx.functions.Action0; | |
import rx.functions.Action1; | |
import rx.schedulers.Schedulers; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class KeyboardObserver implements ViewTreeObserver.OnGlobalLayoutListener { | |
public interface Callback { | |
void onKeyboardVisible(); | |
void onKeyboardHidden(); | |
} | |
WeakReference<View> view; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Custom Scroll listener for RecyclerView. | |
* Based on implementation https://gist.github.com/ssinss/e06f12ef66c51252563e | |
*/ | |
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener { | |
public static String TAG = "EndlessScrollListener"; | |
private int previousTotal = 0; // The total number of items in the dataset after the last load | |
private boolean loading = true; // True if we are still waiting for the last set of data to load. | |
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more. |