"Swipe" or "Fling" on items in ListView - android

I've already implemented a list to display a list of songs for an app that I'm making. In the application, you can upvote songs to a communal player (or unvote them, if you placed a vote for it). Screen shot.
I was able to implement a fling gesture that you'd use to vote (swipe to the right) or unvote (swipe to the left), but you don't see any animation or selection on the song you chose. So, I was hoping to get something working where (at the least) another TextView replaces it in a sliding animation, kind of like how on contacts in Samsung's TouchWiz you can swipe right to call or left to message.
What would be the best way to go about this?
Should I try to make my ListView a list of ViewFlippers and use my fling gesture? (doesn't allow me to slide halfway and then change my mind) Or should I try to use something like this HorizontalPager: http://code.google.com/p/deezapps-widgets/ where each list item is one of those.
Is there a better option that I haven't suggested?

Related

Android Accessibility setting (Talkback) focus

I have a horizontal recycler view (having most recent item at the right most position and the oldest item at the left most position) below a textview. Once the accessibility control reaches textview, on making right swipe it focuses on the left most item of the recycler view (i.e. 1st item). Is there a way we can set the default focus to the rightmost item.
My answer would be.... don't do this.
Focus order should follow reading order. In left to right languages, independent of how your data is organized, this means left to right.
Picture this: Someone is swiping right through your application, and happily going... next, next, next, next... etc. Then suddenly they swipe onto your control and SKIP over a bunch of content. A blind person is going to assume that "Swiping Right" is moving to the next thing. Now, they have just swiped right onto the right most element of your Recycler View. Are they going to know that they skipped over a bunch of content??? NO. From a blind person's point of view this content is lost, unless somehow they know to swipe right and then swipe left to go backwards... NOT LIKELY.
UNLESS....
Are you going to have "right swipe" move left and manage focus over every element of your container. PLEASE, PLEASE don't do this, getting it correct for all relevant technologies (TalkBack, SpeakBack, Switch Control, BrailleBack, etc) is more difficult than you'd think.
Let's say that you don't go through the pain of managing focus on ALL elements of your Recycler container. From a blind person's point of view, your app looks very different swiping right all the way through it, vs swiping left all the way through it.
To summarize... don't do this!
Notably this is also a duplicate question, as there are many TalkBack focus management questions out there.

Swipe animation on fragment

Iv seen other post's that attempt to answer this but don't quite cover it. So hopefully somebody could clear this up.
I have an activity that displays a card, the idea is when you swipe right/left/up the card will move in that direction following the users finger movement the way ViewPager works for scrolling left right. What is the simplest way to implement this kind of animation ? Are there an Open Source libs that do this already ?
I currently have a slide_in/slide_out animation that is used in when calling replace in fragment manager but this applies the animation after the swipe action and not during
(EDIT) I could use a scroller and scroll the view but I wanted something a little "cooler" like swiping through a deck of cards one card at a time.
Thanks in advance

Center aligned selection with animation in ListView (?)

I need a component that works like the picture below but I'm having trouble coming up with some kind of decent solution that works.
I want the list to have a center locked selection but being scrollable with the d-pad. This is for an application running on a TV so no need for touch scroll. So when pressing down on the remote d-pad the list will scroll and a new item will size up and the current selected one will size down and the new selection will still be in the middle.
I've tried doing this using a ListView that I extended and programmatically scrolling when pressing down or up. On scroll finished I called notifyDatasetChanged() on the ListView for re-inflating of the childs and in the ListViews adapters getView() I made the animation of the view located at the current selected position.
This is not optimal since I need to call notifyDatasetChanged(), which re-inflates all visible views, for the animation to apply. The UI becomes laggy when doing this and scrolling fast. It's also not possible to make som kind of compress animation when current selected item goes out of selection. There is also some trouble with the end items (read views) such the first or last in the list when doing animation of them, the may sometimes go out of screen.
I think that his must have been done before and maybe I'm missing it when searching for an answer.
Have anyone done something similar or do you have some suggestions of how this can be achieved? Maybe I'm just starting of with the wrong component here..
Regards,
Kristoffer

Android hierarchical ListView

I am trying to implement a simple tree-like menu. I have a ListView as the root. Each item is a custom View that consists of an arrow icon at the right if it has a submenu and a checkbox taking up the rest of the row. This is all great.
Now here is what I want to do and can't figure out how (I am new to Android, but Googling didn't help me):
If the user slides to the left on an item with an arrow, the whole list will slide out to the left and the corresponding submenu will slide in from the right. If the user slides to the right anywhere on the menu, the whole menu will slide out to the right and the parent menu will slide back in from the left. When you picture it it is really a simple concept.
My problem seems to be double:
I can't figure out how to capture a sliding motion. I assume there is some onSlide event or some such, but I can't find it.
I can't seem to attach events to the individual items. I tried just a simple toast with the onItemClickListener and couldn't get it to fire.
Any help or reference would be appreciated.
For the Sliding, check out the ViewPager class and the matching Adapter class, but generally what you describe sounds a lot like iOS and you should rather not try to duplicate a behaviour that's alien to Android users.

Android ListActivity Clicks

I have a ListActivity as my main activity. I want to be able to do a few things on a single item in the list i.e.
Longpress to bring up a contextmenu for that item
Swipe left to right to slide a new screen from the right to edit the list item.
Does anyone have any code they can show me that does this?
Longpress to bring up a contextmenu for that item
See here for how to use context menus. Here is a sample project that demonstrates their use.
Swipe left to right to slide a new screen from the right to edit the list item.
See here for how to use gesture libraries. Here is a ViewSwiper that adds gestures to a ViewFlipper. Here is an implementation of a drag-and-drop ListView, based on some poorly-understood code culled from Android itself. Blending all of that together, you may be able to implement what you seek. However, this will be rather difficult, and may not result in a user interface that is very usable. I strongly encourage you to simply have list item clicks be the way to indicate to edit an item, not a gesture.
I think You can use a 2 Child ViewFlipper as your Listitem.
one child for a normal dispaly(a TextView maybe), another a EditText.
and in case it work as you said, don't forget to set gesterListener on your ViewFlipper,do showNext or showPrevious in your OnFling method.

Categories

Resources