am de32713f: Merge "Collect and store proguard obfuscation dictionary files." into jb-mr2-dev

* commit 'de32713f47b33c6d4c0bb4c8943e1eccf81aa0c5':
  Collect and store proguard obfuscation dictionary files.
diff --git a/core/pathmap.mk b/core/pathmap.mk
index 09f912e..7024e3e 100644
--- a/core/pathmap.mk
+++ b/core/pathmap.mk
@@ -115,7 +115,6 @@
         v7/gridlayout \
         v7/appcompat \
         v7/mediarouter \
-        v8/renderscript \
         v13
 
 #
diff --git a/tools/droiddoc/templates-sdk/assets/css/default.css b/tools/droiddoc/templates-sdk/assets/css/default.css
index 0c12340..4c01c2e 100644
--- a/tools/droiddoc/templates-sdk/assets/css/default.css
+++ b/tools/droiddoc/templates-sdk/assets/css/default.css
@@ -305,6 +305,8 @@
       position: absolute;
       top: 0;
       right: 0; }
+    #nav .nav-section-header.empty {
+      padding:0; }
     #nav .nav-section-header.empty:after {
       display: none; }
     /* nested nav headers */
@@ -338,7 +340,7 @@
       width: 34px;
       height: 34px; }
   #nav li.expanded li ul.tree-list-children {
-    padding:0;
+    padding: 0;
   }
   #nav li.expanded li ul.tree-list-children .tree-list-children {
     padding:0 0 0 10px;
@@ -2358,6 +2360,7 @@
 #jd-content img.toggle-content-img {
   margin:0 5px 5px 0;
 }
+
 div.toggle-content-toggleme {
   padding:0 0 0 15px;
 }
@@ -2443,6 +2446,161 @@
   background-position: -10px 0;
 }
 
+
+/* --------------------------------------------------------------------------
+Styles for samples project trees and code browsing in resources tab 
+*/
+
+#codesample-wrapper {
+  width:1000px;
+  overflow:visible;
+}
+pre#codesample-block {
+  float:left;
+  overflow:visible;
+  background:transparent;
+  border:none;
+}
+pre#codesample-block .code-line:hover {
+  background:#e7e7e7;
+}
+pre#codesample-line-numbers {
+  float:left;
+  width:2em;
+  background:transparent;
+  border:none;
+  border-right:1px solid #ccc;
+  padding-left:0;
+  font-family:monospace;
+  text-align:right;
+  -webkit-touch-callout: none;
+  -webkit-user-select: none;
+  -khtml-user-select: none;
+  -moz-user-select: -moz-none;
+  -ms-user-select: none;
+  user-select: none;
+}
+pre#codesample-line-numbers a {
+  color:#999;
+}
+pre#codesample-line-numbers.hidden {
+  display:none;
+}
+pre#codesample-block span.code-line {
+  width:100%;
+  display:inline-block;
+}
+
+.structure-dir {
+background-image:url(../../assets/images/folder.png);
+background-repeat:no-repeat;
+background-position:16px 2px;
+  margin:.25em 0 0 0;
+  padding:0 0 0 0;
+}
+
+.structure-toggleme {
+  margin:0 0 0 3em;
+  padding:0 0 0 0;
+  text-decoration:none;
+}
+
+.structure-java{
+background-image:url(../../assets/images/file-java.png);
+background-repeat:no-repeat;
+background-position:0px 2px;
+  margin:.3em 0 0 0;
+  padding:.3em 0 .3em 22px;
+}
+
+.structure-file {
+background-image:url(../../assets/images/file-generic.png);
+background-repeat:no-repeat;
+background-position:0px 2px;
+  margin:.3em 0 0 0;
+  padding:.3em 0 .3em 22px;
+}
+
+.structure-xml {
+background-image:url(../../assets/images/file-xml.png);
+background-repeat:no-repeat;
+background-position:0px 2px;
+  margin:.3em 0 0 0;
+  padding:.3em 0 .25em 22px;
+}
+
+.structure-img {
+background-image:url(../../assets/images/file-image.png);
+background-repeat:no-repeat;
+background-position:0px 2px;
+  margin:.3em 0 0 0;
+  padding:.3em 0 .25em 22px;
+}
+
+.structure-manifest {
+background-image:url(../../assets/images/file-manifest.png);
+background-repeat:no-repeat;
+  margin:.0 0 0 1.25em;
+  padding:0 0 0 22px;
+  text-decoration:none;
+}
+
+#jd-content .structure-toggle-img {
+  margin:.5em 0 0 0;
+padding-right:2.1em;
+}
+
+.dirInfo {
+  margin-left:2em;
+}
+
+.structure-dir a {
+  text-decoration:none;
+}
+
+.structure-manifest a {
+  text-decoration: none;
+}
+.structure-file a {
+  text-decoration: none;
+}
+
+.sampleEmbed {
+  background-color:rgb(249, 249, 249);
+}
+
+.sampleEmbed ol.lineNumbers {
+  list-style-type: decimal;
+  padding-left:1em;
+}
+
+.sampleEmbed ol.lineNumbers li {
+border-left:1px solid #ddd;
+border-right:1px solid #ddd;
+color:gray;
+background-color:#f7f7f7;
+margin:0 0 0 24px;
+padding: 2px 2px 2px 6px;
+}
+
+.sampleEmbed ol.lineNumbers li:hover {
+background: #efefef;
+}
+
+/* --------------------------------------------------------------------------
+Styles for raw formatted line numbers (not used with listformatted version)
+div.sampleLine div.lineNumber {
+  display: inline;
+}
+div.sampleLine div.lineCode {
+  display: inline;
+  padding-left:6px;
+}
+div.sampleLine {
+  padding:0;
+  margin:0;
+}*/
+
 /* --------------------------------------------------------------------------
 Butterbar
 */
@@ -2489,7 +2647,7 @@
 .caption {
   margin: 0.5em 0 2em 0;
   color: #000;
-  font-size: 11.5px;
+  font-size: 11.5px; 
 }
 
 .nolist {
@@ -2664,6 +2822,10 @@
   margin:0 0 20px 20px;
   border:1px solid #ddd;
 }
+a.notice-developers.wide,
+a.notice-designers.wide {
+  width:278px;
+}
 a.notice-developers div,
 a.notice-designers div {
   min-height:40px;
diff --git a/tools/droiddoc/templates-sdk/assets/images/file-generic.png b/tools/droiddoc/templates-sdk/assets/images/file-generic.png
new file mode 100644
index 0000000..1802457
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/images/file-generic.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/assets/images/file-image.png b/tools/droiddoc/templates-sdk/assets/images/file-image.png
new file mode 100644
index 0000000..d3aec46
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/images/file-image.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/assets/images/file-java.png b/tools/droiddoc/templates-sdk/assets/images/file-java.png
new file mode 100644
index 0000000..ec85e4b
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/images/file-java.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/assets/images/file-manifest.png b/tools/droiddoc/templates-sdk/assets/images/file-manifest.png
new file mode 100644
index 0000000..332d066
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/images/file-manifest.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/assets/images/file-xml.png b/tools/droiddoc/templates-sdk/assets/images/file-xml.png
new file mode 100644
index 0000000..3dd21b6
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/images/file-xml.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/assets/images/folder.png b/tools/droiddoc/templates-sdk/assets/images/folder.png
new file mode 100644
index 0000000..44c6100
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/images/folder.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/assets/js/docs.js b/tools/droiddoc/templates-sdk/assets/js/docs.js
index ba65e44..87cbcd3 100644
--- a/tools/droiddoc/templates-sdk/assets/js/docs.js
+++ b/tools/droiddoc/templates-sdk/assets/js/docs.js
@@ -11,7 +11,7 @@
 var basePath = getBaseUri(location.pathname);
 var SITE_ROOT = toRoot + basePath.substring(1,basePath.indexOf("/",1));
 var GOOGLE_DATA; // combined data for google service apis, used for search suggest
-  
+
 // Ensure that all ajax getScript() requests allow caching
 $.ajaxSetup({
   cache: true
@@ -59,10 +59,10 @@
       toggleFullscreen(false);
     }
   });
-  
+
   // initialize the divs with custom scrollbars
   $('.scroll-pane').jScrollPane( {verticalGutter:0} );
-  
+
   // add HRs below all H2s (except for a few other h2 variants)
   $('h2').not('#qv h2').not('#tb h2').not('.sidebox h2').not('#devdoc-nav h2').not('h2.norule').css({marginBottom:0}).after('<hr/>');
 
@@ -78,7 +78,7 @@
   });
 
   // Set up quicknav
-  var quicknav_open = false;  
+  var quicknav_open = false;
   $("#btn-quicknav").click(function() {
     if (quicknav_open) {
       $(this).removeClass('active');
@@ -90,20 +90,20 @@
       expand();
     }
   })
-  
+
   var expand = function() {
    $('#header-wrap').addClass('quicknav');
    $('#quicknav').stop().show().animate({opacity:'1'});
   }
-  
+
   var collapse = function() {
     $('#quicknav').stop().animate({opacity:'0'}, 100, function() {
       $(this).hide();
       $('#header-wrap').removeClass('quicknav');
     });
   }
-  
-  
+
+
   //Set up search
   $("#search_autocomplete").focus(function() {
     $("#search-container").addClass('active');
@@ -127,7 +127,7 @@
     }
   })
 
-    
+
   // prep nav expandos
   var pagePath = document.location.pathname;
   // account for intl docs by removing the intl/*/ path
@@ -188,6 +188,8 @@
       $("#nav-x li.tools a").addClass("selected");
     } else if ($("body").hasClass("google")) {
       $("#nav-x li.google a").addClass("selected");
+    } else if ($("body").hasClass("samples")) {
+      $("#nav-x li.samples a").addClass("selected");
     }
 
   // highlight Distribute tab
@@ -209,7 +211,7 @@
     // set up prev links
     var $prevLink = [];
     var $prevListItem = $selListItem.prev('li');
-    
+
     var crossBoundaries = ($("body.design").length > 0) || ($("body.guide").length > 0) ? true :
 false; // navigate across topic boundaries only in design docs
     if ($prevListItem.length) {
@@ -224,10 +226,10 @@
       // jump to this section's index page (if it exists)
       var $parentListItem = $selListItem.parents('li');
       $prevLink = $selListItem.parents('li').find('a');
-      
+
       // except if cross boundaries aren't allowed, and we're at the top of a section already
       // (and there's another parent)
-      if (!crossBoundaries && $parentListItem.hasClass('nav-section') 
+      if (!crossBoundaries && $parentListItem.hasClass('nav-section')
                            && $selListItem.hasClass('nav-section')) {
         $prevLink = [];
       }
@@ -238,7 +240,7 @@
     var startClass = false;
     var training = $(".next-class-link").length; // decides whether to provide "next class" link
     var isCrossingBoundary = false;
-    
+
     if ($selListItem.hasClass('nav-section')) {
       // we're on an index page, jump to the first topic
       $nextLink = $selListItem.find('ul:eq(0)').find('a:eq(0)');
@@ -251,7 +253,7 @@
         // then set the landing page "start link" text to be the first doc title
         $('.topic-start-link').text($nextLink.text().toUpperCase());
       }
-      
+
       // If the selected page has a description, then it's a class or article homepage
       if ($selListItem.find('a[description]').length) {
         // this means we're on a class landing page
@@ -273,7 +275,7 @@
     if (startClass) {
       $('.start-class-link').attr('href', $nextLink.attr('href')).removeClass("hide");
 
-      // if there's no training bar (below the start button), 
+      // if there's no training bar (below the start button),
       // then we need to add a bottom border to button
       if (!$("#tb").length) {
         $('.start-class-link').css({'border-bottom':'1px solid #DADADA'});
@@ -283,7 +285,7 @@
       $('.next-page-link').attr('href','')
                           .removeClass("hide").addClass("disabled")
                           .click(function() { return false; });
-     
+
       $('.next-class-link').attr('href',$nextLink.attr('href'))
                           .removeClass("hide").append($nextLink.html());
       $('.next-class-link').find('.new').empty();
@@ -298,7 +300,7 @@
       } else {
         $('.prev-page-link').attr('href', $prevLink.attr('href')).removeClass("hide");
       }
-    } 
+    }
 
     // If this is a training 'article', there should be no prev/next nav
     // ... if the grandparent is the "nav" ... and it has no child list items...
@@ -307,16 +309,16 @@
       $('.next-page-link,.prev-page-link').attr('href','').addClass("disabled")
                           .click(function() { return false; });
     }
-    
+
   }
-  
-  
-  
+
+
+
   // Set up the course landing pages for Training with class names and descriptions
   if ($('body.trainingcourse').length) {
     var $classLinks = $selListItem.find('ul li a').not('#nav .nav-section .nav-section ul a');
     var $classDescriptions = $classLinks.attr('description');
-    
+
     var $olClasses  = $('<ol class="class-list"></ol>');
     var $liClass;
     var $imgIcon;
@@ -328,18 +330,20 @@
       $liClass  = $('<li></li>');
       $h2Title  = $('<a class="title" href="'+$(this).attr('href')+'"><h2>' + $(this).html()+'</h2><span></span></a>');
       $pSummary = $('<p class="description">' + $(this).attr('description') + '</p>');
-      
+
       $olLessons  = $('<ol class="lesson-list"></ol>');
-      
+
       $lessons = $(this).closest('li').find('ul li a');
-      
+
       if ($lessons.length) {
-        $imgIcon = $('<img src="'+toRoot+'assets/images/resource-tutorial.png" alt=""/>');
+        $imgIcon = $('<img src="'+toRoot+'assets/images/resource-tutorial.png" '
+            + ' width="64" height="64" alt=""/>');
         $lessons.each(function(index) {
           $olLessons.append('<li><a href="'+$(this).attr('href')+'">' + $(this).html()+'</a></li>');
         });
       } else {
-        $imgIcon = $('<img src="'+toRoot+'assets/images/resource-article.png" alt=""/>');
+        $imgIcon = $('<img src="'+toRoot+'assets/images/resource-article.png" '
+            + ' width="64" height="64" alt=""/>');
         $pSummary.addClass('article');
       }
 
@@ -349,36 +353,10 @@
     $('.jd-descr').append($olClasses);
   }
 
-
-
-
   // Set up expand/collapse behavior
-  $('#nav li.nav-section .nav-section-header').click(function() {
-    var section = $(this).closest('li.nav-section');
-    if (section.hasClass('expanded')) {
-    /* hide me */
-    //  if (section.hasClass('selected') || section.find('li').hasClass('selected')) {
-   //   /* but not if myself or my descendents are selected */
-   //     return;
-    //  }
-      section.children('ul').slideUp(250, function() {
-        section.closest('li').removeClass('expanded');
-        resizeNav();
-      });
-    } else {
-    /* show me */
-      // first hide all other siblings
-      var $others = $('li.nav-section.expanded', $(this).closest('ul'));
-      $others.removeClass('expanded').children('ul').slideUp(250);
-      
-      // now expand me
-      section.closest('li').addClass('expanded');
-      section.children('ul').slideDown(250, function() {
-        resizeNav();
-      });
-    }
-  });
-  
+  initExpandableNavItems("#nav");
+
+
   $(".scroll-pane").scroll(function(event) {
       event.preventDefault();
       return false;
@@ -410,10 +388,10 @@
       // from a scrollable div and so there's no need to make adjustments to our layout
       return;
     }
-    var scrollTop = $(window).scrollTop();    
+    var scrollTop = $(window).scrollTop();
     var headerHeight = $('#header').outerHeight();
     var subheaderHeight = $('#nav-x').outerHeight();
-    var searchResultHeight = $('#searchResults').is(":visible") ? 
+    var searchResultHeight = $('#searchResults').is(":visible") ?
                              $('#searchResults').outerHeight() : 0;
     var totalHeaderHeight = headerHeight + subheaderHeight + searchResultHeight;
     // we set the navbar fixed when the scroll position is beyond the height of the site header...
@@ -423,20 +401,20 @@
     if ($("#doc-col").height() < $("#side-nav").height()) {
       navBarShouldBeFixed = false;
     }
-   
+
     var scrollLeft = $(window).scrollLeft();
     // When the sidenav is fixed and user scrolls horizontally, reposition the sidenav to match
     if (navBarIsFixed && (scrollLeft != prevScrollLeft)) {
       updateSideNavPosition();
       prevScrollLeft = scrollLeft;
     }
-    
-    // Don't continue if the header is sufficently far away 
+
+    // Don't continue if the header is sufficently far away
     // (to avoid intensive resizing that slows scrolling)
     if (navBarIsFixed && navBarShouldBeFixed) {
       return;
     }
-    
+
     if (navBarIsFixed != navBarShouldBeFixed) {
       if (navBarShouldBeFixed) {
         // make it fixed
@@ -447,7 +425,7 @@
             .prependTo('#body-content');
         // add neato "back to top" button
         $('#devdoc-nav a.totop').css({'display':'block','width':$("#nav").innerWidth()+'px'});
-        
+
         // update the sidenaav position for side scrolling
         updateSideNavPosition();
       } else {
@@ -459,25 +437,18 @@
         $('#devdoc-nav a.totop').hide();
       }
       navBarIsFixed = navBarShouldBeFixed;
-    } 
-    
+    }
+
     resizeNav(250); // pass true in order to delay the scrollbar re-initialization for performance
   });
 
-  
+
   var navBarLeftPos;
   if ($('#devdoc-nav').length) {
     setNavBarLeftPos();
   }
 
 
-  // Stop expand/collapse behavior when clicking on nav section links (since we're navigating away
-  // from the page)
-  $('.nav-section-header').find('a:eq(0)').click(function(evt) {
-    window.location.href = $(this).attr('href');
-    return false;
-  });
-
   // Set up play-on-hover <video> tags.
   $('video.play-on-hover').bind('click', function(){
     $(this).get(0).load(); // in case the video isn't seekable
@@ -527,16 +498,16 @@
   var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
 
 
-  // Revise the sidenav widths to make room for the scrollbar 
+  // Revise the sidenav widths to make room for the scrollbar
   // which avoids the visible width from changing each time the bar appears
   var $sidenav = $("#side-nav");
   var sidenav_width = parseInt($sidenav.innerWidth());
-    
+
   $("#devdoc-nav  #nav").css("width", sidenav_width - 4 + "px"); // 4px is scrollbar width
 
 
   $(".scroll-pane").removeAttr("tabindex"); // get rid of tabindex added by jscroller
-  
+
   if ($(".scroll-pane").length > 1) {
     // Check if there's a user preference for the panel heights
     var cookieHeight = readCookie("reference_height");
@@ -544,7 +515,7 @@
       restoreHeight(cookieHeight);
     }
   }
-  
+
   resizeNav();
 
   /* init the language selector based on user cookie for lang */
@@ -582,6 +553,40 @@
 // END of the onload event
 
 
+function initExpandableNavItems(rootTag) {
+  $(rootTag + ' li.nav-section .nav-section-header').click(function() {
+    var section = $(this).closest('li.nav-section');
+    if (section.hasClass('expanded')) {
+    /* hide me and descendants */
+      section.find('ul').slideUp(250, function() {
+        // remove 'expanded' class from my section and any children
+        section.closest('li').removeClass('expanded');
+        $('li.nav-section', section).removeClass('expanded');
+        resizeNav();
+      });
+    } else {
+    /* show me */
+      // first hide all other siblings
+      var $others = $('li.nav-section.expanded', $(this).closest('ul'));
+      $others.removeClass('expanded').children('ul').slideUp(250);
+
+      // now expand me
+      section.closest('li').addClass('expanded');
+      section.children('ul').slideDown(250, function() {
+        resizeNav();
+      });
+    }
+  });
+
+  // Stop expand/collapse behavior when clicking on nav section links
+  // (since we're navigating away from the page)
+  // This selector captures the first instance of <a>, but not those with "#" as the href.
+  $('.nav-section-header').find('a:eq(0)').not('a[href="#"]').click(function(evt) {
+    window.location.href = $(this).attr('href');
+    return false;
+  });
+}
+
 function highlightSidenav() {
   // select current page in sidenav and header, and set up prev/next links if they exist
   var $selNavLink = $('#nav').find('a[href="' + mPagePath + '"]');
@@ -591,7 +596,7 @@
     // Find this page's <li> in sidenav and set selected
     $selListItem = $selNavLink.closest('li');
     $selListItem.addClass('selected');
-    
+
     // Traverse up the tree and expand all parent nav-sections
     $selNavLink.parents('li.nav-section').each(function() {
       $(this).addClass('expanded');
@@ -637,13 +642,6 @@
   $('#devdoc-nav').css({left: -newLeft});
   $('#devdoc-nav .totop').css({left: -(newLeft - parseInt($('#side-nav').css('margin-left')))});
 }
-  
-
-
-
-
-
-
 
 // TODO: use $(document).ready instead
 function addLoadEvent(newfun) {
@@ -668,10 +666,10 @@
 }
 
 
-addLoadEvent( function() {
+$(document).ready(function() {
   $("pre:not(.no-pretty-print)").addClass("prettyprint");
   prettyPrint();
-} );
+});
 
 
 
@@ -682,7 +680,7 @@
   var $nav = $("#devdoc-nav");
   var $window = $(window);
   var navHeight;
-  
+
   // Get the height of entire window and the total header height.
   // Then figure out based on scroll position whether the header is visible
   var windowHeight = $window.height();
@@ -690,12 +688,12 @@
   var headerHeight = $('#header').outerHeight();
   var subheaderHeight = $('#nav-x').outerHeight();
   var headerVisible = (scrollTop < (headerHeight + subheaderHeight));
-  
-  // get the height of space between nav and top of window. 
+
+  // get the height of space between nav and top of window.
   // Could be either margin or top position, depending on whether the nav is fixed.
-  var topMargin = (parseInt($nav.css('margin-top')) || parseInt($nav.css('top'))) + 1; 
+  var topMargin = (parseInt($nav.css('margin-top')) || parseInt($nav.css('top'))) + 1;
   // add 1 for the #side-nav bottom margin
-  
+
   // Depending on whether the header is visible, set the side nav's height.
   if (headerVisible) {
     // The sidenav height grows as the header goes off screen
@@ -704,44 +702,44 @@
     // Once header is off screen, the nav height is almost full window height
     navHeight = windowHeight - topMargin;
   }
-  
-  
-  
+
+
+
   $scrollPanes = $(".scroll-pane");
   if ($scrollPanes.length > 1) {
     // subtract the height of the api level widget and nav swapper from the available nav height
     navHeight -= ($('#api-nav-header').outerHeight(true) + $('#nav-swap').outerHeight(true));
-    
+
     $("#swapper").css({height:navHeight + "px"});
     if ($("#nav-tree").is(":visible")) {
       $("#nav-tree").css({height:navHeight});
     }
-    
-    var classesHeight = navHeight - parseInt($("#resize-packages-nav").css("height")) - 10 + "px"; 
+
+    var classesHeight = navHeight - parseInt($("#resize-packages-nav").css("height")) - 10 + "px";
     //subtract 10px to account for drag bar
-    
-    // if the window becomes small enough to make the class panel height 0, 
+
+    // if the window becomes small enough to make the class panel height 0,
     // then the package panel should begin to shrink
     if (parseInt(classesHeight) <= 0) {
       $("#resize-packages-nav").css({height:navHeight - 10}); //subtract 10px for drag bar
       $("#packages-nav").css({height:navHeight - 10});
     }
-    
+
     $("#classes-nav").css({'height':classesHeight, 'margin-top':'10px'});
     $("#classes-nav .jspContainer").css({height:classesHeight});
-    
-    
+
+
   } else {
     $nav.height(navHeight);
   }
-  
+
   if (delay) {
     updateFromResize = true;
     delayedReInitScrollbars(delay);
   } else {
     reInitScrollbars();
   }
-  
+
 }
 
 var updateScrollbars = false;
@@ -760,7 +758,7 @@
     updateFromResize = false;
     return;
   }
-  
+
   // We're scheduled for an update and the update request came from this method's setTimeout
   if (updateScrollbars && !updateFromResize) {
     reInitScrollbars();
@@ -778,7 +776,7 @@
     var api = $(this).data('jsp');
     if (!api) { setTimeout(reInitScrollbars,300); return;}
     api.reinitialise( {verticalGutter:0} );
-  });  
+  });
   $(".scroll-pane").removeAttr("tabindex"); // get rid of tabindex added by jscroller
 }
 
@@ -809,7 +807,7 @@
 
 
 
-/** Scroll the jScrollPane to make the currently selected item visible 
+/** Scroll the jScrollPane to make the currently selected item visible
     This is called when the page finished loading. */
 function scrollIntoView(nav) {
   var $nav = $("#"+nav);
@@ -818,13 +816,17 @@
 
   if ($nav.is(':visible')) {
     var $selected = $(".selected", $nav);
-    if ($selected.length == 0) return;
-    
-    var selectedOffset = $selected.position().top;
-    if (selectedOffset + 90 > $nav.height()) {  // add 90 so that we scroll up even 
-                                                // if the current item is close to the bottom
-      api.scrollTo(0, selectedOffset - ($nav.height() / 4), false); // scroll the item into view
-                                                              // to be 1/4 of the way from the top
+    if ($selected.length == 0) {
+      // If no selected item found, exit
+      return;
+    }
+    // get the selected item's offset from its container nav by measuring the item's offset
+    // relative to the document then subtract the container nav's offset relative to the document
+    var selectedOffset = $selected.offset().top - $nav.offset().top;
+    if (selectedOffset > $nav.height() * .8) { // multiply nav height by .8 so we move up the item
+                                               // if it's more than 80% down the nav
+      // scroll the item up by an amount equal to 80% the container nav's height
+      api.scrollTo(0, selectedOffset - ($nav.height() * .8), false);
     }
   }
 }
@@ -873,7 +875,7 @@
     date.setTime(date.getTime()+(10*365*24*60*60*1000)); // default expiration is one week
     expiration = date.toGMTString();
   }
-  var cookieValue = cookie_namespace + section + cookie + "=" + val 
+  var cookieValue = cookie_namespace + section + cookie + "=" + val
                     + "; expires=" + expiration+"; path=/";
   document.cookie = cookieValue;
 }
@@ -1012,7 +1014,7 @@
   $("#panel-link").toggle();
   $("#nav-tree").toggle();
   $("#tree-link").toggle();
-  
+
   resizeNav();
 
   // Gross nasty hack to make tree view show up upon first swap by setting height manually
@@ -1020,7 +1022,7 @@
       .css({'height':$("#nav-tree .jspContainer .jspPane").height() +'px'});
   // Another nasty hack to make the scrollbar appear now that we have height
   resizeNav();
-  
+
   if ($("#nav-tree").is(':visible')) {
     scrollIntoView("nav-tree");
   } else {
@@ -1075,7 +1077,7 @@
 
 function changeLangPref(lang, submit) {
   var date = new Date();
-  expires = date.toGMTString(date.setTime(date.getTime()+(10*365*24*60*60*1000))); 
+  expires = date.toGMTString(date.setTime(date.getTime()+(10*365*24*60*60*1000)));
   // keep this for 50 years
   //alert("expires: " + expires)
   writeCookie("pref_lang", lang, null, expires);
@@ -1120,19 +1122,21 @@
 /* Used to hide and reveal supplemental content, such as long code samples.
    See the companion CSS in android-developer-docs.css */
 function toggleContent(obj) {
-  var div = $(obj.parentNode.parentNode);
-  var toggleMe = $(".toggle-content-toggleme",div);
+  var div = $(obj).closest(".toggle-content");
+  var toggleMe = $(".toggle-content-toggleme:eq(0)",div);
   if (div.hasClass("closed")) { // if it's closed, open it
     toggleMe.slideDown();
-    $(".toggle-content-text", obj).toggle();
+    $(".toggle-content-text:eq(0)", obj).toggle();
     div.removeClass("closed").addClass("open");
-    $(".toggle-content-img", div).attr("title", "hide").attr("src", toRoot 
+    $(".toggle-content-img:eq(0)", div).attr("title", "hide").attr("src", toRoot
                   + "assets/images/triangle-opened.png");
   } else { // if it's open, close it
     toggleMe.slideUp('fast', function() {  // Wait until the animation is done before closing arrow
-      $(".toggle-content-text", obj).toggle();
+      $(".toggle-content-text:eq(0)", obj).toggle();
       div.removeClass("open").addClass("closed");
-      $(".toggle-content-img", div).attr("title", "show").attr("src", toRoot 
+      div.find(".toggle-content").removeClass("open").addClass("closed")
+              .find(".toggle-content-toggleme").hide();
+      $(".toggle-content-img", div).attr("title", "show").attr("src", toRoot
                   + "assets/images/triangle-closed.png");
     });
   }
@@ -1160,7 +1164,7 @@
 
 
 
-/*    
+/*
  *  Slideshow 1.0
  *  Used on /index.html and /develop/index.html for carousel
  *
@@ -1201,7 +1205,7 @@
 
  (function($) {
  $.fn.dacSlideshow = function(o) {
-     
+
      //Options - see above
      o = $.extend({
          btnPrev:   null,
@@ -1216,8 +1220,8 @@
          pagination: true
 
      }, o || {});
-     
-     //Set up a carousel for each 
+
+     //Set up a carousel for each
      return this.each(function() {
 
          var running = false;
@@ -1226,7 +1230,7 @@
          var div = $(this);
          var ul = $("ul", div);
          var tLi = $("li", ul);
-         var tl = tLi.size(); 
+         var tl = tLi.size();
          var timer = null;
 
          var li = $("li", ul);
@@ -1245,7 +1249,7 @@
          ul.css(sizeCss, ulSize+"px").css(animCss, -(curr*liSize));
 
          div.css(sizeCss, divSize+"px");
-         
+
          //Pagination
          if (o.pagination) {
              var pagination = $("<div class='pagination'></div>");
@@ -1263,7 +1267,7 @@
                 div.append(pagination);
              }
          }
-         
+
          //Previous button
          if(o.btnPrev)
              $(o.btnPrev).click(function(e) {
@@ -1288,18 +1292,18 @@
                      pauseRotateTimer();
                  }
              });
-         
+
          //Auto rotation
          if(o.auto) startRotateTimer();
-             
+
          function startRotateTimer() {
              clearInterval(timer);
              timer = setInterval(function() {
                   if (curr == tl-1) {
                     go(0);
                   } else {
-                    go(curr+o.scroll);  
-                  } 
+                    go(curr+o.scroll);
+                  }
               }, o.autoTime);
              $(o.btnPause).removeClass('paused');
          }
@@ -1337,11 +1341,11 @@
                     []
                   ).addClass("disabled");
 
-                 
+
                  var nav_items = $('li', pagination);
                  nav_items.removeClass('active');
                  nav_items.eq(to).addClass('active');
-                 
+
 
              }
              if(o.auto) startRotateTimer();
@@ -1363,7 +1367,7 @@
  })(jQuery);
 
 
-/*  
+/*
  *  dacSlideshow 1.0
  *  Used on develop/index.html for side-sliding tabs
  *
@@ -1402,7 +1406,7 @@
  */
  (function($) {
  $.fn.dacTabbedList = function(o) {
-     
+
      //Options - see above
      o = $.extend({
          speed : 250,
@@ -1410,8 +1414,8 @@
          nav_id: null,
          frame_id: null
      }, o || {});
-     
-     //Set up a carousel for each 
+
+     //Set up a carousel for each
      return this.each(function() {
 
          var curr = 0;
@@ -1419,17 +1423,17 @@
          var animCss = "margin-left";
          var sizeCss = "width";
          var div = $(this);
-         
+
          var nav = $(o.nav_id, div);
          var nav_li = $("li", nav);
-         var nav_size = nav_li.size(); 
+         var nav_size = nav_li.size();
          var frame = div.find(o.frame_id);
          var content_width = $(frame).find('ul').width();
          //Buttons
          $(nav_li).click(function(e) {
            go($(nav_li).index($(this)));
          })
-         
+
          //Go to an item
          function go(to) {
              if(!running) {
@@ -1442,10 +1446,10 @@
                      }
                  );
 
-                 
+
                  nav_li.removeClass('active');
                  nav_li.eq(to).addClass('active');
-                 
+
 
              }
              return false;
@@ -1652,7 +1656,7 @@
   * otherwise invokes search suggestions on key-up event.
   * @param e       The JS event
   * @param kd      True if the event is key-down
-  * @param toroot  A string for the site's root path 
+  * @param toroot  A string for the site's root path
   * @returns       True if the event should bubble up
   */
 function search_changed(e, kd, toroot)
@@ -1746,7 +1750,7 @@
         if ($($("li", $selectedUl)[gSelectedIndex]).hasClass("header")) {
           gSelectedIndex++;
         }
-        // set item selected       
+        // set item selected
         $('li:nth-child('+(gSelectedIndex+1)+')', $selectedUl).addClass('jd-selected');
         return false;
       }
@@ -1764,7 +1768,7 @@
         if ($($("li", $selectedUl)[gSelectedIndex]).hasClass("header")) {
           gSelectedIndex++;
         }
-        // set item selected       
+        // set item selected
         $('li:nth-child('+(gSelectedIndex+1)+')', $selectedUl).addClass('jd-selected');
         return false;
       }
@@ -1995,7 +1999,7 @@
 
 function search_focus_changed(obj, focused)
 {
-    if (!focused) {     
+    if (!focused) {
         if(obj.value == ""){
           $(".search .close").addClass("hide");
         }
@@ -2016,9 +2020,9 @@
   $("#searchResults").slideUp();
   $(".search .close").addClass("hide");
   location.hash = '';
-  
+
   $("#search_autocomplete").val("").blur();
-  
+
   // reset the ajax search callback to nothing, so results don't appear unless ENTER
   searchControl.setSearchStartingCallback(this, function(control, searcher, query) {});
 
@@ -2176,10 +2180,10 @@
       setTimeout(function() {
         // remove any residual page numbers
         $('#searchResults .gsc-tabsArea .gsc-cursor-box.gs-bidi-start-align').remove();
-        // move the page numbers to the left position; make a clone, 
+        // move the page numbers to the left position; make a clone,
         // because the element is drawn to the DOM only once
-        // and because we're going to remove it (previous line), 
-        // we need it to be available to move again as the user navigates 
+        // and because we're going to remove it (previous line),
+        // we need it to be available to move again as the user navigates
         $('#searchResults .gsc-webResult .gsc-cursor-box.gs-bidi-start-align:visible')
                         .clone().appendTo('#searchResults .gsc-tabsArea');
         }, 200);
@@ -2224,10 +2228,10 @@
 /* ######################################################## */
 
 /* Initialize some droiddoc stuff, but only if we're in the reference */
-if (location.pathname.indexOf("/reference")) {
-  if(!location.pathname.indexOf("/reference-gms/packages.html")
-    && !location.pathname.indexOf("/reference-gcm/packages.html")
-    && !location.pathname.indexOf("/reference/com/google") == 0) {
+if (location.pathname.indexOf("/reference") == 0) {
+  if(!(location.pathname.indexOf("/reference-gms/packages.html") == 0)
+    && !(location.pathname.indexOf("/reference-gcm/packages.html") == 0)
+    && !(location.pathname.indexOf("/reference/com/google") == 0)) {
     $(document).ready(function() {
       // init available apis based on user pref
       changeApiLevel();
@@ -2241,22 +2245,22 @@
 var maxLevel = 1;
 
 /******* SIDENAV DIMENSIONS ************/
-  
+
   function initSidenavHeightResize() {
     // Change the drag bar size to nicely fit the scrollbar positions
     var $dragBar = $(".ui-resizable-s");
     $dragBar.css({'width': $dragBar.parent().width() - 5 + "px"});
-    
-    $( "#resize-packages-nav" ).resizable({ 
+
+    $( "#resize-packages-nav" ).resizable({
       containment: "#nav-panels",
       handles: "s",
       alsoResize: "#packages-nav",
       resize: function(event, ui) { resizeNav(); }, /* resize the nav while dragging */
       stop: function(event, ui) { saveNavPanels(); } /* once stopped, save the sizes to cookie  */
       });
-          
+
   }
-  
+
 function updateSidenavFixedWidth() {
   if (!navBarIsFixed) return;
   $('#devdoc-nav').css({
@@ -2264,7 +2268,7 @@
     'margin' : $('#side-nav').css('margin')
   });
   $('#devdoc-nav a.totop').css({'display':'block','width':$("#nav").innerWidth()+'px'});
-  
+
   initSidenavHeightResize();
 }
 
@@ -2275,7 +2279,7 @@
     'margin' : $('#side-nav').css('margin')
   });
   $('#devdoc-nav .totop').css({'left': 'inherit'});
-  
+
   initSidenavHeightResize();
 }
 
@@ -2359,7 +2363,7 @@
     if (apiLevelNum > selectedLevelNum) {
       obj.addClass("absent").attr("title","Requires API Level \""
             + apiLevel + "\" or higher");
-    } 
+    }
     else obj.removeClass("absent").removeAttr("title");
   });
 }
@@ -2428,7 +2432,7 @@
       node.expanded = false;
     }
   }
-  
+
 
   node.children_ul = null;
   node.get_children_ul = function() {
@@ -2456,7 +2460,7 @@
       get_node(me, node);
       if ($(node.label_div).hasClass("absent")) {
         $(node.get_children_ul()).addClass("absent");
-      } 
+      }
       $(node.get_children_ul()).slideDown("fast");
     }
     node.plus_img.src = me.toroot + "assets/images/triangle-opened-small.png";
@@ -2532,7 +2536,7 @@
           init_navtree("tree-list", toroot, NAVTREE_DATA);
       }
   });
-  
+
   // perform api level toggling because because the whole tree is new to the DOM
   var selectedLevel = $("#apiLevelSelector option:selected").val();
   toggleVisisbleApis(selectedLevel, "#side-nav");
@@ -2571,6 +2575,13 @@
   }
 }
 
+
+
+
+
+
+
+
 /* TODO: eliminate redundancy with non-google functions */
 function init_google_navtree(navtree_id, toroot, root_nodes)
 {
@@ -2599,8 +2610,8 @@
   node.depth = mom.depth + 1;
   node.get_children_ul = function() {
       if (!node.children_ul) {
-        node.children_ul = document.createElement("ul"); 
-        node.children_ul.className = "tree-list-children"; 
+        node.children_ul = document.createElement("ul");
+        node.children_ul.className = "tree-list-children";
         node.li.appendChild(node.children_ul);
       }
       return node.children_ul;
@@ -2608,8 +2619,8 @@
   node.li = document.createElement("li");
 
   mom.get_children_ul().appendChild(node.li);
-  
-  
+
+
   if(link) {
     child = document.createElement("a");
 
@@ -2622,7 +2633,7 @@
   if (children_data != null) {
     node.li.className="nav-section";
     node.label_div = document.createElement("div");
-    node.label_div.className = "nav-section-header-ref";  
+    node.label_div.className = "nav-section-header-ref";
     node.li.appendChild(node.label_div);
     get_google_node(me, node);
     node.label_div.appendChild(child);
@@ -2656,6 +2667,67 @@
           node_data[2], node_data[3]);
   }
 }
+
+
+
+
+
+
+/****** NEW version of script to build google and sample navs dynamically ******/
+// TODO: update Google reference docs to tolerate this new implementation
+
+function init_google_navtree2(navtree_id, data)
+{
+  var $containerUl = $("#"+navtree_id);
+  var linkText;
+  for (var i in data) {
+    var node_data = data[i];
+    $containerUl.append(new_google_node2(node_data));
+  }
+
+  initExpandableNavItems("#"+navtree_id);
+}
+
+function new_google_node2(node_data)
+{
+  var linkText = node_data[0];
+  if(linkText.match("^"+"com.google.android")=="com.google.android"){
+    linkText = linkText.substr(19, linkText.length);
+  }
+  var $li = $('<li>');
+  var $a;
+  if (node_data[1] != null) {
+    $a = $('<a href="' + toRoot + node_data[1] + '">' + linkText + '</a>');
+  } else {
+    $a = $('<a href="#" onclick="return false;">' + linkText + '/</a>');
+  }
+  var $childUl = $('<ul>');
+  if (node_data[2] != null) {
+    $li.addClass("nav-section");
+    $a = $('<div class="nav-section-header">').append($a);
+    if (node_data[1] == null) $a.addClass('empty');
+
+    for (var i in node_data[2]) {
+      var child_node_data = node_data[2][i];
+      $childUl.append(new_google_node2(child_node_data));
+    }
+    $li.append($childUl);
+  }
+  $li.prepend($a);
+
+  return $li;
+}
+
+
+
+
+
+
+
+
+
+
+
 function showGoogleRefTree() {
   init_default_google_navtree(toRoot);
   init_default_gcm_navtree(toRoot);
@@ -2685,6 +2757,22 @@
   });
 }
 
+function showSamplesRefTree() {
+  init_default_samples_navtree(toRoot);
+}
+
+function init_default_samples_navtree(toroot) {
+  // load json file for navtree data
+  $.getScript(toRoot + 'samples_navtree_data.js', function(data, textStatus, jqxhr) {
+      // when the file is loaded, initialize the tree
+      if(jqxhr.status === 200) {
+          init_google_navtree2("nav.samples-nav", SAMPLES_NAVTREE_DATA);
+          highlightSidenav();
+          resizeNav();
+      }
+  });
+}
+
 /* TOGGLE INHERITED MEMBERS */
 
 /* Toggle an inherited class (arrow toggle)
@@ -2778,3 +2866,62 @@
     ensureAllInheritedExpanded();
   }
 });
+
+
+
+
+
+
+/* On-demand functions */
+
+/** Move sample code line numbers out of PRE block and into non-copyable column */
+function initCodeLineNumbers() {
+  var numbers = $("#codesample-block a.number");
+  if (numbers.length) {
+    $("#codesample-line-numbers").removeClass("hidden").append(numbers);
+  }
+
+  $(document).ready(function() {
+    // select entire line when clicked
+    $("span.code-line").click(function() {
+      if (!shifted) {
+        selectText(this);
+      }
+    });
+    // invoke line link on double click
+    $(".code-line").dblclick(function() {
+      document.location.hash = $(this).attr('id');
+    });
+    // highlight the line when hovering on the number
+    $("#codesample-line-numbers a.number").mouseover(function() {
+      var id = $(this).attr('href');
+      $(id).css('background','#e7e7e7');
+    });
+    $("#codesample-line-numbers a.number").mouseout(function() {
+      var id = $(this).attr('href');
+      $(id).css('background','none');
+    });
+  });
+}
+
+// create SHIFT key binder to avoid the selectText method when selecting multiple lines
+var shifted = false;
+$(document).bind('keyup keydown', function(e){shifted = e.shiftKey; return true;} );
+
+// courtesy of jasonedelman.com
+function selectText(element) {
+    var doc = document
+        , range, selection
+    ;
+    if (doc.body.createTextRange) { //ms
+        range = doc.body.createTextRange();
+        range.moveToElementText(element);
+        range.select();
+    } else if (window.getSelection) { //all others
+        selection = window.getSelection();        
+        range = doc.createRange();
+        range.selectNodeContents(element);
+        selection.removeAllRanges();
+        selection.addRange(range);
+    }
+}
diff --git a/tools/droiddoc/templates-sdk/components/masthead.cs b/tools/droiddoc/templates-sdk/components/masthead.cs
index 4f3273c..f3eb401 100644
--- a/tools/droiddoc/templates-sdk/components/masthead.cs
+++ b/tools/droiddoc/templates-sdk/components/masthead.cs
@@ -188,6 +188,10 @@
                         </li>
                         <li><a href="<?cs var:toroot ?>google/index.html">Google Services</a>
                         </li>
+                        <?cs if:android.hasSamples ?>
+                          <li><a href="<?cs var:toroot ?>samples/index.html">Samples</a>
+                          </li>
+                        <?cs /if ?>
                       </ul>
                     </li>
                     <li class="distribute last">
@@ -214,7 +218,7 @@
   </div>
     
     
-  <?cs if:training || guide || reference || tools || develop || google ?>
+  <?cs if:training || guide || reference || tools || develop || google || samples ?>
     <!-- Secondary x-nav -->
     <div id="nav-x">
         <div class="wrap">
@@ -254,6 +258,11 @@
                 <li class="google"><a href="<?cs var:toroot ?>google/index.html"
                   >Google Services</a>
                 </li>
+                <?cs if:android.hasSamples ?>
+                  <li class="samples"><a href="<?cs var:toroot ?>samples/index.html"
+                    >Samples</a>
+                  </li>
+                <?cs /if ?>
             </ul>
         </div>
         
diff --git a/tools/droiddoc/templates-sdk/customizations.cs b/tools/droiddoc/templates-sdk/customizations.cs
index 33edbde..985f059 100644
--- a/tools/droiddoc/templates-sdk/customizations.cs
+++ b/tools/droiddoc/templates-sdk/customizations.cs
@@ -135,6 +135,30 @@
 <?cs /def ?>
 
 <?cs
+def:samples_nav() ?>
+  <div class="wrap clearfix" id="body-content">
+    <div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
+      <div id="devdoc-nav" class="scroll-pane">
+<a class="totop" href="#top" data-g-event="left-nav-top">to top</a>
+
+<?cs
+        include:"../../../../frameworks/base/docs/html/samples/samples_toc.cs" ?>
+
+
+      </div>
+      <script type="text/javascript">
+       showSamplesRefTree();
+
+      </script>
+    </div> <!-- end side-nav -->
+    <script>
+      $(document).ready(function() {
+        scrollIntoView("devdoc-nav");
+        });
+    </script>
+<?cs /def ?>
+
+<?cs
 def:google_nav() ?>
   <div class="wrap clearfix" id="body-content">
     <div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
@@ -177,28 +201,7 @@
         });
     </script>
 <?cs /def ?>
-<?cs
-def:dist_more_nav() ?>
-  <div class="wrap clearfix" id="body-content">
-    <div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
-      <div id="devdoc-nav" class="scroll-pane">
-<a class="totop" href="#top" data-g-event="left-nav-top">to top</a>
 
-
-<?cs 
-        include:"../../../../frameworks/base/docs/html/distribute/more/more_toc.cs" ?>
-        
-
-      </div>
-    </div> <!-- end side-nav -->
-    <script>
-      $(document).ready(function() {
-        scrollIntoView("devdoc-nav");
-        });
-    </script>
-:
-
-<?cs /def ?>
 <?cs # The default side navigation for the reference docs ?><?cs 
 def:default_left_nav() ?>
 <?cs if:reference.gcm || reference.gms ?>
@@ -322,6 +325,8 @@
     call:tools_nav() ?><?cs
   elif:google ?><?cs 
     call:google_nav() ?><?cs 
+  elif:samples ?><?cs
+    call:samples_nav() ?><?cs
   elif:more ?><?cs 
     call:dist_more_nav() ?><?cs
   elif:distribute ?><?cs 
diff --git a/tools/droiddoc/templates-sdk/docpage.cs b/tools/droiddoc/templates-sdk/docpage.cs
index 90e663b..566e2da 100644
--- a/tools/droiddoc/templates-sdk/docpage.cs
+++ b/tools/droiddoc/templates-sdk/docpage.cs
@@ -3,7 +3,7 @@
 <html<?cs if:devsite ?> devsite<?cs /if ?>>
 <?cs include:"head_tag.cs" ?>
 <body class="gc-documentation <?cs if:(google || reference.gms || reference.gcm) ?>google<?cs /if ?>
-  <?cs if:(guide||develop||training||reference||tools||sdk) ?>develop<?cs if:guide ?> guide<?cs /if ?><?cs
+  <?cs if:(guide||develop||training||reference||tools||sdk||samples) ?>develop<?cs if:guide ?> guide<?cs /if ?><?cs if:samples ?> samples<?cs /if ?><?cs
   elif:about ?>about<?cs
   elif:design ?>design<?cs
   elif:distribute ?>distribute<?cs
diff --git a/tools/droiddoc/templates-sdk/head_tag.cs b/tools/droiddoc/templates-sdk/head_tag.cs
index 9778389..6a1ce06 100644
--- a/tools/droiddoc/templates-sdk/head_tag.cs
+++ b/tools/droiddoc/templates-sdk/head_tag.cs
@@ -2,7 +2,7 @@
 <?cs ####### If building devsite, add some meta data needed for when generating the top nav ######### ?>
 <?cs
   if:devsite ?><?cs
-    if:guide||develop||training||reference||tools||sdk||google
+    if:guide||develop||training||reference||tools||sdk||google||samples
       ?><meta name="top_category" value="develop" /><?cs
     elif:google
       ?><meta name="top_category" value="google" /><?cs
diff --git a/tools/droiddoc/templates-sdk/sample.cs b/tools/droiddoc/templates-sdk/sample.cs
new file mode 100644
index 0000000..cd0659e
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/sample.cs
@@ -0,0 +1,64 @@
+<?cs include:"doctype.cs" ?>
+<?cs include:"macros.cs" ?>
+<html<?cs if:devsite ?> devsite<?cs /if ?>>
+<?cs include:"head_tag.cs" ?>
+<body class="gc-documentation develop samples" itemscope itemtype="http://schema.org/Article">
+<?cs include:"header.cs" ?>
+
+<div <?cs if:fullpage
+?>class="fullpage"<?cs elif:design||tools||about||sdk||distribute
+?>class="col-13" id="doc-col"<?cs else 
+?>class="col-12" id="doc-col"<?cs /if ?> >
+
+<h1 itemprop="name"><?cs var:page.title ?></h1>
+
+<?cs # THIS IS THE MAIN DOC CONTENT ?>
+<div id="jd-content">
+
+<?cs if:android.whichdoc == "online" ?>
+
+<?cs # If this is the online docs, build the src code navigation links ?>
+
+
+<?cs var:summary ?>
+
+<!-- begin file contents -->
+<div id="codesample-wrapper">
+<pre id="codesample-line-numbers" class="no-pretty-print hidden"></pre>
+<pre id="codesample-block"><?cs var:fileContents ?></pre>
+</div>
+<!-- end file contents -->
+<script type="text/javascript">
+  initCodeLineNumbers();
+</script>
+
+
+
+
+<?cs else ?><?cs
+  # else, this means it's offline docs,
+          so don't show src links (we dont have the pages!) ?>
+
+<p>You can find the source code for this sample in your SDK at:</p>
+<p style="margin-left:2em">
+<code><em>&lt;sdk&gt;</em>/samples/android-<em>&lt;version&gt;</em>/</code>
+</p>
+
+<?cs /if ?><?cs # end if/else online docs ?>
+
+  </div> <!-- end jd-content -->
+
+<?cs include:"footer.cs" ?>
+</div><!-- end doc-content -->
+
+<?cs include:"trailer.cs" ?>
+
+</body>
+</html>
+
+
+
+
+
+
+
diff --git a/tools/droiddoc/templates-sdk/sampleindex.cs b/tools/droiddoc/templates-sdk/sampleindex.cs
index a173363..5fff207 100644
--- a/tools/droiddoc/templates-sdk/sampleindex.cs
+++ b/tools/droiddoc/templates-sdk/sampleindex.cs
@@ -1,53 +1,81 @@
 <?cs include:"doctype.cs" ?>
 <?cs include:"macros.cs" ?>
-<?cs set:resources="true" ?>
 <html<?cs if:devsite ?> devsite<?cs /if ?>>
 <?cs include:"head_tag.cs" ?>
+<body class="gc-documentation develop samples" itemscope itemtype="http://schema.org/Article">
 <?cs include:"header.cs" ?>
-<body class="gc-documentation">
 
+<div <?cs if:fullpage
+?>class="fullpage"<?cs elif:design||tools||about||sdk||distribute
+?>class="col-13" id="doc-col"<?cs else 
+?>class="col-12" id="doc-col"<?cs /if ?> >
 
-<a name="top"></a>
-<div class="g-unit" id="doc-content">
- <div id="jd-header" class="guide-header">
-    <span class="crumb">
-      <a href="<?cs var:toroot ?>resources/browser.html?tag=sample">Sample Code</a> >
-    </span>
-  <h1><?cs var:page.title ?></h1>
- </div>
-
+<h1 itemprop="name"><?cs var:projectTitle ?></h1>
+  
 <div id="jd-content">
-<p><a href="../index.html">&larr; Back</a></p>
+<?cs def:display_files(files) ?>
 
-<?cs var:summary ?>
+    <?cs each:file = files ?>
+        <?cs if:file.Type != "dir" ?>
+            <div class="structure-<?cs var:file.Type ?>">
+            <a href="<?cs var:toroot ?><?cs var:file.Href ?>"><?cs var:file.Name ?></a>
+            </div>
+        <?cs else ?>
+            <div class="toggle-content opened structure-dir">
+               <a href="#" onclick="return toggleContent(this)">
+               <img src="<?cs var:toroot ?>assets/images/triangle-opened.png"
+                  class="toggle-content-img structure-toggle-img" height="9px" width="9px" />
+               <?cs var:file.Name ?></a><?cs 
+                  if:file.SummaryFlag == "true" ?><span class="dirInfo"
+                    >[&nbsp;<a href="file.SummaryHref">Info</a>&nbsp;]</a></span><?cs 
+                  /if ?>
+               <div class="toggle-content-toggleme structure-toggleme"> 
+            <?cs if:file.Sub.0.Name ?>
+                 <?cs call:display_files(file.Sub) ?>
+            <?cs /if ?>
+               </div> <?cs # /toggleme ?>
+            </div> <?cs # /toggle-content ?>
+         <?cs /if ?>
+    <?cs /each ?>
+<?cs /def ?>
 
-  <?cs if:subcount(subdirs) ?>
-      <h2>Subdirectories</h2>
-      <ul class="nolist">
-      <?cs each:dir=subdirs ?>
-        <li><a href="<?cs var:dir.name ?>/index.html"><?cs
-          var:dir.name ?>/</a></li>
-      <?cs /each ?>
-      </ul>
-  <?cs /if ?>
+<?cs if:android.whichdoc == "online" ?>
+  <?cs # If this is the online docs, build the src code navigation links ?>
 
-  <?cs if:subcount(files) ?>
-      <h2>Files</h2>
-      <ul class="nolist">
-      <?cs each:file=files ?>
-        <li><a href="<?cs var:file.href ?>"><?cs
-          var:file.name ?></a></li>
-      <?cs /each ?>
-      </ul>
-  <?cs /if ?>
+  <?cs if:page.title == "Project Structure" ?>
 
-</div><!-- end jd-content -->
+    <?cs call:display_files(Files) ?>
+
+  <?cs else ?> <?cs # else not project structure doc ?>
+
+    <?cs var:summary ?>
+
+    <?cs # Remove project structure from landing pages for now
+         # <h2>Project Structure</h2>
+         # <p>Decide what to do with this ...</p>
+         # <?cs call:display_files(Files) ?>
+
+  <?cs /if ?> <?cs # end if project structure ?>
+
+<?cs else ?><?cs
+  # else, this means it's offline docs,
+          so don't show src links (we dont have the pages!) ?>
+
+<p>You can find the source code for this sample in your SDK at:</p>
+<p style="margin-left:2em">
+<code><em>&lt;sdk&gt;</em>/samples/android-<em>&lt;version&gt;</em>/</code>
+</p>
+
+<?cs /if ?><?cs # end if/else online docs ?>
+
+  </div> <!-- end jd-content -->
 
 <?cs include:"footer.cs" ?>
-
 </div><!-- end doc-content -->
 
 <?cs include:"trailer.cs" ?>
 
 </body>
 </html>
+
+
diff --git a/tools/droiddoc/templates-sdk/samples_navtree_data.cs b/tools/droiddoc/templates-sdk/samples_navtree_data.cs
new file mode 100644
index 0000000..24ac7b7
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/samples_navtree_data.cs
@@ -0,0 +1,3 @@
+var SAMPLES_NAVTREE_DATA =
+<?cs var:reference_tree ?>
+;
diff --git a/tools/droiddoc/templates-sdk/sdkpage.cs b/tools/droiddoc/templates-sdk/sdkpage.cs
index 3ebf697..ecc26f5 100644
--- a/tools/droiddoc/templates-sdk/sdkpage.cs
+++ b/tools/droiddoc/templates-sdk/sdkpage.cs
@@ -79,63 +79,112 @@
     <tr>
       <th>Platform</th>
       <th>Package</th>
-      <th>Size</th>
+      <th style="white-space:nowrap">Size (Bytes)</th>
       <th>MD5 Checksum</th>
   </tr>
   <tr>
-    <td>Windows 32-bit</td>
+    <td rowspan="2" style="white-space:nowrap">Windows 32-bit</td>
     <td>
   <a onClick="return onDownload(this)"
      href="http://dl.google.com/android/ndk/<?cs var:ndk.win32_download ?>"><?cs var:ndk.win32_download ?></a>
     </td>
-    <td><?cs var:ndk.win32_bytes ?> bytes</td>
+    <td><?cs var:ndk.win32_bytes ?></td>
     <td><?cs var:ndk.win32_checksum ?></td>
   </tr>
   <tr>
-    <td>Windows 64-bit</td>
+    <td>
+  <a onClick="return onDownload(this)"
+     href="http://dl.google.com/android/ndk/<?cs var:ndk.win32.legacy_download ?>"><?cs var:ndk.win32.legacy_download ?></a>
+    </td>
+    <td><?cs var:ndk.win32.legacy_bytes ?></td>
+    <td><?cs var:ndk.win32.legacy_checksum ?></td>
+  </tr>
+  <tr>
+    <td rowspan="2" style="white-space:nowrap">Windows 64-bit</td>
     <td>
   <a onClick="return onDownload(this)"
      href="http://dl.google.com/android/ndk/<?cs var:ndk.win64_download ?>"><?cs var:ndk.win64_download ?></a>
     </td>
-    <td><?cs var:ndk.win64_bytes ?> bytes</td>
+    <td><?cs var:ndk.win64_bytes ?></td>
     <td><?cs var:ndk.win64_checksum ?></td>
   </tr>
   <tr>
-    <td>Mac OS X 32-bit</td>
+    <td>
+  <a onClick="return onDownload(this)"
+     href="http://dl.google.com/android/ndk/<?cs var:ndk.win64.legacy_download ?>"><?cs var:ndk.win64.legacy_download ?></a>
+    </td>
+    <td><?cs var:ndk.win64.legacy_bytes ?></td>
+    <td><?cs var:ndk.win64.legacy_checksum ?></td>
+  </tr>
+  <tr>
+    <td rowspan="2" style="white-space:nowrap">Mac OS X 32-bit</td>
     <td>
   <a onClick="return onDownload(this)"
      href="http://dl.google.com/android/ndk/<?cs var:ndk.mac32_download ?>"><?cs var:ndk.mac32_download ?></a>
     </td>
-    <td><?cs var:ndk.mac32_bytes ?> bytes</td>
+    <td><?cs var:ndk.mac32_bytes ?></td>
     <td><?cs var:ndk.mac32_checksum ?></td>
   </tr>
   <tr>
-    <td>Mac OS X 64-bit</td>
+    <td>
+  <a onClick="return onDownload(this)"
+     href="http://dl.google.com/android/ndk/<?cs var:ndk.mac32.legacy_download ?>"><?cs var:ndk.mac32.legacy_download ?></a>
+    </td>
+    <td><?cs var:ndk.mac32.legacy_bytes ?></td>
+    <td><?cs var:ndk.mac32.legacy_checksum ?></td>
+  </tr>
+  <tr>
+    <td rowspan="2"  style="white-space:nowrap">Mac OS X 64-bit</td>
     <td>
   <a onClick="return onDownload(this)"
      href="http://dl.google.com/android/ndk/<?cs var:ndk.mac64_download ?>"><?cs var:ndk.mac64_download ?></a>
     </td>
-    <td><?cs var:ndk.mac64_bytes ?> bytes</td>
+    <td><?cs var:ndk.mac64_bytes ?></td>
     <td><?cs var:ndk.mac64_checksum ?></td>
   </tr>
   <tr>
-    <td>Linux 32-bit (x86)</td>
+    <td>
+  <a onClick="return onDownload(this)"
+     href="http://dl.google.com/android/ndk/<?cs var:ndk.mac64.legacy_download ?>"><?cs var:ndk.mac64.legacy_download ?></a>
+    </td>
+    <td><?cs var:ndk.mac64.legacy_bytes ?></td>
+    <td><?cs var:ndk.mac64.legacy_checksum ?></td>
+  </tr>
+
+  <tr>
+    <td rowspan="2" style="white-space:nowrap">Linux 32-bit (x86)</td>
     <td>
   <a onClick="return onDownload(this)"
      href="http://dl.google.com/android/ndk/<?cs var:ndk.linux32_download ?>"><?cs var:ndk.linux32_download ?></a>
     </td>
-    <td><?cs var:ndk.linux32_bytes ?> bytes</td>
+    <td><?cs var:ndk.linux32_bytes ?></td>
     <td><?cs var:ndk.linux32_checksum ?></td>
   </tr>
   <tr>
-    <td>Linux 64-bit (x86)</td>
+    <td>
+  <a onClick="return onDownload(this)"
+     href="http://dl.google.com/android/ndk/<?cs var:ndk.linux32.legacy_download ?>"><?cs var:ndk.linux32.legacy_download ?></a>
+    </td>
+    <td><?cs var:ndk.linux32.legacy_bytes ?></td>
+    <td><?cs var:ndk.linux32.legacy_checksum ?></td>
+  </tr>
+  <tr>
+    <td rowspan="2" style="white-space:nowrap">Linux 64-bit (x86)</td>
     <td>
   <a onClick="return onDownload(this)"
      href="http://dl.google.com/android/ndk/<?cs var:ndk.linux64_download ?>"><?cs var:ndk.linux64_download ?></a>
     </td>
-    <td><?cs var:ndk.linux64_bytes ?> bytes</td>
+    <td><?cs var:ndk.linux64_bytes ?></td>
     <td><?cs var:ndk.linux64_checksum ?></td>
   </tr>
+  <tr>
+    <td>
+  <a onClick="return onDownload(this)"
+     href="http://dl.google.com/android/ndk/<?cs var:ndk.linux64.legacy_download ?>"><?cs var:ndk.linux64.legacy_download ?></a>
+    </td>
+    <td><?cs var:ndk.linux64.legacy_bytes ?></td>
+    <td><?cs var:ndk.linux64.legacy_checksum ?></td>
+  </tr>
   </table>
   
   <?cs ########  HERE IS THE JD DOC CONTENT ######### ?>