Closed gregcabrera422 closed 6 years ago
i have solve it in the last commit small changes in the code
private ScreenShotable replaceFragment(Resourceble slideMenuItem,ScreenShotable screenShotable, int topPosition) {
view = findViewById(R.id.content_frame);
int finalRadius = Math.max(view.getWidth(), view.getHeight());
SupportAnimator animator = ViewAnimationUtils.createCircularReveal(view, 0, topPosition, 0, finalRadius);
animator.setInterpolator(new AccelerateInterpolator());
animator.setDuration(ViewAnimator.CIRCULAR_REVEAL_ANIMATION_DURATION);
findViewById(R.id.content_overlay).setBackgroundDrawable(new BitmapDrawable(getResources(), screenShotable.getBitmap()));
animator.start();
Fragment fragment = null;
switch (slideMenuItem.getName()){
case TAG_HOME:
fragment = FragmentOne.newInstance();
getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, fragment ).commit();
return (ScreenShotable) fragment;
case TAG_NOTIFICATIONS:
fragment = FragmentTwo .newInstance();
getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, fragment ).commit();
return (ScreenShotable) fragment;
case TAG_SETTINGS:
fragment= FragmentThree .newInstance();
getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, fragment ).commit();
return (ScreenShotable) fragment;
case TAG_ABOUT:
fragment = AboutFragment.newInstance();
getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, fragment).commit();
return (ScreenShotable) fragment;
default:
break;
}
return (ScreenShotable) fragment;
}
There's a minor issue when switching fragments, the layout goes back to the very first fragment when the animation happens. For example, when clicking from fragment 3 to fragment 4; in the animation it seemed like you clicked from fragment 1 to fragment 4. Is there a way to fix this? :)