update to sdk page template for Android Studio downloads

Change-Id: I729a1238a97909d4087f7396cc478a5aea0c43cd
(cherry picked from commit 85fd6240cfc2a395d3189a87214813b1568b0122)
diff --git a/tools/droiddoc/templates-sdk/sdkpage.cs b/tools/droiddoc/templates-sdk/sdkpage.cs
index 52aa587..995126b 100644
--- a/tools/droiddoc/templates-sdk/sdkpage.cs
+++ b/tools/droiddoc/templates-sdk/sdkpage.cs
@@ -264,74 +264,16 @@
 
 
 
-<h4><a href='' class="expandable"
-  onclick="toggleExpandable(this,'.pax');hideExpandable('.myide,.reqs');return false;"
-  >VIEW ALL DOWNLOADS AND SIZES</a></h4>
+<div class="pax col-13 online" style="margin:0;">
 
 
-<div class="pax col-13 online" style="display:none;margin:0;">
+<h3>SDK Tools Only</h3>
 
+<p>If you prefer to use a different IDE or run the tools from the
+command line or with build scripts, you can instead download the stand-alone Android SDK Tools.
+These packages provide the basic SDK tools for app development, without an IDE.
+</p>
 
-
-<p class="table-caption"><strong>Android Studio Bundle</strong></p>
-  <table class="download">
-    <tr>
-      <th>Platform</th>
-      <th>Package</th>
-      <th>Size</th>
-      <th>SHA1 Sum</th>
-  </tr>
-  <tr>
-    <td>Windows 32-bit</td>
-    <td>
-  <a onClick="return onDownload(this)" id="win-bundle32"
-     href="https://dl.google.com/android/studio/<?cs var:sdk.win32_bundle_download ?>"><?cs var:studio.win32_bundle_download ?></a>
-    </td>
-    <td><?cs var:studio.win32_bundle_bytes ?> bytes</td>
-    <td><?cs var:studio.win32_bundle_checksum ?></td>
-  </tr>
-  <tr>
-    <td>Windows 64-bit</td>
-    <td>
-  <a onClick="return onDownload(this)" id="win-bundle64"
-     href="https://dl.google.com/android/studio/<?cs var:sdk.win64_bundle_download ?>"><?cs var:studio.win64_bundle_download ?></a>
-    </td>
-    <td><?cs var:studio.win64_bundle_bytes ?> bytes</td>
-    <td><?cs var:studio.win64_bundle_checksum ?></td>
-  </tr>
-  <tr>
-    <td><nobr>Mac OS X 64-bit</nobr></td>
-    <td>
-  <a onClick="return onDownload(this)" id="mac-bundle64"
-     href="https://dl.google.com/android/studio/<?cs var:sdk.mac64_bundle_download ?>"><?cs var:studio.mac64_bundle_download ?></a>
-    </td>
-    <td><?cs var:studio.mac64_bundle_bytes ?> bytes</td>
-    <td><?cs var:studio.mac64_bundle_checksum ?></td>
-  </tr>
-  <tr>
-    <td>Linux 32-bit</td>
-    <td>
-  <a onClick="return onDownload(this)" id="linux-bundle32"
-     href="https://dl.google.com/android/studio/<?cs var:sdk.linux32_bundle_download ?>"><?cs var:studio.linux32_bundle_download ?></a>
-    </td>
-    <td><?cs var:studio.linux32_bundle_bytes ?> bytes</td>
-    <td><?cs var:studio.linux32_bundle_checksum ?></td>
-  </tr>
-  <tr>
-    <td>Linux 64-bit</td>
-    <td>
-  <a onClick="return onDownload(this)" id="linux-bundle64"
-     href="https://dl.google.com/android/studio/<?cs var:sdk.linux64_bundle_download ?>"><?cs var:studio.linux64_bundle_download ?></a>
-    </td>
-    <td><?cs var:studio.linux64_bundle_bytes ?> bytes</td>
-    <td><?cs var:studio.linux64_bundle_checksum ?></td>
-  </tr>
-  </table>
-
-
-
-
-<p class="table-caption"><strong>SDK Tools Only</strong></p>
   <table class="download">
     <tr>
       <th>Platform</th>
@@ -340,7 +282,7 @@
       <th>MD5 Checksum</th>
   </tr>
   <tr>
-    <td rowspan="2">Windows<br>32 &amp; 64-bit</td>
+    <td rowspan="2">Windows</td>
     <td>
   <a onclick="return onDownload(this)" href="http://dl.google.com/android/<?cs var:sdk.win_download
 ?>"><?cs var:sdk.win_download ?></a>
@@ -359,7 +301,7 @@
     <td><?cs var:sdk.win_installer_checksum ?></td>
   </tr>
   <tr>
-    <td><nobr>Mac OS X</nobr><br>32 &amp; 64-bit</td>
+    <td><nobr>Mac OS X</nobr></td>
     <td>
   <a onclick="return onDownload(this)" id="mac-tools" href="http://dl.google.com/android/<?cs
 var:sdk.mac_download
@@ -369,7 +311,7 @@
     <td><?cs var:sdk.mac_checksum ?></td>
   </tr>
   <tr>
-    <td>Linux<br>32 &amp; 64-bit</td>
+    <td>Linux</td>
     <td>
   <a onclick="return onDownload(this)" id="linux-tools" href="http://dl.google.com/android/<?cs
 var:sdk.linux_download
@@ -381,67 +323,55 @@
   </table>
 
 
-<p class="table-caption"><strong>ADT Bundle</strong></p>
+
+<h3>All Android Studio Packages</h3>
+
+<p>Select a specific Android Studio package for your platform.</p>
+
   <table class="download">
     <tr>
       <th>Platform</th>
       <th>Package</th>
       <th>Size</th>
-      <th>MD5 Checksum</th>
+      <th>SHA Sum</th>
   </tr>
+
   <tr>
-    <td>Windows 32-bit</td>
+    <td>Windows</td>
     <td>
-  <a onClick="return onDownload(this)" id="win-bundle32"
-     href="https://dl.google.com/android/adt/<?cs var:sdk.win32_bundle_download ?>"><?cs var:sdk.win32_bundle_download ?></a>
+  <a onclick="return onDownload(this)" id="win-bundle"
+    href="https://dl.google.com/dl/android/studio/ide-zips/<?cs var:studio.version ?>/<?cs var:studio.win_bundle_download ?>"
+    ><?cs var:studio.win_bundle_download ?></a>
     </td>
-    <td><?cs var:sdk.win32_bundle_bytes ?> bytes</td>
-    <td><?cs var:sdk.win32_bundle_checksum ?></td>
+    <td><?cs var:studio.win_bundle_bytes ?> bytes</td>
+    <td><?cs var:studio.win_bundle_checksum ?></td>
   </tr>
+
   <tr>
-    <td>Windows 64-bit</td>
+    <td><nobr>Mac OS X</nobr></td>
     <td>
-  <a onClick="return onDownload(this)" id="win-bundle64"
-     href="https://dl.google.com/android/adt/<?cs var:sdk.win64_bundle_download ?>"><?cs var:sdk.win64_bundle_download ?></a>
+  <a onclick="return onDownload(this)" id="mac-bundle"
+    href="https://dl.google.com/dl/android/studio/ide-zips/<?cs var:studio.version ?>/<?cs var:studio.mac_bundle_download ?>"
+    ><?cs var:studio.mac_bundle_download ?></a>
     </td>
-    <td><?cs var:sdk.win64_bundle_bytes ?> bytes</td>
-    <td><?cs var:sdk.win64_bundle_checksum ?></td>
+    <td><?cs var:studio.mac_bundle_bytes ?> bytes</td>
+    <td><?cs var:studio.mac_bundle_checksum ?></td>
   </tr>
+
   <tr>
-    <td><nobr>Mac OS X 64-bit</nobr></td>
+    <td>Linux</td>
     <td>
-  <a onClick="return onDownload(this)" id="mac-bundle64"
-     href="https://dl.google.com/android/adt/<?cs var:sdk.mac64_bundle_download ?>"><?cs var:sdk.mac64_bundle_download ?></a>
+  <a onclick="return onDownload(this)" id="linux-bundle"
+    href="https://dl.google.com/dl/android/studio/ide-zips/<?cs var:studio.version ?>/<?cs var:studio.linux_bundle_download ?>"
+    ><?cs var:studio.linux_bundle_download ?></a>
     </td>
-    <td><?cs var:sdk.mac64_bundle_bytes ?> bytes</td>
-    <td><?cs var:sdk.mac64_bundle_checksum ?></td>
-  </tr>
-  <tr>
-    <td>Linux 32-bit</td>
-    <td>
-  <a onClick="return onDownload(this)" id="linux-bundle32"
-     href="https://dl.google.com/android/adt/<?cs var:sdk.linux32_bundle_download ?>"><?cs var:sdk.linux32_bundle_download ?></a>
-    </td>
-    <td><?cs var:sdk.linux32_bundle_bytes ?> bytes</td>
-    <td><?cs var:sdk.linux32_bundle_checksum ?></td>
-  </tr>
-  <tr>
-    <td>Linux 64-bit</td>
-    <td>
-  <a onClick="return onDownload(this)" id="linux-bundle64"
-     href="https://dl.google.com/android/adt/<?cs var:sdk.linux64_bundle_download ?>"><?cs var:sdk.linux64_bundle_download ?></a>
-    </td>
-    <td><?cs var:sdk.linux64_bundle_bytes ?> bytes</td>
-    <td><?cs var:sdk.linux64_bundle_checksum ?></td>
+    <td><?cs var:studio.linux_bundle_bytes ?> bytes</td>
+    <td><?cs var:studio.linux_bundle_checksum ?></td>
   </tr>
   </table>
 
 
 
-
-
-
-
 </div><!-- end pax -->
 
 
@@ -462,7 +392,9 @@
   var bundlename;
   var $toolslink;
 
-  if (navigator.appVersion.indexOf("Win")!=-1) {
+  if (navigator.appVersion.indexOf("Mobile")!=-1) {
+    // Do nothing for any "mobile" user agent
+  } else if (navigator.appVersion.indexOf("Win")!=-1) {
     os = "Windows";
     bundlename = '#win-bundle';
     $toolslink = $('#win-tools');
@@ -470,26 +402,18 @@
     os = "Mac";
     bundlename = '#mac-bundle';
     $toolslink = $('#mac-tools');
-  } else if (navigator.appVersion.indexOf("Linux")!=-1) {
+  } else if (navigator.appVersion.indexOf("Linux")!=-1 && navigator.appVersion.indexOf("Android")==-1) {
     os = "Linux";
     bundlename = '#linux-bundle';
     $toolslink = $('#linux-tools');
   }
 
-  if (os) {
+  if (os != undefined) {
     $('#not-supported').hide();
 
     /* set up primary Android Studio download button */
-    $('#download-bundle-button').show();
-    $('#download-bundle-button').append("Download Android Studio <br/><span class='small'>with the Android SDK for " + os + "</span>");
-    $('#download-bundle-button').click(function() {return onDownload(this,true,true);}).attr('href', bundlename);
-
-    /* set up sdk tools only button */
-    $('#download-tools-button').show();
-    $('#download-tools-button').append("Download the stand-alone Android SDK Tools for " + os);
-    $('#download-tools-button').click(function() {return onDownload(this,true);}).attr('href', $toolslink.attr('href'));
-  } else {
-    $('.pax').show();
+    $('.download-bundle-button').append(" <br/><span class='small'>for " + os + "</span>");
+    $('.download-bundle-button').click(function() {return onDownload(this,true,true);}).attr('href', bundlename);
   }
 
 
@@ -502,44 +426,29 @@
       $("#downloadForRealz").html("Download " + $(link).text());
     }
 
-    /* if it's a bundle, show the 32/64-bit picker */
-    if (bundle) {
-      $("#downloadForRealz").attr('Eclipse ADT Bundle','true');
-      if ($("#downloadForRealz").text().indexOf("Mac") == -1) {
-        $("p#bitpicker").show();
-      } else {
-        /* mac is always 64 bit, so set it checked */
-        $("p#bitpicker input[value=64]").attr('checked', true);
-      }
-      /* save link name until the bit version is chosen */
-      $("#downloadForRealz").attr('name',$(link).attr('href'));
-    } else {
-      /* if not using bundle, set download button to ignore bitpicker and set url */
-      $("#downloadForRealz").attr('bundle','false');
-      $("#downloadForRealz").attr('href',$(link).attr('href'));
-      /* set picker checked as a fake default */
-      $("p#bitpicker input[value=64]").attr('checked', true);
-      $("a#next-link").html("Setting Up an Existing IDE").attr('href',toRoot + 'sdk/installing/index.html');
-    }
+    $("#downloadForRealz").attr('bundle', bundle);
+    $("a#downloadForRealz").attr("name", $(link).attr('href'));
 
-    $("#tos").fadeIn('fast');
-    $("#landing").fadeOut('fast');
+    $("#tos").show();
+    $("#landing").hide();
 
-    location.hash = "download";
+    location.hash = "top";
     return false;
   }
 
 
   function onAgreeChecked() {
-    /* verify that the TOS is agreed and a bit version is chosen */
-    if ($("input#agree").is(":checked") && $("#bitpicker input:checked").length) {
+    /* verify that the TOS is agreed */
+    if ($("input#agree").is(":checked")) {
 
       /* if downloading the bundle */
       if ($("#downloadForRealz").attr('bundle')) {
-        /* construct the name of the link we want based on the bit version */
-        linkId = $("a#downloadForRealz").attr("name") + $("#bitpicker input:checked").val();
+        /* construct the name of the link we want */
+        linkId = $("a#downloadForRealz").attr("name");
         /* set the real url for download */
         $("a#downloadForRealz").attr("href", $(linkId).attr("href"));
+      } else {
+        $("a#downloadForRealz").attr("href", $("a#downloadForRealz").attr("name"));
       }
 
       /* reveal the download button */
@@ -550,25 +459,28 @@
   }
 
   function onDownloadForRealz(link) {
-    if ($("input#agree").is(':checked') && $("#bitpicker input:checked").length) {
+    if ($("input#agree").is(':checked')) {
+      location.hash = "";
+      location.hash = "top";
       $("div.sdk-terms").slideUp();
-      $("h1#tos-header").text('Now redirecting to the install instructions...');
-      $("#sdk-terms-form,.sdk-terms-intro").fadeOut('slow', function() {
+      $("h1#tos-header").text('Now downloading...');
+      $(".sdk-terms-intro").text('You\'ll be redirected to the install instructions in a moment.');
+      $("#sdk-terms-form").fadeOut('slow', function() {
         setTimeout(function() {
           if ($("#downloadForRealz").attr('bundle') == 'true') {
-            // User downloaded the ADT Bundle
-            window.location = "/sdk/installing/index.html?pkg=adt";
+            // User downloaded the studio Bundle
+            window.location = "/sdk/installing/index.html?pkg=studio";
           } else {
             // User downloaded the SDK Tools
             window.location = "/sdk/installing/index.html?pkg=tools";
           }
-        }, 500);
+        }, 3000);
       });
       ga('send', 'event', 'SDK', 'IDE and Tools', $("#downloadForRealz").html());
       return true;
     } else {
-      $("label#agreeLabel,#bitpicker input").parent().stop().animate({color: "#258AAF"}, 200,
-        function() {$("label#agreeLabel,#bitpicker input").parent().stop().animate({color: "#222"}, 200)}
+      $("label#agreeLabel").parent().stop().animate({color: "#258AAF"}, 200,
+        function() {$("label#agreeLabel").parent().stop().animate({color: "#222"}, 200)}
       );
       return false;
     }