SlideShare a Scribd company logo
1 of 18
Download to read offline
Pull To Refresh Training
2014/03/11 John
Outline
● Introduction
● Design
● How to implement
○ Touch Event
○ Adding view
○ On Touching
○ Smooth Scrolling
○ Window Manager
● Summary
● Homework
Introduction
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
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.
Design
i.e. LinearLayout
How to implement
Touch event
Touch Event
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.
How to implement
Managing Touch events
Use
ViewConfiguration
Constants
ref: http://goo.gl/JJN80z
How to implement
Managing Touch events
Extend a Child
View's Touchable
Area
ref: http://goo.gl/JJN80z
How to implement
Adding View
How to implement
On Touching
● Touch event filter.
● Setting variable up.
How to implement
On Touching
● Doing actions.
How to implement
Smooth scrolling
Ref: http://goo.gl/eb3DQH
SmoothScrollRunnable:
● Get next position from
Interpolator.
● Set scroll to position.
● Post(this).
How to implement
Window Manager
● Every display has a
WindowManager.
● WindowManager is a
System Manager.
How to implement
Window Manager
Ref: http://goo.gl/sWHpp
Summary
● “Make it a little simpler”
● How dose Touch event transit.
● How to implement smooth scrolling.
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.

More Related Content

Viewers also liked

Eleições Sind-RedeBH - Parte 1
Eleições Sind-RedeBH - Parte 1Eleições Sind-RedeBH - Parte 1
Eleições Sind-RedeBH - Parte 1
coletivofortalecer
 
Mapa de formacion
Mapa de formacionMapa de formacion
Mapa de formacion
kariperezc
 
Academic Event Notification System
Academic Event Notification SystemAcademic Event Notification System
Academic Event Notification System
Ashwini Natbhaje
 
Social Bookmarking
Social BookmarkingSocial Bookmarking
Social Bookmarking
tmichae1
 
General+Rules+Pertaining+To+Contracts
General+Rules+Pertaining+To+ContractsGeneral+Rules+Pertaining+To+Contracts
General+Rules+Pertaining+To+Contracts
varun23oct
 
ADV1100 Workshop for Faculty
ADV1100 Workshop for FacultyADV1100 Workshop for Faculty
ADV1100 Workshop for Faculty
jspevack
 

Viewers also liked (18)

I tuoi dipendenti sono stressati? La causa sei (anche) tu!
I tuoi dipendenti sono stressati? La causa sei (anche) tu!I tuoi dipendenti sono stressati? La causa sei (anche) tu!
I tuoi dipendenti sono stressati? La causa sei (anche) tu!
 
Regularização de dívidas em atraso cai 5,74% em setembro
Regularização de dívidas em atraso cai 5,74% em setembroRegularização de dívidas em atraso cai 5,74% em setembro
Regularização de dívidas em atraso cai 5,74% em setembro
 
Santos et al 2012 JEB
Santos et al 2012 JEBSantos et al 2012 JEB
Santos et al 2012 JEB
 
Eleições Sind-RedeBH - Parte 1
Eleições Sind-RedeBH - Parte 1Eleições Sind-RedeBH - Parte 1
Eleições Sind-RedeBH - Parte 1
 
Mapa de formacion
Mapa de formacionMapa de formacion
Mapa de formacion
 
Academic Event Notification System
Academic Event Notification SystemAcademic Event Notification System
Academic Event Notification System
 
Social Bookmarking
Social BookmarkingSocial Bookmarking
Social Bookmarking
 
General+Rules+Pertaining+To+Contracts
General+Rules+Pertaining+To+ContractsGeneral+Rules+Pertaining+To+Contracts
General+Rules+Pertaining+To+Contracts
 
Android IPC: Binder
Android IPC: BinderAndroid IPC: Binder
Android IPC: Binder
 
Implosion Study
Implosion StudyImplosion Study
Implosion Study
 
A princesa arrogante
A princesa arroganteA princesa arrogante
A princesa arrogante
 
Boletim de outubro
Boletim de outubroBoletim de outubro
Boletim de outubro
 
Old works v pintura de ricardo monteiro - março 2016
Old works v  pintura de ricardo monteiro - março 2016Old works v  pintura de ricardo monteiro - março 2016
Old works v pintura de ricardo monteiro - março 2016
 
Cómo hacer el proceso perfecto de cuentas a pagar
Cómo hacer el proceso perfecto de cuentas a pagarCómo hacer el proceso perfecto de cuentas a pagar
Cómo hacer el proceso perfecto de cuentas a pagar
 
Seminar report on third generation solid state drive
Seminar report on third generation solid state driveSeminar report on third generation solid state drive
Seminar report on third generation solid state drive
 
ADV1100 Workshop for Faculty
ADV1100 Workshop for FacultyADV1100 Workshop for Faculty
ADV1100 Workshop for Faculty
 
Facturas de proveedores, 5 KPIs a seguir
Facturas de proveedores, 5 KPIs a seguirFacturas de proveedores, 5 KPIs a seguir
Facturas de proveedores, 5 KPIs a seguir
 
Utopia Theme Park Presentation
Utopia Theme Park PresentationUtopia Theme Park Presentation
Utopia Theme Park Presentation
 

Similar to Android Training - Pull to Refresh

Multi Touch presentation
Multi Touch presentationMulti Touch presentation
Multi Touch presentation
senthil0809
 
Guidelines for Android application design.pptx
Guidelines for Android application design.pptxGuidelines for Android application design.pptx
Guidelines for Android application design.pptx
debasish duarah
 
Event oriented programming
Event oriented programmingEvent oriented programming
Event oriented programming
Ashwini Awatare
 

Similar to Android Training - Pull to Refresh (20)

Lecture #3 activities and intents
Lecture #3  activities and intentsLecture #3  activities and intents
Lecture #3 activities and intents
 
Tips for building fast multi touch enabled web sites
 Tips for building fast multi touch enabled web sites Tips for building fast multi touch enabled web sites
Tips for building fast multi touch enabled web sites
 
Fast multi touch enabled web sites
Fast multi touch enabled web sitesFast multi touch enabled web sites
Fast multi touch enabled web sites
 
B2. activity and intent
B2. activity and intentB2. activity and intent
B2. activity and intent
 
ANDROID LAB MANUAL.doc
ANDROID LAB MANUAL.docANDROID LAB MANUAL.doc
ANDROID LAB MANUAL.doc
 
Application Design - Part 2
Application Design - Part 2Application Design - Part 2
Application Design - Part 2
 
FirefoxOS Window Management
FirefoxOS Window ManagementFirefoxOS Window Management
FirefoxOS Window Management
 
Event In JavaScript
Event In JavaScriptEvent In JavaScript
Event In JavaScript
 
Events and Listeners in Android
Events and Listeners in AndroidEvents and Listeners in Android
Events and Listeners in Android
 
Nearsoft Mobile Onboarding Workshop
Nearsoft Mobile Onboarding WorkshopNearsoft Mobile Onboarding Workshop
Nearsoft Mobile Onboarding Workshop
 
Mobile Application Development
Mobile Application DevelopmentMobile Application Development
Mobile Application Development
 
Cucumber meets iPhone
Cucumber meets iPhoneCucumber meets iPhone
Cucumber meets iPhone
 
Multi Touch presentation
Multi Touch presentationMulti Touch presentation
Multi Touch presentation
 
Presentation on Android application life cycle and saved instancestate
Presentation on Android application life cycle and saved instancestatePresentation on Android application life cycle and saved instancestate
Presentation on Android application life cycle and saved instancestate
 
Guidelines for Android application design.pptx
Guidelines for Android application design.pptxGuidelines for Android application design.pptx
Guidelines for Android application design.pptx
 
iLabs Toolbox Javashare 2008
iLabs Toolbox Javashare 2008iLabs Toolbox Javashare 2008
iLabs Toolbox Javashare 2008
 
Android by Swecha
Android by SwechaAndroid by Swecha
Android by Swecha
 
Androd Listeners
Androd ListenersAndrod Listeners
Androd Listeners
 
Scratching the Surface with JavaFX
Scratching the Surface with JavaFXScratching the Surface with JavaFX
Scratching the Surface with JavaFX
 
Event oriented programming
Event oriented programmingEvent oriented programming
Event oriented programming
 

More from Kan-Han (John) Lu

More from Kan-Han (John) Lu (20)

Dagger for android
Dagger for androidDagger for android
Dagger for android
 
Android develop guideline
Android develop guidelineAndroid develop guideline
Android develop guideline
 
Working process and git branch strategy
Working process and git branch strategyWorking process and git branch strategy
Working process and git branch strategy
 
Deep neural network for youtube recommendations
Deep neural network for youtube recommendationsDeep neural network for youtube recommendations
Deep neural network for youtube recommendations
 
Android testing part i
Android testing part iAndroid testing part i
Android testing part i
 
Cuda project paper
Cuda project paperCuda project paper
Cuda project paper
 
Twitter as a personalizable information service ii
Twitter as a personalizable information service iiTwitter as a personalizable information service ii
Twitter as a personalizable information service ii
 
Multimedia data minig and analytics sentiment analysis using social multimedia
Multimedia data minig and analytics sentiment analysis using social multimediaMultimedia data minig and analytics sentiment analysis using social multimedia
Multimedia data minig and analytics sentiment analysis using social multimedia
 
ARM: Trusted Zone on Android
ARM: Trusted Zone on AndroidARM: Trusted Zone on Android
ARM: Trusted Zone on Android
 
Android Training - Card Style
Android Training - Card StyleAndroid Training - Card Style
Android Training - Card Style
 
Android Training - View Pager
Android Training - View PagerAndroid Training - View Pager
Android Training - View Pager
 
Android Training - Sliding Menu
Android Training - Sliding MenuAndroid Training - Sliding Menu
Android Training - Sliding Menu
 
Java: Exception Handling
Java: Exception HandlingJava: Exception Handling
Java: Exception Handling
 
Dynamic Proxy by Java
Dynamic Proxy by JavaDynamic Proxy by Java
Dynamic Proxy by Java
 
Code analyzer: FindBugs and PMD
Code analyzer: FindBugs and PMDCode analyzer: FindBugs and PMD
Code analyzer: FindBugs and PMD
 
Android UI System
Android UI SystemAndroid UI System
Android UI System
 
Android Fragment
Android FragmentAndroid Fragment
Android Fragment
 
Android Training - Content Sharing
Android Training - Content SharingAndroid Training - Content Sharing
Android Training - Content Sharing
 
Android Training - Action Bar
Android Training - Action BarAndroid Training - Action Bar
Android Training - Action Bar
 
Explaination of angular
Explaination of angularExplaination of angular
Explaination of angular
 

Recently uploaded

POGONATUM : morphology, anatomy, reproduction etc.
POGONATUM : morphology, anatomy, reproduction etc.POGONATUM : morphology, anatomy, reproduction etc.
POGONATUM : morphology, anatomy, reproduction etc.
Cherry
 
Lipids: types, structure and important functions.
Lipids: types, structure and important functions.Lipids: types, structure and important functions.
Lipids: types, structure and important functions.
Cherry
 
The Mariana Trench remarkable geological features on Earth.pptx
The Mariana Trench remarkable geological features on Earth.pptxThe Mariana Trench remarkable geological features on Earth.pptx
The Mariana Trench remarkable geological features on Earth.pptx
seri bangash
 
Human genetics..........................pptx
Human genetics..........................pptxHuman genetics..........................pptx
Human genetics..........................pptx
Cherry
 
Digital Dentistry.Digital Dentistryvv.pptx
Digital Dentistry.Digital Dentistryvv.pptxDigital Dentistry.Digital Dentistryvv.pptx
Digital Dentistry.Digital Dentistryvv.pptx
MohamedFarag457087
 
(May 9, 2024) Enhanced Ultrafast Vector Flow Imaging (VFI) Using Multi-Angle ...
(May 9, 2024) Enhanced Ultrafast Vector Flow Imaging (VFI) Using Multi-Angle ...(May 9, 2024) Enhanced Ultrafast Vector Flow Imaging (VFI) Using Multi-Angle ...
(May 9, 2024) Enhanced Ultrafast Vector Flow Imaging (VFI) Using Multi-Angle ...
Scintica Instrumentation
 

Recently uploaded (20)

Cot curve, melting temperature, unique and repetitive DNA
Cot curve, melting temperature, unique and repetitive DNACot curve, melting temperature, unique and repetitive DNA
Cot curve, melting temperature, unique and repetitive DNA
 
GBSN - Microbiology (Unit 5) Concept of isolation
GBSN - Microbiology (Unit 5) Concept of isolationGBSN - Microbiology (Unit 5) Concept of isolation
GBSN - Microbiology (Unit 5) Concept of isolation
 
Terpineol and it's characterization pptx
Terpineol and it's characterization pptxTerpineol and it's characterization pptx
Terpineol and it's characterization pptx
 
Role of AI in seed science Predictive modelling and Beyond.pptx
Role of AI in seed science  Predictive modelling and  Beyond.pptxRole of AI in seed science  Predictive modelling and  Beyond.pptx
Role of AI in seed science Predictive modelling and Beyond.pptx
 
Genome Projects : Human, Rice,Wheat,E coli and Arabidopsis.
Genome Projects : Human, Rice,Wheat,E coli and Arabidopsis.Genome Projects : Human, Rice,Wheat,E coli and Arabidopsis.
Genome Projects : Human, Rice,Wheat,E coli and Arabidopsis.
 
Use of mutants in understanding seedling development.pptx
Use of mutants in understanding seedling development.pptxUse of mutants in understanding seedling development.pptx
Use of mutants in understanding seedling development.pptx
 
POGONATUM : morphology, anatomy, reproduction etc.
POGONATUM : morphology, anatomy, reproduction etc.POGONATUM : morphology, anatomy, reproduction etc.
POGONATUM : morphology, anatomy, reproduction etc.
 
Concept of gene and Complementation test.pdf
Concept of gene and Complementation test.pdfConcept of gene and Complementation test.pdf
Concept of gene and Complementation test.pdf
 
Climate Change Impacts on Terrestrial and Aquatic Ecosystems.pptx
Climate Change Impacts on Terrestrial and Aquatic Ecosystems.pptxClimate Change Impacts on Terrestrial and Aquatic Ecosystems.pptx
Climate Change Impacts on Terrestrial and Aquatic Ecosystems.pptx
 
Efficient spin-up of Earth System Models usingsequence acceleration
Efficient spin-up of Earth System Models usingsequence accelerationEfficient spin-up of Earth System Models usingsequence acceleration
Efficient spin-up of Earth System Models usingsequence acceleration
 
Genome sequencing,shotgun sequencing.pptx
Genome sequencing,shotgun sequencing.pptxGenome sequencing,shotgun sequencing.pptx
Genome sequencing,shotgun sequencing.pptx
 
Lipids: types, structure and important functions.
Lipids: types, structure and important functions.Lipids: types, structure and important functions.
Lipids: types, structure and important functions.
 
The Mariana Trench remarkable geological features on Earth.pptx
The Mariana Trench remarkable geological features on Earth.pptxThe Mariana Trench remarkable geological features on Earth.pptx
The Mariana Trench remarkable geological features on Earth.pptx
 
GBSN - Biochemistry (Unit 2) Basic concept of organic chemistry
GBSN - Biochemistry (Unit 2) Basic concept of organic chemistry GBSN - Biochemistry (Unit 2) Basic concept of organic chemistry
GBSN - Biochemistry (Unit 2) Basic concept of organic chemistry
 
Human genetics..........................pptx
Human genetics..........................pptxHuman genetics..........................pptx
Human genetics..........................pptx
 
module for grade 9 for distance learning
module for grade 9 for distance learningmodule for grade 9 for distance learning
module for grade 9 for distance learning
 
Digital Dentistry.Digital Dentistryvv.pptx
Digital Dentistry.Digital Dentistryvv.pptxDigital Dentistry.Digital Dentistryvv.pptx
Digital Dentistry.Digital Dentistryvv.pptx
 
Energy is the beat of life irrespective of the domains. ATP- the energy curre...
Energy is the beat of life irrespective of the domains. ATP- the energy curre...Energy is the beat of life irrespective of the domains. ATP- the energy curre...
Energy is the beat of life irrespective of the domains. ATP- the energy curre...
 
(May 9, 2024) Enhanced Ultrafast Vector Flow Imaging (VFI) Using Multi-Angle ...
(May 9, 2024) Enhanced Ultrafast Vector Flow Imaging (VFI) Using Multi-Angle ...(May 9, 2024) Enhanced Ultrafast Vector Flow Imaging (VFI) Using Multi-Angle ...
(May 9, 2024) Enhanced Ultrafast Vector Flow Imaging (VFI) Using Multi-Angle ...
 
FAIRSpectra - Enabling the FAIRification of Analytical Science
FAIRSpectra - Enabling the FAIRification of Analytical ScienceFAIRSpectra - Enabling the FAIRification of Analytical Science
FAIRSpectra - Enabling the FAIRification of Analytical Science
 

Android Training - Pull to Refresh

  • 1. Pull To Refresh Training 2014/03/11 John
  • 2. Outline ● Introduction ● Design ● How to implement ○ Touch Event ○ Adding view ○ On Touching ○ Smooth Scrolling ○ Window Manager ● Summary ● Homework
  • 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.
  • 7. How to implement Touch event Touch Event
  • 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.
  • 9. How to implement Managing Touch events Use ViewConfiguration Constants ref: http://goo.gl/JJN80z
  • 10. How to implement Managing Touch events Extend a Child View's Touchable Area ref: http://goo.gl/JJN80z
  • 12. How to implement On Touching ● Touch event filter. ● Setting variable up.
  • 13. How to implement On Touching ● Doing actions.
  • 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.
  • 16. How to implement Window Manager Ref: http://goo.gl/sWHpp
  • 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.