add support for gms javadocs
Change-Id: Ieecf09794373a176430f554f39e1c632a7013519
This commit is contained in:
parent
40e9099805
commit
d2dd6e5825
|
@ -138,6 +138,8 @@ $(document).ready(function() {
|
|||
var $selListItem;
|
||||
if ($selNavLink.length) {
|
||||
$selListItem = $selNavLink.closest('li');
|
||||
|
||||
var depth = $selListItem.parents().length;
|
||||
$selListItem.addClass('selected');
|
||||
|
||||
// Traverse up the tree and expand all parent nav-sections
|
||||
|
@ -145,7 +147,36 @@ $(document).ready(function() {
|
|||
$(this).addClass('expanded');
|
||||
$(this).children('ul').show();
|
||||
});
|
||||
|
||||
//expand current item if user clicked on reference or package name
|
||||
if(depth == 10 || depth == 12){
|
||||
$selListItem.closest('li.nav-section').addClass('expanded');
|
||||
$selListItem.closest('li.nav-section').children('ul').show();
|
||||
//if the user clicked on a package name (which has a depth of 12), we know it has children, so expand them
|
||||
if(depth == 12){
|
||||
//expand all of the items under the titles "interfaces", "classes", and "exceptions".
|
||||
$selListItem.children('ul').children('li').children('ul').addClass('expanded');
|
||||
$selListItem.children('ul').children('li').children('ul').show();
|
||||
//also expand all subclasses, subinterfaces, and subexceptions under a particular class, interface, or exception.
|
||||
$selListItem.children('ul').children('li').children('ul').children('li').children('ul').addClass('expanded');
|
||||
$selListItem.children('ul').children('li').children('ul').children('li').children('ul').show();
|
||||
}
|
||||
}
|
||||
//else if the user clicked on a class, interface, or exception, which has a depth of 16 or 18 for a subclass
|
||||
else if(depth == 16 || depth == 18){
|
||||
//expand the classes in the package
|
||||
$selListItem.closest('li.nav-section').parent().children('li').children('ul').children('li').children('ul').addClass('expanded');
|
||||
$selListItem.closest('li.nav-section').parent().children('li').children('ul').children('li').children('ul').show();
|
||||
//expand the level immediately above the class or subclass. This expands all of the interfaces, classes, and exceptions within a package.
|
||||
$selListItem.closest('li.nav-section').parent().parent().children('ul').children('li').children('ul').addClass('expanded');
|
||||
$selListItem.closest('li.nav-section').parent().parent().children('ul').children('li').children('ul').show();
|
||||
|
||||
//if this is the lowest depth (subclass) or container of a subclass expand the uls above the previously expanded uls as well.
|
||||
//this is true when the closest li nav-section has a parents() length of 16.
|
||||
if($selListItem.closest('li.nav-section').parents().length == 16){
|
||||
$selListItem.closest('li.nav-section').parent().parent().parent().children('li').children('ul').addClass('expanded');
|
||||
$selListItem.closest('li.nav-section').parent().parent().parent().children('li').children('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();
|
||||
|
@ -1112,7 +1143,7 @@ function hideExpandable(ids) {
|
|||
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* Slideshow 1.0
|
||||
* Used on /index.html and /develop/index.html for carousel
|
||||
*
|
||||
|
@ -1296,7 +1327,7 @@ function hideExpandable(ids) {
|
|||
})(jQuery);
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* dacSlideshow 1.0
|
||||
* Used on develop/index.html for side-sliding tabs
|
||||
*
|
||||
|
@ -1850,7 +1881,9 @@ function escapeHTML(string) {
|
|||
/* ######################################################## */
|
||||
|
||||
/* Initialize some droiddoc stuff, but only if we're in the reference */
|
||||
if (location.pathname.indexOf("/reference") == 0) {
|
||||
if (location.pathname.indexOf("/reference" &&
|
||||
!location.pathname.indexOf("/reference/google-packages.html") &&
|
||||
!location.pathname.indexOf("/reference/com/google")) == 0) {
|
||||
$(document).ready(function() {
|
||||
// init available apis based on user pref
|
||||
changeApiLevel();
|
||||
|
@ -2066,6 +2099,9 @@ function new_node(me, mom, text, link, children_data, api_level)
|
|||
return node;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function expand_node(me, node)
|
||||
{
|
||||
if (node.children_data && !node.expanded) {
|
||||
|
@ -2146,7 +2182,9 @@ function find_page(url, data)
|
|||
function load_navtree_data(toroot) {
|
||||
var navtreeData = document.createElement("script");
|
||||
navtreeData.setAttribute("type","text/javascript");
|
||||
navtreeData.setAttribute("src", toroot+"navtree_data.js");
|
||||
navtreeData.setAttribute("src", toroot+"google_navtree_data.js");
|
||||
|
||||
console.log(navtreeData.src);
|
||||
$("head").append($(navtreeData));
|
||||
}
|
||||
|
||||
|
@ -2191,6 +2229,105 @@ function init_navtree(navtree_id, toroot, root_nodes)
|
|||
}
|
||||
}
|
||||
|
||||
/* TODO: eliminate redundancy with non-google functions */
|
||||
function init_google_navtree(navtree_id, toroot, root_nodes)
|
||||
{
|
||||
var me = new Object();
|
||||
me.toroot = toroot;
|
||||
me.node = new Object();
|
||||
|
||||
me.node.li = document.getElementById(navtree_id);
|
||||
me.node.children_data = root_nodes;
|
||||
me.node.children = new Array();
|
||||
me.node.children_ul = document.createElement("ul");
|
||||
me.node.get_children_ul = function() { return me.node.children_ul; };
|
||||
//me.node.children_ul.className = "children_ul";
|
||||
me.node.li.appendChild(me.node.children_ul);
|
||||
me.node.depth = 0;
|
||||
|
||||
get_google_node(me, me.node);
|
||||
|
||||
}
|
||||
|
||||
function new_google_node(me, mom, text, link, children_data, api_level)
|
||||
{
|
||||
var node = new Object();
|
||||
var child;
|
||||
node.children = Array();
|
||||
node.children_data = children_data;
|
||||
node.depth = mom.depth + 1;
|
||||
node.get_children_ul = function() {
|
||||
if (!node.children_ul) {
|
||||
node.children_ul = document.createElement("ul");
|
||||
node.li.appendChild(node.children_ul);
|
||||
}
|
||||
return node.children_ul;
|
||||
};
|
||||
node.li = document.createElement("li");
|
||||
|
||||
mom.get_children_ul().appendChild(node.li);
|
||||
|
||||
|
||||
if(link) {
|
||||
child = document.createElement("a");
|
||||
|
||||
}
|
||||
else {
|
||||
child = document.createElement("span");
|
||||
child.setAttribute("style", "padding-left:10px; color:#555; text-transform:uppercase; font-size:12px");
|
||||
|
||||
}
|
||||
if (children_data != null) {
|
||||
node.li.className="nav-section";
|
||||
node.label_div = document.createElement("div");
|
||||
node.label_div.className = "nav-section-header-ref";
|
||||
node.li.appendChild(node.label_div);
|
||||
get_google_node(me, node);
|
||||
node.label_div.appendChild(child);
|
||||
}
|
||||
else {
|
||||
node.li.appendChild(child);
|
||||
}
|
||||
if(link) {
|
||||
child.href = me.toroot + link;
|
||||
}
|
||||
node.label = document.createTextNode(text);
|
||||
child.appendChild(node.label);
|
||||
|
||||
node.children_ul = null;
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
function get_google_node(me, mom)
|
||||
{
|
||||
mom.children_visited = true;
|
||||
var linkText;
|
||||
for (var i in mom.children_data) {
|
||||
var node_data = mom.children_data[i];
|
||||
linkText = node_data[0];
|
||||
|
||||
if(linkText.match("^"+"com.google.android")=="com.google.android"){
|
||||
linkText = linkText.substr(19, linkText.length);
|
||||
}
|
||||
mom.children[i] = new_google_node(me, mom, linkText, node_data[1],
|
||||
node_data[2], node_data[3]);
|
||||
}
|
||||
}
|
||||
function showGoogleRefTree() {
|
||||
init_default_google_navtree(toRoot);
|
||||
init_default_gcm_navtree(toRoot);
|
||||
resizeNav();
|
||||
}
|
||||
|
||||
function init_default_google_navtree(toroot) {
|
||||
init_google_navtree("gms-tree-list", toroot, GMS_NAVTREE_DATA);
|
||||
}
|
||||
|
||||
function init_default_gcm_navtree(toroot) {
|
||||
init_google_navtree("gcm-tree-list", toroot, GCM_NAVTREE_DATA);
|
||||
}
|
||||
|
||||
/* TOGGLE INHERITED MEMBERS */
|
||||
|
||||
/* Toggle an inherited class (arrow toggle)
|
||||
|
@ -2284,6 +2421,3 @@ var control = mac ? e.metaKey && !e.ctrlKey : e.ctrlKey; // get ctrl key
|
|||
ensureAllInheritedExpanded();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -216,7 +216,7 @@ onkeyup="return search_changed(event, false, '<?cs var:toroot ?>')" />
|
|||
es-lang="Guías de la API"
|
||||
>API Guides</a></li>
|
||||
<li><a href="<?cs var:toroot ?>reference/packages.html" <?cs
|
||||
if:reference ?>class="selected"<?cs /if ?>
|
||||
if:reference && !(reference.gcm || reference.gms) ?>class="selected"<?cs /if ?>
|
||||
zh-TW-lang="參考資源"
|
||||
zh-CN-lang="参考"
|
||||
ru-lang="Справочник"
|
||||
|
@ -234,7 +234,7 @@ onkeyup="return search_changed(event, false, '<?cs var:toroot ?>')" />
|
|||
es-lang="Herramientas"
|
||||
>Tools</a></li>
|
||||
<li><a href="<?cs var:toroot ?>google/index.html" <?cs
|
||||
if:google ?>class="selected"<?cs /if ?>
|
||||
if:google || reference.gcm || reference.gms?>class="selected"<?cs /if ?>
|
||||
>Google Services</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -146,6 +146,10 @@ def:google_nav() ?>
|
|||
|
||||
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
showGoogleRefTree();
|
||||
|
||||
</script>
|
||||
</div> <!-- end side-nav -->
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
@ -192,12 +196,18 @@ def:dist_more_nav() ?>
|
|||
scrollIntoView("devdoc-nav");
|
||||
});
|
||||
</script>
|
||||
:
|
||||
|
||||
<?cs /def ?>
|
||||
<?cs # The default side navigation for the reference docs ?><?cs
|
||||
def:default_left_nav() ?>
|
||||
<?cs if:reference.gcm || reference.gms ?>
|
||||
<?cs call:google_nav() ?>
|
||||
<?cs else ?>
|
||||
<div class="wrap clearfix" id="body-content">
|
||||
<div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
|
||||
<div id="devdoc-nav">
|
||||
|
||||
<a class="totop" href="#top" data-g-event="left-nav-top">to top</a>
|
||||
<div id="api-nav-header">
|
||||
<div id="api-level-toggle">
|
||||
|
@ -293,7 +303,9 @@ def:default_left_nav() ?>
|
|||
scrollIntoView("packages-nav");
|
||||
scrollIntoView("classes-nav");
|
||||
});
|
||||
</script><?cs
|
||||
</script>
|
||||
<?cs /if ?>
|
||||
<?cs
|
||||
/def ?>
|
||||
|
||||
<?cs
|
||||
|
@ -317,7 +329,7 @@ def:custom_left_nav() ?><?cs
|
|||
elif:about ?><?cs
|
||||
call:about_nav() ?><?cs
|
||||
else ?><?cs
|
||||
call:default_left_nav() ?><?cs
|
||||
call:default_left_nav() ?> <?cs
|
||||
/if ?>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
var GCM_NAVTREE_DATA =
|
||||
<?cs var:reference_tree ?>
|
||||
;
|
|
@ -0,0 +1,3 @@
|
|||
var GMS_NAVTREE_DATA =
|
||||
<?cs var:reference_tree ?>
|
||||
;
|
|
@ -14,7 +14,7 @@
|
|||
href="<?cs if:android.whichdoc != 'online' ?>http:<?cs /if ?>//fonts.googleapis.com/css?family=Roboto:regular,medium,thin,italic,mediumitalic,bold" title="roboto">
|
||||
<link href="<?cs var:toroot ?>assets/css/default.css" rel="stylesheet" type="text/css">
|
||||
|
||||
<?cs if:reference ?>
|
||||
<?cs if:reference && !(reference.gms || reference.gcm) ?>
|
||||
<!-- FULLSCREEN STYLESHEET -->
|
||||
<link href="<?cs var:toroot ?>assets/css/fullscreen.css" rel="stylesheet" class="fullscreen"
|
||||
type="text/css">
|
||||
|
@ -27,6 +27,10 @@ type="text/css">
|
|||
var toRoot = "<?cs var:toroot ?>";
|
||||
</script>
|
||||
<script src="<?cs var:toroot ?>assets/js/docs.js" type="text/javascript"></script>
|
||||
<?cs if:reference.gms || reference.gcm || google?>
|
||||
<script src="<?cs var:toroot ?>gms_navtree_data.js" type="text/javascript"></script>
|
||||
<script src="<?cs var:toroot ?>gcm_navtree_data.js" type="text/javascript"></script>
|
||||
<?cs else ?>
|
||||
<script src="<?cs var:toroot ?>navtree_data.js" type="text/javascript"></script>
|
||||
|
||||
<?cs /if ?>
|
||||
</head>
|
|
@ -0,0 +1,3 @@
|
|||
var NAVTREE_DATA =
|
||||
<?cs var:reference_tree ?>
|
||||
;
|
Loading…
Reference in New Issue