mgolokhov / dodroid

May the knowledge be with you!
MIT License
20 stars 12 forks source link

ViewPager added to app #18

Closed JayBrizle closed 8 years ago

JayBrizle commented 8 years ago

So ViewPager is only available through the support library for Android. So all references(imports) to Fragments, FragManager, etc had to be changed to android.support.v4.app.* to use the ViewPager. I also added tabs to the pager to add navigation. This is by no means suppose to represent some sort of finished idea but it is at least a visual to see how this navigation would work. The button to replace the main fragment with the questions fragment was commented out along with the replaceFragment method because this does not really work with a paging/swiping navigation the way we have it set up right now. So load up the app on your device and you can swipe between fragments now. There is a dummy third fragment I added called TestFragment just to add one more thing to swipe to while I was developing. Let me know if there is anything wrong with the files added, I was having merge issues on my local master branch but reset my "HEAD" commit to now match your master branch Maxim before I created a new branch to add ViewPager.

JayBrizle commented 8 years ago

We can change things like make the navigation tabs stay at the top of the page and always be visible if we decide to keep a swipe/pager navigation instead of the user only being able to see the current tab and the next one. That would be better navigation then if we are only going to have a few options. We can add an ActionBar menu with an overflow menu, additional navigation drawer(the hamburger icon thing) if needed, etc then if we want.

JayBrizle commented 8 years ago

And just realized I spelled your name wrong Maxim on the first tab in the app ; ) thats whats I get for drinking beers and writing code at the same time.

mgolokhov commented 8 years ago

I thought of endless VeiwPager for quiz, so we can throw away buttons (prev/next) and use swipe.

JayBrizle commented 8 years ago

Ah I see. That's a bit different then. We'll need the FragmentStatePagerAdapter then. The regular FragmentPagerAdapter loads all the frags into memory at once, the state version does not. That will take a bit more work. I will look into implementing it then. We can look into the RecyclerView stuff then too but I will see about getting the ViewPager with a state adapter done first for learning purposes if anything

JayBrizle commented 8 years ago

As I think about it, it might be a waste to put all that effort into implementing the ViewPager that way since there are more efficient ways of doing things now. Maybe just try the RecyclerView route instead since our questions list will become very large

mgolokhov commented 8 years ago

Can not tell for now. Need some more reading.

mgolokhov commented 8 years ago

Here is an old presentation that gives some internals and technics. And a little profile about our candidate.

mgolokhov commented 8 years ago

Modified ViewPager to use FragmentStatePagerAdapter https://github.com/mgolokhov/dodroid/tree/add_viewpager

mgolokhov commented 8 years ago

Playing with RecyclerView. I did not get how to fix focus on one fragment(it is scrolling but not swiping).

mgolokhov commented 8 years ago

I was having merge issues on my local master branch

How to update a GitHub forked repository

JayBrizle commented 8 years ago

Thanks for the link. I have never heard of the rebase command. Github is offering a free course on Git/Github if you didn't see. I am trying to find time to start it myself.