Curiosity Down/Up Swipe Animation & Fragments Populating Based On posts date - android

** in a nutshell: i want the scroll animation as shown in the gif, when the user swipes down/up it goes directly to the item, and its like a fling animation.
For the Date fragments, i guess its a horizontal Recyclerview.
What am looking as an answer is, a code example of the scroll animation, and a way to do the date thing, where i can auto populate the fragments based on the dates.
I've asked before about this and wmy question was not that clear. this app includes a swipe down/up style.
When u swipe down or up, the app doesnt let you swipe like a normal Scrollview, instead from the first touch (up for example) it navigates you to the next post.
Important note is the post/item in full size (item layout match_parent ?).
Also, every post has a date, and the app includes a calendar, when you swipe left or right, you navigates to dates and based on dates you get the posts.
What i want, hints or ways to do something like this. i'd love to provide a code but i've tried to draw the way up in my mind but couldn't think in of a logical way.
For fragments, i guess they're taking the now date, and the oldest date in the post, and based on that they're making (looping) fragments, each fragment has to load a posts based on the date (query to the API which gives date as param?).
Anyway, here's a GIF of the app which explains what im talking about. Im going to setup a bounty for this question, as im eager to achieve such a feature like this in my app.
https://gfycat.com/JadedMenacingAmericanalligator

I have not tried this by myself but I would like to help may be this will do the work
First use this library for the vertical scrolling one at a time
https://github.com/lsjwzh/RecyclerViewPager
or may be this one
https://github.com/castorflex/VerticalViewPager
or may be use the pagersnaphelper of v7 support library like this
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
SnapHelper snapHelper = new PagerSnapHelper();
snapHelper.attachToRecyclerView(recyclerView);
and for the horizontal scrolling you can use these libraries may be if you apply little bit of logic you will achieve it.
https://medium.com/#ali.muzaffar/looping-infinite-viewpager-with-page-indicator-in-android-ce741f25702a
https://github.com/antonyt/InfiniteViewPager
Changing ViewPager to enable infinite page scrolling
let me know if it works.

Related

Android: How can I create a RecyclerView where I can freely drag and drop an item to do certain things?

I am facing a tricky task where I have a horizontal RecyclerView where the user should be able to grab the first item and freely move it. If he drops it in two certain areas, it will be added into the other two lists respectively.
Here is a diagram for the explicit task:
Basically the user can only grab the first item and then choose to drop it inside favourite list or add it in the disliked list. The move should be 100% free and follow the user's finger on the screen. If the item gets dropped halfway between the original middle list and one of the top or bottom list, but closer to the result list, the item should then have a smooth animation towards the other list with some sort of interpolation [This is an important part, the animation should be very smooth to the point that the card gets on the final position].
I have never done anything like it, only have a little experience with MotionLayout but I know that's not of use in this example. At first glance, I expect that this can be done with DragEvents but I have no idea where to start. Any help or examples to teach me how to do this?
Could you please take a look on https://github.com/davideas/FlexibleAdapter
Fast and versatile Adapter for RecyclerView which regroups several features into one library to considerably improve the user experience

Stop user scroll to set position on RecyclerView

So I've got a problem, i'm quite new to android programming, it's been only 6-8 weeks since i've started programming android apps so i may be blind and not see the easy answer but here's my problem:
I'm making a school project and i'm trying to develop a similar calendar to the one in Today's Calendar split view (The one below here)
So i've made a RecyclerView with a GridLayoutManager that looks like this:
And up until here everything's fine, but i'm trying to implement the button that sets the calendar on today's date, the thing is that when i'm scrolling with a fling and then set the RecyclerView position with scrollToPositionWithOffset(position, 0); the view keeps the momentum gained from the first fling, sets the position and then keeps on scrolling until the momentum is gone
I've searched a lot to find a solution, when i was using gridView instead of RecyclerView i used smoothScrollToPositionFromTop() which stopped the scrolling and then the setSelection() to position it, but the gridView skipped frames and i had to change, here with RecyclerView there is no smoothScrollToPositionFromTop and smoothScrollToPosition doesn't stop the scroll, neither does scrollToPosition or scrollToPositionWithOffset.
found this but doesn't help Scroll RecyclerView to show selected item on top
and many others that didn't help.
I considered implementing my own scrolling logic but when i looked into it my head exploded and i wouldn't know where to begin.
Does anyone know how to solve this?
Did you know that RecyclerView has a stopScroll() method to stop a scroll in progress?

What's the difference between HorizontalScrollView & ViewPager?

I'm new programming in Android and i have many doubts about what type of classes can i use in my first app.
I want to do a level menu like cut the rope or angry birds. Only a title and a slider menu.
I think that can do with the two classes, but I'm not sure which is better, can you tell me the difference and which is better to use?
Many thanks.
ViewPager allows you to flip between pages of data (between views). You supply an adapter to generate the pages that the view shows.
But HorizontalScrollView is a container for other views that you can scrolled through, allowing it to be larger than the physical display.
I would go with horizontal scroll view.
EDIT : See FoamyGuy's answer in Angry Birds like scrolling menu where he exactly explains how to achieve such effect.

Swipe Indication for user Android

Suppose I have a ListView displaying exactly 10 rows that is not intended to scroll.
When the user swipes, the next list of 10 rows would be displayed. The bottom of the ListView would say something like "page 2 of 3".
How can I indicate to users that they should swipe to get the next page?
A page indicator might be helpful like you said. I view-pager may be another option. In that case I would use: http://viewpagerindicator.com/
I think you are best off rolling your own solution using a ScrollView and/or a ViewPager
According to a GoogleIO presentation about ListViews, they are coded with many "behind-the-scenes" tricks in order to optimize performance.
When you start trying to modify how they work, then you end up with a complex widget that doesn't make use of its own complexity and optimizations.
Some type of vertical view pager could be good for what you see though.
Reference: http://www.youtube.com/watch?v=wDBM6wVEO70

What is the best approach to implement horizontal scrolling carousel component?

I'm trying to figure out the best approach to design a horizontal scrollview with only a few buttons that when scroll if end is reached it starts showing the first items again hence carousel behavior.
By carousel behavior I'm not saying 3D circle carousel, I just mean that you can continue scrolling horizontally, forever, and the first item shows up again when the end is reached, for example when scrolling swiping to the left.
Any suggestions would be greatly appreciated.
This is way in the future to be useful to the original poster, but for any others who stumble upon this question, I created a custom view that does exactly what Benjamin wanted:
https://github.com/moldedbits/infinitely-scrolling-carousel
You might try this, http://code.google.com/p/infinite-gallery/
If that doesn't work then I don't understand the question and you might want to try and give a bit more detail as to why it doesn't meet your needs
If by carousel ( a rather subjective term) you mean each item has a different "depth" with the center item the most prominent in so far as the UI there are other projects that have done this too

Categories

Resources