Share
Embed
Transcript
32 slides
-
Why am I here? Presentation Overview » What is Android
at Tumblr? » Highlight some the key components. » Discuss some strategies we use. » Talk about some cool stuff. -
Mobile development is like having multiple parallel internets. "No, sorry,
it's not available on that Internet, only the iOS phone Internet." » Jeff Atwood -
Tumblr on Android » 10-50 million installation bracket » 4.4
star rating with close to 1 million reviews » Top Developer » Support for Android back to Froyo (2.2) (May 2010) » Earliest traceable version uploaded Feb 2011 » (V 1.0.16) by Mobelux » Bonus Listed on Amazon Kindle store -
Android Development Android Studio Officially supported IDE for Developing Android
applications » Based on Intellij IDEA » Has Android specific plugins managed by Google » Eclipse support deprecated » Builds with Gradle (previously Ant) -
Android Development Gradle » New official build system for Android
» Command line & IDE use same build system » Eclipse had different systems for each » Dependency management from Maven » We have an internal proxy setup to Maven to ensure if Maven is down, we are not » Allows us to make flavors -
Android Development MVC / MVP The Android Framework forces you
to work in a way that maintains a separation of concerns similar to MVC / MVP, however it's not a perfect implementation of those systems. » Model - Business data (Post, Blog, Tag) » View - Anything extending from View » Partially facilitated through XML layouts » Controller / Presenter - Activities and Fragments -
Key Component The Controller Base BaseFragmentActionBarActivity.java BaseFragment.java » Most classes
are children of these two classes » Holds functionality that is common throughout our app (Compose button, tracking) » Mostly used for Analytics these days -
Key Component Viewing Posts PostListFragment.java PostAdapter.java » Any screen with
a post subclasses from these pieces. » PostListFragment handles most user interactions » Likes, Reblogs, etc. » PostAdapter responsible for holding and displaying data -
Key Component Networking TumblrHTTPService.java TaskScheduler.java ApiRequest.java » Most API requests
are made through TaskScheduler » Ensures that requests always happen » Takes subclasses of ApiRequest which contain request parameters » TaskScheduler routes requests to the TumblrHttpService -
Key Component Cleanup CleanupService.java Prunes the PostTable to keep it
from bloating too large. » Runs twice per day -
Key Component Post Rendering HtmlCache.java HtmlLRUCache.java ContentCrawler.java » Rendering done
by Html.fromHtml() » Very expensive » Content crawler looks through data that isn't currently on screen, and provides hooks for caching it. » If the app ever hiccups, it's probably this -
Key Component Wilson The facade to our image system »
Downloads images » Breaks Gifs » Renders images into views » It's similar in functionality to a popular open source library - Picasso (except it does GIFs) -
Key Component GIFs GifBreaker.java GifDecoder.java GifAnimator.java GifBitmapDrawable.java » Save each
frame as an individual .jpg and cache it » Cache a time-file for each each group » Loop through every Gif on screen, check its time current state, and advance if necessary. -
Key Component Database TumblrProvider.java » ContentProvider provides access to the
applications SQLite Database » Android Framework provides a breadth of functionality which requires a ContentProvider -
Strategy Networking and Storage Viewing Posts 1.Query for posts in
database 2.Check for internet connection 3.Fetch data from API 4.Store in SQLite DB (via the Content Provider) 5.Let the system know that stored data is ready 6.Query for posts in database again -
Strategy Networking and Storage Viewing Posts Offline 1.Query for posts
in database 2.Check for internet connection 3.Fetch data from API 4.Store in SQLite DB (via the Content Provider) 5.Let the system know that stored data is ready 6.Query for posts in database again -
Strategy Networking and Storage Making Posts 1.Save post data from
form into database 2.Check if network available 3.Tell system that there are outgoing posts available 4.Post uploading service kicks off 5.Notification that posting is complete -
Strategy Networking and Storage Making Posts Offline 1.Save post data
from form into database 2.Check if network available 3.Tell system that there are outgoing posts available 4.Post uploading service kicks off 5.Notification that posting is complete -
Strategy Push Notifications 1.Push-Service (in-house) pushes to Google 2.Google attempts
to push payload to all registered devices 3.Tumblr App parses the payload and makes notes request to Refrog 4.Parses Refrog data and saves in DB 5.Posts a single or bundled notification for a blog -
Strategy Push Notifications Offline 1.Push-Service (in-house) pushes to Google 2.Google
attempts to push payload to all registered devices. Google holds them until you come back. 3.Tumblr App parses the payload and makes notes request to Refrog 4.Parses Refrog data and saves in DB 5.Posts a single or bundled notification for a blog -
COOL TIP Push notifications Push notifications don't only have to
be used to show notifications. Android can respond to them silently in the background. » Android push payload limit is 4096 bytes (between 1024-4096 UTF-8 chars) » iOS payload limit is 256 bytes (between 64-256 UTF-8 chars) (Changing to 2048 bytes in iOS 8) -
Strategy Database Behavior Post table When we receive new data
from the server, we completely drop all previous data that is used in that place. For example: When you pull-to-refresh on the dashboard, all cached dashboard posts are removed from the posts table. The same behavior is also exhibited on blogs and search. -
Misc. App-Facts » Chris Haseman and Brandon Denney (bffs) wrote
the first in-house version of the Android app (v3) » We were the first app to support in-line Gifs in the play store » We didn't support landscape until Nov 2013, 2.5 years after first launch » Featured in the Winter 2013 collection under "Most Beautiful Apps" on Google Play -
Misc. Not-so-well-known features » Notifications Widget » Daydream » Posting
Widget » Fast Reblog » Logged out experience (no account required!) » Support for 12 languages - Dutch, German, Italian, Japanese, Portuguese (Brazil & Portugal), Russian, Spanish, Turkish, French, English -
Misc. What about Jumblr? https://github.com/tumblr/jumblr dependencies { compile 'com.tumblr:jumblr:0.0.10' }
Jumblr is a Java library that provides network connections, model objects, and data bindings to the tumblr API. It can be included in any Android project for a quick bootstrap into the Tumblr API. Cool tip: This is still maintained by John Crepezzi, a former Tumblrite -
WELP... Where do I go from here? » developer.android.com -
so much information » api.tumblr.com » Hack-day! » Reach out to any of us, we have a gamut of personalities on the team, one of them matches yours!