Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'jb-mr0-release' of https://android.googlesource.com/pla…

…tform/build into aosp-merge

Change-Id: Ifabf6aee0bb9624e73776606c513835235824b73
  • Loading branch information...
commit 747461c1c6887f9bbf7bccba0894ce482c5dfa8e 2 parents 9f246de + 25454bc
@cyanogen cyanogen authored
Showing with 1,421 additions and 2,012 deletions.
  1. +1 −1  core/build_id.mk
  2. +1 −0  core/clear_vars.mk
  3. +6 −3 core/java.mk
  4. +1 −1  core/version_defaults.mk
  5. +0 −3  target/board/generic/BoardConfig.mk
  6. +0 −3  target/board/generic_x86/BoardConfig.mk
  7. +1 −0  target/product/core.mk
  8. +199 −44 tools/droiddoc/templates-sdk/assets/css/default.css
  9. +2 −0  tools/droiddoc/templates-sdk/assets/css/fullscreen.css
  10. +0 −90 tools/droiddoc/templates-sdk/assets/css/home.css
  11. +0 −181 tools/droiddoc/templates-sdk/assets/js/carousel.js
  12. +0 −459 tools/droiddoc/templates-sdk/assets/js/default.js
  13. +1,180 −23 tools/droiddoc/templates-sdk/assets/js/docs.js
  14. +0 −435 tools/droiddoc/templates-sdk/assets/js/droiddoc.js
  15. +11 −1 tools/droiddoc/templates-sdk/assets/js/global-libraries-combined.js
  16. +0 −78 tools/droiddoc/templates-sdk/assets/js/jquery-history.js
  17. +0 −40 tools/droiddoc/templates-sdk/assets/js/jquery-resizable.min.js
  18. +0 −515 tools/droiddoc/templates-sdk/assets/js/search_autocomplete.js
  19. +0 −101 tools/droiddoc/templates-sdk/assets/js/tabbedlist.js
  20. +8 −2 tools/droiddoc/templates-sdk/components/masthead.cs
  21. +6 −4 tools/droiddoc/templates-sdk/docpage.cs
  22. +5 −28 tools/droiddoc/templates-sdk/head_tag.cs
View
2  core/build_id.mk
@@ -19,4 +19,4 @@
# (like "CRB01"). It must be a single word, and is
# capitalized by convention.
-export BUILD_ID=JRO03R
+export BUILD_ID=JZO54K
View
1  core/clear_vars.mk
@@ -123,6 +123,7 @@ LOCAL_CTS_TEST_RUNNER:=
LOCAL_CLANG:=
LOCAL_ADDRESS_SANITIZER:=
LOCAL_JAR_EXCLUDE_FILES:=
+LOCAL_SOURCE_FILES_ALL_GENERATED:= # '',true
# Trim MAKEFILE_LIST so that $(call my-dir) doesn't need to
# iterate over thousands of entries every time.
View
9 core/java.mk
@@ -15,8 +15,11 @@ endif #PDK
# Make sure there's something to build.
# It's possible to build a package that doesn't contain any classes.
-ifeq (,$(strip $(LOCAL_SRC_FILES)$(all_res_assets)$(LOCAL_STATIC_JAVA_LIBRARIES)))
-$(error $(LOCAL_PATH): Target java module does not define any source or resource files)
+# LOCAL_SOURCE_FILES_ALL_GENERATED is set only if the module does not have static source files,
+# but generated source files in its LOCAL_INTERMEDIATE_SOURCE_DIR.
+# You have to set up the dependency in some other way.
+ifeq (,$(strip $(LOCAL_SRC_FILES)$(all_res_assets)$(LOCAL_STATIC_JAVA_LIBRARIES))$(filter true,$(LOCAL_SOURCE_FILES_ALL_GENERATED)))
+$(warning $(LOCAL_PATH): Target java module does not define any source or resource files)
endif
LOCAL_NO_STANDARD_LIBRARIES:=$(strip $(LOCAL_NO_STANDARD_LIBRARIES))
@@ -232,7 +235,7 @@ $(cleantarget): PRIVATE_CLEAN_FILES += $(intermediates.COMMON)
# If the module includes java code (i.e., it's not framework-res), compile it.
full_classes_jar :=
built_dex :=
-ifneq (,$(strip $(all_java_sources)$(full_static_java_libs)))
+ifneq (,$(strip $(all_java_sources)$(full_static_java_libs))$(filter true,$(LOCAL_SOURCE_FILES_ALL_GENERATED)))
# If LOCAL_BUILT_MODULE_STEM wasn't overridden by our caller,
# full_classes_jar will be the same module as LOCAL_BUILT_MODULE.
View
2  core/version_defaults.mk
@@ -41,7 +41,7 @@ ifeq "" "$(PLATFORM_VERSION)"
# which is the version that we reveal to the end user.
# Update this value when the platform version changes (rather
# than overriding it somewhere else). Can be an arbitrary string.
- PLATFORM_VERSION := 4.1.1
+ PLATFORM_VERSION := 4.1.2
endif
ifeq "" "$(PLATFORM_SDK_VERSION)"
View
3  target/board/generic/BoardConfig.mk
@@ -29,9 +29,6 @@ BOARD_USES_GENERIC_AUDIO := true
# no hardware camera
USE_CAMERA_STUB := true
-# Set /system/bin/sh to ash, not mksh, to make sure we can switch back.
-TARGET_SHELL := ash
-
# Enable dex-preoptimization to speed up the first boot sequence
# of an SDK AVD. Note that this operation only works on Linux for now
ifeq ($(HOST_OS),linux)
View
3  target/board/generic_x86/BoardConfig.mk
@@ -18,9 +18,6 @@ BOARD_USES_GENERIC_AUDIO := true
# no hardware camera
USE_CAMERA_STUB := true
-# Set /system/bin/sh to ash, not mksh, to make sure we can switch back.
-TARGET_SHELL := ash
-
# Enable dex-preoptimization to speed up the first boot sequence
# of an SDK AVD. Note that this operation only works on Linux for now
ifeq ($(HOST_OS),linux)
View
1  target/product/core.mk
@@ -111,6 +111,7 @@ PRODUCT_PACKAGES := \
libwebrtc_audio_preprocessing \
libwilhelm \
libz \
+ make_ext4fs \
mdnsd \
requestsync \
screencap \
View
243 tools/droiddoc/templates-sdk/assets/css/default.css
@@ -530,12 +530,12 @@ h3:target {
}
.design ol {
counter-reset: item; }
- .design ol li {
+ .design ol>li {
font-size: 14px;
line-height: 20px;
list-style-type: none;
position: relative; }
- .design ol li:before {
+ .design ol>li:before {
content: counter(item) ". ";
counter-increment: item;
position: absolute;
@@ -561,16 +561,18 @@ h3:target {
content: "9. "; }
.design ol li.value-10:before {
content: "10. "; }
-.design .with-callouts ol li {
+.design .with-callouts ol>li {
list-style-position: inside;
margin-left: 0; }
- .design .with-callouts ol li:before {
+ .design .with-callouts ol>li:before {
display: inline;
left: -20px;
float: left;
width: 17px;
color: #33b5e5;
font-weight: 500; }
+.design .with-callouts ul>li {
+ list-style-position: outside; }
/* special list items */
li.no-bullet {
@@ -1079,22 +1081,71 @@ color-stop(50%, #acbc00), color-stop(50%, #bdde00), color-stop(100%, #bdde00));
Print Only
========================================================================== */
@media print {
-a {
- color: inherit;
-}
-.nav-x, .nav-y {
- display: none;
-}
-.str { color: #060; }
-.kwd { color: #006; font-weight: bold; }
-.com { color: #600; font-style: italic; }
-.typ { color: #404; font-weight: bold; }
-.lit { color: #044; }
-.pun { color: #440; }
-.pln { color: #000; }
-.tag { color: #006; font-weight: bold; }
-.atn { color: #404; }
-.atv { color: #060; }
+ /* configure printed page */
+ @page {
+ margin: 0.75in 1in;
+ widows: 4;
+ orphans: 4;
+ }
+
+ /* reset spacing metrics */
+ html, body, .wrap {
+ margin: 0 !important;
+ padding: 0 !important;
+ width: auto !important;
+ }
+
+ /* leave enough space on the left for bullets */
+ body {
+ padding-left: 20px !important;
+ }
+ #doc-col {
+ margin-left: 0;
+ }
+
+ /* hide a bunch of non-content elements */
+ #header, #footer, #nav-x, #side-nav,
+ .training-nav-top, .training-nav-bottom,
+ #doc-col .content-footer,
+ .nav-x, .nav-y,
+ .paging-links,
+ a.totop {
+ display: none !important;
+ }
+
+ /* remove extra space above page titles */
+ #doc-col .content-header {
+ margin-top: 0;
+ }
+
+ /* bump up spacing above subheadings */
+ h2 {
+ margin-top: 40px !important;
+ }
+
+ /* print link URLs where possible and give links default text color */
+ p a:after {
+ content: " (" attr(href) ")";
+ font-size: 80%;
+ }
+ p a {
+ word-wrap: break-word;
+ }
+ a {
+ color: inherit;
+ }
+
+ /* syntax highlighting rules */
+ .str { color: #060; }
+ .kwd { color: #006; font-weight: bold; }
+ .com { color: #600; font-style: italic; }
+ .typ { color: #404; font-weight: bold; }
+ .lit { color: #044; }
+ .pun { color: #440; }
+ .pln { color: #000; }
+ .tag { color: #006; font-weight: bold; }
+ .atn { color: #404; }
+ .atv { color: #060; }
}
/* =============================================================================
@@ -2033,8 +2084,11 @@ div.toggle-content.closed .toggle-content-toggleme {
#jd-content img.toggle-content-img {
margin:0 5px 5px 0;
}
-div.toggle-content > p {
- padding:0 0 5px;
+div.toggle-content p {
+ margin:10px 0 0;
+}
+div.toggle-content-toggleme {
+ padding:0 0 0 15px;
}
@@ -2145,14 +2199,9 @@ table.blank th, table.blank td {
.nolist {
list-style:none;
- padding:0;
- margin:0 0 1em 1em;
+ margin-left:0;
}
-.nolist li {
- padding:0 0 2px;
- margin:0;
-}
pre.classic {
background-color:transparent;
@@ -2180,6 +2229,12 @@ p.table-caption {
color:#666;
}
+div.note,
+div.caution,
+div.warning {
+ margin: 0 0 15px;
+}
+
p.note, div.note,
p.caution, div.caution,
p.warning, div.warning {
@@ -2898,10 +2953,6 @@ ul#search_filtered {
/* SEARCH RESULTS */
-/* disable twiddle and size selectors for left column */
-#leftSearchControl div {
- padding:0;
-}
#leftSearchControl .gsc-twiddle {
background-image : none;
@@ -3475,7 +3526,7 @@ EndColorStr='#ececec');
.morehover:hover {
opacity:1;
- height:345px;
+ height:385px;
width:268px;
-webkit-transition-property:height, -webkit-opacity;
}
@@ -3489,7 +3540,7 @@ EndColorStr='#ececec');
.morehover .mid {
width:228px;
background:url(../images/more_mid.png) repeat-y;
- padding:10px 20px 10px 20px;
+ padding:10px 20px 0 20px;
}
.morehover .mid .header {
@@ -3598,15 +3649,19 @@ a.download-sdk {
padding-top: 14px;
}
+#nav-x .wrap {
+ min-height:34px;
+}
+
#nav-x .wrap,
#searchResults.wrap {
max-width:940px;
border-bottom:1px solid #CCC;
- min-height:34px;
-
}
-
+#searchResults.wrap #leftSearchControl {
+ min-height:700px
+}
.nav-x {
margin-left:0;
margin-bottom:0;
@@ -3762,7 +3817,8 @@ a.download-sdk {
height: 300px;
}
.slideshow-develop img.play {
- width:350px;
+ max-width:350px;
+ max-height:240px;
margin:20px 0 0 90px;
-webkit-transform: perspective(800px ) rotateY( 35deg );
box-shadow: -16px 20px 40px rgba(0, 0, 0, 0.3);
@@ -3817,6 +3873,7 @@ a.download-sdk {
.feed .feed-nav li {
list-style: none;
float: left;
+ height: 21px; /* +4px bottom border = 25px; same as .feed-nav */
margin-right: 25px;
cursor: pointer;
}
@@ -3969,21 +4026,24 @@ a.download-sdk {
.landing-docs {
margin:20px 0 0;
}
-.landing-banner {
- height:280px;
-}
.landing-banner .col-6:first-child,
-.landing-docs .col-6:first-child {
+.landing-docs .col-6:first-child,
+.landing-docs .col-12 {
margin-left:0;
+ min-height:280px;
}
.landing-banner .col-6:last-child,
-.landing-docs .col-6:last-child {
+.landing-docs .col-6:last-child,
+.landing-docs .col-12 {
margin-right:0;
}
.landing-banner h1 {
margin-top:0;
}
+.landing-docs {
+ clear:left;
+}
.landing-docs h3 {
font-size:14px;
line-height:21px;
@@ -4002,4 +4062,99 @@ a.download-sdk {
.plusone {
float:right;
-}
+}
+
+
+
+/************* HOME/LANDING PAGE *****************/
+
+.slideshow-home {
+ height: 500px;
+ width: 940px;
+ border-bottom: 1px solid #CCC;
+ position: relative;
+ margin: 0;
+}
+.slideshow-home .frame {
+ width: 940px;
+ height: 500px;
+}
+.slideshow-home .content-left {
+ float: left;
+ text-align: center;
+ vertical-align: center;
+ margin: 0 0 0 35px;
+}
+.slideshow-home .content-right {
+ margin: 80px 0 0 0;
+}
+.slideshow-home .content-right p {
+ margin-bottom: 10px;
+}
+.slideshow-home .content-right p:last-child {
+ margin-top: 15px;
+}
+.slideshow-home .content-right h1 {
+ padding:0;
+}
+.slideshow-home .item {
+ height: 500px;
+ width: 940px;
+}
+.home-sections {
+ padding: 30px 20px 20px;
+ margin: 20px 0;
+ background: -webkit-linear-gradient(top, #F6F6F6,#F9F9F9);
+}
+.home-sections ul {
+ margin: 0;
+}
+.home-sections ul li {
+ float: left;
+ display: block;
+ list-style: none;
+ width: 170px;
+ height: 35px;
+ border: 1px solid #ccc;
+ background: white;
+ margin-right: 10px;
+ border-radius: 1px;
+ -webkit-border-radius: 1px;
+ -moz-border-radius: 1px;
+ box-shadow: 1px 1px 5px #EEE;
+ -webkit-box-shadow: 1px 1px 5px #EEE;
+ -moz-box-shadow: 1px 1px 5px #EEE;
+ background: white;
+}
+.home-sections ul li:hover {
+ background: #F9F9F9;
+ border: 1px solid #CCC;
+}
+.home-sections ul li a,
+.home-sections ul li a:hover {
+ font-weight: bold;
+ margin-top: 8px;
+ line-height: 18px;
+ float: left;
+ width: 100%;
+ text-align: center;
+ color: #09c !important;
+}
+.home-sections ul li a {
+ font-weight: bold;
+ margin-top: 8px;
+ line-height: 18px;
+ float: left;
+ width:100%;
+ text-align:center;
+}
+.home-sections ul li img {
+ float: left;
+ margin: -8px 0 0 10px;
+}
+.home-sections ul li.last {
+ margin-right: 0px;
+}
+.fullpage #footer {
+ margin-top: -40px;
+}
View
2  tools/droiddoc/templates-sdk/assets/css/fullscreen.css
@@ -2,6 +2,7 @@
/* =============================================================================
Columns
========================================================================== */
+/* Applied to body to debug layout alignments
.grid {
width:100%;
height:100%;
@@ -10,6 +11,7 @@
margin:auto;
position:absolute;
}
+*/
@media screen, projection, print {
.full {
View
90 tools/droiddoc/templates-sdk/assets/css/home.css
@@ -1,90 +0,0 @@
-.slideshow-home {
- height: 500px;
- width: 940px;
- border-bottom: 1px solid #CCC;
- position: relative;
- margin: 0;
-}
-.slideshow-home .frame {
- width: 940px;
- height: 500px;
-}
-.slideshow-home .content-left {
- float: left;
- text-align: center;
- vertical-align: center;
- margin: 0 0 0 35px;
-}
-.slideshow-home .content-right {
- margin: 80px 0 0 0;
-}
-.slideshow-home .content-right p {
- margin-bottom: 10px;
-}
-.slideshow-home .content-right p:last-child {
- margin-top: 15px;
-}
-.slideshow-home .content-right h1 {
- padding:0;
-}
-.slideshow-home .item {
- height: 500px;
- width: 940px;
-}
-.home-sections {
- padding: 30px 20px 20px;
- margin: 20px 0;
- background: -webkit-linear-gradient(top, #F6F6F6,#F9F9F9);
-}
-.home-sections ul {
- margin: 0;
-}
-.home-sections ul li {
- float: left;
- display: block;
- list-style: none;
- width: 170px;
- height: 35px;
- border: 1px solid #ccc;
- background: white;
- margin-right: 10px;
- border-radius: 1px;
- -webkit-border-radius: 1px;
- -moz-border-radius: 1px;
- box-shadow: 1px 1px 5px #EEE;
- -webkit-box-shadow: 1px 1px 5px #EEE;
- -moz-box-shadow: 1px 1px 5px #EEE;
- background: white;
-}
-.home-sections ul li:hover {
- background: #F9F9F9;
- border: 1px solid #CCC;
-}
-.home-sections ul li a,
-.home-sections ul li a:hover {
- font-weight: bold;
- margin-top: 8px;
- line-height: 18px;
- float: left;
- width: 100%;
- text-align: center;
- color: #09c !important;
-}
-.home-sections ul li a {
- font-weight: bold;
- margin-top: 8px;
- line-height: 18px;
- float: left;
- width:100%;
- text-align:center;
-}
-.home-sections ul li img {
- float: left;
- margin: -8px 0 0 10px;
-}
-.home-sections ul li.last {
- margin-right: 0px;
-}
-#footer {
- margin-top: -40px;
-}
View
181 tools/droiddoc/templates-sdk/assets/js/carousel.js
@@ -1,181 +0,0 @@
-/*
- * jQuery dacSlideshow 1.0
- *
- * Sample usage:
- * HTML -
- * <div class="slideshow-container">
- * <a href="" class="slideshow-prev">Prev</a>
- * <a href="" class="slideshow-next">Next</a>
- * <ul>
- * <li class="item"><img src="images/marquee1.jpg"></li>
- * <li class="item"><img src="images/marquee2.jpg"></li>
- * <li class="item"><img src="images/marquee3.jpg"></li>
- * <li class="item"><img src="images/marquee4.jpg"></li>
- * </ul>
- * </div>
- *
- * <script type="text/javascript">
- * $('.slideshow-container').dacSlideshow({
- * auto: true,
- * btnPrev: '.slideshow-prev',
- * btnNext: '.slideshow-next'
- * });
- * </script>
- *
- * Options:
- * btnPrev: optional identifier for previous button
- * btnNext: optional identifier for next button
- * auto: whether or not to auto-proceed
- * speed: animation speed
- * autoTime: time between auto-rotation
- * easing: easing function for transition
- * start: item to select by default
- * scroll: direction to scroll in
- * pagination: whether or not to include dotted pagination
- *
- */
-
- (function($) {
- $.fn.dacSlideshow = function(o) {
-
- //Options - see above
- o = $.extend({
- btnPrev: null,
- btnNext: null,
- auto: true,
- speed: 500,
- autoTime: 12000,
- easing: null,
- start: 0,
- scroll: 1,
- pagination: true
-
- }, o || {});
-
- //Set up a carousel for each
- return this.each(function() {
-
- var running = false;
- var animCss = o.vertical ? "top" : "left";
- var sizeCss = o.vertical ? "height" : "width";
- var div = $(this);
- var ul = $("ul", div);
- var tLi = $("li", ul);
- var tl = tLi.size();
- var timer = null;
-
- var li = $("li", ul);
- var itemLength = li.size();
- var curr = o.start;
-
- li.css({float: o.vertical ? "none" : "left"});
- ul.css({margin: "0", padding: "0", position: "relative", "list-style-type": "none", "z-index": "1"});
- div.css({position: "relative", "z-index": "2", left: "0px"});
-
- var liSize = o.vertical ? height(li) : width(li);
- var ulSize = liSize * itemLength;
- var divSize = liSize;
-
- li.css({width: li.width(), height: li.height()});
- ul.css(sizeCss, ulSize+"px").css(animCss, -(curr*liSize));
-
- div.css(sizeCss, divSize+"px");
-
- //Pagination
- if (o.pagination) {
- var pagination = $("<div class='pagination'></div>");
- var pag_ul = $("<ul></ul>");
- if (tl > 1) {
- for (var i=0;i<tl;i++) {
- var li = $("<li>"+i+"</li>");
- pag_ul.append(li);
- if (i==o.start) li.addClass('active');
- li.click(function() {
- go(parseInt($(this).text()));
- })
- }
- pagination.append(pag_ul);
- div.append(pagination);
- }
- }
-
- //Previous button
- if(o.btnPrev)
- $(o.btnPrev).click(function(e) {
- e.preventDefault();
- return go(curr-o.scroll);
- });
-
- //Next button
- if(o.btnNext)
- $(o.btnNext).click(function(e) {
- e.preventDefault();
- return go(curr+o.scroll);
- });
-
- //Auto rotation
- if(o.auto) startRotateTimer();
-
- function startRotateTimer() {
- clearInterval(timer);
- timer = setInterval(function() {
- if (curr == tl-1) {
- go(0);
- } else {
- go(curr+o.scroll);
- }
- }, o.autoTime);
- }
-
- //Go to an item
- function go(to) {
- if(!running) {
-
- if(to<0) {
- to = itemLength-1;
- } else if (to>itemLength-1) {
- to = 0;
- }
- curr = to;
-
- running = true;
-
- ul.animate(
- animCss == "left" ? { left: -(curr*liSize) } : { top: -(curr*liSize) } , o.speed, o.easing,
- function() {
- running = false;
- }
- );
-
- $(o.btnPrev + "," + o.btnNext).removeClass("disabled");
- $( (curr-o.scroll<0 && o.btnPrev)
- ||
- (curr+o.scroll > itemLength && o.btnNext)
- ||
- []
- ).addClass("disabled");
-
-
- var nav_items = $('li', pagination);
- nav_items.removeClass('active');
- nav_items.eq(to).addClass('active');
-
-
- }
- if(o.auto) startRotateTimer();
- return false;
- };
- });
- };
-
- function css(el, prop) {
- return parseInt($.css(el[0], prop)) || 0;
- };
- function width(el) {
- return el[0].offsetWidth + css(el, 'marginLeft') + css(el, 'marginRight');
- };
- function height(el) {
- return el[0].offsetHeight + css(el, 'marginTop') + css(el, 'marginBottom');
- };
-
- })(jQuery);
View
459 tools/droiddoc/templates-sdk/assets/js/default.js
@@ -1,459 +0,0 @@
-var navBarIsFixed = false;
-$(document).ready(function() {
- // init the fullscreen toggle click event
- $('#nav-swap .fullscreen').click(function(){
- if ($(this).hasClass('disabled')) {
- toggleFullscreen(true);
- } else {
- 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('#devdoc-nav h2').css({marginBottom:0}).after('<hr/>');
-
- // set search's onkeyup handler here so we can show suggestions even while search results are visible
- $("#search_autocomplete").keyup(function() {return search_changed(event, false, '/')});
-
- // set up the search close button
- $('.search .close').click(function() {
- $searchInput = $('#search_autocomplete');
- $searchInput.attr('value', '');
- $(this).addClass("hide");
- $("#search-container").removeClass('active');
- $("#search_autocomplete").blur();
- search_focus_changed($searchInput.get(), false); // see search_autocomplete.js
- hideResults(); // see search_autocomplete.js
- });
- $('.search').click(function() {
- if (!$('#search_autocomplete').is(":focused")) {
- $('#search_autocomplete').focus();
- }
- });
-
- // Set up quicknav
- var quicknav_open = false;
- $("#btn-quicknav").click(function() {
- if (quicknav_open) {
- $(this).removeClass('active');
- quicknav_open = false;
- collapse();
- } else {
- $(this).addClass('active');
- quicknav_open = true;
- 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');
- })
- $("#search-container").mouseover(function() {
- $("#search-container").addClass('active');
- $("#search_autocomplete").focus();
- })
- $("#search-container").mouseout(function() {
- if ($("#search_autocomplete").is(":focus")) return;
- if ($("#search_autocomplete").val() == '') {
- setTimeout(function(){
- $("#search-container").removeClass('active');
- $("#search_autocomplete").blur();
- },250);
- }
- })
- $("#search_autocomplete").blur(function() {
- if ($("#search_autocomplete").val() == '') {
- $("#search-container").removeClass('active');
- }
- })
-
-
- // prep nav expandos
- var pagePath = document.location.pathname;
- // account for intl docs by removing the intl/*/ path
- if (pagePath.indexOf("/intl/") == 0) {
- pagePath = pagePath.substr(pagePath.indexOf("/",6)); // start after intl/ to get last /
- }
-
- if (pagePath.indexOf(SITE_ROOT) == 0) {
- if (pagePath == '' || pagePath.charAt(pagePath.length - 1) == '/') {
- pagePath += 'index.html';
- }
- }
-
- if (SITE_ROOT.match(/\.\.\//) || SITE_ROOT == '') {
- // If running locally, SITE_ROOT will be a relative path, so account for that by
- // finding the relative URL to this page. This will allow us to find links on the page
- // leading back to this page.
- var pathParts = pagePath.split('/');
- var relativePagePathParts = [];
- var upDirs = (SITE_ROOT.match(/(\.\.\/)+/) || [''])[0].length / 3;
- for (var i = 0; i < upDirs; i++) {
- relativePagePathParts.push('..');
- }
- for (var i = 0; i < upDirs; i++) {
- relativePagePathParts.push(pathParts[pathParts.length - (upDirs - i) - 1]);
- }
- relativePagePathParts.push(pathParts[pathParts.length - 1]);
- pagePath = relativePagePathParts.join('/');
- } else {
- // Otherwise the page path is already an absolute URL
- }
-
- // select current page in sidenav and set up prev/next links if they exist
- var $selNavLink = $('#nav').find('a[href="' + pagePath + '"]');
- if ($selNavLink.length) {
- $selListItem = $selNavLink.closest('li');
-
- $selListItem.addClass('selected');
- $selListItem.closest('li.nav-section').addClass('expanded');
- $selListItem.closest('li.nav-section').children('ul').show();
- $selListItem.closest('li.nav-section').parent().closest('li.nav-section').addClass('expanded');
- $selListItem.closest('li.nav-section').parent().closest('ul').show();
-
-
- // $selListItem.closest('li.nav-section').closest('li.nav-section').addClass('expanded');
- // $selListItem.closest('li.nav-section').closest('li.nav-section').children('ul').show();
-
- // 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) {
- if ($prevListItem.hasClass('nav-section')) {
- if (crossBoundaries) {
- // jump to last topic of previous section
- $prevLink = $prevListItem.find('a:last');
- }
- } else {
- // jump to previous topic in this section
- $prevLink = $prevListItem.find('a:eq(0)');
- }
- } else {
- // 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') && $selListItem.hasClass('nav-section')) {
- $prevLink = [];
- }
- }
-
- if ($prevLink.length) {
- var prevHref = $prevLink.attr('href');
- if (prevHref == SITE_ROOT + 'index.html') {
- // Don't show Previous when it leads to the homepage
- } else {
- $('.prev-page-link').attr('href', $prevLink.attr('href')).removeClass("hide");
- }
- }
-
- // set up next links
- var $nextLink = [];
- var startCourse = false;
- 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').find('a:eq(0)');
-
- // if there aren't any children, go to the next section (required for About pages)
- if($nextLink.length == 0) {
- $nextLink = $selListItem.next('li').find('a');
- }
-
- // Handle some Training specialties
- if ($selListItem.parent().is("#nav") && $(".start-course-link").length) {
- // this means we're at the very top of the TOC hierarchy
- startCourse = true;
- } else if ($(".start-class-link").length) {
- // this means this page has children but is not at the top (it's a class, not a course)
- startClass = true;
- }
- } else {
- // jump to the next topic in this section (if it exists)
- $nextLink = $selListItem.next('li').find('a:eq(0)');
- if (!$nextLink.length) {
- if (crossBoundaries || training) {
- // no more topics in this section, jump to the first topic in the next section
- $nextLink = $selListItem.parents('li:eq(0)').next('li.nav-section').find('a:eq(0)');
- isCrossingBoundary = true;
- }
- }
- }
- if ($nextLink.length) {
- if (startCourse || startClass) {
- if (startCourse) {
- $('.start-course-link').attr('href', $nextLink.attr('href')).removeClass("hide");
- } else {
- $('.start-class-link').attr('href', $nextLink.attr('href')).removeClass("hide");
- }
- // if there's no training bar (below the start button), then we need to add a bottom border to button
- if (!$("#tb").length) {
- $('.start-course-link').css({'border-bottom':'1px solid #DADADA'});
- $('.start-class-link').css({'border-bottom':'1px solid #DADADA'});
- }
- } else if (training && isCrossingBoundary) {
- $('.content-footer.next-class').show();
- $('.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();
- } else {
- $('.next-page-link').attr('href', $nextLink.attr('href')).removeClass("hide");
- }
- }
-
- }
-
-
-
- // 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();
- });
- }
- });
-
- $(".scroll-pane").scroll(function(event) {
- event.preventDefault();
- return false;
- });
-
- /* Resize nav height when window height changes */
- $(window).resize(function() {
- var stylesheet = $('link[rel="stylesheet"][title="fullscreen"]');
- setNavBarLeftPos(); // do this even if sidenav isn't fixed because it could become fixed
- // make sidenav behave when resizing the window and side-scolling is a concern
- if (navBarIsFixed) {
- if ((stylesheet.attr("disabled") == "disabled") || stylesheet.length == 0) {
- updateSideNavPosition();
- } else {
- updateSidenavFullscreenWidth();
- }
- }
- resizeNav();
- });
-
-
- // Set up fixed navbar
- var prevScrollLeft = 0; // used to compare current position to previous position of horiz scroll
- $(window).scroll(function(event) {
- if (event.target.nodeName == "DIV") {
- // Dump scroll event if the target is a DIV, because that means the event is coming
- // from a scrollable div and so there's no need to make adjustments to our layout
- return;
- }
- var scrollTop = $(window).scrollTop();
- var headerHeight = $('#header').outerHeight();
- var subheaderHeight = $('#nav-x').outerHeight();
- var searchResultHeight = $('#searchResults').is(":visible") ? $('#searchResults').outerHeight() : 0;
- var totalHeaderHeight = headerHeight + subheaderHeight + searchResultHeight;
- var navBarShouldBeFixed = scrollTop > totalHeaderHeight;
-
- 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 (to avoid intensive resizing that slows scrolling)
- if (navBarIsFixed && navBarShouldBeFixed) {
- return;
- }
-
- if (navBarIsFixed != navBarShouldBeFixed) {
- if (navBarShouldBeFixed) {
- // make it fixed
- var width = $('#devdoc-nav').width();
- var margin = $('#devdoc-nav').parent().css('margin');
- $('#devdoc-nav')
- .addClass('fixed')
- .css({'width':width+'px','margin':margin})
- .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 {
- // make it static again
- $('#devdoc-nav')
- .removeClass('fixed')
- .css({'width':'auto','margin':''})
- .prependTo('#side-nav');
- $('#devdoc-nav a.totop').hide();
- }
- navBarIsFixed = navBarShouldBeFixed;
- }
-
- resizeNav(250); // pass true in order to delay the scrollbar re-initialization for performance reasons
- });
-
-
- 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
- $(this).get(0).play();
- });
-
- // Set up tooltips
- var TOOLTIP_MARGIN = 10;
- $('acronym').each(function() {
- var $target = $(this);
- var $tooltip = $('<div>')
- .addClass('tooltip-box')
- .text($target.attr('title'))
- .hide()
- .appendTo('body');
- $target.removeAttr('title');
-
- $target.hover(function() {
- // in
- var targetRect = $target.offset();
- targetRect.width = $target.width();
- targetRect.height = $target.height();
-
- $tooltip.css({
- left: targetRect.left,
- top: targetRect.top + targetRect.height + TOOLTIP_MARGIN
- });
- $tooltip.addClass('below');
- $tooltip.show();
- }, function() {
- // out
- $tooltip.hide();
- });
- });
-
- // Set up <h2> deeplinks
- $('h2').click(function() {
- var id = $(this).attr('id');
- if (id) {
- document.location.hash = id;
- }
- });
-
- //Loads the +1 button
- var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
- po.src = 'https://apis.google.com/js/plusone.js';
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
-
-
- // 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");
- if (cookieHeight) {
- restoreHeight(cookieHeight);
- }
- }
-
- resizeNav();
-
-
-});
-
-
-
- function toggleFullscreen(enable) {
- var delay = 20;
- var enabled = false;
- var stylesheet = $('link[rel="stylesheet"][title="fullscreen"]');
- if (enable) {
- // Currently NOT USING fullscreen; enable fullscreen
- stylesheet.removeAttr('disabled');
- $('#nav-swap .fullscreen').removeClass('disabled');
- $('#devdoc-nav').css({left:''});
- setTimeout(updateSidenavFullscreenWidth,delay); // need to wait a moment for css to switch
- enabled = true;
- } else {
- // Currently USING fullscreen; disable fullscreen
- stylesheet.attr('disabled', 'disabled');
- $('#nav-swap .fullscreen').addClass('disabled');
- setTimeout(updateSidenavFixedWidth,delay); // need to wait a moment for css to switch
- enabled = false;
- }
- writeCookie("fullscreen", enabled, null, null);
- setNavBarLeftPos();
- resizeNav(delay);
- setTimeout(initSidenavHeightResize,delay);
- }
-
-
- function setNavBarLeftPos() {
- navBarLeftPos = $('#body-content').offset().left;
- }
-
-
- function updateSideNavPosition() {
- var newLeft = $(window).scrollLeft() - navBarLeftPos;
- $('#devdoc-nav').css({left: -newLeft});
- $('#devdoc-nav .totop').css({left: -(newLeft - parseInt($('#side-nav').css('margin-left')))});
- }
-
View
1,203 tools/droiddoc/templates-sdk/assets/js/docs.js
@@ -195,11 +195,15 @@ false; // navigate across topic boundaries only in design docs
if ($selListItem.hasClass('nav-section')) {
// we're on an index page, jump to the first topic
- $nextLink = $selListItem.find('ul').find('a:eq(0)');
+ $nextLink = $selListItem.find('ul:eq(0)').find('a:eq(0)');
// if there aren't any children, go to the next section (required for About pages)
if($nextLink.length == 0) {
$nextLink = $selListItem.next('li').find('a');
+ } else if ($('.topic-start-link').length) {
+ // as long as there's a child link and there is a "topic start link" (we're on a landing)
+ // then set the landing page "start link" text to be the first doc title
+ $('.topic-start-link').text($nextLink.text().toUpperCase());
}
// Handle some Training specialties
@@ -944,29 +948,9 @@ function swapNav() {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+/* ############################################ */
/* ########## LOCALIZATION ############ */
+/* ############################################ */
function getBaseUri(uri) {
var intlUrl = (uri.substring(0,6) == "/intl/");
@@ -1084,3 +1068,1176 @@ function toggleContent(obj) {
}
return false;
}
+
+
+
+
+
+
+/*
+ * Slideshow 1.0
+ * Used on /index.html and /develop/index.html for carousel
+ *
+ * Sample usage:
+ * HTML -
+ * <div class="slideshow-container">
+ * <a href="" class="slideshow-prev">Prev</a>
+ * <a href="" class="slideshow-next">Next</a>
+ * <ul>
+ * <li class="item"><img src="images/marquee1.jpg"></li>
+ * <li class="item"><img src="images/marquee2.jpg"></li>
+ * <li class="item"><img src="images/marquee3.jpg"></li>
+ * <li class="item"><img src="images/marquee4.jpg"></li>
+ * </ul>
+ * </div>
+ *
+ * <script type="text/javascript">
+ * $('.slideshow-container').dacSlideshow({
+ * auto: true,
+ * btnPrev: '.slideshow-prev',
+ * btnNext: '.slideshow-next'
+ * });
+ * </script>
+ *
+ * Options:
+ * btnPrev: optional identifier for previous button
+ * btnNext: optional identifier for next button
+ * auto: whether or not to auto-proceed
+ * speed: animation speed
+ * autoTime: time between auto-rotation
+ * easing: easing function for transition
+ * start: item to select by default
+ * scroll: direction to scroll in
+ * pagination: whether or not to include dotted pagination
+ *
+ */
+
+ (function($) {
+ $.fn.dacSlideshow = function(o) {
+
+ //Options - see above
+ o = $.extend({
+ btnPrev: null,
+ btnNext: null,
+ auto: true,
+ speed: 500,
+ autoTime: 12000,
+ easing: null,
+ start: 0,
+ scroll: 1,
+ pagination: true
+
+ }, o || {});
+
+ //Set up a carousel for each
+ return this.each(function() {
+
+ var running = false;
+ var animCss = o.vertical ? "top" : "left";
+ var sizeCss = o.vertical ? "height" : "width";
+ var div = $(this);
+ var ul = $("ul", div);
+ var tLi = $("li", ul);
+ var tl = tLi.size();
+ var timer = null;
+
+ var li = $("li", ul);
+ var itemLength = li.size();
+ var curr = o.start;
+
+ li.css({float: o.vertical ? "none" : "left"});
+ ul.css({margin: "0", padding: "0", position: "relative", "list-style-type": "none", "z-index": "1"});
+ div.css({position: "relative", "z-index": "2", left: "0px"});
+
+ var liSize = o.vertical ? height(li) : width(li);
+ var ulSize = liSize * itemLength;
+ var divSize = liSize;
+
+ li.css({width: li.width(), height: li.height()});
+ ul.css(sizeCss, ulSize+"px").css(animCss, -(curr*liSize));
+
+ div.css(sizeCss, divSize+"px");
+
+ //Pagination
+ if (o.pagination) {
+ var pagination = $("<div class='pagination'></div>");
+ var pag_ul = $("<ul></ul>");
+ if (tl > 1) {
+ for (var i=0;i<tl;i++) {
+ var li = $("<li>"+i+"</li>");
+ pag_ul.append(li);
+ if (i==o.start) li.addClass('active');
+ li.click(function() {
+ go(parseInt($(this).text()));
+ })
+ }
+ pagination.append(pag_ul);
+ div.append(pagination);
+ }
+ }
+
+ //Previous button
+ if(o.btnPrev)
+ $(o.btnPrev).click(function(e) {
+ e.preventDefault();
+ return go(curr-o.scroll);
+ });
+
+ //Next button
+ if(o.btnNext)
+ $(o.btnNext).click(function(e) {
+ e.preventDefault();
+ return go(curr+o.scroll);
+ });
+
+ //Auto rotation
+ if(o.auto) startRotateTimer();
+
+ function startRotateTimer() {
+ clearInterval(timer);
+ timer = setInterval(function() {
+ if (curr == tl-1) {
+ go(0);
+ } else {
+ go(curr+o.scroll);
+ }
+ }, o.autoTime);
+ }
+
+ //Go to an item
+ function go(to) {
+ if(!running) {
+
+ if(to<0) {
+ to = itemLength-1;
+ } else if (to>itemLength-1) {
+ to = 0;
+ }
+ curr = to;
+
+ running = true;
+
+ ul.animate(
+ animCss == "left" ? { left: -(curr*liSize) } : { top: -(curr*liSize) } , o.speed, o.easing,
+ function() {
+ running = false;
+ }
+ );
+
+ $(o.btnPrev + "," + o.btnNext).removeClass("disabled");
+ $( (curr-o.scroll<0 && o.btnPrev)
+ ||
+ (curr+o.scroll > itemLength && o.btnNext)
+ ||
+ []
+ ).addClass("disabled");
+
+
+ var nav_items = $('li', pagination);
+ nav_items.removeClass('active');
+ nav_items.eq(to).addClass('active');
+
+
+ }
+ if(o.auto) startRotateTimer();
+ return false;
+ };
+ });
+ };
+
+ function css(el, prop) {
+ return parseInt($.css(el[0], prop)) || 0;
+ };
+ function width(el) {
+ return el[0].offsetWidth + css(el, 'marginLeft') + css(el, 'marginRight');
+ };
+ function height(el) {
+ return el[0].offsetHeight + css(el, 'marginTop') + css(el, 'marginBottom');
+ };
+
+ })(jQuery);
+
+
+/*
+ * dacSlideshow 1.0
+ * Used on develop/index.html for side-sliding tabs
+ *
+ * Sample usage:
+ * HTML -
+ * <div class="slideshow-container">
+ * <a href="" class="slideshow-prev">Prev</a>
+ * <a href="" class="slideshow-next">Next</a>
+ * <ul>
+ * <li class="item"><img src="images/marquee1.jpg"></li>
+ * <li class="item"><img src="images/marquee2.jpg"></li>
+ * <li class="item"><img src="images/marquee3.jpg"></li>
+ * <li class="item"><img src="images/marquee4.jpg"></li>
+ * </ul>
+ * </div>
+ *
+ * <script type="text/javascript">
+ * $('.slideshow-container').dacSlideshow({
+ * auto: true,
+ * btnPrev: '.slideshow-prev',
+ * btnNext: '.slideshow-next'
+ * });
+ * </script>
+ *
+ * Options:
+ * btnPrev: optional identifier for previous button
+ * btnNext: optional identifier for next button
+ * auto: whether or not to auto-proceed
+ * speed: animation speed
+ * autoTime: time between auto-rotation
+ * easing: easing function for transition
+ * start: item to select by default
+ * scroll: direction to scroll in
+ * pagination: whether or not to include dotted pagination
+ *
+ */
+ (function($) {
+ $.fn.dacTabbedList = function(o) {
+
+ //Options - see above
+ o = $.extend({
+ speed : 250,
+ easing: null,
+ nav_id: null,
+ frame_id: null
+ }, o || {});
+
+ //Set up a carousel for each
+ return this.each(function() {
+
+ var curr = 0;
+ var running = false;
+ 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 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) {
+ curr = to;
+ running = true;
+
+ frame.animate({ 'margin-left' : -(curr*content_width) }, o.speed, o.easing,
+ function() {
+ running = false;
+ }
+ );
+
+
+ nav_li.removeClass('active');
+ nav_li.eq(to).addClass('active');
+
+
+ }
+ return false;
+ };
+ });
+ };
+
+ function css(el, prop) {
+ return parseInt($.css(el[0], prop)) || 0;
+ };
+ function width(el) {
+ return el[0].offsetWidth + css(el, 'marginLeft') + css(el, 'marginRight');
+ };
+ function height(el) {
+ return el[0].offsetHeight + css(el, 'marginTop') + css(el, 'marginBottom');
+ };
+
+ })(jQuery);
+
+
+
+
+
+/* ######################################################## */
+/* ################ SEARCH SUGGESTIONS ################## */
+/* ######################################################## */
+
+
+var gSelectedIndex = -1;
+var gSelectedID = -1;
+var gMatches = new Array();
+var gLastText = "";
+var ROW_COUNT = 20;
+var gInitialized = false;
+
+function set_item_selected($li, selected)
+{
+ if (selected) {
+ $li.attr('class','jd-autocomplete jd-selected');
+ } else {
+ $li.attr('class','jd-autocomplete');
+ }
+}
+
+function set_item_values(toroot, $li, match)
+{
+ var $link = $('a',$li);
+ $link.html(match.__hilabel || match.label);
+ $link.attr('href',toroot + match.link);
+}
+
+function sync_selection_table(toroot)
+{
+ var $list = $("#search_filtered");
+ var $li; //list item jquery object
+ var i; //list item iterator
+ gSelectedID = -1;
+
+ //initialize the table; draw it for the first time (but not visible).
+ if (!gInitialized) {
+ for (i=0; i<ROW_COUNT; i++) {
+ var $li = $("<li class='jd-autocomplete'></li>");
+ $list.append($li);
+
+ $li.mousedown(function() {
+ window.location = this.firstChild.getAttribute("href");
+ });
+ $li.mouseover(function() {
+ $('#search_filtered li').removeClass('jd-selected');
+ $(this).addClass('jd-selected');
+ gSelectedIndex = $('#search_filtered li').index(this);
+ });
+ $li.append('<a></a>');
+ }
+ gInitialized = true;
+ }
+
+ //if we have results, make the table visible and initialize result info
+ if (gMatches.length > 0) {
+ $('#search_filtered_div').removeClass('no-display');
+ var N = gMatches.length < ROW_COUNT ? gMatches.length : ROW_COUNT;
+ for (i=0; i<N; i++) {
+ $li = $('#search_filtered li:nth-child('+(i+1)+')');
+ $li.attr('class','show-item');
+ set_item_values(toroot, $li, gMatches[i]);
+ set_item_selected($li, i == gSelectedIndex);
+ if (i == gSelectedIndex) {
+ gSelectedID = gMatches[i].id;
+ }
+ }
+ //start hiding rows that are no longer matches
+ for (; i<ROW_COUNT; i++) {
+ $li = $('#search_filtered li:nth-child('+(i+1)+')');
+ $li.attr('class','no-display');
+ }
+ //if there are more results we're not showing, so say so.
+/* if (gMatches.length > ROW_COUNT) {
+ li = list.rows[ROW_COUNT];
+ li.className = "show-item";
+ c1 = li.cells[0];
+ c1.innerHTML = "plus " + (gMatches.length-ROW_COUNT) + " more";
+ } else {
+ list.rows[ROW_COUNT].className = "hide-item";
+ }*/
+ //if we have no results, hide the table
+ } else {
+ $('#search_filtered_div').addClass('no-display');
+ }
+}
+
+function search_changed(e, kd, toroot)
+{
+ var search = document.getElementById("search_autocomplete");
+ var text = search.value.replace(/(^ +)|( +$)/g, '');
+
+ // show/hide the close button
+ if (text != '') {
+ $(".search .close").removeClass("hide");
+ } else {
+ $(".search .close").addClass("hide");
+ }
+
+ // 13 = enter
+ if (e.keyCode == 13) {
+ $('#search_filtered_div').addClass('no-display');
+ if (!$('#search_filtered_div').hasClass('no-display') || (gSelectedIndex < 0)) {
+ if ($("#searchResults").is(":hidden")) {
+ // if results aren't showing, return true to allow search to execute
+ return true;
+ } else {
+ // otherwise, results are already showing, so allow ajax to auto refresh the results
+ // and ignore this Enter press to avoid the reload.
+ return false;
+ }
+ } else if (kd && gSelectedIndex >= 0) {
+ window.location = toroot + gMatches[gSelectedIndex].link;
+ return false;
+ }
+ }
+ // 38 -- arrow up
+ else if (kd && (e.keyCode == 38)) {
+ if (gSelectedIndex >= 0) {
+ $('#search_filtered li').removeClass('jd-selected');
+ gSelectedIndex--;
+ $('#search_filtered li:nth-child('+(gSelectedIndex+1)+')').addClass('jd-selected');
+ }
+ return false;
+ }
+ // 40 -- arrow down
+ else if (kd && (e.keyCode == 40)) {
+ if (gSelectedIndex < gMatches.length-1
+ && gSelectedIndex < ROW_COUNT-1) {
+ $('#search_filtered li').removeClass('jd-selected');
+ gSelectedIndex++;
+ $('#search_filtered li:nth-child('+(gSelectedIndex+1)+')').addClass('jd-selected');
+ }
+ return false;
+ }
+ else if (!kd && (e.keyCode != 40) && (e.keyCode != 38)) {
+ gMatches = new Array();
+ matchedCount = 0;
+ gSelectedIndex = -1;
+ for (var i=0; i<DATA.length; i++) {
+ var s = DATA[i];
+ if (text.length != 0 &&
+ s.label.toLowerCase().indexOf(text.toLowerCase()) != -1) {
+ gMatches[matchedCount] = s;
+ matchedCount++;
+ }
+ }
+ rank_autocomplete_results(text);
+ for (var i=0; i<gMatches.length; i++) {
+ var s = gMatches[i];
+ if (gSelectedID == s.id) {
+ gSelectedIndex = i;
+ }
+ }
+ highlight_autocomplete_result_labels(text);
+ sync_selection_table(toroot);
+ return true; // allow the event to bubble up to the search api
+ }
+}
+
+function rank_autocomplete_results(query) {
+ query = query || '';
+ if (!gMatches || !gMatches.length)
+ return;
+
+ // helper function that gets the last occurence index of the given regex
+ // in the given string, or -1 if not found
+ var _lastSearch = function(s, re) {
+ if (s == '')
+ return -1;
+ var l = -1;
+ var tmp;
+ while ((tmp = s.search(re)) >= 0) {
+ if (l < 0) l = 0;
+ l += tmp;
+ s = s.substr(tmp + 1);
+ }
+ return l;
+ };
+
+ // helper function that counts the occurrences of a given character in
+ // a given string
+ var _countChar = function(s, c) {
+ var n = 0;
+ for (var i=0; i<s.length; i++)
+ if (s.charAt(i) == c) ++n;
+ return n;
+ };
+
+ var queryLower = query.toLowerCase();
+ var queryAlnum = (queryLower.match(/\w+/) || [''])[0];
+ var partPrefixAlnumRE = new RegExp('\\b' + queryAlnum);
+ var partExactAlnumRE = new RegExp('\\b' + queryAlnum + '\\b');
+
+ var _resultScoreFn = function(result) {
+ // scores are calculated based on exact and prefix matches,
+ // and then number of path separators (dots) from the last
+ // match (i.e. favoring classes and deep package names)
+ var score = 1.0;
+ var labelLower = result.label.toLowerCase();
+ var t;
+ t = _lastSearch(labelLower, partExactAlnumRE);
+ if (t >= 0) {
+ // exact part match
+ var partsAfter = _countChar(labelLower.substr(t + 1), '.');
+ score *= 200 / (partsAfter + 1);
+ } else {
+ t = _lastSearch(labelLower, partPrefixAlnumRE);
+ if (t >= 0) {
+ // part prefix match
+ var partsAfter = _countChar(labelLower.substr(t + 1), '.');
+ score *= 20 / (partsAfter + 1);
+ }
+ }
+
+ return score;
+ };
+
+ for (var i=0; i<gMatches.length; i++) {
+ gMatches[i].__resultScore = _resultScoreFn(gMatches[i]);
+ }
+
+ gMatches.sort(function(a,b){
+ var n = b.__resultScore - a.__resultScore;
+ if (n == 0) // lexicographical sort if scores are the same
+ n = (a.label < b.label) ? -1 : 1;
+ return n;
+ });
+}
+
+function highlight_autocomplete_result_labels(query) {
+ query = query || '';
+ if (!gMatches || !gMatches.length)
+ return;
+
+ var queryLower = query.toLowerCase();
+ var queryAlnumDot = (queryLower.match(/[\w\.]+/) || [''])[0];
+ var queryRE = new RegExp(
+ '(' + queryAlnumDot.replace(/\./g, '\\.') + ')', 'ig');
+ for (var i=0; i<gMatches.length; i++) {
+ gMatches[i].__hilabel = gMatches[i].label.replace(
+ queryRE, '<b>$1</b>');
+ }
+}
+
+function search_focus_changed(obj, focused)
+{
+ if (!focused) {
+ if(obj.value == ""){
+ $(".search .close").addClass("hide");
+ }
+ document.getElementById("search_filtered_div").className = "no-display";
+ }
+}
+
+function submit_search() {
+ var query = document.getElementById('search_autocomplete').value;
+ location.hash = 'q=' + query;
+ loadSearchResults();
+ $("#searchResults").slideDown('slow');
+ return false;
+}
+
+
+function hideResults() {
+ $("#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) {});
+ return false;
+}
+
+
+
+/* ########################################################## */
+/* ################ CUSTOM SEARCH ENGINE ################## */
+/* ########################################################## */
+
+google.load('search', '1');
+var searchControl;
+
+function loadSearchResults() {
+ document.getElementById("search_autocomplete").style.color = "#000";
+
+ // create search control
+ searchControl = new google.search.SearchControl();
+
+ // use our existing search form and use tabs when multiple searchers are used
+ drawOptions = new google.search.DrawOptions();
+ drawOptions.setDrawMode(google.search.SearchControl.DRAW_MODE_TABBED);
+ drawOptions.setInput(document.getElementById("search_autocomplete"));
+
+ // configure search result options
+ searchOptions = new google.search.SearcherOptions();
+ searchOptions.setExpandMode(GSearchControl.EXPAND_MODE_OPEN);
+
+ // configure each of the searchers, for each tab
+ devSiteSearcher = new google.search.WebSearch();
+ devSiteSearcher.setUserDefinedLabel("All");
+ devSiteSearcher.setSiteRestriction("001482626316274216503:zu90b7s047u");
+
+ designSearcher = new google.search.WebSearch();
+ designSearcher.setUserDefinedLabel("Design");
+ designSearcher.setSiteRestriction("http://developer.android.com/design/");
+
+ trainingSearcher = new google.search.WebSearch();
+ trainingSearcher.setUserDefinedLabel("Training");
+ trainingSearcher.setSiteRestriction("http://developer.android.com/training/");
+
+ guidesSearcher = new google.search.WebSearch();
+ guidesSearcher.setUserDefinedLabel("Guides");
+ guidesSearcher.setSiteRestriction("http://developer.android.com/guide/");
+
+ referenceSearcher = new google.search.WebSearch();
+ referenceSearcher.setUserDefinedLabel("Reference");
+ referenceSearcher.setSiteRestriction("http://developer.android.com/reference/");
+
+ blogSearcher = new google.search.WebSearch();
+ blogSearcher.setUserDefinedLabel("Blog");
+ blogSearcher.setSiteRestriction("http://android-developers.blogspot.com");
+
+ // add each searcher to the search control
+ searchControl.addSearcher(devSiteSearcher, searchOptions);
+ searchControl.addSearcher(designSearcher, searchOptions);
+ searchControl.addSearcher(trainingSearcher, searchOptions);
+ searchControl.addSearcher(guidesSearcher, searchOptions);
+ searchControl.addSearcher(referenceSearcher, searchOptions);
+ searchControl.addSearcher(blogSearcher, searchOptions);
+
+ // configure result options
+ searchControl.setResultSetSize(google.search.Search.LARGE_RESULTSET);
+ searchControl.setLinkTarget(google.search.Search.LINK_TARGET_SELF);
+ searchControl.setTimeoutInterval(google.search.SearchControl.TIMEOUT_SHORT);
+ searchControl.setNoResultsString(google.search.SearchControl.NO_RESULTS_DEFAULT_STRING);
+
+ // upon ajax search, refresh the url and search title
+ searchControl.setSearchStartingCallback(this, function(control, searcher, query) {
+ updateResultTitle(query);
+ var query = document.getElementById('search_autocomplete').value;
+ location.hash = 'q=' + query;
+ });
+
+ // draw the search results box
+ searchControl.draw(document.getElementById("leftSearchControl"), drawOptions);
+
+ // get query and execute the search
+ searchControl.execute(decodeURI(getQuery(location.hash)));
+
+ document.getElementById("search_autocomplete").focus();
+ addTabListeners();
+}
+// End of loadSearchResults
+
+
+google.setOnLoadCallback(function(){
+ if (location.hash.indexOf("q=") == -1) {
+ // if there's no query in the url, don't search and make sure results are hidden
+ $('#searchResults').hide();
+ return;
+ } else {
+ // first time loading search results for this page
+ $('#searchResults').slideDown('slow');
+ $(".search .close").removeClass("hide");
+ loadSearchResults();
+ }
+}, true);
+
+// when an event on the browser history occurs (back, forward, load) requery hash and do search
+$(window).hashchange( function(){
+ // Exit if the hash isn't a search query or there's an error in the query
+ if ((location.hash.indexOf("q=") == -1) || (query == "undefined")) {
+ // If the results pane is open, close it.
+ if (!$("#searchResults").is(":hidden")) {
+ hideResults();
+ }
+ return;
+ }
+
+ // Otherwise, we have a search to do
+ var query = decodeURI(getQuery(location.hash));
+ searchControl.execute(query);
+ $('#searchResults').slideDown('slow');
+ $("#search_autocomplete").focus();
+ $(".search .close").removeClass("hide");
+
+ updateResultTitle(query);
+});
+
+function updateResultTitle(query) {
+ $("#searchTitle").html("Results for <em>" + escapeHTML(query) + "</em>");
+}
+
+// forcefully regain key-up event control (previously jacked by search api)
+$("#search_autocomplete").keyup(function(event) {
+ return search_changed(event, false, toRoot);
+});
+
+// add event listeners to each tab so we can track the browser history
+function addTabListeners() {
+ var tabHeaders = $(".gsc-tabHeader");
+ for (var i = 0; i < tabHeaders.length; i++) {
+ $(tabHeaders[i]).attr("id",i).click(function() {
+ /*
+ // make a copy of the page numbers for the search left pane
+ 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,
+ // 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
+ $('#searchResults .gsc-webResult .gsc-cursor-box.gs-bidi-start-align:visible')
+ .clone().appendTo('#searchResults .gsc-tabsArea');
+ }, 200);
+ */
+ });
+ }
+ setTimeout(function(){$(tabHeaders[0]).click()},200);
+}
+
+
+function getQuery(hash) {
+ var queryParts = hash.split('=');
+ return queryParts[1];
+}
+
+/* returns the given string with all HTML brackets converted to entities
+ TODO: move this to the site's JS library */
+function escapeHTML(string) {
+ return string.replace(/</g,"&lt;")
+ .replace(/>/g,"&gt;");
+}
+
+
+
+
+
+
+
+/* ######################################################## */
+/* ################# JAVADOC REFERENCE ################### */
+/* ######################################################## */
+
+/* Initialize some droiddoc stuff */
+$(document).ready(function() {
+
+ // init available apis based on user pref
+ changeApiLevel();
+ initSidenavHeightResize()
+});
+
+var API_LEVEL_COOKIE = "api_level";
+var minLevel = 1;
+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({
+ 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({
+ 'width' : $('#side-nav').css('width'),
+ 'margin' : $('#side-nav').css('margin')
+ });
+ $('#devdoc-nav a.totop').css({'display':'block','width':$("#nav").innerWidth()+'px'});
+
+ initSidenavHeightResize();
+}
+
+function updateSidenavFullscreenWidth() {
+ if (!navBarIsFixed) return;
+ $('#devdoc-nav').css({
+ 'width' : $('#side-nav').css('width'),
+ 'margin' : $('#side-nav').css('margin')
+ });
+ $('#devdoc-nav .totop').css({'left': 'inherit'});
+
+ initSidenavHeightResize();
+}
+
+function buildApiLevelSelector() {
+ maxLevel = SINCE_DATA.length;
+ var userApiLevel = parseInt(readCookie(API_LEVEL_COOKIE));
+ userApiLevel = userApiLevel == 0 ? maxLevel : userApiLevel; // If there's no cookie (zero), use the max by default
+
+ minLevel = parseInt($("#doc-api-level").attr("class"));
+ // Handle provisional api levels; the provisional level will always be the highest possible level
+ // Provisional api levels will also have a length; other stuff that's just missing a level won't,
+ // so leave those kinds of entities at the default level of 1 (for example, the R.styleable class)
+ if (isNaN(minLevel) && minLevel.length) {
+ minLevel = maxLevel;
+ }
+ var select = $("#apiLevelSelector").html("").change(changeApiLevel);
+ for (var i = maxLevel-1; i >= 0; i--) {
+ var option = $("<option />").attr("value",""+SINCE_DATA[i]).append(""+SINCE_DATA[i]);
+ // if (SINCE_DATA[i] < minLevel) option.addClass("absent"); // always false for strings (codenames)
+ select.append(option);
+ }
+
+ // get the DOM element and use setAttribute cuz IE6 fails when using jquery .attr('selected',true)
+ var selectedLevelItem = $("#apiLevelSelector option[value='"+userApiLevel+"']").get(0);
+ selectedLevelItem.setAttribute('selected',true);
+}
+
+function changeApiLevel() {
+ maxLevel = SINCE_DATA.length;
+ var selectedLevel = maxLevel;
+
+ selectedLevel = parseInt($("#apiLevelSelector option:selected").val());
+ toggleVisisbleApis(selectedLevel, "body");
+
+ var date = new Date();
+ date.setTime(date.getTime()+(10*365*24*60*60*1000)); // keep this for 10 years
+ var expiration = date.toGMTString();
+ writeCookie(API_LEVEL_COOKIE, selectedLevel, null, expiration);
+
+ if (selectedLevel < minLevel) {
+ var thing = ($("#jd-header").html().indexOf("package") != -1) ? "package" : "class";
+ $("#naMessage").show().html("<div><p><strong>This " + thing + " is not available with API level " + selectedLevel + ".</strong></p>"
+ + "<p>To use this " + thing + ", you must develop your app using a build target "
+ + "that supports API level " + $("#doc-api-level").attr("class") + " or higher. To read these "
+ + "APIs, change the value of the API level filter above.</p>"
+ + "<p><a href='" +toRoot+ "guide/appendix/api-levels.html'>What is the API level?</a></p></div>");
+ } else {
+ $("#naMessage").hide();
+ }
+}
+
+function toggleVisisbleApis(selectedLevel, context) {
+ var apis = $(".api",context);
+ apis.each(function(i) {
+ var obj = $(this);
+ var className = obj.attr("class");
+ var apiLevelIndex = className.lastIndexOf("-")+1;
+ var apiLevelEndIndex = className.indexOf(" ", apiLevelIndex);
+ apiLevelEndIndex = apiLevelEndIndex != -1 ? apiLevelEndIndex : className.length;
+ var apiLevel = className.substring(apiLevelIndex, apiLevelEndIndex);
+ if (apiLevel.length == 0) { // for odd cases when the since data is actually missing, just bail
+ return;
+ }
+ apiLevel = parseInt(apiLevel);
+
+ // Handle provisional api levels; if this item's level is the provisional one, set it to the max
+ var selectedLevelNum = parseInt(selectedLevel)
+ var apiLevelNum = parseInt(apiLevel);
+ if (isNaN(apiLevelNum)) {
+ apiLevelNum = maxLevel;
+ }
+
+ // Grey things out that aren't available and give a tooltip title
+ if (apiLevelNum > selectedLevelNum) {
+ obj.addClass("absent").attr("title","Requires API Level \""
+ + apiLevel + "\" or higher");
+ }
+ else obj.removeClass("absent").removeAttr("title");
+ });
+}
+
+
+
+
+/* ################# SIDENAV TREE VIEW ################### */
+
+function new_node(me, mom, text, link, children_data, api_level)
+{
+ var node = new Object();
+ node.children = Array();
+ node.children_data = children_data;
+ node.depth = mom.depth + 1;
+
+ node.li = document.createElement("li");
+ mom.get_children_ul().appendChild(node.li);
+
+ node.label_div = document.createElement("div");
+ node.label_div.className = "label";
+ if (api_level != null) {
+ $(node.label_div).addClass("api");
+ $(node.label_div).addClass("api-level-"+api_level);
+ }
+ node.li.appendChild(node.label_div);
+
+ if (children_data != null) {
+ node.expand_toggle = document.createElement("a");
+ node.expand_toggle.href = "javascript:void(0)";
+ node.expand_toggle.onclick = function() {
+ if (node.expanded) {
+ $(node.get_children_ul()).slideUp("fast");
+ node.plus_img.src = me.toroot + "assets/images/triangle-closed-small.png";
+ node.expanded = false;
+ } else {
+ expand_node(me, node);
+ }
+ };
+ node.label_div.appendChild(node.expand_toggle);
+
+ node.plus_img = document.createElement("img");
+ node.plus_img.src = me.toroot + "assets/images/triangle-closed-small.png";
+ node.plus_img.className = "plus";
+ node.plus_img.width = "8";
+ node.plus_img.border = "0";
+ node.expand_toggle.appendChild(node.plus_img);
+
+ node.expanded = false;
+ }
+
+ var a = document.createElement("a");
+ node.label_div.appendChild(a);
+ node.label = document.createTextNode(text);
+ a.appendChild(node.label);
+ if (link) {
+ a.href = me.toroot + link;
+ } else {
+ if (children_data != null) {
+ a.className = "nolink";
+ a.href = "javascript:void(0)";
+ a.onclick = node.expand_toggle.onclick;
+ // This next line shouldn't be necessary. I'll buy a beer for the first
+ // person who figures out how to remove this line and have the link
+ // toggle shut on the first try. --joeo@android.com
+ node.expanded = false;
+ }
+ }
+
+
+ node.children_ul = null;
+ node.get_children_ul = function() {
+ if (!node.children_ul) {
+ node.children_ul = document.createElement("ul");
+ node.children_ul.className = "children_ul";
+ node.children_ul.style.display = "none";
+ node.li.appendChild(node.children_ul);
+ }
+ return node.children_ul;
+ };
+
+ return node;
+}
+
+function expand_node(me, node)
+{
+ if (node.children_data && !node.expanded) {
+ if (node.children_visited) {
+ $(node.get_children_ul()).slideDown("fast");
+ } else {
+ 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";
+ node.expanded = true;
+
+ // perform api level toggling because new nodes are new to the DOM
+ var selectedLevel = $("#apiLevelSelector option:selected").val();
+ toggleVisisbleApis(selectedLevel, "#side-nav");
+ }
+}
+
+function get_node(me, mom)
+{
+ mom.children_visited = true;
+ for (var i in mom.children_data) {
+ var node_data = mom.children_data[i];
+ mom.children[i] = new_node(me, mom, node_data[0], node_data[1],
+ node_data[2], node_data[3]);
+ }
+}
+
+function this_page_relative(toroot)
+{
+ var full = document.location.pathname;
+ var file = "";
+ if (toroot.substr(0, 1) == "/") {
+ if (full.substr(0, toroot.length) == toroot) {
+ return full.substr(toroot.length);
+ } else {
+ // the file isn't under toroot. Fail.