diff options
Diffstat (limited to 'tools/droiddoc')
-rw-r--r-- | tools/droiddoc/src/ClearPage.java | 2 | ||||
-rw-r--r-- | tools/droiddoc/src/DocFile.java | 3 | ||||
-rw-r--r-- | tools/droiddoc/templates-sdk/customization.cs | 49 | ||||
-rw-r--r-- | tools/droiddoc/templates-sdk/header_tabs.cs | 34 | ||||
-rw-r--r-- | tools/droiddoc/templates/assets/android-developer-core.css | 10 | ||||
-rw-r--r-- | tools/droiddoc/templates/assets/android-developer-docs.css | 8 | ||||
-rw-r--r-- | tools/droiddoc/templates/assets/android-developer-docs.js | 47 |
7 files changed, 99 insertions, 54 deletions
diff --git a/tools/droiddoc/src/ClearPage.java b/tools/droiddoc/src/ClearPage.java index 2a8fced..184c8b8 100644 --- a/tools/droiddoc/src/ClearPage.java +++ b/tools/droiddoc/src/ClearPage.java @@ -126,7 +126,7 @@ public class ClearPage OutputStreamWriter stream = null; try { stream = new OutputStreamWriter( - new FileOutputStream(file)); + new FileOutputStream(file), "UTF-8"); String rendered = cs.render(); stream.write(rendered, 0, rendered.length()); } diff --git a/tools/droiddoc/src/DocFile.java b/tools/droiddoc/src/DocFile.java index b71c081..0c3d112 100644 --- a/tools/droiddoc/src/DocFile.java +++ b/tools/droiddoc/src/DocFile.java @@ -33,7 +33,8 @@ public class DocFile try { File f = new File(filename); int length = (int)f.length(); - FileReader reader = new FileReader(f); + FileInputStream is = new FileInputStream(f); + InputStreamReader reader = new InputStreamReader(is, "UTF-8"); char[] buf = new char[length]; int index = 0; int amt; diff --git a/tools/droiddoc/templates-sdk/customization.cs b/tools/droiddoc/templates-sdk/customization.cs index 9ec1f44..ba0e0f6 100644 --- a/tools/droiddoc/templates-sdk/customization.cs +++ b/tools/droiddoc/templates-sdk/customization.cs @@ -11,12 +11,12 @@ def:default_search_box() ?> <table class="gsc-search-box" cellpadding="0" cellspacing="0"><tbody> <tr> <td class="gsc-input"> - <input id="search_autocomplete" class="gsc-input" type="text" size="33" autocomplete="off" + <input id="search_autocomplete" class="gsc-input" type="text" size="33" autocomplete="off" title="search developer docs" name="q" - value="search developer docs" - onFocus="search_focus_changed(this, true)" - onBlur="search_focus_changed(this, false)" - onkeydown="return search_changed(event, true, '<?cs var:toroot?>')" + value="search developer docs" + onFocus="search_focus_changed(this, true)" + onBlur="search_focus_changed(this, false)" + onkeydown="return search_changed(event, true, '<?cs var:toroot?>')" onkeyup="return search_changed(event, false, '<?cs var:toroot?>')" /> <div id="search_filtered_div" class="no-display"> <table id="search_filtered" cellspacing=0> @@ -46,19 +46,29 @@ def:custom_masthead() ?> </div> <div id="headerRight"> <div id="headerLinks"> - <!-- <img src="<?cs var:toroot ?>assets/images/icon_world.jpg" alt="" /> --> + <?cs if:template.showLanguageMenu ?> + <img src="<?cs var:toroot ?>assets/images/icon_world.jpg" alt="" /> <span id="language"> - <select name="language" onChange="changeLangPref(this.value)"> - <option value="en">English</option> - <!-- <option value="ja"></option> --> - </select> - <script type="text/javascript"> - <!-- - loadLangPref(); - //--> - </script> - </span> - <a href="http://www.android.com">Android.com</a> + <select name="language" onChange="changeLangPref(this.value, true)"> + <option value="en">English </option> + <option value="ja">日本語</option> + <?cs # + <option value="de">Deutsch</option> + <option value="es">Español</option> + <option value="fr">Français</option> + <option value="it">Italiano</option> + <option value="zh-CN">中文 (简体)</option> + <option value="zh-TW">中文 (繁體)</option> + ?> + </select> + <script type="text/javascript"> + <!-- + loadLangPref(); + //--> + </script> + </span> + <?cs /if ?> + <a href="http://www.android.com">Android.com</a> </div><?cs call:default_search_box() ?> </div><!-- headerRight --> @@ -151,9 +161,8 @@ def:default_left_nav() ?> if (!isMobile) { $("<a href='#' id='nav-swap' onclick='swapNav();return false;' style='font-size:10px;line-height:9px;margin-left:1em;text-decoration:none;'><span id='tree-link'>Use Tree Navigation</span><span id='panel-link' style='display:none'>Use Panel Navigation</span></a>").appendTo("#side-nav"); chooseDefaultNav(); - if ($("#nav-tree").is(':visible')) { - init_default_navtree("<?cs var:toroot ?>"); - } else { + if ($("#nav-tree").is(':visible')) init_navtree("nav-tree", "<?cs var:toroot ?>", NAVTREE_DATA); + else { addLoadEvent(function() { scrollIntoView("packages-nav"); scrollIntoView("classes-nav"); diff --git a/tools/droiddoc/templates-sdk/header_tabs.cs b/tools/droiddoc/templates-sdk/header_tabs.cs index 12b747e..2fa5945 100644 --- a/tools/droiddoc/templates-sdk/header_tabs.cs +++ b/tools/droiddoc/templates-sdk/header_tabs.cs @@ -9,27 +9,47 @@ <li id="home-link"><a href="<?cs var:toroot ?><?cs if:android.whichdoc != "online" ?>offline.html<?cs else ?>index.html<?cs /if ?>"> <span class="en">Home</span> - <span class="ja"></span> + <span class="de">Startseite</span> + <span class="ja">ホーム</span> + <span class="zh-CN">主页</span> + <span class="zh-TW">首頁</span> </a></li> <li id="sdk-link"><a href="<?cs var:toroot ?>sdk/<?cs var:sdk.current ?>/index.html"> <span class="en">SDK</span> - <span class="ja"></span> </a></li> <li id="guide-link"><a href="<?cs var:toroot ?>guide/index.html" onClick="return loadLast('guide')"> <span class="en">Dev Guide</span> - <span class="ja"></span> + <span class="de">Handbuch</span> + <span class="es">Guía</span> + <span class="fr">Guide</span> + <span class="it">Guida</span> + <span class="ja">開発ガイド</span> + <span class="zh-CN">开发人员指南</span> + <span class="zh-TW">開發指南</span> </a></li> <li id="reference-link"><a href="<?cs var:toroot ?>reference/packages.html" onClick="return loadLast('reference')"> <span class="en">Reference</span> - <span class="ja"></span> + <span class="de">Referenz</span> + <span class="es">Referencia</span> + <span class="fr">Référence</span> + <span class="it">Riferimento</span> + <span class="ja">リファレンス</span> + <span class="zh-CN">参考</span> + <span class="zh-TW">參考資料</span> </a></li> <li><a href="http://android-developers.blogspot.com"> <span class="en">Blog</span> - <span class="ja"></span> + <span class="ja">ブログ</span> + <span class="zh-CN">博客</span> + <span class="zh-TW">網誌</span> </a></li> <li id="community-link"><a href="<?cs var:toroot ?>community/index.html"> <span class="en">Community</span> - <span class="ja"></span> + <span class="es">Comunidad</span> + <span class="fr">Communauté</span> + <span class="ja">コミュニティ</span> + <span class="zh-CN">社区</span> + <span class="zh-TW">社群</span> </a></li> -</ul>
\ No newline at end of file +</ul> diff --git a/tools/droiddoc/templates/assets/android-developer-core.css b/tools/droiddoc/templates/assets/android-developer-core.css index 8a1b9cd..dee006f 100644 --- a/tools/droiddoc/templates/assets/android-developer-core.css +++ b/tools/droiddoc/templates/assets/android-developer-core.css @@ -238,6 +238,10 @@ hr.blue { top:7px; } +#header li a span+span { + display:none; +} + /* TAB HIGHLIGHTING */ .home #home-link a, .publish #publish-link a, @@ -276,8 +280,12 @@ hr.blue { color: #7FA9B5; } +#headerLinks img { + vertical-align:middle; +} + #language { - margin:0 10px; + margin:0 10px 0 4px; } #search { diff --git a/tools/droiddoc/templates/assets/android-developer-docs.css b/tools/droiddoc/templates/assets/android-developer-docs.css index f4aa5ef..cf44b26 100644 --- a/tools/droiddoc/templates/assets/android-developer-docs.css +++ b/tools/droiddoc/templates/assets/android-developer-docs.css @@ -89,6 +89,10 @@ zoom:1; } +#side-nav li a span+span { + display:none; +} + #side-nav li a:hover { text-decoration:underline; } @@ -1130,9 +1134,9 @@ body .ui-resizable-autohide .ui-resizable-handle { display: none; } /* use 'body page-break-inside: avoid; } - #qv, +/* #qv, #qv-wrapper { display:none; } - +*/ } diff --git a/tools/droiddoc/templates/assets/android-developer-docs.js b/tools/droiddoc/templates/assets/android-developer-docs.js index 160e492..964191b 100644 --- a/tools/droiddoc/templates/assets/android-developer-docs.js +++ b/tools/droiddoc/templates/assets/android-developer-docs.js @@ -31,15 +31,6 @@ if ((agent.indexOf("Mobile") != -1) || addLoadEvent(mobileSetup); } -/* loads the lists.js file to the page. -Loading this in the head was slowing page load time */ -addLoadEvent( function() { - var lists = document.createElement("script"); - lists.setAttribute("type","text/javascript"); - lists.setAttribute("src", toRoot+"reference/lists.js"); - $("head").append($(lists)); -} ); - window.onresize = resizeAll; function mobileSetup() { @@ -214,6 +205,19 @@ function resizeAll() { } } +function getBaseUri(uri) { + intlUrl = uri.substring(0,6) == "/intl/"; + if (intlUrl) { + base = uri.substring(uri.indexOf('intl/')+5,uri.length); + base = base.substring(base.indexOf('/')+1, base.length); + //alert("intl, returning base url: /" + base); + return ("/" + base); + } else { + //alert("not intl, returning uri as found."); + return uri; + } +} + function loadLast(cookiePath) { var location = window.location.href; if (location.indexOf("/"+cookiePath+"/") != -1) { @@ -228,7 +232,7 @@ function loadLast(cookiePath) { } $(window).unload(function(){ - var path = location.pathname; + var path = getBaseUri(location.pathname); if (path.indexOf("/reference/") != -1) { writeCookie("lastpage", path, "reference", null); } else if (path.indexOf("/guide/") != -1) { @@ -236,8 +240,6 @@ $(window).unload(function(){ } }); - - function toggle(obj, slide) { var ul = $("ul", obj); var li = ul.parent(); @@ -258,8 +260,6 @@ function toggle(obj, slide) { } } - - function buildToggleLists() { $(".toggle-list").each( function(i) { @@ -291,11 +291,11 @@ function swapNav() { nav_pref = NAV_PREF_PANELS; } else { nav_pref = NAV_PREF_TREE; - init_default_navtree(toRoot); + init_navtree("nav-tree", toRoot, NAVTREE_DATA); } var date = new Date(); date.setTime(date.getTime()+(10*365*24*60*60*1000)); // keep this for 10 years - writeCookie("nav", nav_pref, null, date.toGMTString()); + writeCookie("nav", nav_pref, "reference", date.toGMTString()); $("#nav-panels").toggle(); $("#panel-link").toggle(); @@ -396,12 +396,16 @@ function changeDocLang(lang) { changeNavLang(lang); } -function changeLangPref(lang) { +function changeLangPref(lang, refresh) { var date = new Date(); - date.setTime(date.getTime()+(50*365*24*60*60*1000)); // keep this for 50 years - writeCookie("pref_lang", lang, null, date); - - changeDocLang(lang); + expires = date.toGMTString(date.setTime(date.getTime()+(10*365*24*60*60*1000))); // keep this for 50 years + //alert("expires: " + expires) + writeCookie("pref_lang", lang, null, expires); + //changeDocLang(lang); + if (refresh) { + l = getBaseUri(location.pathname); + window.location = l; + } } function loadLangPref() { @@ -414,4 +418,3 @@ function loadLangPref() { function getLangPref() { return $("#language").find(":selected").attr("value"); } - |