/** Merge the given PageFloatyFox into the primary. */ private void mergeFloater(final PageFloatyFox newFloater) { // Get location of primary. int[] primaryLocation = new int[2]; primaryFloatyFox.getLocationOnScreen(primaryLocation); AnimationUtils.convertToLayoutSpaceForView(primaryLocation, primaryFloatyFox); OverlayAnimation translation = OverlayAnimation.TransformTo(newFloater, 500, primaryLocation[0], primaryLocation[1]); translation.addListener( new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { // Upon reaching the primary, vanish. newFloater.destroy(); } }); translation.start(); }
/** Spawn the persistent "primary" floating fox, if it doesn't already exist. */ private void spawnPrimaryFox() { if (primaryFloatyFox == null) { primaryFloatyFox = new PrimaryFloatyFox(context, windowManager); primaryFloatyFox.show(); } }