Merge "Revert "remove renderscript support lib from javadocs" ... put support lib javadocs for renderscript back in." into jb-mr2-ub-dev
diff --git a/core/Makefile b/core/Makefile
index 55ab6a5..299fbf8 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1391,6 +1391,27 @@
endif # EMMA_INSTRUMENT=true
+#------------------------------------------------------------------
+# A zip of Proguard obfuscation dictionary files.
+# Only for apps_only build.
+#
+ifdef TARGET_BUILD_APPS
+PROGUARD_DICT_ZIP := $(PRODUCT_OUT)/$(TARGET_PRODUCT)-proguard-dict-$(FILE_NAME_TAG).zip
+# the dependency will be set up later in build/core/main.mk.
+$(PROGUARD_DICT_ZIP) :
+ @echo "Packaging Proguard obfuscation dictionary files."
+ $(hide) dict_files=`find $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS -name proguard_dictionary`; \
+ if [ -n "$$dict_files" ]; then \
+ zip -q $@ $$dict_files; \
+ else \
+ touch $(dir $@)/dummy; \
+ (cd $(dir $@) && zip -q $(notdir $@) dummy); \
+ zip -qd $@ dummy; \
+ rm $(dir $@)/dummy; \
+ fi
+
+endif # TARGET_BUILD_APPS
+
# -----------------------------------------------------------------
# dalvik something
.PHONY: dalvikfiles
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 188c352..9415731 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -387,19 +387,20 @@
ifeq ($(LOCAL_BUILD_HOST_DEX),true)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,core-hostdex,$(LOCAL_IS_HOST_MODULE))
-full_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
+full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
else
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH :=
-full_java_libs := $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/,$(addsuffix $(COMMON_JAVA_PACKAGE_SUFFIX),$(LOCAL_JAVA_LIBRARIES)))
-full_java_lib_deps := $(full_java_libs)
+full_shared_java_libs := $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/,\
+ $(addsuffix $(COMMON_JAVA_PACKAGE_SUFFIX),$(LOCAL_JAVA_LIBRARIES)))
+full_java_lib_deps := $(full_shared_java_libs)
endif # LOCAL_BUILD_HOST_DEX
else
-full_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
+full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
endif # !LOCAL_IS_HOST_MODULE
-full_java_libs += $(full_static_java_libs) $(LOCAL_CLASSPATH)
+full_java_libs := $(full_shared_java_libs) $(full_static_java_libs) $(LOCAL_CLASSPATH)
full_java_lib_deps += $(full_static_java_libs) $(LOCAL_CLASSPATH)
# This is set by packages that are linking to other packages that export
@@ -412,6 +413,7 @@
APPS,$(lib),,COMMON)/classes.jar)
# link against the jar with full original names (before proguard processing).
+ full_shared_java_libs += $(link_apk_libraries)
full_java_libs += $(link_apk_libraries)
full_java_lib_deps += $(link_apk_libraries)
endif
@@ -426,14 +428,12 @@
$(LOCAL_PATH): Multiple LOCAL_INSTRUMENTATION_FOR members defined)
endif
- link_instr_intermediates_dir := $(call intermediates-dir-for, \
- APPS,$(LOCAL_INSTRUMENTATION_FOR))
link_instr_intermediates_dir.COMMON := $(call intermediates-dir-for, \
APPS,$(LOCAL_INSTRUMENTATION_FOR),,COMMON)
-
# link against the jar with full original names (before proguard processing).
- full_java_libs += $(link_instr_intermediates_dir.COMMON)/classes.jar
- full_java_lib_deps += $(link_instr_intermediates_dir.COMMON)/classes.jar
+ link_instr_classes_jar := $(link_instr_intermediates_dir.COMMON)/classes.jar
+ full_java_libs += $(link_instr_classes_jar)
+ full_java_lib_deps += $(link_instr_classes_jar)
endif
jar_manifest_file :=
@@ -444,7 +444,7 @@
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAR_MANIFEST :=
endif
-endif
+endif # PRIVATE java vars
###########################################################
diff --git a/core/binary.mk b/core/binary.mk
index 10d4927..e695567 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -141,21 +141,17 @@
ifdef LOCAL_SDK_VERSION
my_target_project_includes :=
my_target_c_includes := $(my_ndk_stl_include_path) $(my_ndk_version_root)/usr/include
-
-# filter out including of AndroidConfig.h in system/core.
-TARGET_GLOBAL_CFLAGS_NO_ANDCONF ?= $(subst $(TARGET_ANDROID_CONFIG_CFLAGS),,\
- $(TARGET_GLOBAL_CFLAGS))
-my_target_global_cflags := $(TARGET_GLOBAL_CFLAGS_NO_ANDCONF)
else
my_target_project_includes := $(TARGET_PROJECT_INCLUDES)
my_target_c_includes := $(TARGET_C_INCLUDES)
-ifeq ($(strip $(LOCAL_CLANG)),true)
-my_target_c_includes += $(CLANG_CONFIG_EXTRA_TARGET_C_INCLUDES)
+endif # LOCAL_SDK_VERSION
+
+ifeq ($(LOCAL_CLANG),true)
my_target_global_cflags := $(TARGET_GLOBAL_CLANG_FLAGS)
+my_target_c_includes += $(CLANG_CONFIG_EXTRA_TARGET_C_INCLUDES)
else
my_target_global_cflags := $(TARGET_GLOBAL_CFLAGS)
endif # LOCAL_CLANG
-endif # LOCAL_SDK_VERSION
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_PROJECT_INCLUDES := $(my_target_project_includes)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_C_INCLUDES := $(my_target_c_includes)
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 8d84814..90a99ac 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -102,7 +102,7 @@
LOCAL_SDK_RES_VERSION:=
LOCAL_NDK_STL_VARIANT:=
LOCAL_EMMA_INSTRUMENT:=
-LOCAL_PROGUARD_ENABLED:= # '',full,custom,nosystem,disabled
+LOCAL_PROGUARD_ENABLED:= # '',full,custom,nosystem,disabled,obfuscation,optimization
LOCAL_PROGUARD_FLAGS:=
LOCAL_PROGUARD_FLAG_FILES:=
LOCAL_EMMA_COVERAGE_FILTER:=
diff --git a/core/combo/TARGET_linux-arm.mk b/core/combo/TARGET_linux-arm.mk
index 371ba96..e3e6841 100644
--- a/core/combo/TARGET_linux-arm.mk
+++ b/core/combo/TARGET_linux-arm.mk
@@ -93,6 +93,8 @@
TARGET_thumb_CFLAGS += -marm -fno-omit-frame-pointer
endif
+android_config_h := $(call select-android-config-h,linux-arm)
+
TARGET_GLOBAL_CFLAGS += \
-msoft-float -fpic -fPIE \
-ffunction-sections \
@@ -103,11 +105,9 @@
-Werror=format-security \
-D_FORTIFY_SOURCE=1 \
-fno-short-enums \
- $(arch_variant_cflags)
-
-android_config_h := $(call select-android-config-h,linux-arm)
-TARGET_ANDROID_CONFIG_CFLAGS := -include $(android_config_h) -I $(dir $(android_config_h))
-TARGET_GLOBAL_CFLAGS += $(TARGET_ANDROID_CONFIG_CFLAGS)
+ $(arch_variant_cflags) \
+ -include $(android_config_h) \
+ -I $(dir $(android_config_h))
# This warning causes dalvik not to build with gcc 4.6+ and -Werror.
# We cannot turn it off blindly since the option is not available
diff --git a/core/combo/TARGET_linux-mips.mk b/core/combo/TARGET_linux-mips.mk
index 83fe657..73ed203 100644
--- a/core/combo/TARGET_linux-mips.mk
+++ b/core/combo/TARGET_linux-mips.mk
@@ -80,6 +80,8 @@
TARGET_mips_CFLAGS += -fno-omit-frame-pointer
endif
+android_config_h := $(call select-android-config-h,linux-mips)
+
TARGET_GLOBAL_CFLAGS += \
$(TARGET_mips_CFLAGS) \
-Ulinux -U__unix -U__unix__ -Umips \
@@ -90,11 +92,9 @@
-Wa,--noexecstack \
-Werror=format-security \
-D_FORTIFY_SOURCE=1 \
- $(arch_variant_cflags)
-
-android_config_h := $(call select-android-config-h,linux-mips)
-TARGET_ANDROID_CONFIG_CFLAGS := -include $(android_config_h) -I $(dir $(android_config_h))
-TARGET_GLOBAL_CFLAGS += $(TARGET_ANDROID_CONFIG_CFLAGS)
+ $(arch_variant_cflags) \
+ -include $(android_config_h) \
+ -I $(dir $(android_config_h))
# This warning causes dalvik not to build with gcc 4.6+ and -Werror.
# We cannot turn it off blindly since the option is not available
diff --git a/core/combo/TARGET_linux-x86.mk b/core/combo/TARGET_linux-x86.mk
index 04531b2..a4abcff 100644
--- a/core/combo/TARGET_linux-x86.mk
+++ b/core/combo/TARGET_linux-x86.mk
@@ -85,6 +85,8 @@
endif
KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH)
+android_config_h := $(call select-android-config-h,target_linux-x86)
+
TARGET_GLOBAL_CFLAGS += \
-O2 \
-Ulinux \
@@ -101,11 +103,9 @@
-fstrict-aliasing \
-funswitch-loops \
-funwind-tables \
- -fstack-protector
-
-android_config_h := $(call select-android-config-h,target_linux-x86)
-TARGET_ANDROID_CONFIG_CFLAGS := -include $(android_config_h) -I $(dir $(android_config_h))
-TARGET_GLOBAL_CFLAGS += $(TARGET_ANDROID_CONFIG_CFLAGS)
+ -fstack-protector \
+ -include $(android_config_h) \
+ -I $(dir $(android_config_h))
# XXX: Not sure this is still needed. Must check with our toolchains.
TARGET_GLOBAL_CPPFLAGS += \
diff --git a/core/definitions.mk b/core/definitions.mk
index 7834baa..43fdc40 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1716,35 +1716,6 @@
endef
###########################################################
-## Obfuscate a jar file
-###########################################################
-
-# PRIVATE_KEEP_FILE is a file containing a list of classes
-# PRIVATE_INTERMEDIATES_DIR is a directory we can use for temporary files
-# The module using this must depend on
-# $(HOST_OUT_JAVA_LIBRARIES)/proguard-4.0.1.jar
-define obfuscate-jar
-@echo "Obfuscate jar: $(notdir $@) ($@)"
-@mkdir -p $(dir $@)
-@rm -f $@
-@mkdir -p $(PRIVATE_INTERMEDIATES_DIR)
-$(hide) sed -e 's/^/-keep class /' < $(PRIVATE_KEEP_FILE) > \
- $(PRIVATE_INTERMEDIATES_DIR)/keep.pro
-$(hide) java -Xmx512M -jar $(HOST_OUT_JAVA_LIBRARIES)/proguard-4.0.1.jar \
- -injars $< \
- -outjars $@ \
- -target 1.5 \
- -dontnote -dontwarn \
- -printmapping $(PRIVATE_INTERMEDIATES_DIR)/out.map \
- -forceprocessing \
- -renamesourcefileattribute SourceFile \
- -keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,*Annotation*,EnclosingMethod \
- -repackageclasses \
- -keepclassmembers "class * { public protected *; }" \
- @$(PRIVATE_INTERMEDIATES_DIR)/keep.pro
-endef
-
-###########################################################
## Commands for copying files
###########################################################
@@ -1887,34 +1858,11 @@
###########################################################
## Commands to call Proguard
###########################################################
-
-# Command to copy the file with acp, if proguard is disabled.
-define proguard-disabled-commands
-@echo Copying: $@
-$(hide) $(ACP) -fp $< $@
-endef
-
-# Command to call Proguard
-# $(1): extra flags for instrumentation.
-define proguard-enabled-commands
-@echo Proguard: $@
-$(hide) $(PROGUARD) -injars $< -outjars $@ $(PRIVATE_PROGUARD_FLAGS) $(1)
-endef
-
-# Figure out the proguard dictionary file of the module that is instrumentationed for.
-define get-instrumentation-proguard-flags
-$(if $(PRIVATE_INSTRUMENTATION_FOR),$(if $(ALL_MODULES.$(PRIVATE_INSTRUMENTATION_FOR).PROGUARD_ENABLED),-applymapping $(call intermediates-dir-for,APPS,$(PRIVATE_INSTRUMENTATION_FOR),,COMMON)/proguard_dictionary))
-endef
-
define transform-jar-to-proguard
-$(eval _instrumentation_proguard_flags:=$(call get-instrumentation-proguard-flags))
-$(eval _enable_proguard:=$(PRIVATE_PROGUARD_ENABLED)$(_instrumentation_proguard_flags))
-$(if $(_enable_proguard),$(call proguard-enabled-commands,$(_instrumentation_proguard_flags)),$(call proguard-disabled-commands))
-$(eval _instrumentation_proguard_flags:=)
-$(eval _enable_proguard:=)
+@echo Proguard: $@
+$(hide) $(PROGUARD) -injars $< -outjars $@ $(PRIVATE_PROGUARD_FLAGS)
endef
-
###########################################################
## Stuff source generated from one-off tools
###########################################################
@@ -1999,6 +1947,7 @@
###########################################################
## Define device-specific radio files
###########################################################
+INSTALLED_RADIOIMAGE_TARGET :=
# Copy a radio image file to the output location, and add it to
# INSTALLED_RADIOIMAGE_TARGET.
diff --git a/core/java.mk b/core/java.mk
index f43bf3b..a2d41ad 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -88,7 +88,6 @@
built_dex_intermediate_leaf := classes-with-local.dex
endif
-LOCAL_PROGUARD_ENABLED:=$(strip $(LOCAL_PROGUARD_ENABLED))
ifeq ($(LOCAL_PROGUARD_ENABLED),disabled)
LOCAL_PROGUARD_ENABLED :=
endif
@@ -386,42 +385,75 @@
$(hide) $(ACP) -fp $< $@
# Run proguard if necessary, otherwise just copy the file.
+ifdef LOCAL_PROGUARD_ENABLED
+ifneq ($(filter-out full custom nosystem obfuscation optimization,$(LOCAL_PROGUARD_ENABLED)),)
+ $(warning while processing: $(LOCAL_MODULE))
+ $(error invalid value for LOCAL_PROGUARD_ENABLED: $(LOCAL_PROGUARD_ENABLED))
+endif
proguard_dictionary := $(intermediates.COMMON)/proguard_dictionary
-# Proguard doesn't like a class in both library and the jar to be processed.
-proguard_full_java_libs := $(filter-out $(full_static_java_libs),$(full_java_libs))
-proguard_flags := $(addprefix -libraryjars ,$(proguard_full_java_libs)) \
+proguard_flags := $(addprefix -libraryjars ,$(full_shared_java_libs)) \
-forceprocessing \
-printmapping $(proguard_dictionary)
-ifneq ($(LOCAL_PROGUARD_ENABLED),nosystem)
+
+ifeq ($(filter nosystem,$(LOCAL_PROGUARD_ENABLED)),)
proguard_flags += -include $(BUILD_SYSTEM)/proguard.flags
ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
proguard_flags += -include $(BUILD_SYSTEM)/proguard.emma.flags
endif
# If this is a test package, add proguard keep flags for tests.
-ifneq ($(strip $(LOCAL_INSTRUMENTATION_FOR)$(filter tests,$(LOCAL_MODULE_TAGS))$(filter android.test.runner,$(LOCAL_JAVA_LIBRARIES))),)
-proguard_flags := $(proguard_flags) -include $(BUILD_SYSTEM)/proguard_tests.flags
+ifneq ($(LOCAL_INSTRUMENTATION_FOR)$(filter tests,$(LOCAL_MODULE_TAGS)),)
+proguard_flags += -include $(BUILD_SYSTEM)/proguard_tests.flags
endif # test package
-else # LOCAL_PROGUARD_ENABLED is nosystem
-proguard_flags += -include $(BUILD_SYSTEM)/proguard_basic_keeps.flags
-endif # LOCAL_PROGUARD_ENABLED is not nosystem
+ifeq ($(filter obfuscation,$(LOCAL_PROGUARD_ENABLED)),)
+# By default no obfuscation
+proguard_flags += -dontobfuscate
+endif # No obfuscation
+ifeq ($(filter optimization,$(LOCAL_PROGUARD_ENABLED)),)
+# By default no optimization
+proguard_flags += -dontoptimize
+endif # No optimization
-ifneq ($(LOCAL_PROGUARD_ENABLED),)
-ifeq ($(filter full custom nosystem, $(LOCAL_PROGUARD_ENABLED)),)
- $(warning while processing: $(LOCAL_MODULE))
- $(error invalid value for LOCAL_PROGUARD_ENABLED: $(LOCAL_PROGUARD_ENABLED))
-endif # not a legal value
-endif # LOCAL_PROGUARD_ENABLED
+ifdef LOCAL_INSTRUMENTATION_FOR
+ifeq ($(filter obfuscation,$(LOCAL_PROGUARD_ENABLED)),)
+# If no obfuscation, link in the instrmented package's classes.jar as a library.
+# link_instr_classes_jar is defined in base_rule.mk
+proguard_flags += -libraryjars $(link_instr_classes_jar)
+else # obfuscation
+# If obfuscation is enabled, the main app must be obfuscated too.
+# We need to run obfuscation using the main app's dictionary,
+# and treat the main app's class.jar as injars instead of libraryjars.
+proguard_flags := -injars $(link_instr_classes_jar) \
+ -outjars $(intermediates.COMMON)/proguard.$(LOCAL_INSTRUMENTATION_FOR).jar \
+ -include $(link_instr_intermediates_dir.COMMON)/proguard_options \
+ -applymapping $(link_instr_intermediates_dir.COMMON)/proguard_dictionary \
+ -verbose \
+ $(proguard_flags)
+
+# Sometimes (test + main app) uses different keep rules from the main app -
+# apply the main app's dictionary anyway.
+proguard_flags += -ignorewarnings
+
+# Make sure we run Proguard on the main app first
+$(full_classes_proguard_jar) : $(link_instr_intermediates_dir.COMMON)/proguard.classes.jar
+
+endif # no obfuscation
+endif # LOCAL_INSTRUMENTATION_FOR
+endif # LOCAL_PROGUARD_ENABLED is not nosystem
proguard_flag_files := $(addprefix $(LOCAL_PATH)/, $(LOCAL_PROGUARD_FLAG_FILES))
LOCAL_PROGUARD_FLAGS += $(addprefix -include , $(proguard_flag_files))
-$(full_classes_proguard_jar): PRIVATE_PROGUARD_ENABLED:=$(LOCAL_PROGUARD_ENABLED)
$(full_classes_proguard_jar): PRIVATE_PROGUARD_FLAGS := $(proguard_flags) $(LOCAL_PROGUARD_FLAGS)
-$(full_classes_proguard_jar): PRIVATE_INSTRUMENTATION_FOR:=$(strip $(LOCAL_INSTRUMENTATION_FOR))
$(full_classes_proguard_jar) : $(full_classes_jar) $(proguard_flag_files) | $(ACP) $(PROGUARD)
$(call transform-jar-to-proguard)
-ALL_MODULES.$(LOCAL_MODULE).PROGUARD_ENABLED:=$(LOCAL_PROGUARD_ENABLED)
+else # LOCAL_PROGUARD_ENABLED not defined
+$(full_classes_proguard_jar) : $(full_classes_jar)
+ @echo Copying: $@
+ $(hide) $(ACP) -fp $< $@
+
+endif # LOCAL_PROGUARD_ENABLED defined
+
# Override PRIVATE_INTERMEDIATES_DIR so that install-dex-debug
# will work even when intermediates != intermediates.COMMON.
diff --git a/core/main.mk b/core/main.mk
index 6a077e4..3af4306 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -547,10 +547,20 @@
$(eval r := $(ALL_MODULES.$(m).REQUIRED)) \
$(if $(r), \
$(eval r := $(call module-installed-files,$(r))) \
- $(eval $(call add-required-deps,$(ALL_MODULES.$(m).INSTALLED),$(r))) \
+ $(eval t_m := $(filter $(TARGET_OUT_ROOT)/%, $(ALL_MODULES.$(m).INSTALLED))) \
+ $(eval h_m := $(filter $(HOST_OUT_ROOT)/%, $(ALL_MODULES.$(m).INSTALLED))) \
+ $(eval t_r := $(filter $(TARGET_OUT_ROOT)/%, $(r))) \
+ $(eval h_r := $(filter $(HOST_OUT_ROOT)/%, $(r))) \
+ $(if $(t_m), $(eval $(call add-required-deps, $(t_m),$(t_r)))) \
+ $(if $(h_m), $(eval $(call add-required-deps, $(h_m),$(h_r)))) \
) \
)
+t_m :=
+h_m :=
+t_r :=
+h_r :=
+
# Resolve the dependencies on shared libraries.
$(foreach m,$(TARGET_DEPENDENCIES_ON_SHARED_LIBRARIES), \
$(eval p := $(subst :,$(space),$(m))) \
@@ -809,6 +819,9 @@
$(call dist-for-goals,apps_only, $(EMMA_META_ZIP))
endif
+ $(PROGUARD_DICT_ZIP) : $(apps_only_installed_files)
+ $(call dist-for-goals,apps_only, $(PROGUARD_DICT_ZIP))
+
.PHONY: apps_only
apps_only: $(unbundled_build_modules)
@@ -828,6 +841,10 @@
$(INSTALLED_FACTORY_BUNDLE_TARGET) \
)
+ # Put a copy of the radio/bootloader files in the dist dir.
+ $(foreach f,$(INSTALLED_RADIOIMAGE_TARGET), \
+ $(call dist-for-goals, droidcore, $(f)))
+
ifneq ($(TARGET_BUILD_PDK),true)
$(call dist-for-goals, droidcore, \
$(APPS_ZIP) \
diff --git a/core/proguard.flags b/core/proguard.flags
index 1e3951b..0641627 100644
--- a/core/proguard.flags
+++ b/core/proguard.flags
@@ -1,9 +1,10 @@
+# We have moved -dontobfuscate and -dontoptimize to the makefiles.
# dex does not like code run through proguard optimize and preverify steps.
--dontoptimize
+# -dontoptimize
-dontpreverify
# Don't obfuscate. We only need dead code striping.
--dontobfuscate
+# -dontobfuscate
# Add this flag in your package's own configuration if it's needed.
#-flattenpackagehierarchy
diff --git a/core/proguard_basic_keeps.flags b/core/proguard_basic_keeps.flags
index 0ce81ef..af0e05d 100644
--- a/core/proguard_basic_keeps.flags
+++ b/core/proguard_basic_keeps.flags
@@ -1,7 +1,6 @@
# see http://sourceforge.net/tracker/?func=detail&aid=2787465&group_id=54750&atid=474707
-optimizations !code/simplification/arithmetic
-optimizations !code/simplification/cast
--allowaccessmodification
# To prevent name conflict in incremental obfuscation.
-useuniqueclassmembernames
diff --git a/core/proguard_tests.flags b/core/proguard_tests.flags
index f4063d6..4481a1b 100644
--- a/core/proguard_tests.flags
+++ b/core/proguard_tests.flags
@@ -1,5 +1,9 @@
# Keep everything for tests
--dontshrink -dontobfuscate
+-dontshrink
+
+# But we may want to obfuscate if the main app gets obfuscated.
+# This flag has been moved to the makefiles.
+#-dontobfuscate
#-keep class * extends junit.framework.TestCase {
# public void test*();
diff --git a/target/product/core.mk b/target/product/core.mk
index 0e7aad6..93667fb 100644
--- a/target/product/core.mk
+++ b/target/product/core.mk
@@ -36,7 +36,6 @@
TelephonyProvider \
UserDictionaryProvider \
VpnDialogs \
- abcc \
atrace \
libandroidfw \
libaudiopreprocessing \
diff --git a/target/product/mini.mk b/target/product/mini.mk
index 751b481..67ef4fd 100644
--- a/target/product/mini.mk
+++ b/target/product/mini.mk
@@ -64,7 +64,6 @@
Shell \
TelephonyProvider \
UserDictionaryProvider \
- abcc \
apache-xml \
audio \
bouncycastle \
diff --git a/tools/droiddoc/templates-sdk/assets/css/default.css b/tools/droiddoc/templates-sdk/assets/css/default.css
index 0c12340..0120144 100644
--- a/tools/droiddoc/templates-sdk/assets/css/default.css
+++ b/tools/droiddoc/templates-sdk/assets/css/default.css
@@ -305,6 +305,8 @@
position: absolute;
top: 0;
right: 0; }
+ #nav .nav-section-header.empty {
+ padding:0; }
#nav .nav-section-header.empty:after {
display: none; }
/* nested nav headers */
@@ -338,7 +340,7 @@
width: 34px;
height: 34px; }
#nav li.expanded li ul.tree-list-children {
- padding:0;
+ padding: 0;
}
#nav li.expanded li ul.tree-list-children .tree-list-children {
padding:0 0 0 10px;
@@ -2358,6 +2360,7 @@
#jd-content img.toggle-content-img {
margin:0 5px 5px 0;
}
+
div.toggle-content-toggleme {
padding:0 0 0 15px;
}
@@ -2443,6 +2446,167 @@
background-position: -10px 0;
}
+
+/* --------------------------------------------------------------------------
+Styles for samples project trees and code browsing in resources tab
+*/
+
+#codesample-wrapper {
+ width:1000px;
+ overflow:visible;
+}
+pre#codesample-block {
+ float:left;
+ overflow:visible;
+ background:transparent;
+ border:none;
+}
+pre#codesample-block .code-line:hover {
+ background:#e7e7e7;
+}
+pre#codesample-line-numbers {
+ float:left;
+ width:2em;
+ background:transparent;
+ border:none;
+ border-right:1px solid #ccc;
+ padding-left:0;
+ font-family:monospace;
+ text-align:right;
+ -webkit-touch-callout: none;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: -moz-none;
+ -ms-user-select: none;
+ user-select: none;
+}
+pre#codesample-line-numbers a {
+ color:#999;
+}
+pre#codesample-line-numbers.hidden {
+ display:none;
+}
+pre#codesample-block span.code-line {
+ width:100%;
+ display:inline-block;
+}
+
+.structure-dir {
+background-image:url(../../assets/images/folder.png);
+background-repeat:no-repeat;
+background-position:16px 2px;
+ margin:.25em 0 0 0;
+ padding:0 0 0 0;
+}
+
+.structure-toggleme {
+ margin:0 0 0 3em;
+ padding:0 0 0 0;
+ text-decoration:none;
+}
+
+.structure-java{
+background-image:url(../../assets/images/file-java.png);
+background-repeat:no-repeat;
+background-position:0px 2px;
+ margin:.3em 0 0 0;
+ padding:.3em 0 .3em 22px;
+}
+
+.structure-file {
+background-image:url(../../assets/images/file-generic.png);
+background-repeat:no-repeat;
+background-position:0px 2px;
+ margin:.3em 0 0 0;
+ padding:.3em 0 .3em 22px;
+}
+
+.structure-xml {
+background-image:url(../../assets/images/file-xml.png);
+background-repeat:no-repeat;
+background-position:0px 2px;
+ margin:.3em 0 0 0;
+ padding:.3em 0 .25em 22px;
+}
+
+.structure-img {
+background-image:url(../../assets/images/file-image.png);
+background-repeat:no-repeat;
+background-position:0px 2px;
+ margin:.3em 0 0 0;
+ padding:.3em 0 .25em 22px;
+}
+
+.structure-manifest {
+background-image:url(../../assets/images/file-manifest.png);
+background-repeat:no-repeat;
+ margin:.0 0 0 1.25em;
+ padding:0 0 0 22px;
+ text-decoration:none;
+}
+
+#jd-content .structure-toggle-img {
+ margin:.5em 0 0 0;
+padding-right:2.1em;
+}
+
+.dirInfo {
+ margin-left:2em;
+}
+
+.structure-dir a {
+ text-decoration:none;
+}
+
+.structure-manifest a {
+ text-decoration: none;
+}
+.structure-file a {
+ text-decoration: none;
+}
+
+.sampleEmbed {
+ background-color:rgb(249, 249, 249);
+}
+
+.sampleEmbed ol.lineNumbers {
+ list-style-type: decimal;
+ padding-left:1em;
+}
+
+.sampleEmbed ol.lineNumbers li {
+border-left:1px solid #ddd;
+border-right:1px solid #ddd;
+color:gray;
+background-color:#f7f7f7;
+margin:0 0 0 24px;
+padding: 2px 2px 2px 6px;
+}
+
+.sampleEmbed ol.lineNumbers li:hover {
+background: #efefef;
+}
+
+.samples-nav li a {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+/* --------------------------------------------------------------------------
+Styles for raw formatted line numbers (not used with listformatted version)
+div.sampleLine div.lineNumber {
+ display: inline;
+}
+div.sampleLine div.lineCode {
+ display: inline;
+ padding-left:6px;
+}
+div.sampleLine {
+ padding:0;
+ margin:0;
+}*/
+
/* --------------------------------------------------------------------------
Butterbar
*/
@@ -2489,7 +2653,7 @@
.caption {
margin: 0.5em 0 2em 0;
color: #000;
- font-size: 11.5px;
+ font-size: 11.5px;
}
.nolist {
@@ -2664,6 +2828,10 @@
margin:0 0 20px 20px;
border:1px solid #ddd;
}
+a.notice-developers.wide,
+a.notice-designers.wide {
+ width:278px;
+}
a.notice-developers div,
a.notice-designers div {
min-height:40px;
diff --git a/tools/droiddoc/templates-sdk/assets/images/file-generic.png b/tools/droiddoc/templates-sdk/assets/images/file-generic.png
new file mode 100644
index 0000000..1802457
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/images/file-generic.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/assets/images/file-image.png b/tools/droiddoc/templates-sdk/assets/images/file-image.png
new file mode 100644
index 0000000..d3aec46
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/images/file-image.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/assets/images/file-java.png b/tools/droiddoc/templates-sdk/assets/images/file-java.png
new file mode 100644
index 0000000..ec85e4b
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/images/file-java.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/assets/images/file-manifest.png b/tools/droiddoc/templates-sdk/assets/images/file-manifest.png
new file mode 100644
index 0000000..332d066
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/images/file-manifest.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/assets/images/file-xml.png b/tools/droiddoc/templates-sdk/assets/images/file-xml.png
new file mode 100644
index 0000000..3dd21b6
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/images/file-xml.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/assets/images/folder.png b/tools/droiddoc/templates-sdk/assets/images/folder.png
new file mode 100644
index 0000000..44c6100
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/images/folder.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/assets/js/docs.js b/tools/droiddoc/templates-sdk/assets/js/docs.js
index ba65e44..87cbcd3 100644
--- a/tools/droiddoc/templates-sdk/assets/js/docs.js
+++ b/tools/droiddoc/templates-sdk/assets/js/docs.js
@@ -11,7 +11,7 @@
var basePath = getBaseUri(location.pathname);
var SITE_ROOT = toRoot + basePath.substring(1,basePath.indexOf("/",1));
var GOOGLE_DATA; // combined data for google service apis, used for search suggest
-
+
// Ensure that all ajax getScript() requests allow caching
$.ajaxSetup({
cache: true
@@ -59,10 +59,10 @@
toggleFullscreen(false);
}
});
-
+
// initialize the divs with custom scrollbars
$('.scroll-pane').jScrollPane( {verticalGutter:0} );
-
+
// add HRs below all H2s (except for a few other h2 variants)
$('h2').not('#qv h2').not('#tb h2').not('.sidebox h2').not('#devdoc-nav h2').not('h2.norule').css({marginBottom:0}).after('<hr/>');
@@ -78,7 +78,7 @@
});
// Set up quicknav
- var quicknav_open = false;
+ var quicknav_open = false;
$("#btn-quicknav").click(function() {
if (quicknav_open) {
$(this).removeClass('active');
@@ -90,20 +90,20 @@
expand();
}
})
-
+
var expand = function() {
$('#header-wrap').addClass('quicknav');
$('#quicknav').stop().show().animate({opacity:'1'});
}
-
+
var collapse = function() {
$('#quicknav').stop().animate({opacity:'0'}, 100, function() {
$(this).hide();
$('#header-wrap').removeClass('quicknav');
});
}
-
-
+
+
//Set up search
$("#search_autocomplete").focus(function() {
$("#search-container").addClass('active');
@@ -127,7 +127,7 @@
}
})
-
+
// prep nav expandos
var pagePath = document.location.pathname;
// account for intl docs by removing the intl/*/ path
@@ -188,6 +188,8 @@
$("#nav-x li.tools a").addClass("selected");
} else if ($("body").hasClass("google")) {
$("#nav-x li.google a").addClass("selected");
+ } else if ($("body").hasClass("samples")) {
+ $("#nav-x li.samples a").addClass("selected");
}
// highlight Distribute tab
@@ -209,7 +211,7 @@
// set up prev links
var $prevLink = [];
var $prevListItem = $selListItem.prev('li');
-
+
var crossBoundaries = ($("body.design").length > 0) || ($("body.guide").length > 0) ? true :
false; // navigate across topic boundaries only in design docs
if ($prevListItem.length) {
@@ -224,10 +226,10 @@
// jump to this section's index page (if it exists)
var $parentListItem = $selListItem.parents('li');
$prevLink = $selListItem.parents('li').find('a');
-
+
// except if cross boundaries aren't allowed, and we're at the top of a section already
// (and there's another parent)
- if (!crossBoundaries && $parentListItem.hasClass('nav-section')
+ if (!crossBoundaries && $parentListItem.hasClass('nav-section')
&& $selListItem.hasClass('nav-section')) {
$prevLink = [];
}
@@ -238,7 +240,7 @@
var startClass = false;
var training = $(".next-class-link").length; // decides whether to provide "next class" link
var isCrossingBoundary = false;
-
+
if ($selListItem.hasClass('nav-section')) {
// we're on an index page, jump to the first topic
$nextLink = $selListItem.find('ul:eq(0)').find('a:eq(0)');
@@ -251,7 +253,7 @@
// then set the landing page "start link" text to be the first doc title
$('.topic-start-link').text($nextLink.text().toUpperCase());
}
-
+
// If the selected page has a description, then it's a class or article homepage
if ($selListItem.find('a[description]').length) {
// this means we're on a class landing page
@@ -273,7 +275,7 @@
if (startClass) {
$('.start-class-link').attr('href', $nextLink.attr('href')).removeClass("hide");
- // if there's no training bar (below the start button),
+ // if there's no training bar (below the start button),
// then we need to add a bottom border to button
if (!$("#tb").length) {
$('.start-class-link').css({'border-bottom':'1px solid #DADADA'});
@@ -283,7 +285,7 @@
$('.next-page-link').attr('href','')
.removeClass("hide").addClass("disabled")
.click(function() { return false; });
-
+
$('.next-class-link').attr('href',$nextLink.attr('href'))
.removeClass("hide").append($nextLink.html());
$('.next-class-link').find('.new').empty();
@@ -298,7 +300,7 @@
} else {
$('.prev-page-link').attr('href', $prevLink.attr('href')).removeClass("hide");
}
- }
+ }
// If this is a training 'article', there should be no prev/next nav
// ... if the grandparent is the "nav" ... and it has no child list items...
@@ -307,16 +309,16 @@
$('.next-page-link,.prev-page-link').attr('href','').addClass("disabled")
.click(function() { return false; });
}
-
+
}
-
-
-
+
+
+
// Set up the course landing pages for Training with class names and descriptions
if ($('body.trainingcourse').length) {
var $classLinks = $selListItem.find('ul li a').not('#nav .nav-section .nav-section ul a');
var $classDescriptions = $classLinks.attr('description');
-
+
var $olClasses = $('<ol class="class-list"></ol>');
var $liClass;
var $imgIcon;
@@ -328,18 +330,20 @@
$liClass = $('<li></li>');
$h2Title = $('<a class="title" href="'+$(this).attr('href')+'"><h2>' + $(this).html()+'</h2><span></span></a>');
$pSummary = $('<p class="description">' + $(this).attr('description') + '</p>');
-
+
$olLessons = $('<ol class="lesson-list"></ol>');
-
+
$lessons = $(this).closest('li').find('ul li a');
-
+
if ($lessons.length) {
- $imgIcon = $('<img src="'+toRoot+'assets/images/resource-tutorial.png" alt=""/>');
+ $imgIcon = $('<img src="'+toRoot+'assets/images/resource-tutorial.png" '
+ + ' width="64" height="64" alt=""/>');
$lessons.each(function(index) {
$olLessons.append('<li><a href="'+$(this).attr('href')+'">' + $(this).html()+'</a></li>');
});
} else {
- $imgIcon = $('<img src="'+toRoot+'assets/images/resource-article.png" alt=""/>');
+ $imgIcon = $('<img src="'+toRoot+'assets/images/resource-article.png" '
+ + ' width="64" height="64" alt=""/>');
$pSummary.addClass('article');
}
@@ -349,36 +353,10 @@
$('.jd-descr').append($olClasses);
}
-
-
-
// Set up expand/collapse behavior
- $('#nav li.nav-section .nav-section-header').click(function() {
- var section = $(this).closest('li.nav-section');
- if (section.hasClass('expanded')) {
- /* hide me */
- // if (section.hasClass('selected') || section.find('li').hasClass('selected')) {
- // /* but not if myself or my descendents are selected */
- // return;
- // }
- section.children('ul').slideUp(250, function() {
- section.closest('li').removeClass('expanded');
- resizeNav();
- });
- } else {
- /* show me */
- // first hide all other siblings
- var $others = $('li.nav-section.expanded', $(this).closest('ul'));
- $others.removeClass('expanded').children('ul').slideUp(250);
-
- // now expand me
- section.closest('li').addClass('expanded');
- section.children('ul').slideDown(250, function() {
- resizeNav();
- });
- }
- });
-
+ initExpandableNavItems("#nav");
+
+
$(".scroll-pane").scroll(function(event) {
event.preventDefault();
return false;
@@ -410,10 +388,10 @@
// from a scrollable div and so there's no need to make adjustments to our layout
return;
}
- var scrollTop = $(window).scrollTop();
+ var scrollTop = $(window).scrollTop();
var headerHeight = $('#header').outerHeight();
var subheaderHeight = $('#nav-x').outerHeight();
- var searchResultHeight = $('#searchResults').is(":visible") ?
+ var searchResultHeight = $('#searchResults').is(":visible") ?
$('#searchResults').outerHeight() : 0;
var totalHeaderHeight = headerHeight + subheaderHeight + searchResultHeight;
// we set the navbar fixed when the scroll position is beyond the height of the site header...
@@ -423,20 +401,20 @@
if ($("#doc-col").height() < $("#side-nav").height()) {
navBarShouldBeFixed = false;
}
-
+
var scrollLeft = $(window).scrollLeft();
// When the sidenav is fixed and user scrolls horizontally, reposition the sidenav to match
if (navBarIsFixed && (scrollLeft != prevScrollLeft)) {
updateSideNavPosition();
prevScrollLeft = scrollLeft;
}
-
- // Don't continue if the header is sufficently far away
+
+ // Don't continue if the header is sufficently far away
// (to avoid intensive resizing that slows scrolling)
if (navBarIsFixed && navBarShouldBeFixed) {
return;
}
-
+
if (navBarIsFixed != navBarShouldBeFixed) {
if (navBarShouldBeFixed) {
// make it fixed
@@ -447,7 +425,7 @@
.prependTo('#body-content');
// add neato "back to top" button
$('#devdoc-nav a.totop').css({'display':'block','width':$("#nav").innerWidth()+'px'});
-
+
// update the sidenaav position for side scrolling
updateSideNavPosition();
} else {
@@ -459,25 +437,18 @@
$('#devdoc-nav a.totop').hide();
}
navBarIsFixed = navBarShouldBeFixed;
- }
-
+ }
+
resizeNav(250); // pass true in order to delay the scrollbar re-initialization for performance
});
-
+
var navBarLeftPos;
if ($('#devdoc-nav').length) {
setNavBarLeftPos();
}
- // Stop expand/collapse behavior when clicking on nav section links (since we're navigating away
- // from the page)
- $('.nav-section-header').find('a:eq(0)').click(function(evt) {
- window.location.href = $(this).attr('href');
- return false;
- });
-
// Set up play-on-hover <video> tags.
$('video.play-on-hover').bind('click', function(){
$(this).get(0).load(); // in case the video isn't seekable
@@ -527,16 +498,16 @@
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
- // Revise the sidenav widths to make room for the scrollbar
+ // Revise the sidenav widths to make room for the scrollbar
// which avoids the visible width from changing each time the bar appears
var $sidenav = $("#side-nav");
var sidenav_width = parseInt($sidenav.innerWidth());
-
+
$("#devdoc-nav #nav").css("width", sidenav_width - 4 + "px"); // 4px is scrollbar width
$(".scroll-pane").removeAttr("tabindex"); // get rid of tabindex added by jscroller
-
+
if ($(".scroll-pane").length > 1) {
// Check if there's a user preference for the panel heights
var cookieHeight = readCookie("reference_height");
@@ -544,7 +515,7 @@
restoreHeight(cookieHeight);
}
}
-
+
resizeNav();
/* init the language selector based on user cookie for lang */
@@ -582,6 +553,40 @@
// END of the onload event
+function initExpandableNavItems(rootTag) {
+ $(rootTag + ' li.nav-section .nav-section-header').click(function() {
+ var section = $(this).closest('li.nav-section');
+ if (section.hasClass('expanded')) {
+ /* hide me and descendants */
+ section.find('ul').slideUp(250, function() {
+ // remove 'expanded' class from my section and any children
+ section.closest('li').removeClass('expanded');
+ $('li.nav-section', section).removeClass('expanded');
+ resizeNav();
+ });
+ } else {
+ /* show me */
+ // first hide all other siblings
+ var $others = $('li.nav-section.expanded', $(this).closest('ul'));
+ $others.removeClass('expanded').children('ul').slideUp(250);
+
+ // now expand me
+ section.closest('li').addClass('expanded');
+ section.children('ul').slideDown(250, function() {
+ resizeNav();
+ });
+ }
+ });
+
+ // Stop expand/collapse behavior when clicking on nav section links
+ // (since we're navigating away from the page)
+ // This selector captures the first instance of <a>, but not those with "#" as the href.
+ $('.nav-section-header').find('a:eq(0)').not('a[href="#"]').click(function(evt) {
+ window.location.href = $(this).attr('href');
+ return false;
+ });
+}
+
function highlightSidenav() {
// select current page in sidenav and header, and set up prev/next links if they exist
var $selNavLink = $('#nav').find('a[href="' + mPagePath + '"]');
@@ -591,7 +596,7 @@
// Find this page's <li> in sidenav and set selected
$selListItem = $selNavLink.closest('li');
$selListItem.addClass('selected');
-
+
// Traverse up the tree and expand all parent nav-sections
$selNavLink.parents('li.nav-section').each(function() {
$(this).addClass('expanded');
@@ -637,13 +642,6 @@
$('#devdoc-nav').css({left: -newLeft});
$('#devdoc-nav .totop').css({left: -(newLeft - parseInt($('#side-nav').css('margin-left')))});
}
-
-
-
-
-
-
-
// TODO: use $(document).ready instead
function addLoadEvent(newfun) {
@@ -668,10 +666,10 @@
}
-addLoadEvent( function() {
+$(document).ready(function() {
$("pre:not(.no-pretty-print)").addClass("prettyprint");
prettyPrint();
-} );
+});
@@ -682,7 +680,7 @@
var $nav = $("#devdoc-nav");
var $window = $(window);
var navHeight;
-
+
// Get the height of entire window and the total header height.
// Then figure out based on scroll position whether the header is visible
var windowHeight = $window.height();
@@ -690,12 +688,12 @@
var headerHeight = $('#header').outerHeight();
var subheaderHeight = $('#nav-x').outerHeight();
var headerVisible = (scrollTop < (headerHeight + subheaderHeight));
-
- // get the height of space between nav and top of window.
+
+ // get the height of space between nav and top of window.
// Could be either margin or top position, depending on whether the nav is fixed.
- var topMargin = (parseInt($nav.css('margin-top')) || parseInt($nav.css('top'))) + 1;
+ var topMargin = (parseInt($nav.css('margin-top')) || parseInt($nav.css('top'))) + 1;
// add 1 for the #side-nav bottom margin
-
+
// Depending on whether the header is visible, set the side nav's height.
if (headerVisible) {
// The sidenav height grows as the header goes off screen
@@ -704,44 +702,44 @@
// Once header is off screen, the nav height is almost full window height
navHeight = windowHeight - topMargin;
}
-
-
-
+
+
+
$scrollPanes = $(".scroll-pane");
if ($scrollPanes.length > 1) {
// subtract the height of the api level widget and nav swapper from the available nav height
navHeight -= ($('#api-nav-header').outerHeight(true) + $('#nav-swap').outerHeight(true));
-
+
$("#swapper").css({height:navHeight + "px"});
if ($("#nav-tree").is(":visible")) {
$("#nav-tree").css({height:navHeight});
}
-
- var classesHeight = navHeight - parseInt($("#resize-packages-nav").css("height")) - 10 + "px";
+
+ var classesHeight = navHeight - parseInt($("#resize-packages-nav").css("height")) - 10 + "px";
//subtract 10px to account for drag bar
-
- // if the window becomes small enough to make the class panel height 0,
+
+ // if the window becomes small enough to make the class panel height 0,
// then the package panel should begin to shrink
if (parseInt(classesHeight) <= 0) {
$("#resize-packages-nav").css({height:navHeight - 10}); //subtract 10px for drag bar
$("#packages-nav").css({height:navHeight - 10});
}
-
+
$("#classes-nav").css({'height':classesHeight, 'margin-top':'10px'});
$("#classes-nav .jspContainer").css({height:classesHeight});
-
-
+
+
} else {
$nav.height(navHeight);
}
-
+
if (delay) {
updateFromResize = true;
delayedReInitScrollbars(delay);
} else {
reInitScrollbars();
}
-
+
}
var updateScrollbars = false;
@@ -760,7 +758,7 @@
updateFromResize = false;
return;
}
-
+
// We're scheduled for an update and the update request came from this method's setTimeout
if (updateScrollbars && !updateFromResize) {
reInitScrollbars();
@@ -778,7 +776,7 @@
var api = $(this).data('jsp');
if (!api) { setTimeout(reInitScrollbars,300); return;}
api.reinitialise( {verticalGutter:0} );
- });
+ });
$(".scroll-pane").removeAttr("tabindex"); // get rid of tabindex added by jscroller
}
@@ -809,7 +807,7 @@
-/** Scroll the jScrollPane to make the currently selected item visible
+/** Scroll the jScrollPane to make the currently selected item visible
This is called when the page finished loading. */
function scrollIntoView(nav) {
var $nav = $("#"+nav);
@@ -818,13 +816,17 @@
if ($nav.is(':visible')) {
var $selected = $(".selected", $nav);
- if ($selected.length == 0) return;
-
- var selectedOffset = $selected.position().top;
- if (selectedOffset + 90 > $nav.height()) { // add 90 so that we scroll up even
- // if the current item is close to the bottom
- api.scrollTo(0, selectedOffset - ($nav.height() / 4), false); // scroll the item into view
- // to be 1/4 of the way from the top
+ if ($selected.length == 0) {
+ // If no selected item found, exit
+ return;
+ }
+ // get the selected item's offset from its container nav by measuring the item's offset
+ // relative to the document then subtract the container nav's offset relative to the document
+ var selectedOffset = $selected.offset().top - $nav.offset().top;
+ if (selectedOffset > $nav.height() * .8) { // multiply nav height by .8 so we move up the item
+ // if it's more than 80% down the nav
+ // scroll the item up by an amount equal to 80% the container nav's height
+ api.scrollTo(0, selectedOffset - ($nav.height() * .8), false);
}
}
}
@@ -873,7 +875,7 @@
date.setTime(date.getTime()+(10*365*24*60*60*1000)); // default expiration is one week
expiration = date.toGMTString();
}
- var cookieValue = cookie_namespace + section + cookie + "=" + val
+ var cookieValue = cookie_namespace + section + cookie + "=" + val
+ "; expires=" + expiration+"; path=/";
document.cookie = cookieValue;
}
@@ -1012,7 +1014,7 @@
$("#panel-link").toggle();
$("#nav-tree").toggle();
$("#tree-link").toggle();
-
+
resizeNav();
// Gross nasty hack to make tree view show up upon first swap by setting height manually
@@ -1020,7 +1022,7 @@
.css({'height':$("#nav-tree .jspContainer .jspPane").height() +'px'});
// Another nasty hack to make the scrollbar appear now that we have height
resizeNav();
-
+
if ($("#nav-tree").is(':visible')) {
scrollIntoView("nav-tree");
} else {
@@ -1075,7 +1077,7 @@
function changeLangPref(lang, submit) {
var date = new Date();
- expires = date.toGMTString(date.setTime(date.getTime()+(10*365*24*60*60*1000)));
+ 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);
@@ -1120,19 +1122,21 @@
/* Used to hide and reveal supplemental content, such as long code samples.
See the companion CSS in android-developer-docs.css */
function toggleContent(obj) {
- var div = $(obj.parentNode.parentNode);
- var toggleMe = $(".toggle-content-toggleme",div);
+ var div = $(obj).closest(".toggle-content");
+ var toggleMe = $(".toggle-content-toggleme:eq(0)",div);
if (div.hasClass("closed")) { // if it's closed, open it
toggleMe.slideDown();
- $(".toggle-content-text", obj).toggle();
+ $(".toggle-content-text:eq(0)", obj).toggle();
div.removeClass("closed").addClass("open");
- $(".toggle-content-img", div).attr("title", "hide").attr("src", toRoot
+ $(".toggle-content-img:eq(0)", div).attr("title", "hide").attr("src", toRoot
+ "assets/images/triangle-opened.png");
} else { // if it's open, close it
toggleMe.slideUp('fast', function() { // Wait until the animation is done before closing arrow
- $(".toggle-content-text", obj).toggle();
+ $(".toggle-content-text:eq(0)", obj).toggle();
div.removeClass("open").addClass("closed");
- $(".toggle-content-img", div).attr("title", "show").attr("src", toRoot
+ div.find(".toggle-content").removeClass("open").addClass("closed")
+ .find(".toggle-content-toggleme").hide();
+ $(".toggle-content-img", div).attr("title", "show").attr("src", toRoot
+ "assets/images/triangle-closed.png");
});
}
@@ -1160,7 +1164,7 @@
-/*
+/*
* Slideshow 1.0
* Used on /index.html and /develop/index.html for carousel
*
@@ -1201,7 +1205,7 @@
(function($) {
$.fn.dacSlideshow = function(o) {
-
+
//Options - see above
o = $.extend({
btnPrev: null,
@@ -1216,8 +1220,8 @@
pagination: true
}, o || {});
-
- //Set up a carousel for each
+
+ //Set up a carousel for each
return this.each(function() {
var running = false;
@@ -1226,7 +1230,7 @@
var div = $(this);
var ul = $("ul", div);
var tLi = $("li", ul);
- var tl = tLi.size();
+ var tl = tLi.size();
var timer = null;
var li = $("li", ul);
@@ -1245,7 +1249,7 @@
ul.css(sizeCss, ulSize+"px").css(animCss, -(curr*liSize));
div.css(sizeCss, divSize+"px");
-
+
//Pagination
if (o.pagination) {
var pagination = $("<div class='pagination'></div>");
@@ -1263,7 +1267,7 @@
div.append(pagination);
}
}
-
+
//Previous button
if(o.btnPrev)
$(o.btnPrev).click(function(e) {
@@ -1288,18 +1292,18 @@
pauseRotateTimer();
}
});
-
+
//Auto rotation
if(o.auto) startRotateTimer();
-
+
function startRotateTimer() {
clearInterval(timer);
timer = setInterval(function() {
if (curr == tl-1) {
go(0);
} else {
- go(curr+o.scroll);
- }
+ go(curr+o.scroll);
+ }
}, o.autoTime);
$(o.btnPause).removeClass('paused');
}
@@ -1337,11 +1341,11 @@
[]
).addClass("disabled");
-
+
var nav_items = $('li', pagination);
nav_items.removeClass('active');
nav_items.eq(to).addClass('active');
-
+
}
if(o.auto) startRotateTimer();
@@ -1363,7 +1367,7 @@
})(jQuery);
-/*
+/*
* dacSlideshow 1.0
* Used on develop/index.html for side-sliding tabs
*
@@ -1402,7 +1406,7 @@
*/
(function($) {
$.fn.dacTabbedList = function(o) {
-
+
//Options - see above
o = $.extend({
speed : 250,
@@ -1410,8 +1414,8 @@
nav_id: null,
frame_id: null
}, o || {});
-
- //Set up a carousel for each
+
+ //Set up a carousel for each
return this.each(function() {
var curr = 0;
@@ -1419,17 +1423,17 @@
var animCss = "margin-left";
var sizeCss = "width";
var div = $(this);
-
+
var nav = $(o.nav_id, div);
var nav_li = $("li", nav);
- var nav_size = nav_li.size();
+ var nav_size = nav_li.size();
var frame = div.find(o.frame_id);
var content_width = $(frame).find('ul').width();
//Buttons
$(nav_li).click(function(e) {
go($(nav_li).index($(this)));
})
-
+
//Go to an item
function go(to) {
if(!running) {
@@ -1442,10 +1446,10 @@
}
);
-
+
nav_li.removeClass('active');
nav_li.eq(to).addClass('active');
-
+
}
return false;
@@ -1652,7 +1656,7 @@
* otherwise invokes search suggestions on key-up event.
* @param e The JS event
* @param kd True if the event is key-down
- * @param toroot A string for the site's root path
+ * @param toroot A string for the site's root path
* @returns True if the event should bubble up
*/
function search_changed(e, kd, toroot)
@@ -1746,7 +1750,7 @@
if ($($("li", $selectedUl)[gSelectedIndex]).hasClass("header")) {
gSelectedIndex++;
}
- // set item selected
+ // set item selected
$('li:nth-child('+(gSelectedIndex+1)+')', $selectedUl).addClass('jd-selected');
return false;
}
@@ -1764,7 +1768,7 @@
if ($($("li", $selectedUl)[gSelectedIndex]).hasClass("header")) {
gSelectedIndex++;
}
- // set item selected
+ // set item selected
$('li:nth-child('+(gSelectedIndex+1)+')', $selectedUl).addClass('jd-selected');
return false;
}
@@ -1995,7 +1999,7 @@
function search_focus_changed(obj, focused)
{
- if (!focused) {
+ if (!focused) {
if(obj.value == ""){
$(".search .close").addClass("hide");
}
@@ -2016,9 +2020,9 @@
$("#searchResults").slideUp();
$(".search .close").addClass("hide");
location.hash = '';
-
+
$("#search_autocomplete").val("").blur();
-
+
// reset the ajax search callback to nothing, so results don't appear unless ENTER
searchControl.setSearchStartingCallback(this, function(control, searcher, query) {});
@@ -2176,10 +2180,10 @@
setTimeout(function() {
// remove any residual page numbers
$('#searchResults .gsc-tabsArea .gsc-cursor-box.gs-bidi-start-align').remove();
- // move the page numbers to the left position; make a clone,
+ // move the page numbers to the left position; make a clone,
// because the element is drawn to the DOM only once
- // and because we're going to remove it (previous line),
- // we need it to be available to move again as the user navigates
+ // and because we're going to remove it (previous line),
+ // we need it to be available to move again as the user navigates
$('#searchResults .gsc-webResult .gsc-cursor-box.gs-bidi-start-align:visible')
.clone().appendTo('#searchResults .gsc-tabsArea');
}, 200);
@@ -2224,10 +2228,10 @@
/* ######################################################## */
/* Initialize some droiddoc stuff, but only if we're in the reference */
-if (location.pathname.indexOf("/reference")) {
- if(!location.pathname.indexOf("/reference-gms/packages.html")
- && !location.pathname.indexOf("/reference-gcm/packages.html")
- && !location.pathname.indexOf("/reference/com/google") == 0) {
+if (location.pathname.indexOf("/reference") == 0) {
+ if(!(location.pathname.indexOf("/reference-gms/packages.html") == 0)
+ && !(location.pathname.indexOf("/reference-gcm/packages.html") == 0)
+ && !(location.pathname.indexOf("/reference/com/google") == 0)) {
$(document).ready(function() {
// init available apis based on user pref
changeApiLevel();
@@ -2241,22 +2245,22 @@
var maxLevel = 1;
/******* SIDENAV DIMENSIONS ************/
-
+
function initSidenavHeightResize() {
// Change the drag bar size to nicely fit the scrollbar positions
var $dragBar = $(".ui-resizable-s");
$dragBar.css({'width': $dragBar.parent().width() - 5 + "px"});
-
- $( "#resize-packages-nav" ).resizable({
+
+ $( "#resize-packages-nav" ).resizable({
containment: "#nav-panels",
handles: "s",
alsoResize: "#packages-nav",
resize: function(event, ui) { resizeNav(); }, /* resize the nav while dragging */
stop: function(event, ui) { saveNavPanels(); } /* once stopped, save the sizes to cookie */
});
-
+
}
-
+
function updateSidenavFixedWidth() {
if (!navBarIsFixed) return;
$('#devdoc-nav').css({
@@ -2264,7 +2268,7 @@
'margin' : $('#side-nav').css('margin')
});
$('#devdoc-nav a.totop').css({'display':'block','width':$("#nav").innerWidth()+'px'});
-
+
initSidenavHeightResize();
}
@@ -2275,7 +2279,7 @@
'margin' : $('#side-nav').css('margin')
});
$('#devdoc-nav .totop').css({'left': 'inherit'});
-
+
initSidenavHeightResize();
}
@@ -2359,7 +2363,7 @@
if (apiLevelNum > selectedLevelNum) {
obj.addClass("absent").attr("title","Requires API Level \""
+ apiLevel + "\" or higher");
- }
+ }
else obj.removeClass("absent").removeAttr("title");
});
}
@@ -2428,7 +2432,7 @@
node.expanded = false;
}
}
-
+
node.children_ul = null;
node.get_children_ul = function() {
@@ -2456,7 +2460,7 @@
get_node(me, node);
if ($(node.label_div).hasClass("absent")) {
$(node.get_children_ul()).addClass("absent");
- }
+ }
$(node.get_children_ul()).slideDown("fast");
}
node.plus_img.src = me.toroot + "assets/images/triangle-opened-small.png";
@@ -2532,7 +2536,7 @@
init_navtree("tree-list", toroot, NAVTREE_DATA);
}
});
-
+
// perform api level toggling because because the whole tree is new to the DOM
var selectedLevel = $("#apiLevelSelector option:selected").val();
toggleVisisbleApis(selectedLevel, "#side-nav");
@@ -2571,6 +2575,13 @@
}
}
+
+
+
+
+
+
+
/* TODO: eliminate redundancy with non-google functions */
function init_google_navtree(navtree_id, toroot, root_nodes)
{
@@ -2599,8 +2610,8 @@
node.depth = mom.depth + 1;
node.get_children_ul = function() {
if (!node.children_ul) {
- node.children_ul = document.createElement("ul");
- node.children_ul.className = "tree-list-children";
+ node.children_ul = document.createElement("ul");
+ node.children_ul.className = "tree-list-children";
node.li.appendChild(node.children_ul);
}
return node.children_ul;
@@ -2608,8 +2619,8 @@
node.li = document.createElement("li");
mom.get_children_ul().appendChild(node.li);
-
-
+
+
if(link) {
child = document.createElement("a");
@@ -2622,7 +2633,7 @@
if (children_data != null) {
node.li.className="nav-section";
node.label_div = document.createElement("div");
- node.label_div.className = "nav-section-header-ref";
+ node.label_div.className = "nav-section-header-ref";
node.li.appendChild(node.label_div);
get_google_node(me, node);
node.label_div.appendChild(child);
@@ -2656,6 +2667,67 @@
node_data[2], node_data[3]);
}
}
+
+
+
+
+
+
+/****** NEW version of script to build google and sample navs dynamically ******/
+// TODO: update Google reference docs to tolerate this new implementation
+
+function init_google_navtree2(navtree_id, data)
+{
+ var $containerUl = $("#"+navtree_id);
+ var linkText;
+ for (var i in data) {
+ var node_data = data[i];
+ $containerUl.append(new_google_node2(node_data));
+ }
+
+ initExpandableNavItems("#"+navtree_id);
+}
+
+function new_google_node2(node_data)
+{
+ var linkText = node_data[0];
+ if(linkText.match("^"+"com.google.android")=="com.google.android"){
+ linkText = linkText.substr(19, linkText.length);
+ }
+ var $li = $('<li>');
+ var $a;
+ if (node_data[1] != null) {
+ $a = $('<a href="' + toRoot + node_data[1] + '">' + linkText + '</a>');
+ } else {
+ $a = $('<a href="#" onclick="return false;">' + linkText + '/</a>');
+ }
+ var $childUl = $('<ul>');
+ if (node_data[2] != null) {
+ $li.addClass("nav-section");
+ $a = $('<div class="nav-section-header">').append($a);
+ if (node_data[1] == null) $a.addClass('empty');
+
+ for (var i in node_data[2]) {
+ var child_node_data = node_data[2][i];
+ $childUl.append(new_google_node2(child_node_data));
+ }
+ $li.append($childUl);
+ }
+ $li.prepend($a);
+
+ return $li;
+}
+
+
+
+
+
+
+
+
+
+
+
function showGoogleRefTree() {
init_default_google_navtree(toRoot);
init_default_gcm_navtree(toRoot);
@@ -2685,6 +2757,22 @@
});
}
+function showSamplesRefTree() {
+ init_default_samples_navtree(toRoot);
+}
+
+function init_default_samples_navtree(toroot) {
+ // load json file for navtree data
+ $.getScript(toRoot + 'samples_navtree_data.js', function(data, textStatus, jqxhr) {
+ // when the file is loaded, initialize the tree
+ if(jqxhr.status === 200) {
+ init_google_navtree2("nav.samples-nav", SAMPLES_NAVTREE_DATA);
+ highlightSidenav();
+ resizeNav();
+ }
+ });
+}
+
/* TOGGLE INHERITED MEMBERS */
/* Toggle an inherited class (arrow toggle)
@@ -2778,3 +2866,62 @@
ensureAllInheritedExpanded();
}
});
+
+
+
+
+
+
+/* On-demand functions */
+
+/** Move sample code line numbers out of PRE block and into non-copyable column */
+function initCodeLineNumbers() {
+ var numbers = $("#codesample-block a.number");
+ if (numbers.length) {
+ $("#codesample-line-numbers").removeClass("hidden").append(numbers);
+ }
+
+ $(document).ready(function() {
+ // select entire line when clicked
+ $("span.code-line").click(function() {
+ if (!shifted) {
+ selectText(this);
+ }
+ });
+ // invoke line link on double click
+ $(".code-line").dblclick(function() {
+ document.location.hash = $(this).attr('id');
+ });
+ // highlight the line when hovering on the number
+ $("#codesample-line-numbers a.number").mouseover(function() {
+ var id = $(this).attr('href');
+ $(id).css('background','#e7e7e7');
+ });
+ $("#codesample-line-numbers a.number").mouseout(function() {
+ var id = $(this).attr('href');
+ $(id).css('background','none');
+ });
+ });
+}
+
+// create SHIFT key binder to avoid the selectText method when selecting multiple lines
+var shifted = false;
+$(document).bind('keyup keydown', function(e){shifted = e.shiftKey; return true;} );
+
+// courtesy of jasonedelman.com
+function selectText(element) {
+ var doc = document
+ , range, selection
+ ;
+ if (doc.body.createTextRange) { //ms
+ range = doc.body.createTextRange();
+ range.moveToElementText(element);
+ range.select();
+ } else if (window.getSelection) { //all others
+ selection = window.getSelection();
+ range = doc.createRange();
+ range.selectNodeContents(element);
+ selection.removeAllRanges();
+ selection.addRange(range);
+ }
+}
diff --git a/tools/droiddoc/templates-sdk/components/masthead.cs b/tools/droiddoc/templates-sdk/components/masthead.cs
index 4f3273c..f3eb401 100644
--- a/tools/droiddoc/templates-sdk/components/masthead.cs
+++ b/tools/droiddoc/templates-sdk/components/masthead.cs
@@ -188,6 +188,10 @@
</li>
<li><a href="<?cs var:toroot ?>google/index.html">Google Services</a>
</li>
+ <?cs if:android.hasSamples ?>
+ <li><a href="<?cs var:toroot ?>samples/index.html">Samples</a>
+ </li>
+ <?cs /if ?>
</ul>
</li>
<li class="distribute last">
@@ -214,7 +218,7 @@
</div>
- <?cs if:training || guide || reference || tools || develop || google ?>
+ <?cs if:training || guide || reference || tools || develop || google || samples ?>
<!-- Secondary x-nav -->
<div id="nav-x">
<div class="wrap">
@@ -254,6 +258,11 @@
<li class="google"><a href="<?cs var:toroot ?>google/index.html"
>Google Services</a>
</li>
+ <?cs if:android.hasSamples ?>
+ <li class="samples"><a href="<?cs var:toroot ?>samples/index.html"
+ >Samples</a>
+ </li>
+ <?cs /if ?>
</ul>
</div>
diff --git a/tools/droiddoc/templates-sdk/customizations.cs b/tools/droiddoc/templates-sdk/customizations.cs
index 33edbde..985f059 100644
--- a/tools/droiddoc/templates-sdk/customizations.cs
+++ b/tools/droiddoc/templates-sdk/customizations.cs
@@ -135,6 +135,30 @@
<?cs /def ?>
<?cs
+def:samples_nav() ?>
+ <div class="wrap clearfix" id="body-content">
+ <div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
+ <div id="devdoc-nav" class="scroll-pane">
+<a class="totop" href="#top" data-g-event="left-nav-top">to top</a>
+
+<?cs
+ include:"../../../../frameworks/base/docs/html/samples/samples_toc.cs" ?>
+
+
+ </div>
+ <script type="text/javascript">
+ showSamplesRefTree();
+
+ </script>
+ </div> <!-- end side-nav -->
+ <script>
+ $(document).ready(function() {
+ scrollIntoView("devdoc-nav");
+ });
+ </script>
+<?cs /def ?>
+
+<?cs
def:google_nav() ?>
<div class="wrap clearfix" id="body-content">
<div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
@@ -177,28 +201,7 @@
});
</script>
<?cs /def ?>
-<?cs
-def:dist_more_nav() ?>
- <div class="wrap clearfix" id="body-content">
- <div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
- <div id="devdoc-nav" class="scroll-pane">
-<a class="totop" href="#top" data-g-event="left-nav-top">to top</a>
-
-<?cs
- include:"../../../../frameworks/base/docs/html/distribute/more/more_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() ?>
<?cs if:reference.gcm || reference.gms ?>
@@ -322,6 +325,8 @@
call:tools_nav() ?><?cs
elif:google ?><?cs
call:google_nav() ?><?cs
+ elif:samples ?><?cs
+ call:samples_nav() ?><?cs
elif:more ?><?cs
call:dist_more_nav() ?><?cs
elif:distribute ?><?cs
diff --git a/tools/droiddoc/templates-sdk/docpage.cs b/tools/droiddoc/templates-sdk/docpage.cs
index 90e663b..6faac04 100644
--- a/tools/droiddoc/templates-sdk/docpage.cs
+++ b/tools/droiddoc/templates-sdk/docpage.cs
@@ -3,7 +3,7 @@
<html<?cs if:devsite ?> devsite<?cs /if ?>>
<?cs include:"head_tag.cs" ?>
<body class="gc-documentation <?cs if:(google || reference.gms || reference.gcm) ?>google<?cs /if ?>
- <?cs if:(guide||develop||training||reference||tools||sdk) ?>develop<?cs if:guide ?> guide<?cs /if ?><?cs
+ <?cs if:(guide||develop||training||reference||tools||sdk||samples) ?>develop<?cs if:guide ?> guide<?cs /if ?><?cs if:samples ?> samples<?cs /if ?><?cs
elif:about ?>about<?cs
elif:design ?>design<?cs
elif:distribute ?>distribute<?cs
@@ -130,7 +130,7 @@
</div>
<?cs if:!fullscreen ?>
<div class="paging-links layout-content-col col-4">
- <?cs if:(design||training||guide||walkthru) && !page.landing && !page.trainingcourse && !footer.hide ?>
+ <?cs if:(design||training||walkthru) && !page.landing && !page.trainingcourse && !footer.hide ?>
<a href="#" class="prev-page-link hide"
zh-tw-lang="上一堂課"
zh-cn-lang="上一课"
diff --git a/tools/droiddoc/templates-sdk/head_tag.cs b/tools/droiddoc/templates-sdk/head_tag.cs
index 9778389..37f1b37 100644
--- a/tools/droiddoc/templates-sdk/head_tag.cs
+++ b/tools/droiddoc/templates-sdk/head_tag.cs
@@ -2,7 +2,7 @@
<?cs ####### If building devsite, add some meta data needed for when generating the top nav ######### ?>
<?cs
if:devsite ?><?cs
- if:guide||develop||training||reference||tools||sdk||google
+ if:guide||develop||training||reference||tools||sdk||google||samples
?><meta name="top_category" value="develop" /><?cs
elif:google
?><meta name="top_category" value="google" /><?cs
@@ -13,7 +13,8 @@
/if
?><?cs # END if/else devsite ?>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<meta name="viewport" content="width=device-width" />
<?cs if:page.metaDescription ?>
<meta name="Description" content="<?cs var:page.metaDescription ?>">
<?cs /if ?>
diff --git a/tools/droiddoc/templates-sdk/sample.cs b/tools/droiddoc/templates-sdk/sample.cs
new file mode 100644
index 0000000..a8eaf8c
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/sample.cs
@@ -0,0 +1,99 @@
+<?cs include:"doctype.cs" ?>
+<?cs include:"macros.cs" ?>
+<html<?cs if:devsite ?> devsite<?cs /if ?>>
+<?cs include:"head_tag.cs" ?>
+<body class="gc-documentation develop samples" itemscope itemtype="http://schema.org/Article">
+<?cs include:"header.cs" ?>
+
+<div <?cs if:fullpage
+?>class="fullpage"<?cs elif:design||tools||about||sdk||distribute
+?>class="col-13" id="doc-col"<?cs else
+?>class="col-12" id="doc-col"<?cs /if ?> >
+
+<!-- start breadcrumb block -->
+<div id="api-info-block">
+ <div class="sum-details-links">
+
+ <!-- related links -->
+ <a href="<?cs var:toroot ?>samples/<?cs var:projectDir ?>/index.html">Overview</a>
+ | <a href="<?cs var:toroot ?>samples/<?cs var:projectDir ?>/project.html">Project</a>
+ | <a href="<?cs var:toroot ?>downloads/samples/<?cs var:projectDir ?>.zip">Download</a>
+
+ </div><!-- end sum-details-links -->
+ <div class="api-level">
+ Other info
+ </div>
+</div> <!-- end api-info-block -->
+
+<div id="jd-header" style="border:0;">
+
+<div id="pathCrumb">
+<?cs each:item = parentdirs ?>
+ <?cs if:pathCrumbLinks
+ ?><a href="<?cs var:toroot ?><?cs var:item.Link ?>"><?cs var:item.Name ?></a> /
+ <?cs else
+ ?><?cs var:item.Name ?> / <?cs /if ?>
+<?cs /each ?>
+</div>
+
+ <h1 itemprop="name"><?cs var:page.title ?></h1>
+</div>
+<!-- end breadcrumb block -->
+
+
+<?cs # THIS IS THE MAIN DOC CONTENT ?>
+<div id="jd-content">
+
+<?cs if:android.whichdoc == "online" ?>
+
+<?cs # If this is the online docs, build the src code navigation links ?>
+
+
+<?cs var:summary ?>
+
+<!-- begin file contents -->
+<div id="codesample-wrapper">
+<pre id="codesample-line-numbers" class="no-pretty-print hidden"></pre>
+<pre id="codesample-block"><?cs var:fileContents ?></pre>
+</div>
+
+<h3 id="file-location" style="clear:left">Source file location</h3>
+<p>The file containing the source code shown below is located in the corresponding directory in
+<code><sdk>/samples/android-<version>/...</code></p>
+
+
+<!-- end file contents -->
+<script type="text/javascript">
+ initCodeLineNumbers();
+</script>
+
+
+
+
+<?cs else ?><?cs
+ # else, this means it's offline docs,
+ so don't show src links (we dont have the pages!) ?>
+
+<p>You can find the source code for this sample in your SDK at:</p>
+<p style="margin-left:2em">
+<code><em><sdk></em>/samples/android-<em><version></em>/</code>
+</p>
+
+<?cs /if ?><?cs # end if/else online docs ?>
+
+ </div> <!-- end jd-content -->
+
+<?cs include:"footer.cs" ?>
+</div><!-- end doc-content -->
+
+<?cs include:"trailer.cs" ?>
+
+</body>
+</html>
+
+
+
+
+
+
+
diff --git a/tools/droiddoc/templates-sdk/sampleindex.cs b/tools/droiddoc/templates-sdk/sampleindex.cs
index a173363..077b3d5 100644
--- a/tools/droiddoc/templates-sdk/sampleindex.cs
+++ b/tools/droiddoc/templates-sdk/sampleindex.cs
@@ -1,53 +1,99 @@
<?cs include:"doctype.cs" ?>
<?cs include:"macros.cs" ?>
-<?cs set:resources="true" ?>
<html<?cs if:devsite ?> devsite<?cs /if ?>>
<?cs include:"head_tag.cs" ?>
+<body class="gc-documentation develop samples" itemscope itemtype="http://schema.org/Article">
<?cs include:"header.cs" ?>
-<body class="gc-documentation">
+<div <?cs if:fullpage
+?>class="fullpage"<?cs elif:design||tools||about||sdk||distribute
+?>class="col-13" id="doc-col"<?cs else
+?>class="col-12" id="doc-col"<?cs /if ?> >
-<a name="top"></a>
-<div class="g-unit" id="doc-content">
- <div id="jd-header" class="guide-header">
- <span class="crumb">
- <a href="<?cs var:toroot ?>resources/browser.html?tag=sample">Sample Code</a> >
- </span>
- <h1><?cs var:page.title ?></h1>
- </div>
+<!-- start breadcrumb block -->
+<div id="api-info-block">
+<div class="sum-details-links">
+<!-- related links -->
+<?cs if:projectStructure ?>
+<a href="<?cs var:toroot ?>samples/<?cs var:projectDir ?>/index.html">Overview</a>
+| Project<?cs else ?>Overview
+| <a href="<?cs var:toroot ?>samples/<?cs var:projectDir ?>/project.html">Project</a>
+<?cs /if ?>
+| <a href="<?cs var:toroot ?>downloads/samples/<?cs var:projectDir ?>.zip">Download</a>
+
+</div><!-- end sum-details-links -->
+<div class="api-level">
+ Other info
+</div>
+</div><!-- end breadcurmb block -->
+
+<h1 itemprop="name"><?cs var:projectDir ?></h1>
+
<div id="jd-content">
-<p><a href="../index.html">← Back</a></p>
+<?cs def:display_files(files) ?>
-<?cs var:summary ?>
+ <?cs each:file = files ?>
+ <?cs if:file.Type != "dir" ?>
+ <div class="structure-<?cs var:file.Type ?>">
+ <a href="<?cs var:toroot ?><?cs var:file.Href ?>"><?cs var:file.Name ?></a>
+ </div>
+ <?cs else ?>
+ <div class="toggle-content opened structure-dir">
+ <a href="#" onclick="return toggleContent(this)">
+ <img src="<?cs var:toroot ?>assets/images/triangle-opened.png"
+ class="toggle-content-img structure-toggle-img" height="9px" width="9px" />
+ <?cs var:file.Name ?></a><?cs
+ if:file.SummaryFlag == "true" ?><span class="dirInfo"
+ >[ <a href="file.SummaryHref">Info</a> ]</a></span><?cs
+ /if ?>
+ <div class="toggle-content-toggleme structure-toggleme">
+ <?cs if:file.Sub.0.Name ?>
+ <?cs call:display_files(file.Sub) ?>
+ <?cs /if ?>
+ </div> <?cs # /toggleme ?>
+ </div> <?cs # /toggle-content ?>
+ <?cs /if ?>
+ <?cs /each ?>
+<?cs /def ?>
- <?cs if:subcount(subdirs) ?>
- <h2>Subdirectories</h2>
- <ul class="nolist">
- <?cs each:dir=subdirs ?>
- <li><a href="<?cs var:dir.name ?>/index.html"><?cs
- var:dir.name ?>/</a></li>
- <?cs /each ?>
- </ul>
- <?cs /if ?>
+<?cs if:android.whichdoc == "online" ?>
+ <?cs # If this is the online docs, build the src code navigation links ?>
- <?cs if:subcount(files) ?>
- <h2>Files</h2>
- <ul class="nolist">
- <?cs each:file=files ?>
- <li><a href="<?cs var:file.href ?>"><?cs
- var:file.name ?></a></li>
- <?cs /each ?>
- </ul>
- <?cs /if ?>
+ <?cs if:projectStructure ?>
-</div><!-- end jd-content -->
+ <?cs call:display_files(Files) ?>
+
+ <?cs else ?> <?cs # else not project structure doc ?>
+
+ <?cs var:summary ?>
+
+ <?cs # Remove project structure from landing pages for now
+ # <h2>Project Structure</h2>
+ # <p>Decide what to do with this ...</p>
+ # <?cs call:display_files(Files) ?>
+
+ <?cs /if ?> <?cs # end if projectStructure ?>
+
+<?cs else ?><?cs
+ # else, this means it's offline docs,
+ so don't show src links (we dont have the pages!) ?>
+
+<p>You can find the source code for this sample in your SDK at:</p>
+<p style="margin-left:2em">
+<code><em><sdk></em>/samples/android-<em><version></em>/</code>
+</p>
+
+<?cs /if ?><?cs # end if/else online docs ?>
+
+ </div> <!-- end jd-content -->
<?cs include:"footer.cs" ?>
-
</div><!-- end doc-content -->
<?cs include:"trailer.cs" ?>
</body>
</html>
+
+
diff --git a/tools/droiddoc/templates-sdk/samples_navtree_data.cs b/tools/droiddoc/templates-sdk/samples_navtree_data.cs
new file mode 100644
index 0000000..24ac7b7
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/samples_navtree_data.cs
@@ -0,0 +1,3 @@
+var SAMPLES_NAVTREE_DATA =
+<?cs var:reference_tree ?>
+;
diff --git a/tools/droiddoc/templates-sdk/sdkpage.cs b/tools/droiddoc/templates-sdk/sdkpage.cs
index 3ebf697..ecc26f5 100644
--- a/tools/droiddoc/templates-sdk/sdkpage.cs
+++ b/tools/droiddoc/templates-sdk/sdkpage.cs
@@ -79,63 +79,112 @@
<tr>
<th>Platform</th>
<th>Package</th>
- <th>Size</th>
+ <th style="white-space:nowrap">Size (Bytes)</th>
<th>MD5 Checksum</th>
</tr>
<tr>
- <td>Windows 32-bit</td>
+ <td rowspan="2" style="white-space:nowrap">Windows 32-bit</td>
<td>
<a onClick="return onDownload(this)"
href="http://dl.google.com/android/ndk/<?cs var:ndk.win32_download ?>"><?cs var:ndk.win32_download ?></a>
</td>
- <td><?cs var:ndk.win32_bytes ?> bytes</td>
+ <td><?cs var:ndk.win32_bytes ?></td>
<td><?cs var:ndk.win32_checksum ?></td>
</tr>
<tr>
- <td>Windows 64-bit</td>
+ <td>
+ <a onClick="return onDownload(this)"
+ href="http://dl.google.com/android/ndk/<?cs var:ndk.win32.legacy_download ?>"><?cs var:ndk.win32.legacy_download ?></a>
+ </td>
+ <td><?cs var:ndk.win32.legacy_bytes ?></td>
+ <td><?cs var:ndk.win32.legacy_checksum ?></td>
+ </tr>
+ <tr>
+ <td rowspan="2" style="white-space:nowrap">Windows 64-bit</td>
<td>
<a onClick="return onDownload(this)"
href="http://dl.google.com/android/ndk/<?cs var:ndk.win64_download ?>"><?cs var:ndk.win64_download ?></a>
</td>
- <td><?cs var:ndk.win64_bytes ?> bytes</td>
+ <td><?cs var:ndk.win64_bytes ?></td>
<td><?cs var:ndk.win64_checksum ?></td>
</tr>
<tr>
- <td>Mac OS X 32-bit</td>
+ <td>
+ <a onClick="return onDownload(this)"
+ href="http://dl.google.com/android/ndk/<?cs var:ndk.win64.legacy_download ?>"><?cs var:ndk.win64.legacy_download ?></a>
+ </td>
+ <td><?cs var:ndk.win64.legacy_bytes ?></td>
+ <td><?cs var:ndk.win64.legacy_checksum ?></td>
+ </tr>
+ <tr>
+ <td rowspan="2" style="white-space:nowrap">Mac OS X 32-bit</td>
<td>
<a onClick="return onDownload(this)"
href="http://dl.google.com/android/ndk/<?cs var:ndk.mac32_download ?>"><?cs var:ndk.mac32_download ?></a>
</td>
- <td><?cs var:ndk.mac32_bytes ?> bytes</td>
+ <td><?cs var:ndk.mac32_bytes ?></td>
<td><?cs var:ndk.mac32_checksum ?></td>
</tr>
<tr>
- <td>Mac OS X 64-bit</td>
+ <td>
+ <a onClick="return onDownload(this)"
+ href="http://dl.google.com/android/ndk/<?cs var:ndk.mac32.legacy_download ?>"><?cs var:ndk.mac32.legacy_download ?></a>
+ </td>
+ <td><?cs var:ndk.mac32.legacy_bytes ?></td>
+ <td><?cs var:ndk.mac32.legacy_checksum ?></td>
+ </tr>
+ <tr>
+ <td rowspan="2" style="white-space:nowrap">Mac OS X 64-bit</td>
<td>
<a onClick="return onDownload(this)"
href="http://dl.google.com/android/ndk/<?cs var:ndk.mac64_download ?>"><?cs var:ndk.mac64_download ?></a>
</td>
- <td><?cs var:ndk.mac64_bytes ?> bytes</td>
+ <td><?cs var:ndk.mac64_bytes ?></td>
<td><?cs var:ndk.mac64_checksum ?></td>
</tr>
<tr>
- <td>Linux 32-bit (x86)</td>
+ <td>
+ <a onClick="return onDownload(this)"
+ href="http://dl.google.com/android/ndk/<?cs var:ndk.mac64.legacy_download ?>"><?cs var:ndk.mac64.legacy_download ?></a>
+ </td>
+ <td><?cs var:ndk.mac64.legacy_bytes ?></td>
+ <td><?cs var:ndk.mac64.legacy_checksum ?></td>
+ </tr>
+
+ <tr>
+ <td rowspan="2" style="white-space:nowrap">Linux 32-bit (x86)</td>
<td>
<a onClick="return onDownload(this)"
href="http://dl.google.com/android/ndk/<?cs var:ndk.linux32_download ?>"><?cs var:ndk.linux32_download ?></a>
</td>
- <td><?cs var:ndk.linux32_bytes ?> bytes</td>
+ <td><?cs var:ndk.linux32_bytes ?></td>
<td><?cs var:ndk.linux32_checksum ?></td>
</tr>
<tr>
- <td>Linux 64-bit (x86)</td>
+ <td>
+ <a onClick="return onDownload(this)"
+ href="http://dl.google.com/android/ndk/<?cs var:ndk.linux32.legacy_download ?>"><?cs var:ndk.linux32.legacy_download ?></a>
+ </td>
+ <td><?cs var:ndk.linux32.legacy_bytes ?></td>
+ <td><?cs var:ndk.linux32.legacy_checksum ?></td>
+ </tr>
+ <tr>
+ <td rowspan="2" style="white-space:nowrap">Linux 64-bit (x86)</td>
<td>
<a onClick="return onDownload(this)"
href="http://dl.google.com/android/ndk/<?cs var:ndk.linux64_download ?>"><?cs var:ndk.linux64_download ?></a>
</td>
- <td><?cs var:ndk.linux64_bytes ?> bytes</td>
+ <td><?cs var:ndk.linux64_bytes ?></td>
<td><?cs var:ndk.linux64_checksum ?></td>
</tr>
+ <tr>
+ <td>
+ <a onClick="return onDownload(this)"
+ href="http://dl.google.com/android/ndk/<?cs var:ndk.linux64.legacy_download ?>"><?cs var:ndk.linux64.legacy_download ?></a>
+ </td>
+ <td><?cs var:ndk.linux64.legacy_bytes ?></td>
+ <td><?cs var:ndk.linux64.legacy_checksum ?></td>
+ </tr>
</table>
<?cs ######## HERE IS THE JD DOC CONTENT ######### ?>