blob: eaa70e21dcae8555d3b7070c603f0280b159fbea [file] [log] [blame]
Scott Main50e990c2012-06-21 17:14:39 -07001fullpage=true
2page.title=Develop
3header.hide=1
4carousel=1
5tabbedList=1
6@jd:body
7
8<style>
9#noplayer-message {
10position: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&reg; 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
Scott Main67922bb2012-07-23 14:33:42 -070027
Scott Main50e990c2012-06-21 17:14:39 -070028<div class="wrap">
29 <!-- Slideshow -->
30 <div class="slideshow-container slideshow-develop col-16">
31 <a href="" class="slideshow-prev">Prev</a>
32 <a href="" class="slideshow-next">Next</a>
33 <div class="frame">
34 <ul>
35 <li class="item carousel-home">
36 <div class="col-8">
37 <img
Scott Main67922bb2012-07-23 14:33:42 -070038src="http://4.bp.blogspot.com/-g05If_eKKRQ/UAcrVLI-OYI/AAAAAAAAAr8/AWvunVb5S-w/s320/nexus7.png"
39class="play no-shadow no-transform" />
40 </div>
41 <div class="content-right col-6">
42 <p class="title-intro">From the blog:</p>
43 <h2>Getting Your App Ready for Jelly Bean and Nexus 7</h2>
44 <p>For many people, their first taste of Jelly Bean will be on the beautiful
45 Nexus 7. While most applications will run just fine on Nexus 7, who wants
46 their app to be just fine? Here are some tips for optimizing your application
47 to make the most of this device.</p>
48 <p><a
49href="http://android-developers.blogspot.com/2012/07/getting-your-app-ready-for-jelly-bean.html" class="button">Read
50more</a></p>
51 </div>
52 </li>
53 <li class="item carousel-home">
54 <div class="col-8">
55 <img
Scott Main50e990c2012-06-21 17:14:39 -070056src="http://1.bp.blogspot.com/-6qyjPxTuzv0/T6lde-Oq_fI/AAAAAAAABXc/zle7OFEGP44/s400/fddns%2Bcopy.png"
57class="play no-shadow no-transform" />
58 </div>
59 <div class="content-right col-6">
60 <p class="title-intro">From the blog:</p>
61 <h2>Using DialogFragments</h2>
62 <p>In this post, I'll show how to use DialogFragments with the <a
63href="http://developer.android.com/reference/android/support/v4/app/DialogFragment.html">v4 support
64library</a> (for backward compatibility on pre-Honeycomb devices) to show a simple edit dialog and
65return a result to the calling Activity using an interface.</p>
66 <p><a
67href="http://android-developers.blogspot.com/2012/05/using-dialogfragments.html" class="button">Read
68more</a></p>
69 </div>
70 </li>
71 <li class="item carousel-home">
72 <div class="col-8">
73 <img
74src="http://1.bp.blogspot.com/-6K1kfNOdek8/T72bXvtTSQI/AAAAAAAABmw/kYzmJt0_328/s1600/google-play-subscriptions.png" class="play"></div>
75 <div class="content-right col-6">
76 <p class="title-intro">From the blog:</p>
77 <h2>In-app Subscriptions in Google Play</h2>
78 <p>Starting today, developers can use In-app Billing to sell monthly or annual
79subscriptions from inside of their apps. All subscriptions are auto-renewing, for every app and game
80and every type of subscription product.</p>
81 <p><a class="button"
82href="http://android-developers.blogspot.com/2012/05/in-app-subscriptions-in-google-play.html">Read
83more</a></p>
84 </div>
85 </li>
86 <li class="item carousel-home">
87 <div class="col-8">
88 <img
89src="{@docRoot}images/home/developers_live.png" class="play"></div>
90 <div class="content-right col-6">
91 <h2>Learn what great apps are made of</h2>
92 <p>Every week we host a live broadcast in which we review a collection of apps and games
93 nominated by the creators. It's no-holds-barred and we tell you exactly what is flawed or
94 fantastic in each app and how to make improvements.</p>
95 <p><a href="" class="button" onclick="$('ul#DevelopersLive li:first
96a').click();return false;">Watch the latest review</a></p>
97 </div>
98 </li>
Scott Main50e990c2012-06-21 17:14:39 -070099 </ul>
100 </div>
101 </div>
102 <!-- /End slideshow -->
103</div>
104<div class="wrap">
105 <!-- news and feature feed -->
106 <div class="feed col-8" style="margin-left:0">
107 <ul class="feed-nav">
108 <li class="active">DEVELOPER NEWS</li>
109 <li>FEATURED DOCS</li>
110 </ul>
111 <div class="feed-container">
112 <div class="feed-frame">
113 <!-- DEVELOPER NEWS -->
114 <ul>
Scott Main67922bb2012-07-23 14:33:42 -0700115 <li><a href="http://android-developers.blogspot.com/2012/06/android-sdk-tools-revision-20.html">
116 <div class="feed-image" style="background:url('http://1.bp.blogspot.com/-Kp1qE5du6l8/T-xurIjfPgI/AAAAAAAABAM/kuWQwPgi0rw/s640/newactivity+(1).png') no-repeat 0 0">
117 </div>
118 <h4>Android SDK Tools, Revision 20</h4>
119 <p>Along with the preview of the Android 4.1 (Jelly Bean) platform, we launched Android SDK Tools R20 and ADT 20.0.0. Here are a few things...</p>
120 </a></li>
Scott Main50e990c2012-06-21 17:14:39 -0700121 <li><a href="http://android-developers.blogspot.com/2012/04/faster-emulator-with-better-hardware.html">
122 <div class="feed-image" style="background:url('../images/emulator-wvga800l.png') no-repeat 0 0">
123 </div>
124 <h4>A Faster Emulator with Better...</h4>
125 <p>Today were thrilled to announce several significant improvements to the emulator, including a dramatic...</p>
126 </a></li>
127 <li><a href="http://android-developers.blogspot.com/2012/04/android-c2dm-client-login-key.html">
128 <div class="feed-image" style="background:url('../images/develop/auth-code.png') no-repeat 0 0">
129 </div>
130 <h4>Android C2DM Client Login key...</h4>
131 <p>In the upcoming weeks, some of the older Client
132 Login authentication keys will expire. If you generated the token youre...</p>
133 </a></li>
134 <li><a href="http://android-developers.blogspot.com/2012/04/accessibility-are-you-serving-all-your.html">
135 <div class="feed-image">
136 </div>
137 <h4>Accessibility</h4>
138 <p>We recently published some new resources to help developers make their Android applications more accessible... </p>
139 </a></li>
Scott Main67922bb2012-07-23 14:33:42 -0700140
Scott Main50e990c2012-06-21 17:14:39 -0700141 </ul>
142 <!-- FEATURED DOCS -->
143 <ul>
144 <li><a href="{@docRoot}guide/google/play/billing/index.html">
145 <h4>Google Play In-app Billing</h4>
146 <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>
147 </a></li>
148 <li><a href="{@docRoot}guide/topics/providers/contacts-provider.html">
149 <h4>Contacts Provider</h4>
150 <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>
151 </a></li>
152 <li><a href="{@docRoot}training/efficient-downloads/index.html">
153 <h4>Transferring Data Without Draining the Battery</h4>
154 <p>This training class demonstrates the best practices for scheduling and executing downloads using techniques such as caching, polling, and prefetching.</p>
155 </a></li>
156 <li><a href="{@docRoot}training/backward-compatible-ui/index.html">
157 <h4>Creating Backward-Compatible UIs</h4>
158 <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>
159 </a></li>
160 </ul>
161 </div>
162 </div>
163 </div> <!-- /news and feature feed -->
164 <!-- video feed -->
165 <div class="feed col-8" style="margin-right:0">
166 <ul class="feed-nav">
167 <li class="active">DEVELOPERS LIVE</li>
168 <li>VIDEO PLAYLISTS</li>
169 </ul>
170 <div class="feed-container">
171 <div class="feed-frame">
172 <ul id="DevelopersLive">
173 </ul>
174 <ul id="VideoPlaylists">
175 </ul>
176 </div>
177 </div>
178 </div>
179 <!-- /video feed -->
180</div>
181
182<br class="clearfix"/>
183 </div>
184
185
186
187
188
189
190
191
192
193
194<script src="//swfobject.googlecode.com/svn/trunk/swfobject/swfobject.js" type="text/javascript"></script>
195<script type="text/javascript">
196
197/* Load a video into the player box.
198 * @param id The YouTube video ID
199 * @param title The video title to display in the player box (character escaped)
200 * @param autoplay Whether to automatically play the video
201 */
202function loadVideo(id, title, autoplay) {
203 swfobject.embedSWF('//www.youtube.com/v/' + id + '&rel=1&border=0&fs=1&autoplay=' +
204 (autoplay?1:0), 'player', '525', '330', '9.0.0', false, false, {allowfullscreen: 'true'});
205 $("#videoPlayerTitle").html("<h2>" + unescape(title) + "</h2>");
206 $("#player-wrapper").show();
207 setTimeout(function(){$('#noplayer-message').show()}, 2000);
208}
209
210/* Draw all videos from a playlist into a 'videoPreviews' list
211 * @param data The feed data returned from the youtube request
212 */
213function renderVideoPlaylists(data) {
214 var MAX_LIST_DESC_LENGTH = 130; // the length at which we will trim the description
215 var MAX_VIDEO_DESC_LENGTH = 100; // the length at which we will trim the description
216 var MAX_LIST_LENGTH = 4; // number of videos to put in the list
217 var feed = data.feed;
218 var entries = feed.entry || [];
219 var playlistId = feed.yt$playlistId.$t;
220
221 var $ulVideos = $('<ul style="display:none"/>');
222 var summary = feed.media$group.media$description != null ? feed.media$group.media$description.$t : feed.subtitle.$t;
223
224 var $liPlaylist = $('<li class="playlist"></li>');
225 var $aPlaylist = $('<a href="" onclick="togglePlaylist(this);return false;"></a>');
226 $liPlaylist.append($aPlaylist);
227 $aPlaylist.append('<h4>' + feed.title.$t + '</h4>');
228
229 var playlistDescription = summary.substr(0, MAX_LIST_DESC_LENGTH);
230 playlistDescription += playlistDescription.length == MAX_LIST_DESC_LENGTH ? "..." : ""; // add ellipsis if we've chopped the description
231 $aPlaylist.append('<p>' + playlistDescription + '</p>');
232
233 // Loop through each entry (each video) and add it to the 'videoPreviews' list
234 var length = feed.entry.length < MAX_LIST_LENGTH ? feed.entry.length : MAX_LIST_LENGTH; // max of 4 videos per list
235 for (var i = 0; i < length; i++) {
236 var entry = entries[i];
237
238 var title = entry.title.$t;
239 var id = entry.media$group.yt$videoid.$t;
240 var thumbUrl = entry.media$group.media$thumbnail[0].url;
241 var fullDescription = entry.media$group.media$description.$t;
242 var playerUrl = entry.media$group.media$content[0].url;
243
244 var shortDescription = fullDescription.substr(0, MAX_VIDEO_DESC_LENGTH);
245 shortDescription += shortDescription.length == MAX_VIDEO_DESC_LENGTH ? "..." : ""; // add ellipsis if we've chopped the description
246
247 var img = $('<img src="' + thumbUrl + '" width="60" height="45"/>');
248 var a = $('<a href="#" onclick="loadVideo(\'' + id + '\',\'' + escape(title) + '\',true); return false;" />');
249 var pShortDescription = $('<p>' + shortDescription + '</p>');
250 var h5Title = "<h5>" + title + "</h5>";
251 var li = $('<li class="playlist-video"/>');
252
253 li.append(a);
254 a.append(img).append(h5Title).append(pShortDescription);
255
256 $ulVideos.append(li);
257
258 // use the first entry's thumbnail for the playlist
259 if (i == 0) {
260 $aPlaylist.prepend('<img src="' + thumbUrl + '" width="120" height="90"/>');
261 }
262 }
263
264 if (feed.entry.length > MAX_LIST_LENGTH) {
265 // add item to go to youtube for playlist
266 $ulVideos.append('<li class="more"><a href="//www.youtube.com/playlist?list=PL' + playlistId + '">More &raquo;</a></li>');
267 }
268
269 $liPlaylist.append($ulVideos);
270 $('#VideoPlaylists').append($liPlaylist);
271}
272
273
274function renderDevelopersLivePlaylist(data) {
275
276 var MAX_DESC_LENGTH = 125; // the length at which we will trim the description
277 var feed = data.feed;
278 var entries = feed.entry || [];
279 var playlistId = feed.yt$playlistId.$t;
280
281 var ul = $('#DevelopersLive');
282
283 // Loop through each entry (each video) and add it to the '#DevelopersLive' list
284 for (var i = 0; i < 4; i++) {
285 var entry = entries[i];
286
287 var title = entry.title.$t;
288 var id = entry.media$group.yt$videoid.$t;
289 var thumbUrl = entry.media$group.media$thumbnail[0].url;
290 var fullDescription = entry.media$group.media$description.$t;
291 var playerUrl = entry.media$group.media$content[0].url;
292 var shortDescription = fullDescription.substr(0, MAX_DESC_LENGTH);
293 shortDescription += shortDescription.length == MAX_DESC_LENGTH ? "..." : ""; // add ellipsis if we've chopped the description
294
295 var img = $('<img src="' + thumbUrl + '" width="120" height="90"/>');
296 var a = $('<a href="#" onclick="loadVideo(\'' + id + '\',\'' + escape(title) + '\',true); return false;" />');
297 var pShortDescription = $('<p>' + shortDescription + '</p>');
298 var h4Title = "<h4>" + title + "</h4>";
299 var li = $('<li/>');
300
301 li.append(a);
302 a.append(img).append(h4Title).append(pShortDescription);
303
304 ul.append(li);
305 }
306}
307
308
309
310/* This 'playlist' object defines the playlist IDs for each tab.
311 * Each name inside 'playlist' corresponds to class names for the tab that the playlists belong to (eg: "googleioTab" and "googleioBox" divs).
312 * Each string in 'ids' is the ID of a YouTube playlist that belongs in the corresponding tab.
313 */
314var playlists = {
315 'googleio' : {
Scott Main67922bb2012-07-23 14:33:42 -0700316 'ids': ["4C6BCDE45E05F49E"]
Scott Main50e990c2012-06-21 17:14:39 -0700317 },
318 'fridayreview' : {
319 'ids': ["B7B9B23D864A55C3"]
320 },
321 'officehours' : {
322 'ids': ["7383D9AADA6E6D55"]
323 },
324 'about' : {
325 'ids': ["D7C64411AF40DEA5"]
326 }
327};
328
329/* Request the playlist feeds from YouTube */
330function showVideosPlaylists() {
331 for (var x in playlists) {
332 var ids = playlists[x].ids;
333 for (var i in ids) {
334 var script = "<script type='text/javascript' src='//gdata.youtube.com/feeds/api/playlists/"
335 + ids[i] +
336 "?v=2&alt=json-in-script&max-results=50&callback=renderVideoPlaylists&orderby=published'><\/script>";
337 $("body").append(script);
338 }
339 }
340}
341
342
343/* Request the playlist feeds from YouTube */
344function showDevelopersLivePlaylist() {
345 var playlistId = "B7B9B23D864A55C3"; /* The Friday Review */
346 var script = "<script type='text/javascript' src='//gdata.youtube.com/feeds/api/playlists/"
347 + playlistId +
348 "?v=2&alt=json-in-script&max-results=10&callback=renderDevelopersLivePlaylist&orderby=published'><\/script > ";
349 $("body").append(script);
350}
351
352
353function togglePlaylist(listLink) {
354 var $list = $(listLink).parent();
355 var $ul = $list.find('ul');
356 if ($ul.is(":visible")) {
357 $ul.slideUp(function() {
358 $list.css({'height':'inherit'});
359 });
360 } else {
361 $list.closest('ul').find('li.playlist').find('ul').slideUp();
362 $ul.slideDown();
363 $list.css({'height':'auto'});
364 }
365}
366
367showDevelopersLivePlaylist();
368showVideosPlaylists();
369</script>