1 var NAVTREE = 2 [ 3 [ "NDK Programmer's Guide", "index.html", [ 4 [ "Concepts", "md_1__concepts__concepts.html", null ], 5 [ "- Before Beginning", "md_1__concepts__concepts.html#bb", null ], 6 [ "- Introduction", "md_1__concepts__concepts.html#intro", null ], 7 [ "- Process", "md_1__concepts__concepts.html#hiw", null ], 8 [ "- Native Activities and Applications", "md_1__concepts__concepts.html#naa", null ], 9 [ "Samples", "md_2__samples__samples.html", null ], 10 [ "- hello-jni", "md_2__samples_sample--hellojni.html", null ], 11 [ "- native-activity", "md_2__samples_sample--nativeactivity.html", null ], 12 [ "- Teapot", "md_2__samples_samples-teapot.html", null ], 13 [ "Building", "md_3__key__topics__building_building.html", null ], 14 [ "- ndk-build", "md_3__key__topics__building__chapter_1-section_8_ndk-build.html", null ], 15 [ "- Android.mk", "md_3__key__topics__building__chapter_1-section_8__android_8mk.html", null ], 16 [ "- Application.mk", "md_3__key__topics__building__a_p_p_l_i_c_a_t_i_o_n-_m_k.html", null ], 17 [ "- Standalone Toolchain", "md_3__key__topics__building__s_t_a_n_d_a_l_o_n_e-_t_o_o_l_c_h_a_i_n.html", null ], 18 [ "Debugging", "md_3__key__topics__debugging_debugging.html", null ], 19 [ "- ndk-gdb and ndk-gdb-py", "md_3__key__topics__debugging__n_d_k-_g_d_b.html", null ], 20 [ "- ndk-stack", "md_3__key__topics__debugging__n_d_k-_s_t_a_c_k.html", null ], 21 [ "Architectures and CPUs", "md_3__key__topics__c_p_u__support__instruction_sets_and__c_p_us.html", null ], 22 [ "- ABI Management", "md_3__key__topics__c_p_u__support__chapter_1-section_8__a_b_is.html", null ], 23 [ "- Neon", "md_3__key__topics__c_p_u__support__c_p_u-_a_r_m-_n_e_o_n.html", null ], 24 [ "- Mips", "md_3__key__topics__c_p_u__support__c_p_u-_m_i_p_s.html", null ], 25 [ "- x86", "md_3__key__topics__c_p_u__support__c_p_u-_x86.html", null ], 26 [ "- x86_64", "md_3__key__topics__c_p_u__support__c_p_u-_x86-64.html", null ], 27 [ "- CPU Features", "md_3__key__topics__c_p_u__support__c_p_u-_f_e_a_t_u_r_e_s.html", null ], 28 [ "Libraries", "md_3__key__topics__libraries_libraries.html", null ], 29 [ "- Stable APIs", "md_3__key__topics__libraries__s_t_a_b_l_e-_a_p_i_s.html", null ], 30 [ "- C++ Support", "md_3__key__topics__libraries__c_p_l_u_s_p_l_u_s-_s_u_p_p_o_r_t.html", null ], 31 [ "- Prebuilt Libraries", "md_3__key__topics__libraries__p_r_e_b_u_i_l_t_s.html", null ], 32 [ "Additional Information", "md_4__additional__info__additional__info.html", null ], 33 [ "- Atomics", "md_4__additional__info__a_n_d_r_o_i_d-_a_t_o_m_i_c_s.html", null ], 34 [ "- Importing Modules (Sharing Code Made Easy)", "md_4__additional__info__i_m_p_o_r_t-_m_o_d_u_l_e.html", null ], 35 [ "- ndk-depends", "md_4__additional__info__n_d_k-_d_e_p_e_n_d_s.html", null ], 36 [ "- Android System Image Issues", "md_4__additional__info__s_y_s_t_e_m-_i_s_s_u_e_s.html", null ], 37 [ "- Licenses", "md_4__additional__info__l_i_c_e_n_s_e_s.html", null ] 38 ] ] 39 ]; 40 41 var NAVTREEINDEX = 42 [ 43 "index.html" 44 ]; 45 46 var SYNCONMSG = 'click to disable panel synchronisation'; 47 var SYNCOFFMSG = 'click to enable panel synchronisation'; 48 var SYNCONMSG = 'click to disable panel synchronisation'; 49 var SYNCOFFMSG = 'click to enable panel synchronisation'; 50 var navTreeSubIndices = new Array(); 51 52 function getData(varName) 53 { 54 var i = varName.lastIndexOf('/'); 55 var n = i>=0 ? varName.substring(i+1) : varName; 56 return eval(n.replace(/\-/g,'_')); 57 } 58 59 function stripPath(uri) 60 { 61 return uri.substring(uri.lastIndexOf('/')+1); 62 } 63 64 function stripPath2(uri) 65 { 66 var i = uri.lastIndexOf('/'); 67 var s = uri.substring(i+1); 68 var m = uri.substring(0,i+1).match(/\/d\w\/d\w\w\/$/); 69 return m ? uri.substring(i-6) : s; 70 } 71 72 function localStorageSupported() 73 { 74 try { 75 return 'localStorage' in window && window['localStorage'] !== null && window.localStorage.getItem; 76 } 77 catch(e) { 78 return false; 79 } 80 } 81 82 83 function storeLink(link) 84 { 85 if (!$("#nav-sync").hasClass('sync') && localStorageSupported()) { 86 window.localStorage.setItem('navpath',link); 87 } 88 } 89 90 function deleteLink() 91 { 92 if (localStorageSupported()) { 93 window.localStorage.setItem('navpath',''); 94 } 95 } 96 97 function cachedLink() 98 { 99 if (localStorageSupported()) { 100 return window.localStorage.getItem('navpath'); 101 } else { 102 return ''; 103 } 104 } 105 106 function getScript(scriptName,func,show) 107 { 108 var head = document.getElementsByTagName("head")[0]; 109 var script = document.createElement('script'); 110 script.id = scriptName; 111 script.type = 'text/javascript'; 112 script.onload = func; 113 script.src = scriptName+'.js'; 114 if ($.browser.msie && $.browser.version<=8) { 115 // script.onload does not work with older versions of IE 116 script.onreadystatechange = function() { 117 if (script.readyState=='complete' || script.readyState=='loaded') { 118 func(); if (show) showRoot(); 119 } 120 } 121 } 122 head.appendChild(script); 123 } 124 125 function createIndent(o,domNode,node,level) 126 { 127 var level=-1; 128 var n = node; 129 while (n.parentNode) { level++; n=n.parentNode; } 130 if (node.childrenData) { 131 var imgNode = document.createElement("img"); 132 imgNode.style.paddingLeft=(16*level).toString()+'px'; 133 imgNode.width = 16; 134 imgNode.height = 22; 135 imgNode.border = 0; 136 node.plus_img = imgNode; 137 node.expandToggle = document.createElement("a"); 138 node.expandToggle.href = "javascript:void(0)"; 139 node.expandToggle.onclick = function() { 140 if (node.expanded) { 141 $(node.getChildrenUL()).slideUp("fast"); 142 node.plus_img.src = node.relpath+"ftv2pnode.png"; 143 node.expanded = false; 144 } else { 145 expandNode(o, node, false, false); 146 } 147 } 148 node.expandToggle.appendChild(imgNode); 149 domNode.appendChild(node.expandToggle); 150 imgNode.src = node.relpath+"ftv2pnode.png"; 151 } else { 152 var span = document.createElement("span"); 153 span.style.display = 'inline-block'; 154 span.style.width = 16*(level+1)+'px'; 155 span.style.height = '22px'; 156 span.innerHTML = ' '; 157 domNode.appendChild(span); 158 } 159 } 160 161 var animationInProgress = false; 162 163 function gotoAnchor(anchor,aname,updateLocation) 164 { 165 var pos, docContent = $('#doc-content'); 166 if (anchor.parent().attr('class')=='memItemLeft' || 167 anchor.parent().attr('class')=='fieldtype' || 168 anchor.parent().is(':header')) 169 { 170 pos = anchor.parent().position().top; 171 } else if (anchor.position()) { 172 pos = anchor.position().top; 173 } 174 if (pos) { 175 var dist = Math.abs(Math.min( 176 pos-docContent.offset().top, 177 docContent[0].scrollHeight- 178 docContent.height()-docContent.scrollTop())); 179 animationInProgress=true; 180 docContent.animate({ 181 scrollTop: pos + docContent.scrollTop() - docContent.offset().top 182 },Math.max(50,Math.min(500,dist)),function(){ 183 if (updateLocation) window.location.href=aname; 184 animationInProgress=false; 185 }); 186 } 187 } 188 189 function newNode(o, po, text, link, childrenData, lastNode) 190 { 191 var node = new Object(); 192 node.children = Array(); 193 node.childrenData = childrenData; 194 node.depth = po.depth + 1; 195 node.relpath = po.relpath; 196 node.isLast = lastNode; 197 198 node.li = document.createElement("li"); 199 po.getChildrenUL().appendChild(node.li); 200 node.parentNode = po; 201 202 node.itemDiv = document.createElement("div"); 203 node.itemDiv.className = "item"; 204 205 node.labelSpan = document.createElement("span"); 206 node.labelSpan.className = "label"; 207 208 createIndent(o,node.itemDiv,node,0); 209 node.itemDiv.appendChild(node.labelSpan); 210 node.li.appendChild(node.itemDiv); 211 212 var a = document.createElement("a"); 213 node.labelSpan.appendChild(a); 214 node.label = document.createTextNode(text); 215 node.expanded = false; 216 a.appendChild(node.label); 217 if (link) { 218 var url; 219 if (link.substring(0,1)=='^') { 220 url = link.substring(1); 221 link = url; 222 } else { 223 url = node.relpath+link; 224 } 225 a.className = stripPath(link.replace('#',':')); 226 if (link.indexOf('#')!=-1) { 227 var aname = '#'+link.split('#')[1]; 228 var srcPage = stripPath($(location).attr('pathname')); 229 var targetPage = stripPath(link.split('#')[0]); 230 a.href = srcPage!=targetPage ? url : "javascript:void(0)"; 231 a.onclick = function(){ 232 storeLink(link); 233 if (!$(a).parent().parent().hasClass('selected')) 234 { 235 $('.item').removeClass('selected'); 236 $('.item').removeAttr('id'); 237 $(a).parent().parent().addClass('selected'); 238 $(a).parent().parent().attr('id','selected'); 239 } 240 var anchor = $(aname); 241 gotoAnchor(anchor,aname,true); 242 }; 243 } else { 244 a.href = url; 245 a.onclick = function() { storeLink(link); } 246 } 247 } else { 248 if (childrenData != null) 249 { 250 a.className = "nolink"; 251 a.href = "javascript:void(0)"; 252 a.onclick = node.expandToggle.onclick; 253 } 254 } 255 256 node.childrenUL = null; 257 node.getChildrenUL = function() { 258 if (!node.childrenUL) { 259 node.childrenUL = document.createElement("ul"); 260 node.childrenUL.className = "children_ul"; 261 node.childrenUL.style.display = "none"; 262 node.li.appendChild(node.childrenUL); 263 } 264 return node.childrenUL; 265 }; 266 267 return node; 268 } 269 270 function showRoot() 271 { 272 var headerHeight = $("#top").height(); 273 var footerHeight = $("#nav-path").height(); 274 var windowHeight = $(window).height() - headerHeight - footerHeight; 275 (function (){ // retry until we can scroll to the selected item 276 try { 277 var navtree=$('#nav-tree'); 278 navtree.scrollTo('#selected',0,{offset:-windowHeight/2}); 279 } catch (err) { 280 setTimeout(arguments.callee, 0); 281 } 282 })(); 283 } 284 285 function expandNode(o, node, imm, showRoot) 286 { 287 if (node.childrenData && !node.expanded) { 288 if (typeof(node.childrenData)==='string') { 289 var varName = node.childrenData; 290 getScript(node.relpath+varName,function(){ 291 node.childrenData = getData(varName); 292 expandNode(o, node, imm, showRoot); 293 }, showRoot); 294 } else { 295 if (!node.childrenVisited) { 296 getNode(o, node); 297 } if (imm || ($.browser.msie && $.browser.version>8)) { 298 // somehow slideDown jumps to the start of tree for IE9 :-( 299 $(node.getChildrenUL()).show(); 300 } else { 301 $(node.getChildrenUL()).slideDown("fast"); 302 } 303 if (node.isLast) { 304 node.plus_img.src = node.relpath+"ftv2mlastnode.png"; 305 } else { 306 node.plus_img.src = node.relpath+"ftv2mnode.png"; 307 } 308 node.expanded = true; 309 } 310 } 311 } 312 313 function glowEffect(n,duration) 314 { 315 n.addClass('glow').delay(duration).queue(function(next){ 316 $(this).removeClass('glow');next(); 317 }); 318 } 319 320 function highlightAnchor() 321 { 322 var aname = $(location).attr('hash'); 323 var anchor = $(aname); 324 if (anchor.parent().attr('class')=='memItemLeft'){ 325 var rows = $('.memberdecls tr[class$="'+ 326 window.location.hash.substring(1)+'"]'); 327 glowEffect(rows.children(),300); // member without details 328 } else if (anchor.parents().slice(2).prop('tagName')=='TR') { 329 glowEffect(anchor.parents('div.memitem'),1000); // enum value 330 } else if (anchor.parent().attr('class')=='fieldtype'){ 331 glowEffect(anchor.parent().parent(),1000); // struct field 332 } else if (anchor.parent().is(":header")) { 333 glowEffect(anchor.parent(),1000); // section header 334 } else { 335 glowEffect(anchor.next(),1000); // normal member 336 } 337 gotoAnchor(anchor,aname,false); 338 } 339 340 function selectAndHighlight(hash,n) 341 { 342 var a; 343 if (hash) { 344 var link=stripPath($(location).attr('pathname'))+':'+hash.substring(1); 345 a=$('.item a[class$="'+link+'"]'); 346 } 347 if (a && a.length) { 348 a.parent().parent().addClass('selected'); 349 a.parent().parent().attr('id','selected'); 350 highlightAnchor(); 351 } else if (n) { 352 $(n.itemDiv).addClass('selected'); 353 $(n.itemDiv).attr('id','selected'); 354 } 355 if ($('#nav-tree-contents .item:first').hasClass('selected')) { 356 $('#nav-sync').css('top','30px'); 357 } else { 358 $('#nav-sync').css('top','5px'); 359 } 360 showRoot(); 361 } 362 363 function showNode(o, node, index, hash) 364 { 365 if (node && node.childrenData) { 366 if (typeof(node.childrenData)==='string') { 367 var varName = node.childrenData; 368 getScript(node.relpath+varName,function(){ 369 node.childrenData = getData(varName); 370 showNode(o,node,index,hash); 371 },true); 372 } else { 373 if (!node.childrenVisited) { 374 getNode(o, node); 375 } 376 $(node.getChildrenUL()).css({'display':'block'}); 377 if (node.isLast) { 378 node.plus_img.src = node.relpath+"ftv2mlastnode.png"; 379 } else { 380 node.plus_img.src = node.relpath+"ftv2mnode.png"; 381 } 382 node.expanded = true; 383 var n = node.children[o.breadcrumbs[index]]; 384 if (index+1<o.breadcrumbs.length) { 385 showNode(o,n,index+1,hash); 386 } else { 387 if (typeof(n.childrenData)==='string') { 388 var varName = n.childrenData; 389 getScript(n.relpath+varName,function(){ 390 n.childrenData = getData(varName); 391 node.expanded=false; 392 showNode(o,node,index,hash); // retry with child node expanded 393 },true); 394 } else { 395 var rootBase = stripPath(o.toroot.replace(/\..+$/, '')); 396 if (rootBase=="index" || rootBase=="pages" || rootBase=="search") { 397 expandNode(o, n, true, true); 398 } 399 selectAndHighlight(hash,n); 400 } 401 } 402 } 403 } else { 404 selectAndHighlight(hash); 405 } 406 } 407 408 function removeToInsertLater(element) { 409 var parentNode = element.parentNode; 410 var nextSibling = element.nextSibling; 411 parentNode.removeChild(element); 412 return function() { 413 if (nextSibling) { 414 parentNode.insertBefore(element, nextSibling); 415 } else { 416 parentNode.appendChild(element); 417 } 418 }; 419 } 420 421 function getNode(o, po) 422 { 423 var insertFunction = removeToInsertLater(po.li); 424 po.childrenVisited = true; 425 var l = po.childrenData.length-1; 426 for (var i in po.childrenData) { 427 var nodeData = po.childrenData[i]; 428 po.children[i] = newNode(o, po, nodeData[0], nodeData[1], nodeData[2], 429 i==l); 430 } 431 insertFunction(); 432 } 433 434 function gotoNode(o,subIndex,root,hash,relpath) 435 { 436 var nti = navTreeSubIndices[subIndex][root+hash]; 437 o.breadcrumbs = $.extend(true, [], nti ? nti : navTreeSubIndices[subIndex][root]); 438 if (!o.breadcrumbs && root!=NAVTREE[0][1]) { // fallback: show index 439 navTo(o,NAVTREE[0][1],"",relpath); 440 $('.item').removeClass('selected'); 441 $('.item').removeAttr('id'); 442 } 443 if (o.breadcrumbs) { 444 o.breadcrumbs.unshift(0); // add 0 for root node 445 showNode(o, o.node, 0, hash); 446 } 447 } 448 449 function navTo(o,root,hash,relpath) 450 { 451 var link = cachedLink(); 452 if (link) { 453 var parts = link.split('#'); 454 root = parts[0]; 455 if (parts.length>1) hash = '#'+parts[1]; 456 else hash=''; 457 } 458 if (hash.match(/^#l\d+$/)) { 459 var anchor=$('a[name='+hash.substring(1)+']'); 460 glowEffect(anchor.parent(),1000); // line number 461 hash=''; // strip line number anchors 462 //root=root.replace(/_source\./,'.'); // source link to doc link 463 } 464 var url=root+hash; 465 var i=-1; 466 while (NAVTREEINDEX[i+1]<=url) i++; 467 if (i==-1) { i=0; root=NAVTREE[0][1]; } // fallback: show index 468 if (navTreeSubIndices[i]) { 469 gotoNode(o,i,root,hash,relpath) 470 } else { 471 getScript(relpath+'navtreeindex'+i,function(){ 472 navTreeSubIndices[i] = eval('NAVTREEINDEX'+i); 473 if (navTreeSubIndices[i]) { 474 gotoNode(o,i,root,hash,relpath); 475 } 476 },true); 477 } 478 } 479 480 function showSyncOff(n,relpath) 481 { 482 } 483 484 function showSyncOn(n,relpath) 485 { 486 } 487 488 function toggleSyncButton(relpath) 489 { 490 var navSync = $('#nav-sync'); 491 if (navSync.hasClass('sync')) { 492 navSync.removeClass('sync'); 493 showSyncOff(navSync,relpath); 494 storeLink(stripPath2($(location).attr('pathname'))+$(location).attr('hash')); 495 } else { 496 navSync.addClass('sync'); 497 showSyncOn(navSync,relpath); 498 deleteLink(); 499 } 500 } 501 502 function initNavTree(toroot,relpath) 503 { 504 var o = new Object(); 505 o.toroot = toroot; 506 o.node = new Object(); 507 o.node.li = document.getElementById("nav-tree-contents"); 508 o.node.childrenData = NAVTREE; 509 o.node.children = new Array(); 510 o.node.childrenUL = document.createElement("ul"); 511 o.node.getChildrenUL = function() { return o.node.childrenUL; }; 512 o.node.li.appendChild(o.node.childrenUL); 513 o.node.depth = 0; 514 o.node.relpath = relpath; 515 o.node.expanded = false; 516 o.node.isLast = true; 517 o.node.plus_img = document.createElement("img"); 518 o.node.plus_img.src = relpath+"ftv2pnode.png"; 519 o.node.plus_img.width = 16; 520 o.node.plus_img.height = 22; 521 522 if (localStorageSupported()) { 523 var navSync = $('#nav-sync'); 524 if (cachedLink()) { 525 showSyncOff(navSync,relpath); 526 navSync.removeClass('sync'); 527 } else { 528 showSyncOn(navSync,relpath); 529 } 530 navSync.click(function(){ toggleSyncButton(relpath); }); 531 } 532 533 $(window).load(function(){ 534 navTo(o,toroot,window.location.hash,relpath); 535 showRoot(); 536 }); 537 538 $(window).bind('hashchange', function(){ 539 if (window.location.hash && window.location.hash.length>1){ 540 var a; 541 if ($(location).attr('hash')){ 542 var clslink=stripPath($(location).attr('pathname'))+':'+ 543 $(location).attr('hash').substring(1); 544 a=$('.item a[class$="'+clslink+'"]'); 545 } 546 if (a==null || !$(a).parent().parent().hasClass('selected')){ 547 $('.item').removeClass('selected'); 548 $('.item').removeAttr('id'); 549 } 550 var link=stripPath2($(location).attr('pathname')); 551 navTo(o,link,$(location).attr('hash'),relpath); 552 } else if (!animationInProgress) { 553 $('#doc-content').scrollTop(0); 554 $('.item').removeClass('selected'); 555 $('.item').removeAttr('id'); 556 navTo(o,toroot,window.location.hash,relpath); 557 } 558 }) 559 } 560