New View/Activity/Fragment animation
private void setupAnimation(View view) {
if (view.getViewTreeObserver().isAlive()) {
ViewTreeObserver observer = view.getViewTreeObserver();
observer.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
if (view.getViewTreeObserver().isAlive()) {
view.setY(view.getHeight());
view.animate().translationY(0).setDuration(1000).start();
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
view.getViewTreeObserver().removeGlobalOnLayoutListener(this);
} else {
view.getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
}
}
});
}
}
Output test failures to the console instead of needing to navigate to the test report. Super helpful when running on Travis or similar CI system (outside of android
block):
// Show full stack trace in the console
tasks.withType(Test) {
testLogging {
exceptionFormat "full"
}
}