Android Accessibility setting (Talkback) focus - android

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.

Related

Leanback.DetailsFragment not scrolling as expected

I have a details fragment that is using a DetailsOverviewRow and FullWidthDetailsOverviewRowPresenter. When the page first loads the action buttons are selected. When I press down once, focus leaves the buttons and nothing else happens. When I press down a second time focus moves to a ListRow that is further down the page. I'm trying to figure out why the overview, or body as it's called in the presenter, section doesn't focus.
Should there not be a second 'state' between the two screenshots where the overview/body is readable?
Possibly of note. The DetailsFragment isn't declared in an activities xml, I'm changing fragments manually using FragmentTransactions. Also, the Fragment is instantiated using a static create method (source below).
Thanks in advance.
Activity xml
DetailsFragment java
I haven't tried this example in particular, but from my time spent with Leanback support library, I learned that even though a lot of helpful stuff is indeed provided, a lot is not :D
So I would try these things:
1) Make sure that something in the area you want visible is focusable. (Clickable elements should be focusable by default, but better check too) What I mean is that on the screenshot, there is just text, no buttons or editable content in that area. So when you press down, there is nothing to focus. What happens if you make the body TextView focusable?
(Yes, one would expect that the support library would take care of that, but that might not be the case.)
2) Find out what actually gets focused when you press down, since as you said, the focus leaves the buttons - but where does it go? (How to find out which view is focused?) You might have a "direction problem" somewhere. That is - the focus travels based on the view hierarchy tree, not based on what we see on the screen. In some cases, it is possible to skip some elements or get stuck somewhere by moving focus through an unexpected part of the view tree, that makes sense for the algorithm, but isn't logical from the human perspective.
The details presenter focus works this way :
1) First focus is given to Action buttons. Right/left nav press shifts the focus right/left between action buttons.
2) Down nav press from actions row shifts the focus from actions row to details row (individual details items itself are not focusable), this is achieved by shifting the Thumbnail anchoring position to further south.
3) Down nav press from details row shifts the focus from details row to related row.
So the details row gains focus by changing the anchoring position of Thumbnail image. Is your thumbnail image changing its anchoring position when pressing down from actions row?
Hate to answer my own question. This was due to my failure to RTFM. I was creating the fragment UI after a network request completes. For the FullWidthDetailsPresenter to work properly it and the ClassPresenterSelector() should be initialized in the fragments onCreate() method.

Moving horizontally to another layout

I want to download a list of topics from server (e.g. 40) and then put them on a ListView. By swiping left or right you could download another list of topics and put them on a ListView.
ListViews would be like pages that you can scroll horizontally.
A good example of this is Google Reader. You can swipe left or right when you are in a topic to see another topic.
This isn't in fact a big problem but I would like it to look smooth like in Google Reader. It shows how the last page moves off screen and new page moves to middle.
If I understand correctly, then you might take a look at ViewPager.

how to code that you slide your finger on view to get view text one by one?

// A user tries to make meaningfull words by sliding his/her finger on the buttons in the game screen. The buttons are located as a grid, the characters on the buttons are used to make words. I need to know which features (which layout, which view, which listeners, etc..) of android to use, what to use.
User combines adjacent letters without removing finger to make meaningful words. When it comes to last letter, user needs to just remove the finger.
Create your own child of View that has an internal grid of words, draws them to its canvas, and responds to touch events to trace a path across them. I suggest you study TileView; once you understand what it's doing, you'll find that it's actually very easy to write the view you need.

Scroll ListView smoothly and programmatically

I have searched a lot but I couldn't find an answer.
I want to implement something like in Go Launcher. When you drag an icon in app drawer and move it out of container top or bottom bound, the list begins to scroll.
So far, I have tried following things:
Dispatch touch events to simulate scrolling - impossible while touching the screen
Use smoothScrollBy() method - almost there, but it scrolls only screen height distance
Use scrollBy() - it moves only the container and leaves blank space. I would put there some rows if only I could be able to reuse views that went off the screen.
I need the ListView to scroll SMOOTHLY.
So here goes ma question. Anybody knows how can it be done? I'll put a gratitude in About section of my app to person who will help me:)
using listview and try scrollToPosition(),or smoothscrollBy()

"Swipe" or "Fling" on items in ListView

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?

Categories

Resources