mohamedebrahim96 / Whos-in-Space

Ever wondered who's in space? Quickly find out how many astronauts are in space and where they are during their time above Earth. Want to learn more? Simply tap an astronaut's name! who's in space? is now available just by glancing at your watch. Get notifications and quickly see how many people are in space at any time. Oh, and a bonus feature. Tap the number in the watch app to view the 20 most recent images from the feed!
https://play.google.com/store/apps/details?id=com.vacuum.app.whoisinspace
12 stars 3 forks source link

Animation bug #1

Closed gregcabrera422 closed 6 years ago

gregcabrera422 commented 6 years ago

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? :)

mohamedebrahim96 commented 6 years ago

Thanks for reporting the bug

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;
    }