4. Introduction
There is a patent application
for the “pull-to-refresh”
feature that Loren Brichter
pioneered in Tweetie and is
now an extremely popular UI
gesture used in a lot of iOS,
Mac and Android apps.
ref: http://goo.gl/PjTjMA
5. Design
1. The user pulls down a list.
2. A message appears, telling the user
who can pull down the list to refresh.
3. The user pulls the list further down.
4. A new message appears, telling the
user that the list will refresh when he
releases it.
5. A refreshing or loading message
appears.
6. The refreshing message disappears
and a new list is shown, with the new
items at the top of the list.
8. How to implement
Touch event
The onInterceptTouchEvent() method is called whenever a
touch event is detected on the surface of a ViewGroup,
including on the surface of its children.
The onInterceptTouchEvent() method gives a parent the
chance to see any touch event before its children do.
14. How to implement
Smooth scrolling
Ref: http://goo.gl/eb3DQH
SmoothScrollRunnable:
● Get next position from
Interpolator.
● Set scroll to position.
● Post(this).
15. How to implement
Window Manager
● Every display has a
WindowManager.
● WindowManager is a
System Manager.
17. Summary
● “Make it a little simpler”
● How dose Touch event transit.
● How to implement smooth scrolling.
18. Homework
Sample source code: (You can also fInd it at the video record nearby if this link is invalid.)
https://www.dropbox.com/s/9zqt60tf7drppyi/TrainingPullToRefresh.zip
Basic:
● Let it be pulled from left.
Advance:
● Let it be pulled from both top and bottom.