super.onCreate(savedInstanceState);
setContentView(R.layout.view_layers);
setupList(R.id.list1);
setupList(R.id.list2);
setupList(R.id.list3);
getWindow().getDecorView().postDelayed(new Runnable() {
@Override
public void run() {
final View leftList = findViewById(R.id.list1);
final View middleList = findViewById(R.id.list2);
final View rightList = findViewById(R.id.list3);
final ObjectAnimator moveRight = ObjectAnimator.ofFloat(leftList,
"x", 0, rightList.getLeft());
moveRight.setDuration(1500);
moveRight.setRepeatCount(ObjectAnimator.INFINITE);
moveRight.setRepeatMode(ObjectAnimator.REVERSE);
final ObjectAnimator moveLeft = ObjectAnimator.ofFloat(rightList,
"x", rightList.getLeft(), 0);
moveLeft.setDuration(1500);
moveLeft.setRepeatCount(ObjectAnimator.INFINITE);
moveLeft.setRepeatMode(ObjectAnimator.REVERSE);
final ObjectAnimator rotate = ObjectAnimator.ofFloat(middleList,
"rotationY", 0, 360);
rotate.setDuration(3000);
rotate.setRepeatCount(ObjectAnimator.INFINITE);
rotate.setRepeatMode(ObjectAnimator.REVERSE);
Paint p = new Paint();
p.setColorFilter(new PorterDuffColorFilter(0xffff0000, PorterDuff.Mode.MULTIPLY));
Paint p2 = new Paint();
p2.setAlpha(127);
Paint p3 = new Paint();
p3.setColorFilter(new PorterDuffColorFilter(0xff00ff00, PorterDuff.Mode.MULTIPLY));
leftList.setLayerType(View.LAYER_TYPE_SOFTWARE, p);
leftList.setAlpha(0.5f);
middleList.setLayerType(View.LAYER_TYPE_HARDWARE, p3);
middleList.setAlpha(0.5f);
middleList.setVerticalFadingEdgeEnabled(true);
rightList.setLayerType(View.LAYER_TYPE_SOFTWARE, p2);
moveRight.start();
moveLeft.start();
rotate.start();
((View) leftList.getParent()).setAlpha(0.5f);
}
}, 2000);