Building TimePiece

  • 1,440 views
Uploaded on

Code and patterns from building TimePiece: an Android World Clock application released under the Open Source MIT license. The talk was given at the Philly Android Alliance User Group meeting on 8/24

Code and patterns from building TimePiece: an Android World Clock application released under the Open Source MIT license. The talk was given at the Philly Android Alliance User Group meeting on 8/24

More in: Technology , Business
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
1,440
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
5
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Building TimePiece
    Arpit Mathur
    http://twitter.com/arpit
  • 2. What is TimePiece
    World Time lookup without API calls
    Visually interesting (fun with animation)
    Open Source (under the MIT license)
  • 3. Technical breakdown
    Local SQLite database with City / Java TimeZone Id mappings
    JODA DateTime library
    Search
    Custom List Renderers
    The usual app stuff:
    User Preferences
    Menus
    Intro screens
    Context menus
  • 4. Implementing ContentProviders with local SQLite databases
  • 5. Steps
    Add SQLite to your assets folder
    Copy the database to your app’s data folder
    Open the database (extend SQLiteOpenHelper)
    Create a ContentProvider from this Database
  • 6. Code:
    DataBaseHelper
    TimeZoneLookupService
    CitySearchSuggestionProvider
  • 7. Create a searchable config xml file
    Create an Activity to handle the search
    Add the Search config and activity to the activity that you want to trigger search on
    Implementing Search
  • 8. Search config (in res/xml)
  • 9. Search Activity
  • 10. Integrate with Main Activity
  • 11. Mind the stacks!
    Activity LaunchModesdeclared in Activity:
    multiple
    singleTop
    singleTask
    singleInstance
  • 12. Replacing the Activity with Suggestions
    res/searchable.xml
    CitySearchSuggestionProvider
  • 13. Return format
  • 14. Building Custom Lists
    Create a List View or a ListActivity
    Create an Adapter for populating the List
    Populate the List Adapter
    Refresh the Adapter every 60 seconds
  • 15. Code
    MyLocationsActivity
    MyLocationsDataAdapter
  • 16. A little deeper into Animation
  • 17. Loading Animation XMLs
  • 18. Creating animation objects at runtime
  • 19. Creating custom animations
    Extend Animation
    Override applyTransform
  • 20.
  • 21. Remember:
    Animations only effect the rendering buffers so objects don’t actually change in position itself
    If you don’t set setFillAfter, the animated object will return to its location/transformation as before animation started
    Leverage LayoutAnimations as well as regular animations
  • 22. Releasing to the Market
    Use Android Asset Studio to create your icons
    Broken Market search: Joining words is probably a bad idea
    When adding images to your app’s description, make sure the first one is most representative (for third party market indexers like Chomp)
  • 23. Links
    TimePiece:
    https://market.android.com/details?id=com.arpitonline.worldclock
    Packing local SQLite databases:
    http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/
    Android Asset Studio:
    http://android-ui-utils.googlecode.com/hg/asset-studio/dist/index.html