Scott Main | 50e990c | 2012-06-21 17:14:39 -0700 | [diff] [blame^] | 1 | fullpage=true |
| 2 | page.title=Develop |
| 3 | header.hide=1 |
| 4 | carousel=1 |
| 5 | tabbedList=1 |
| 6 | @jd:body |
| 7 | |
| 8 | <style> |
| 9 | #noplayer-message { |
| 10 | position:absolute;top:50%;left:0;width:100%;z-index:-1;text-align:center;display:none; |
| 11 | } |
| 12 | #player-frame object {z-index:1;} |
| 13 | </style> |
| 14 | |
| 15 | <div id="player-wrapper"> |
| 16 | <div id="player-frame"> |
| 17 | <div id="noplayer-message"> |
| 18 | <!-- busted flash player message --> |
| 19 | Your video is supposed to appear here.<br/> |
| 20 | Make sure you have the <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash® Player</a>. |
| 21 | </div> |
| 22 | <div id="player"><!-- Youtube embeds here... actually replaces this div --></div> |
| 23 | <a class="close" onclick="$('#player-wrapper').hide()">close video</a> |
| 24 | </div> |
| 25 | </div> |
| 26 | |
| 27 | <div class="wrap"> |
| 28 | <!-- Slideshow --> |
| 29 | <div class="slideshow-container slideshow-develop col-16"> |
| 30 | <a href="" class="slideshow-prev">Prev</a> |
| 31 | <a href="" class="slideshow-next">Next</a> |
| 32 | <div class="frame"> |
| 33 | <ul> |
| 34 | <li class="item carousel-home"> |
| 35 | <div class="col-8"> |
| 36 | <img |
| 37 | src="http://1.bp.blogspot.com/-6qyjPxTuzv0/T6lde-Oq_fI/AAAAAAAABXc/zle7OFEGP44/s400/fddns%2Bcopy.png" |
| 38 | class="play no-shadow no-transform" /> |
| 39 | </div> |
| 40 | <div class="content-right col-6"> |
| 41 | <p class="title-intro">From the blog:</p> |
| 42 | <h2>Using DialogFragments</h2> |
| 43 | <p>In this post, I'll show how to use DialogFragments with the <a |
| 44 | href="http://developer.android.com/reference/android/support/v4/app/DialogFragment.html">v4 support |
| 45 | library</a> (for backward compatibility on pre-Honeycomb devices) to show a simple edit dialog and |
| 46 | return a result to the calling Activity using an interface.</p> |
| 47 | <p><a |
| 48 | href="http://android-developers.blogspot.com/2012/05/using-dialogfragments.html" class="button">Read |
| 49 | more</a></p> |
| 50 | </div> |
| 51 | </li> |
| 52 | <li class="item carousel-home"> |
| 53 | <div class="col-8"> |
| 54 | <img |
| 55 | src="http://1.bp.blogspot.com/-6K1kfNOdek8/T72bXvtTSQI/AAAAAAAABmw/kYzmJt0_328/s1600/google-play-subscriptions.png" class="play"></div> |
| 56 | <div class="content-right col-6"> |
| 57 | <p class="title-intro">From the blog:</p> |
| 58 | <h2>In-app Subscriptions in Google Play</h2> |
| 59 | <p>Starting today, developers can use In-app Billing to sell monthly or annual |
| 60 | subscriptions from inside of their apps. All subscriptions are auto-renewing, for every app and game |
| 61 | and every type of subscription product.</p> |
| 62 | <p><a class="button" |
| 63 | href="http://android-developers.blogspot.com/2012/05/in-app-subscriptions-in-google-play.html">Read |
| 64 | more</a></p> |
| 65 | </div> |
| 66 | </li> |
| 67 | <li class="item carousel-home"> |
| 68 | <div class="col-8"> |
| 69 | <img |
| 70 | src="{@docRoot}images/home/developers_live.png" class="play"></div> |
| 71 | <div class="content-right col-6"> |
| 72 | <h2>Learn what great apps are made of</h2> |
| 73 | <p>Every week we host a live broadcast in which we review a collection of apps and games |
| 74 | nominated by the creators. It's no-holds-barred and we tell you exactly what is flawed or |
| 75 | fantastic in each app and how to make improvements.</p> |
| 76 | <p><a href="" class="button" onclick="$('ul#DevelopersLive li:first |
| 77 | a').click();return false;">Watch the latest review</a></p> |
| 78 | </div> |
| 79 | </li> |
| 80 | <li class="item carousel-home"> |
| 81 | <div class="col-8"> |
| 82 | <img style="margin-top:30px;width:300px" |
| 83 | src="{@docRoot}images/home/ics-android.png" class="play no-shadow no-transform" /> |
| 84 | </div> |
| 85 | <div class="content-right col-6"> |
| 86 | <h2>Ice Cream Sandwich</h2> |
| 87 | <p>Android 4.0 brings handsets and tablets together with a unified |
| 88 | design and a set of APIs for you to build a great user experience on all devices. |
| 89 | For information about API changes in the latest release (API level 15), |
| 90 | read the <a href='{@docRoot}about/versions/android-4.0.3.html'>platform notes</a> and <a |
| 91 | href='{@docRoot}sdk/api_diff/15/changes.html'>diff report</a>.</p> |
| 92 | <p><a class="button" |
| 93 | href="{@docRoot}about/versions/android-4.0-highlights.html">Read the highlights</a></p> |
| 94 | </div> |
| 95 | </li> |
| 96 | </ul> |
| 97 | </div> |
| 98 | </div> |
| 99 | <!-- /End slideshow --> |
| 100 | </div> |
| 101 | <div class="wrap"> |
| 102 | <!-- news and feature feed --> |
| 103 | <div class="feed col-8" style="margin-left:0"> |
| 104 | <ul class="feed-nav"> |
| 105 | <li class="active">DEVELOPER NEWS</li> |
| 106 | <li>FEATURED DOCS</li> |
| 107 | </ul> |
| 108 | <div class="feed-container"> |
| 109 | <div class="feed-frame"> |
| 110 | <!-- DEVELOPER NEWS --> |
| 111 | <ul> |
| 112 | <li><a href="http://android-developers.blogspot.com/2012/04/faster-emulator-with-better-hardware.html"> |
| 113 | <div class="feed-image" style="background:url('../images/emulator-wvga800l.png') no-repeat 0 0"> |
| 114 | </div> |
| 115 | <h4>A Faster Emulator with Better...</h4> |
| 116 | <p>Today we’re thrilled to announce several significant improvements to the emulator, including a dramatic...</p> |
| 117 | </a></li> |
| 118 | <li><a href="http://android-developers.blogspot.com/2012/04/android-c2dm-client-login-key.html"> |
| 119 | <div class="feed-image" style="background:url('../images/develop/auth-code.png') no-repeat 0 0"> |
| 120 | </div> |
| 121 | <h4>Android C2DM — Client Login key...</h4> |
| 122 | <p>In the upcoming weeks, some of the older Client |
| 123 | Login authentication keys will expire. If you generated the token you’re...</p> |
| 124 | </a></li> |
| 125 | <li><a href="http://android-developers.blogspot.com/2012/04/accessibility-are-you-serving-all-your.html"> |
| 126 | <div class="feed-image"> |
| 127 | </div> |
| 128 | <h4>Accessibility</h4> |
| 129 | <p>We recently published some new resources to help developers make their Android applications more accessible... </p> |
| 130 | </a></li> |
| 131 | <li><a href="http://android-developers.blogspot.com/2012/04/new-seller-countries-in-google-play.html"> |
| 132 | <div class="feed-image" style="background:url('http://developer.android.com/images/home/play_logo.png') no-repeat 0 0" > |
| 133 | </div> |
| 134 | <h4>New Seller Countries in Google Play</h4> |
| 135 | <p>Over the past year we’ve been working to expand the list of |
| 136 | countries and currencies from which Android developers...</p> |
| 137 | </a></li> |
| 138 | </ul> |
| 139 | <!-- FEATURED DOCS --> |
| 140 | <ul> |
| 141 | <li><a href="{@docRoot}guide/google/play/billing/index.html"> |
| 142 | <h4>Google Play In-app Billing</h4> |
| 143 | <p>In-app Billing is a Google Play service that lets you sell digital content from inside your applications. You can sell products as standard in-app products (one-time purchase) or with subscriptions (recurring...</p> |
| 144 | </a></li> |
| 145 | <li><a href="{@docRoot}guide/topics/providers/contacts-provider.html"> |
| 146 | <h4>Contacts Provider</h4> |
| 147 | <p>The Contacts Provider is a powerful and flexible Android component that manages the device's central repository of data about people. You can use it to build powerful social features...</p> |
| 148 | </a></li> |
| 149 | <li><a href="{@docRoot}training/efficient-downloads/index.html"> |
| 150 | <h4>Transferring Data Without Draining the Battery</h4> |
| 151 | <p>This training class demonstrates the best practices for scheduling and executing downloads using techniques such as caching, polling, and prefetching.</p> |
| 152 | </a></li> |
| 153 | <li><a href="{@docRoot}training/backward-compatible-ui/index.html"> |
| 154 | <h4>Creating Backward-Compatible UIs</h4> |
| 155 | <p>This training class demonstrates how to use UI components and APIs available in newer versions of Android in a backward-compatible way, ensuring that your application still runs on previous versions...</p> |
| 156 | </a></li> |
| 157 | </ul> |
| 158 | </div> |
| 159 | </div> |
| 160 | </div> <!-- /news and feature feed --> |
| 161 | <!-- video feed --> |
| 162 | <div class="feed col-8" style="margin-right:0"> |
| 163 | <ul class="feed-nav"> |
| 164 | <li class="active">DEVELOPERS LIVE</li> |
| 165 | <li>VIDEO PLAYLISTS</li> |
| 166 | </ul> |
| 167 | <div class="feed-container"> |
| 168 | <div class="feed-frame"> |
| 169 | <ul id="DevelopersLive"> |
| 170 | </ul> |
| 171 | <ul id="VideoPlaylists"> |
| 172 | </ul> |
| 173 | </div> |
| 174 | </div> |
| 175 | </div> |
| 176 | <!-- /video feed --> |
| 177 | </div> |
| 178 | |
| 179 | <br class="clearfix"/> |
| 180 | </div> |
| 181 | |
| 182 | |
| 183 | |
| 184 | |
| 185 | |
| 186 | |
| 187 | |
| 188 | |
| 189 | |
| 190 | |
| 191 | <script src="//swfobject.googlecode.com/svn/trunk/swfobject/swfobject.js" type="text/javascript"></script> |
| 192 | <script type="text/javascript"> |
| 193 | |
| 194 | /* Load a video into the player box. |
| 195 | * @param id The YouTube video ID |
| 196 | * @param title The video title to display in the player box (character escaped) |
| 197 | * @param autoplay Whether to automatically play the video |
| 198 | */ |
| 199 | function loadVideo(id, title, autoplay) { |
| 200 | swfobject.embedSWF('//www.youtube.com/v/' + id + '&rel=1&border=0&fs=1&autoplay=' + |
| 201 | (autoplay?1:0), 'player', '525', '330', '9.0.0', false, false, {allowfullscreen: 'true'}); |
| 202 | $("#videoPlayerTitle").html("<h2>" + unescape(title) + "</h2>"); |
| 203 | $("#player-wrapper").show(); |
| 204 | setTimeout(function(){$('#noplayer-message').show()}, 2000); |
| 205 | } |
| 206 | |
| 207 | /* Draw all videos from a playlist into a 'videoPreviews' list |
| 208 | * @param data The feed data returned from the youtube request |
| 209 | */ |
| 210 | function renderVideoPlaylists(data) { |
| 211 | var MAX_LIST_DESC_LENGTH = 130; // the length at which we will trim the description |
| 212 | var MAX_VIDEO_DESC_LENGTH = 100; // the length at which we will trim the description |
| 213 | var MAX_LIST_LENGTH = 4; // number of videos to put in the list |
| 214 | var feed = data.feed; |
| 215 | var entries = feed.entry || []; |
| 216 | var playlistId = feed.yt$playlistId.$t; |
| 217 | |
| 218 | var $ulVideos = $('<ul style="display:none"/>'); |
| 219 | var summary = feed.media$group.media$description != null ? feed.media$group.media$description.$t : feed.subtitle.$t; |
| 220 | |
| 221 | var $liPlaylist = $('<li class="playlist"></li>'); |
| 222 | var $aPlaylist = $('<a href="" onclick="togglePlaylist(this);return false;"></a>'); |
| 223 | $liPlaylist.append($aPlaylist); |
| 224 | $aPlaylist.append('<h4>' + feed.title.$t + '</h4>'); |
| 225 | |
| 226 | var playlistDescription = summary.substr(0, MAX_LIST_DESC_LENGTH); |
| 227 | playlistDescription += playlistDescription.length == MAX_LIST_DESC_LENGTH ? "..." : ""; // add ellipsis if we've chopped the description |
| 228 | $aPlaylist.append('<p>' + playlistDescription + '</p>'); |
| 229 | |
| 230 | // Loop through each entry (each video) and add it to the 'videoPreviews' list |
| 231 | var length = feed.entry.length < MAX_LIST_LENGTH ? feed.entry.length : MAX_LIST_LENGTH; // max of 4 videos per list |
| 232 | for (var i = 0; i < length; i++) { |
| 233 | var entry = entries[i]; |
| 234 | |
| 235 | var title = entry.title.$t; |
| 236 | var id = entry.media$group.yt$videoid.$t; |
| 237 | var thumbUrl = entry.media$group.media$thumbnail[0].url; |
| 238 | var fullDescription = entry.media$group.media$description.$t; |
| 239 | var playerUrl = entry.media$group.media$content[0].url; |
| 240 | |
| 241 | var shortDescription = fullDescription.substr(0, MAX_VIDEO_DESC_LENGTH); |
| 242 | shortDescription += shortDescription.length == MAX_VIDEO_DESC_LENGTH ? "..." : ""; // add ellipsis if we've chopped the description |
| 243 | |
| 244 | var img = $('<img src="' + thumbUrl + '" width="60" height="45"/>'); |
| 245 | var a = $('<a href="#" onclick="loadVideo(\'' + id + '\',\'' + escape(title) + '\',true); return false;" />'); |
| 246 | var pShortDescription = $('<p>' + shortDescription + '</p>'); |
| 247 | var h5Title = "<h5>" + title + "</h5>"; |
| 248 | var li = $('<li class="playlist-video"/>'); |
| 249 | |
| 250 | li.append(a); |
| 251 | a.append(img).append(h5Title).append(pShortDescription); |
| 252 | |
| 253 | $ulVideos.append(li); |
| 254 | |
| 255 | // use the first entry's thumbnail for the playlist |
| 256 | if (i == 0) { |
| 257 | $aPlaylist.prepend('<img src="' + thumbUrl + '" width="120" height="90"/>'); |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | if (feed.entry.length > MAX_LIST_LENGTH) { |
| 262 | // add item to go to youtube for playlist |
| 263 | $ulVideos.append('<li class="more"><a href="//www.youtube.com/playlist?list=PL' + playlistId + '">More »</a></li>'); |
| 264 | } |
| 265 | |
| 266 | $liPlaylist.append($ulVideos); |
| 267 | $('#VideoPlaylists').append($liPlaylist); |
| 268 | } |
| 269 | |
| 270 | |
| 271 | function renderDevelopersLivePlaylist(data) { |
| 272 | |
| 273 | var MAX_DESC_LENGTH = 125; // the length at which we will trim the description |
| 274 | var feed = data.feed; |
| 275 | var entries = feed.entry || []; |
| 276 | var playlistId = feed.yt$playlistId.$t; |
| 277 | |
| 278 | var ul = $('#DevelopersLive'); |
| 279 | |
| 280 | // Loop through each entry (each video) and add it to the '#DevelopersLive' list |
| 281 | for (var i = 0; i < 4; i++) { |
| 282 | var entry = entries[i]; |
| 283 | |
| 284 | var title = entry.title.$t; |
| 285 | var id = entry.media$group.yt$videoid.$t; |
| 286 | var thumbUrl = entry.media$group.media$thumbnail[0].url; |
| 287 | var fullDescription = entry.media$group.media$description.$t; |
| 288 | var playerUrl = entry.media$group.media$content[0].url; |
| 289 | var shortDescription = fullDescription.substr(0, MAX_DESC_LENGTH); |
| 290 | shortDescription += shortDescription.length == MAX_DESC_LENGTH ? "..." : ""; // add ellipsis if we've chopped the description |
| 291 | |
| 292 | var img = $('<img src="' + thumbUrl + '" width="120" height="90"/>'); |
| 293 | var a = $('<a href="#" onclick="loadVideo(\'' + id + '\',\'' + escape(title) + '\',true); return false;" />'); |
| 294 | var pShortDescription = $('<p>' + shortDescription + '</p>'); |
| 295 | var h4Title = "<h4>" + title + "</h4>"; |
| 296 | var li = $('<li/>'); |
| 297 | |
| 298 | li.append(a); |
| 299 | a.append(img).append(h4Title).append(pShortDescription); |
| 300 | |
| 301 | ul.append(li); |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | |
| 306 | |
| 307 | /* This 'playlist' object defines the playlist IDs for each tab. |
| 308 | * Each name inside 'playlist' corresponds to class names for the tab that the playlists belong to (eg: "googleioTab" and "googleioBox" divs). |
| 309 | * Each string in 'ids' is the ID of a YouTube playlist that belongs in the corresponding tab. |
| 310 | */ |
| 311 | var playlists = { |
| 312 | 'googleio' : { |
| 313 | 'ids': ["734A052F802C96B9"] |
| 314 | }, |
| 315 | 'fridayreview' : { |
| 316 | 'ids': ["B7B9B23D864A55C3"] |
| 317 | }, |
| 318 | 'officehours' : { |
| 319 | 'ids': ["7383D9AADA6E6D55"] |
| 320 | }, |
| 321 | 'about' : { |
| 322 | 'ids': ["D7C64411AF40DEA5"] |
| 323 | } |
| 324 | }; |
| 325 | |
| 326 | /* Request the playlist feeds from YouTube */ |
| 327 | function showVideosPlaylists() { |
| 328 | for (var x in playlists) { |
| 329 | var ids = playlists[x].ids; |
| 330 | for (var i in ids) { |
| 331 | var script = "<script type='text/javascript' src='//gdata.youtube.com/feeds/api/playlists/" |
| 332 | + ids[i] + |
| 333 | "?v=2&alt=json-in-script&max-results=50&callback=renderVideoPlaylists&orderby=published'><\/script>"; |
| 334 | $("body").append(script); |
| 335 | } |
| 336 | } |
| 337 | } |
| 338 | |
| 339 | |
| 340 | /* Request the playlist feeds from YouTube */ |
| 341 | function showDevelopersLivePlaylist() { |
| 342 | var playlistId = "B7B9B23D864A55C3"; /* The Friday Review */ |
| 343 | var script = "<script type='text/javascript' src='//gdata.youtube.com/feeds/api/playlists/" |
| 344 | + playlistId + |
| 345 | "?v=2&alt=json-in-script&max-results=10&callback=renderDevelopersLivePlaylist&orderby=published'><\/script > "; |
| 346 | $("body").append(script); |
| 347 | } |
| 348 | |
| 349 | |
| 350 | function togglePlaylist(listLink) { |
| 351 | var $list = $(listLink).parent(); |
| 352 | var $ul = $list.find('ul'); |
| 353 | if ($ul.is(":visible")) { |
| 354 | $ul.slideUp(function() { |
| 355 | $list.css({'height':'inherit'}); |
| 356 | }); |
| 357 | } else { |
| 358 | $list.closest('ul').find('li.playlist').find('ul').slideUp(); |
| 359 | $ul.slideDown(); |
| 360 | $list.css({'height':'auto'}); |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | showDevelopersLivePlaylist(); |
| 365 | showVideosPlaylists(); |
| 366 | </script> |