Skip to content

Instantly share code, notes, and snippets.

public class ImageFlipper{
private static final int START_ANGLE = 90;
private static final int END_ANGLE = 270;
private int animationDuration = 800;
private ObjectAnimator flipObjectAnimator;
public ImageFlipper(final View targetView, final int[] drawableResources){
((ImageView)targetView).setImageResource(drawableResources[0]);
flipObjectAnimator = ObjectAnimator.ofFloat(targetView, "rotationY", START_ANGLE, END_ANGLE);
public class MyFragment {
boolean loaded;
private void maybeLoad() {
if (!loaded && getUserVisibleHint()) {
loaded = true;
loadMyData();
}
}
@Override
/*
* Copyright 2014 Chris Banes
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software