diff --git a/tools/droiddoc/templates-sdk/customization.cs b/tools/droiddoc/templates-sdk/customization.cs index 6bdb99206..6ae844662 100644 --- a/tools/droiddoc/templates-sdk/customization.cs +++ b/tools/droiddoc/templates-sdk/customization.cs @@ -73,9 +73,10 @@ def:custom_masthead() ?> call:default_search_box() ?>
- - + +
diff --git a/tools/droiddoc/templates/assets/android-developer-core.css b/tools/droiddoc/templates/assets/android-developer-core.css index eb7e10723..954032b7d 100644 --- a/tools/droiddoc/templates/assets/android-developer-core.css +++ b/tools/droiddoc/templates/assets/android-developer-core.css @@ -48,11 +48,12 @@ a:visited code { } input, select, -textarea, option { +textarea, option, label { font-family:inherit; font-size:inherit; padding:0; margin:0; + vertical-align:middle; } option { diff --git a/tools/droiddoc/templates/assets/android-developer-docs.css b/tools/droiddoc/templates/assets/android-developer-docs.css index e8dc20bbb..d700c0ea3 100644 --- a/tools/droiddoc/templates/assets/android-developer-docs.css +++ b/tools/droiddoc/templates/assets/android-developer-docs.css @@ -341,6 +341,9 @@ links to summary tables) */ #api-level-toggle { padding:0 10px; font-size:11px; +} + +#api-level-toggle label.disabled { color:#999; } diff --git a/tools/droiddoc/templates/assets/android-developer-docs.js b/tools/droiddoc/templates/assets/android-developer-docs.js index 5f472f66a..db5e64fc8 100644 --- a/tools/droiddoc/templates/assets/android-developer-docs.js +++ b/tools/droiddoc/templates/assets/android-developer-docs.js @@ -99,7 +99,7 @@ function readCookie(cookie) { } function writeCookie(cookie, val, section, expiration) { - if (!val) return; + if (val==undefined) return; section = section == null ? "_" : "_"+section+"_"; if (expiration == null) { var date = new Date(); diff --git a/tools/droiddoc/templates/assets/android-developer-reference.js b/tools/droiddoc/templates/assets/android-developer-reference.js index 3080760f1..b96e1366c 100644 --- a/tools/droiddoc/templates/assets/android-developer-reference.js +++ b/tools/droiddoc/templates/assets/android-developer-reference.js @@ -1,48 +1,77 @@ /* API LEVEL TOGGLE */ addLoadEvent(changeApiLevel); + +var API_LEVEL_ENABLED_COOKIE = "api_level_enabled"; var API_LEVEL_COOKIE = "api_level"; var minLevel = 1; -function buildApiLevelToggle() { - var maxLevel = SINCE_DATA.length; - var userApiLevel = readCookie(API_LEVEL_COOKIE); - - if (userApiLevel != 0) { - selectedLevel = userApiLevel; - } else { - selectedLevel = maxLevel; - } +function toggleApiLevelSelector(checkbox) { + var date = new Date(); + date.setTime(date.getTime()+(10*365*24*60*60*1000)); // keep this for 10 years + var expiration = date.toGMTString(); + if (checkbox.checked) { + $("#apiLevelSelector").removeAttr("disabled"); + $("#api-level-toggle label").removeClass("disabled"); + writeCookie(API_LEVEL_ENABLED_COOKIE, 1, null, expiration); + } else { + $("#apiLevelSelector").attr("disabled","disabled"); + $("#api-level-toggle label").addClass("disabled"); + writeCookie(API_LEVEL_ENABLED_COOKIE, 0, null, expiration); + } + changeApiLevel(); +} + +function buildApiLevelSelector() { + var maxLevel = SINCE_DATA.length; + var userApiLevelEnabled = readCookie(API_LEVEL_ENABLED_COOKIE); + var userApiLevel = readCookie(API_LEVEL_COOKIE); + + if (userApiLevelEnabled == 0) { + $("#apiLevelSelector").attr("disabled","disabled"); + } else { + $("#apiLevelCheckbox").attr("checked","checked"); + $("#api-level-toggle label").removeClass("disabled"); + } minLevel = $("body").attr("class"); - var select = $("#apiLevelControl").html("").change(changeApiLevel); - for (var i = maxLevel-1; i >= 0; i--) { - var option = $("