Giter VIP home page Giter VIP logo

Comments (10)

heinrichreimer avatar heinrichreimer commented on July 19, 2024

I can't reproduce this behavior on my devices. Which library version and which device are you using?

from material-intro.

AkshayChordiya avatar AkshayChordiya commented on July 19, 2024

I'm using SNAPSHOT of material-intro.

​Regards
,
​Akshay Chordiya

On Mon, Mar 7, 2016 at 8:11 PM, Heinrich Reimer [email protected]
wrote:

I can't reproduce this behavior on my devices. Which library version and
which device are you using?


Reply to this email directly or view it on GitHub
#20 (comment)
.

from material-intro.

Maxr1998 avatar Maxr1998 commented on July 19, 2024

For me, it doesn't show the startup two times, but he is right with recreation. The FragmentManager normally cares about retaining Fragments, etc. This is broken with this library, which means Fragments are recreated each rotation, and that wastes power and CPU cycles.

I think it will be pretty difficult adding proper fragment retaining support, but it will be worth it ;D

from material-intro.

Maxr1998 avatar Maxr1998 commented on July 19, 2024

Fun fact: if you rotate the device, the Fragments get recreated, but onCreateView doesn't get called, means permissionGranted is false, and doesn't get true, means you can't go forward anymore after rotation.

from material-intro.

Maxr1998 avatar Maxr1998 commented on July 19, 2024

Sadly, my fix doesn't fix the problem of my last comment. So we definitely need to rewrite the IntroActivity for proper instance saving and restoring support.

from material-intro.

heinrichreimer avatar heinrichreimer commented on July 19, 2024

I switched from using FragmentPagerAdapter to using FragmentStatePagerAdapter in e6fe290. This should keep Fragments in memory. I have to look into restoring pager position though.

from material-intro.

heinrichreimer avatar heinrichreimer commented on July 19, 2024

The main issue is that the displayed Fragment is the old one loaded from FragmentManager and the code that checks if users are allowed to go to the next page is the new one returned because onCreate() gets called on IntroActivity

from material-intro.

heinrichreimer avatar heinrichreimer commented on July 19, 2024

We could either try to detect if an old but matching Fragment is already existing in FragmentManager in SlideAdapter.addSlide(). But that would require us to save a unique ID with every Slide which I don't like as it's extra effort for developers implementing this library ...
... or we simply don't use Fragment retaining at all but instead create every Fragment again after an orientation change. That's not a problem in particular as the fragments used in an intro won't be very complicated and thus the recreation process would not take too much time...

from material-intro.

heinrichreimer avatar heinrichreimer commented on July 19, 2024

(Accidentially closed the issue. Sorry for that!)

from material-intro.

heinrichreimer avatar heinrichreimer commented on July 19, 2024

Finally found a solution for the first approach without requiring an ID. Needs some polishing and will be a breaking change so stay tuned for a fix soon.

from material-intro.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.