In my project i'm using this https://github.com/ecstasy2/tinder-card-stack library for tinder like cards swipe animation. It work good, but it doesn't support removing top view by button click, like or dislike. I lost a lot of time trying to make some callbacks to library, in which i'am trying to remove top view of stack. Can anyone help me in this quistion ? Or mb any other libs can do this thing ? Thx
Related
What is the easiest way to implement a screen slide in Nativescript like shown in Android Viewpager , but in a vertical direction ? Another example of this functionality would be the rss reader feedly where you can change rss feeds by swiping up/down.
The page should allow vertical scrolling to the top/bottom and then transition after a certain treshold.
I already encountered nativescript-slides, which can only do horizontally sliding.
So is there a "nativescript" way or do i have to implement it as native android/ios feature (for example by this) ? In either case a sample on how to integrate it in nativescript would be great.
Update
Recorded an example:
taken from this Repo with Android native code. The outstanding PR made changes to offer vertical scrolling in the list. But the repo seems to be outdated and a bit buggy.
I can provide more info later but there's a new plugin implementing the native controls for android and iOS for slides/carousel her https://github.com/alexrainman/nativescript-carousel-view and vertical swiping is on his radar, I think he might even be close to completing that.
To give an answer for anybody interested in above nested scrolling animation:
For Android I had to implement the native ReyclerView in Nativescript in favor of the NS buildin ListView. It is an optimized view structure which among other things allows nested (vertical) scrolling and can be used as replacement for an ordinary list.
Together with https://github.com/alexrainman/nativescript-carousel-view works like a charm!
Anyone that ends up here still looking for ways to achieve this.
I spent a lot of time trying to figure out a way to achieve this and tried to find ready plugins for this. Also tried to use the plugin from Alexrainman but eventually gave up since the plugin was not up to date with the current nativescript-version.
My solution:
I used radListView as a basis for this implementation and leveraged the methods and events on the radListView.
By using scrolled-event I gathered data for the use of the scrolling feature: scroll Speed and scroll direction. (These might be also taken from the event data, but since I did not find the event details from the Nativescript-documentation I gave up trying to guess where to find this data on the event-model).
Then I also saved the fixed height of one item on my list (The height I fixed to screenHeight-200).
With all this info, I managed to hook the event "ScrollDragEnded" and add logic that makes my list behave like a vertical slider. Moving on the list by method "scrollToIndex" and figuring out which index to scroll and when by leveraging all the data mentioned above.
This is the way I managed to make a pretty good vertical slide.
Good luck!
I want to create a over scroll bounce animation in GridView.
I have searched for a long time but still could not find a way to implement a over scroll bounce animation to my GridView , I came across with the flow home launcher and wonder how did the devs achieve that animation when scrolling the app list , it would be better if i can attach a video .
I realise that there are many apps doing this over scroll animation but how?
The following screenshorts is the flow home launcher
Perhaps this repo on GitHub - which provides the over-scroll 'bounce' effect it seems you're looking for, could do the trick for you.
It works well on many scrollable core Android views - one of which is GridView:
Given a GridView object at hand, you could apply the effect as follows:
GridView gridView = ...
OverScrollDecoratorHelper.setUpOverScroll(gridView);
Note: you haven't specified what the context is. Assuming you're implementing an Activity, this should be done upon creation (i.e. in onCreate()).
To include it in your project, add this to your project's gradle.build:
dependencies {
// ...
compile 'me.everything:overscroll-decor-android:1.0.0'
}
I am using Jeremy Feinstein's SlidingMenu library to implement a sliding menu on the right.
Is there any way to make the menu slide out without displacing/pushing the content view to the side? Currently, when the menu slides out, the content also gets pushed towards either the left or right (depending on which direction the menu is coming out from). I would like to make an implementation where the menu appears from either the left/right but "sits on top" of the content view (content view never moves, the menu view literally flies in and out).
Ive been digging about but there doesnt appear to be a simple function i can call to enable this. Do I have to implement it myself or am I missing something?
Time to answer my own question! :D
It seems that after looking through the source code of Jeremy Feinstein's SlidingMenu library, what happens is that the library actually "extracts" out our view and then somehow join it together with the sliding-out view. After that, the views are merely scrolled around (I could be mistaken, but i know the extraction of view does occur. As for the way the library accomplishes the scrolling and sliding, i didnt look into it too much.).
So, the answer to my own question is : No, it cannot be done by the library. No simple function available (due to the way the library achieves the sliding effect).
In the end, i opted to use a framelayout with overlapping views. One visible, the other invisible. Then i just change visibility and animate the views.
The idea I'm having is having a view that can be pulled down on top of the current view, with similar animation features like the one you can pull down from the top all the time, on Android Devices.
Here's an illustration:
The idea is to grab it and being able to pull it down on top of the other view, and then being able to interact with that view. To slide it up again, you should grab the bottom of the view (the grey area in the illustration) again, and then pull it up.
I haven't even worked with animations before but I found a lot of topics on that, while searching for solutions to my problem, including this: Slide down view in android
but my impression is that, that is about making animations when the user isn't touching the phone.
What is the best way to do this?
Is there a better way to do something very similar?
EDIT:
Here's the topic that made me find the solution: How to make an Android SlidingDrawer slide out from the left?
And here's the solution I used:
SlidingDrawer Top-to-Bottom
You could use a SlidingDrawer, this is a built in component into Android, but as far as I know it slides only from bottom - up.
If you a comfortable to modify your app design, then this could be an option for you.
However, on internet are some libraries of custom SlidingDrawer that lets you put the marker on any side of your screen, so you can drag it top-down, left-right, right-left.. any way you want.
Useful links:
How to make an Android SlidingDrawer slide out from the left?
SlidingDrawer Top-to-Bottom
I'd like to make a view in my Android app that flips between multiple views on a swipe/fling. I'd like it to behave more or less like the Android Launcher behaves when flipping between views. In particular,
It should flip views on swipe.
Generally a swipe will flip between one view and the next. It should not fling across all of the views.
If you swipe slowly, you should see the views dragging as you're swiping, eg. the way the Launcher does it.
I tried using a ViewFlipper with a GestureOverlayView as per Romain Guy's blog post here, but there's no indicator to the user as they're swiping. This makes discoverability difficult, which is presumably why Launcher does it the way they do.
I tried using a Gallery object, but when I swipe from left to right, there's a certain amount of momentum that flings the users through all the views rather than just taking them to the next view.
Is there a good way to accomplish what I'm trying to do?
I know this is an old question but ViewPager is created for this exact same purpose. ViewPager is part of android compatibility package and more can be found at http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html
Take a look at HorizontalPager. It's actually based on RealViewSwitcher, which in turn is based on the Android homescreen's code, and supports snap-to paging with drag feedback, as well as nested vertically-scrolling subviews. Gesture support for fast swipes isn't all it should be, but this may get you part of the way there (and I'd welcome contributions back).
EDIT: As of 2012 you're much better off using Google's ViewPager - it's in the compat library.
Check out SwipeView within this project https://github.com/fry15/uk.co.jasonfry.android.tools It does exactly what you want it to do and is super simple to implement.
#CommonsGuy extended ViewFlipper to do it.
https://github.com/commonsguy/cwac-viewswiper
Ihaven't used this one yet so im not sure if it moves with your finger like the launcher if not your going to have to make an OnTochListener to do it for you in me.ACTION_MOVE you will update the view to change its position. I'll post some sample code when I get home if you don't get another answer.