am a9d796a4: docs: Add navigation heading for Develop > Preview

* commit 'a9d796a4f9e198f17de6f1a27264b1b4fc9a778a':
  docs: Add navigation heading for Develop > Preview
This commit is contained in:
Joe Fernandez 2015-05-07 06:29:59 +00:00 committed by Android Git Automerger
commit c4ef9bb08f
4 changed files with 123 additions and 124 deletions

View File

@ -192,6 +192,8 @@ $(document).ready(function() {
subNavEl.find("li.google > a").addClass("selected"); subNavEl.find("li.google > a").addClass("selected");
} else if ($("body").hasClass("samples")) { } else if ($("body").hasClass("samples")) {
subNavEl.find("li.samples > a").addClass("selected"); subNavEl.find("li.samples > a").addClass("selected");
} else if ($("body").hasClass("preview")) {
subNavEl.find("li.preview > a").addClass("selected");
} else { } else {
parentNavEl.removeClass('has-subnav').addClass("selected"); parentNavEl.removeClass('has-subnav').addClass("selected");
} }
@ -2357,6 +2359,37 @@ function search_changed(e, kd, toroot)
} }
} }
// Search for Preview Guides
for (var i=0; i<PREVIEW_RESOURCES.length; i++) {
// current search comparison, with counters for tag and title,
// used later to improve ranking
var s = PREVIEW_RESOURCES[i];
s.matched_tag = 0;
s.matched_title = 0;
var matched = false;
// Check if query matches any tags; work backwards toward 1 to assist ranking
for (var j = s.keywords.length - 1; j >= 0; j--) {
// it matches a tag
if (s.keywords[j].toLowerCase().match(textRegex)) {
matched = true;
s.matched_tag = j + 1; // add 1 to index position
}
}
// Check if query matches the doc title, but only for current language
if (s.lang == currentLang) {
// if query matches the doc title
if (s.title.toLowerCase().match(textRegex)) {
matched = true;
s.matched_title = 1;
}
}
if (matched) {
gDocsMatches[matchedCountDocs] = s;
matchedCountDocs++;
}
}
// Rank/sort all the matched pages // Rank/sort all the matched pages
rank_autocomplete_doc_results(text, gDocsMatches); rank_autocomplete_doc_results(text, gDocsMatches);
} }
@ -3707,7 +3740,7 @@ function showSamples() {
return $el; return $el;
} }
function createResponsiveFlowColumn(cardSize) { function createResponsiveFlowColumn(cardSize) {
var cardWidth = parseInt(cardSize.match(/(\d+)/)[1], 10); var cardWidth = parseInt(cardSize.match(/(\d+)/)[1], 10);
var column = $('<div>').addClass('col-' + (cardWidth / 3) + 'of6'); var column = $('<div>').addClass('col-' + (cardWidth / 3) + 'of6');
@ -3732,7 +3765,7 @@ function showSamples() {
while (i < resources.length) { while (i < resources.length) {
var cardSize = cardSizes[j++ % cardSizes.length]; var cardSize = cardSizes[j++ % cardSizes.length];
cardSize = cardSize.replace(/^\s+|\s+$/,''); cardSize = cardSize.replace(/^\s+|\s+$/,'');
var column = createResponsiveFlowColumn(cardSize).appendTo($widget); var column = createResponsiveFlowColumn(cardSize).appendTo($widget);
// A stack has a third dimension which is the number of stacked items // A stack has a third dimension which is the number of stacked items

View File

@ -1,10 +1,7 @@
<?cs def:custom_masthead() ?> <?cs def:custom_masthead() ?>
<?cs if:preview ?>
<?cs call:preview_masthead() ?>
<?cs else ?>
<a name="top"></a> <a name="top"></a>
<!-- dialog to prompt lang pref change when loaded from hardcoded URL <!-- dialog to prompt lang pref change when loaded from hardcoded URL
<div id="langMessage" style="display:none"> <div id="langMessage" style="display:none">
<div> <div>
<div class="lang en"> <div class="lang en">
@ -180,6 +177,9 @@
<a class="dac-nav-link" href="<?cs var:toroot ?>samples/index.html">Samples</a> <a class="dac-nav-link" href="<?cs var:toroot ?>samples/index.html">Samples</a>
</li> </li>
<?cs /if ?> <?cs /if ?>
<li class="dac-nav-item preview">
<a class="dac-nav-link" href="<?cs var:toroot ?>preview/index.html">M Preview</a>
</li>
</ul> </ul>
</li> </li>
<li class="dac-nav-item distribute"> <li class="dac-nav-item distribute">
@ -217,41 +217,9 @@
</nav> </nav>
<!-- end navigation--> <!-- end navigation-->
<?cs /if ?><?cs # end if/else !devsite ?> <?cs /if ?><?cs # end if/else !devsite ?>
<?cs /if ?><?cs # end if/else preview ?><?cs
/def ?>
<?cs def:preview_masthead() ?> <?cs
<a name="top"></a> /def ?><?cs # end custom_masthead() ?>
<!-- Header -->
<div id="header-wrapper">
<div id="header"><?cs call:butter_bar() ?>
<div class="wrap" id="header-wrap">
<div class="col_3 logo landing-logo" style="width:240px">
<a href="<?cs var:toroot ?>preview/index.html">
<img src="<?cs var:toroot ?>assets/images/android.png" height="25" alt="Android"
style="margin:-3px 0 0" />
</a>
</div>
<div class="col-8" style="margin:0"><h1 style="margin: 4px 0 0 0px;padding:0;line-height:16px;
color:#666;font-weight:100;font-size:27px;">L Developer Preview</h1></div>
<?cs # ADD SEARCH AND MENU ?>
<?cs call:header_search_widget() ?>
</div><!-- end header-wrap -->
</div><!-- /Header -->
<div id="searchResults" class="wrap" style="display:none;">
<h2 id="searchTitle">Results</h2>
<div id="leftSearchControl" class="search-control">Loading...</div>
</div>
</div> <!--end header-wrapper -->
<?cs
/def ?>
<?cs # (UN)COMMENT THE INSIDE OF THIS METHOD TO TOGGLE VISIBILITY ?> <?cs # (UN)COMMENT THE INSIDE OF THIS METHOD TO TOGGLE VISIBILITY ?>
@ -268,6 +236,6 @@ color:#666;font-weight:100;font-size:27px;">L Developer Preview</h1></div>
</div> </div>
</div> </div>
?> ?>
<?cs /def ?> <?cs /def ?>

View File

@ -1,15 +1,15 @@
<?cs <?cs
def:fullpage() ?> def:fullpage() ?>
<div id="body-content"> <div id="body-content">
<div> <div>
<?cs /def ?> <?cs /def ?>
<?cs <?cs
def:sdk_nav() ?> def:sdk_nav() ?>
<div class="wrap clearfix" id="body-content"><div class="cols"> <div class="wrap clearfix" id="body-content"><div class="cols">
<div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement"> <div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
<div id="devdoc-nav" class="scroll-pane"> <div id="devdoc-nav" class="scroll-pane">
<?cs <?cs
include:"../../../../frameworks/base/docs/html/sdk/sdk_toc.cs" ?> include:"../../../../frameworks/base/docs/html/sdk/sdk_toc.cs" ?>
@ -26,10 +26,10 @@ def:tools_nav() ?>
<div class="wrap clearfix" id="body-content"><div class="cols"> <div class="wrap clearfix" id="body-content"><div class="cols">
<div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement"> <div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
<div id="devdoc-nav" class="scroll-pane"> <div id="devdoc-nav" class="scroll-pane">
<?cs <?cs
include:"../../../../frameworks/base/docs/html/tools/tools_toc.cs" ?> include:"../../../../frameworks/base/docs/html/tools/tools_toc.cs" ?>
</div> </div>
</div> <!-- end side-nav --> </div> <!-- end side-nav -->
<script> <script>
@ -45,9 +45,9 @@ def:training_nav() ?>
<div id="devdoc-nav" class="scroll-pane"> <div id="devdoc-nav" class="scroll-pane">
<?cs <?cs
include:"../../../../frameworks/base/docs/html/training/training_toc.cs" ?> include:"../../../../frameworks/base/docs/html/training/training_toc.cs" ?>
</div> </div>
</div> <!-- end side-nav --> </div> <!-- end side-nav -->
@ -72,6 +72,20 @@ def:googleplay_nav() ?>
</script> </script>
<?cs /def ?><?cs <?cs /def ?><?cs
def:preview_nav() ?>
<div class="wrap clearfix" id="body-content">
<div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
<div id="devdoc-nav" class="scroll-pane">
<?cs include:"../../../../frameworks/base/docs/html/preview/preview_toc.cs" ?>
</div>
</div> <!-- end side-nav -->
<script>
$(document).ready(function() {
scrollIntoView("devdoc-nav");
});
</script>
<?cs /def ?><?cs
def:essentials_nav() ?> def:essentials_nav() ?>
<div class="wrap clearfix" id="body-content"><div class="cols"> <div class="wrap clearfix" id="body-content"><div class="cols">
<div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement"> <div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
@ -175,9 +189,9 @@ def:guide_nav() ?>
<div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement"> <div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
<div id="devdoc-nav" class="scroll-pane"> <div id="devdoc-nav" class="scroll-pane">
<?cs <?cs
include:"../../../../frameworks/base/docs/html/guide/guide_toc.cs" ?> include:"../../../../frameworks/base/docs/html/guide/guide_toc.cs" ?>
</div> </div>
</div> <!-- end side-nav --> </div> <!-- end side-nav -->
@ -196,7 +210,7 @@ def:design_nav() ?>
<?cs <?cs
include:"../../../../frameworks/base/docs/html/design/design_toc.cs" ?> include:"../../../../frameworks/base/docs/html/design/design_toc.cs" ?>
</div> </div>
</div> <!-- end side-nav --> </div> <!-- end side-nav -->
@ -214,7 +228,7 @@ def:distribute_nav() ?>
<?cs <?cs
include:"../../../../frameworks/base/docs/html/distribute/distribute_toc.cs" ?> include:"../../../../frameworks/base/docs/html/distribute/distribute_toc.cs" ?>
</div> </div>
</div> <!-- end side-nav --> </div> <!-- end side-nav -->
@ -252,12 +266,12 @@ def:google_nav() ?>
<?cs <?cs
include:"../../../../frameworks/base/docs/html/google/google_toc.cs" ?> include:"../../../../frameworks/base/docs/html/google/google_toc.cs" ?>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
showGoogleRefTree(); showGoogleRefTree();
</script> </script>
</div> <!-- end side-nav --> </div> <!-- end side-nav -->
<script> <script>
@ -275,7 +289,7 @@ def:about_nav() ?>
<?cs <?cs
include:"../../../../frameworks/base/docs/html/about/about_toc.cs" ?> include:"../../../../frameworks/base/docs/html/about/about_toc.cs" ?>
</div> </div>
</div> <!-- end side-nav --> </div> <!-- end side-nav -->
@ -306,23 +320,7 @@ def:wear_nav() ?>
</script> </script>
<?cs /def ?> <?cs /def ?>
<?cs <?cs # The default side navigation for the reference docs ?><?cs
def:preview_nav() ?>
<div class="wrap clearfix" id="body-content"><div class="cols">
<div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
<div id="devdoc-nav" class="scroll-pane">
<?cs
include:"../../../../frameworks/base/docs/html/preview/preview_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() ?> def:default_left_nav() ?>
<?cs if:reference.gcm || reference.gms ?> <?cs if:reference.gcm || reference.gms ?>
<?cs call:google_nav() ?> <?cs call:google_nav() ?>
@ -343,15 +341,15 @@ def:default_left_nav() ?>
<div id="api-nav-title">Android APIs</div> <div id="api-nav-title">Android APIs</div>
</div><!-- end nav header --> </div><!-- end nav header -->
<script> <script>
var SINCE_DATA = [ <?cs var SINCE_DATA = [ <?cs
each:since = since ?>'<?cs each:since = since ?>'<?cs
var:since.name ?>'<?cs var:since.name ?>'<?cs
if:!last(since) ?>, <?cs /if ?><?cs if:!last(since) ?>, <?cs /if ?><?cs
/each /each
?> ]; ?> ];
buildApiLevelSelector(); buildApiLevelSelector();
</script> </script>
<div id="swapper"> <div id="swapper">
<div id="nav-panels"> <div id="nav-panels">
<div id="resize-packages-nav"> <div id="resize-packages-nav">
@ -366,7 +364,7 @@ def:default_left_nav() ?>
<div id="classes-nav" class="scroll-pane"> <div id="classes-nav" class="scroll-pane">
<?cs <?cs
if:subcount(class.package) ?> if:subcount(class.package) ?>
<ul> <ul>
<?cs call:list("Annotations", class.package.annotations) ?> <?cs call:list("Annotations", class.package.annotations) ?>
@ -375,7 +373,7 @@ def:default_left_nav() ?>
<?cs call:list("Enums", class.package.enums) ?> <?cs call:list("Enums", class.package.enums) ?>
<?cs call:list("Exceptions", class.package.exceptions) ?> <?cs call:list("Exceptions", class.package.exceptions) ?>
<?cs call:list("Errors", class.package.errors) ?> <?cs call:list("Errors", class.package.errors) ?>
</ul><?cs </ul><?cs
elif:subcount(package) ?> elif:subcount(package) ?>
<ul> <ul>
<?cs call:class_link_list("Annotations", package.annotations) ?> <?cs call:class_link_list("Annotations", package.annotations) ?>
@ -384,11 +382,11 @@ def:default_left_nav() ?>
<?cs call:class_link_list("Enums", package.enums) ?> <?cs call:class_link_list("Enums", package.enums) ?>
<?cs call:class_link_list("Exceptions", package.exceptions) ?> <?cs call:class_link_list("Exceptions", package.exceptions) ?>
<?cs call:class_link_list("Errors", package.errors) ?> <?cs call:class_link_list("Errors", package.errors) ?>
</ul><?cs </ul><?cs
else ?> else ?>
<p style="padding:10px">Select a package to view its members</p><?cs <p style="padding:10px">Select a package to view its members</p><?cs
/if ?><br/> /if ?><br/>
</div><!-- end classes --> </div><!-- end classes -->
</div><!-- end nav-panels --> </div><!-- end nav-panels -->
@ -429,7 +427,7 @@ def:default_left_nav() ?>
}); });
</script> </script>
<?cs /if ?> <?cs /if ?>
<?cs <?cs
/def ?> /def ?>
@ -477,25 +475,27 @@ def:header_search_widget() ?>
<?cs <?cs
def:custom_left_nav() ?><?cs def:custom_left_nav() ?><?cs
if:fullpage ?><?cs if:fullpage ?><?cs
call:fullpage() ?><?cs call:fullpage() ?><?cs
elif:nonavpage ?><?cs elif:nonavpage ?><?cs
call:no_nav() ?><?cs call:no_nav() ?><?cs
elif:guide ?><?cs elif:guide ?><?cs
call:guide_nav() ?><?cs call:guide_nav() ?><?cs
elif:design ?><?cs elif:design ?><?cs
call:design_nav() ?><?cs call:design_nav() ?><?cs
elif:training ?><?cs elif:training ?><?cs
call:training_nav() ?><?cs call:training_nav() ?><?cs
elif:tools ?><?cs elif:tools ?><?cs
call:tools_nav() ?><?cs call:tools_nav() ?><?cs
elif:google ?><?cs elif:google ?><?cs
call:google_nav() ?><?cs call:google_nav() ?><?cs
elif:samples ?><?cs elif:samples ?><?cs
call:samples_nav() ?><?cs call:samples_nav() ?><?cs
elif:distribute ?><?cs elif:preview ?><?cs
call:preview_nav() ?><?cs
elif:distribute ?><?cs
if:googleplay ?><?cs if:googleplay ?><?cs
call:googleplay_nav() ?><?cs call:googleplay_nav() ?><?cs
elif:essentials ?><?cs elif:essentials ?><?cs
@ -519,31 +519,29 @@ def:custom_left_nav() ?><?cs
call:distribute_nav() ?><?cs call:distribute_nav() ?><?cs
elif:wear ?><?cs elif:wear ?><?cs
call:wear_nav() ?><?cs call:wear_nav() ?><?cs
elif:preview ?><?cs
call:preview_nav() ?><?cs
else ?><?cs else ?><?cs
call:default_left_nav() ?> <?cs call:default_left_nav() ?> <?cs
/if ?><?cs /if ?><?cs
/def ?> /def ?>
<?cs # appears at the bottom of every page ?><?cs <?cs # appears at the bottom of every page ?><?cs
def:custom_cc_copyright() ?> def:custom_cc_copyright() ?>
Except as noted, this content is Except as noted, this content is
licensed under <a href="http://creativecommons.org/licenses/by/2.5/"> licensed under <a href="http://creativecommons.org/licenses/by/2.5/">
Creative Commons Attribution 2.5</a>. For details and Creative Commons Attribution 2.5</a>. For details and
restrictions, see the <a href="<?cs var:toroot ?>license.html">Content restrictions, see the <a href="<?cs var:toroot ?>license.html">Content
License</a>.<?cs License</a>.<?cs
/def ?> /def ?>
<?cs <?cs
def:custom_copyright() ?> def:custom_copyright() ?>
Except as noted, this content is licensed under <a Except as noted, this content is licensed under <a
href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0</a>. href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0</a>.
For details and restrictions, see the <a href="<?cs var:toroot ?>license.html"> For details and restrictions, see the <a href="<?cs var:toroot ?>license.html">
Content License</a>.<?cs Content License</a>.<?cs
/def ?> /def ?>
<?cs <?cs
def:custom_footerlinks() ?> def:custom_footerlinks() ?>
<a href="<?cs var:toroot ?>about/index.html">About Android</a> <a href="<?cs var:toroot ?>about/index.html">About Android</a>
<a href="<?cs var:toroot ?>auto/index.html">Auto</a> <a href="<?cs var:toroot ?>auto/index.html">Auto</a>
@ -553,7 +551,7 @@ def:custom_footerlinks() ?>
<?cs <?cs
/def ?> /def ?>
<?cs # appears on the right side of the blue bar at the bottom off every page ?><?cs <?cs # appears on the right side of the blue bar at the bottom off every page ?><?cs
def:custom_buildinfo() ?><?cs def:custom_buildinfo() ?><?cs
if:!google && !reference.gcm && !reference.gms ?> if:!google && !reference.gcm && !reference.gms ?>
Android <?cs var:sdk.version ?>&nbsp;r<?cs var:sdk.rel.id ?> &mdash; <?cs Android <?cs var:sdk.version ?>&nbsp;r<?cs var:sdk.rel.id ?> &mdash; <?cs

View File

@ -4,22 +4,25 @@
<?cs include:"head_tag.cs" ?> <?cs include:"head_tag.cs" ?>
<body class="gc-documentation <body class="gc-documentation
<?cs # add document classes for navigation header selection (and other stuff) ?>
<?cs <?cs
if:(google || reference.gms || reference.gcm) ?>google<?cs /if ?><?cs if:(google || reference.gms || reference.gcm) ?>google<?cs
if:(guide||develop||training||reference||tools||google||sdk||samples) ?>develop<?cs /if ?><?cs
if:guide ?> guide<?cs /if ?><?cs if:(guide||develop||training||reference||tools||sdk||google||samples||preview) ?>develop<?cs
if:samples ?> samples<?cs /if ?><?cs if:guide ?> guide<?cs /if ?><?cs
elif:(distribute||googleplay||essentials||users||engage||monetize||disttools||stories) if:samples ?> samples<?cs /if ?><?cs
?>distribute<?cs if:preview ?> preview<?cs /if ?><?cs
if:googleplay ?> googleplay<?cs /if ?><?cs elif:(distribute||googleplay||essentials||users||engage||monetize||disttools||stories)
if:essentials ?> essentials<?cs /if ?><?cs ?>distribute<?cs
if:users ?> users<?cs /if ?><?cs if:googleplay ?> googleplay<?cs /if ?><?cs
if:engage ?> engage<?cs /if ?><?cs if:essentials ?> essentials<?cs /if ?><?cs
if:monetize ?> monetize<?cs /if ?><?cs if:users ?> users<?cs /if ?><?cs
if:disttools ?> disttools<?cs /if ?><?cs if:engage ?> engage<?cs /if ?><?cs
if:stories ?> stories<?cs /if ?><?cs if:monetize ?> monetize<?cs /if ?><?cs
elif:(about||wear||tv||auto) ?>about<?cs if:disttools ?> disttools<?cs /if ?><?cs
elif:design ?>design<?cs if:stories ?> stories<?cs /if ?><?cs
elif:(about||wear||tv||auto) ?>about<?cs
elif:design ?>design<?cs
/if ?><?cs /if ?><?cs
if:page.trainingcourse ?> trainingcourse<?cs if:page.trainingcourse ?> trainingcourse<?cs
/if ?>" itemscope itemtype="http://schema.org/Article"><?cs /if ?>" itemscope itemtype="http://schema.org/Article"><?cs
@ -193,6 +196,3 @@ include:"header.cs" ?>
</body> </body>
</html> </html>