From 24f1d0b9512dfc20bb1814a4e63f976a59f3ad99 Mon Sep 17 00:00:00 2001 From: Maurice Lam Date: Mon, 14 Sep 2015 10:33:48 -0700 Subject: [SuwLib] Add RecyclerView templates Add new "full-support" build variant that includes RecyclerView as one of its dependencies, and add RecyclerView templates to the library. Bug: 24103690 Change-Id: I01a2b7ba3f9ff1d30a9b8aa9061ffe2a42eed968 --- library/Android.mk | 35 ++++++++++ library/build.gradle | 5 +- library/common-eclair-mr1.mk | 26 +++++++- library/common-full-support.mk | 49 ++++++++++++++ .../res/layout/suw_recycler_template_card.xml | 76 +++++++++++++++++++++ .../res/layout/suw_recycler_template_card_wide.xml | 77 ++++++++++++++++++++++ .../res/layout/suw_recycler_template_header.xml | 77 ++++++++++++++++++++++ .../suw_recycler_template_header_collapsed.xml | 64 ++++++++++++++++++ library/full-support/res/values-land/layouts.xml | 24 +++++++ .../res/values-sw600dp-land/layouts.xml | 24 +++++++ .../full-support/res/values-sw600dp/layouts.xml | 24 +++++++ library/full-support/res/values/layouts.xml | 24 +++++++ library/rules.gradle | 15 +++++ library/standalone-rules.gradle | 5 +- tools/gradle/settings.gradle | 3 + 15 files changed, 523 insertions(+), 5 deletions(-) create mode 100644 library/common-full-support.mk create mode 100644 library/full-support/res/layout/suw_recycler_template_card.xml create mode 100644 library/full-support/res/layout/suw_recycler_template_card_wide.xml create mode 100644 library/full-support/res/layout/suw_recycler_template_header.xml create mode 100644 library/full-support/res/layout/suw_recycler_template_header_collapsed.xml create mode 100644 library/full-support/res/values-land/layouts.xml create mode 100644 library/full-support/res/values-sw600dp-land/layouts.xml create mode 100644 library/full-support/res/values-sw600dp/layouts.xml create mode 100644 library/full-support/res/values/layouts.xml diff --git a/library/Android.mk b/library/Android.mk index 0ece411..bcbd0e9 100644 --- a/library/Android.mk +++ b/library/Android.mk @@ -1,3 +1,7 @@ +## +# Build the platform version of setup wizard library. +# + LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) @@ -12,6 +16,10 @@ LOCAL_SRC_FILES := $(call all-java-files-under, main/src platform/src) include $(BUILD_STATIC_JAVA_LIBRARY) +## +# Build eclair-mr1-compat library, which uses AppCompat support library to provide backwards +# compatibility back to SDK v7. +# include $(CLEAR_VARS) @@ -30,3 +38,30 @@ LOCAL_STATIC_JAVA_LIBRARIES := \ android-support-v7-appcompat include $(BUILD_STATIC_JAVA_LIBRARY) + + +## +# Build the full-support library, which includes RecyclerView and any other support libraries as +# they are integrated. +# +include $(CLEAR_VARS) + +LOCAL_AAPT_FLAGS := --auto-add-overlay \ + --extra-packages android.support.v7.appcompat \ + --extra-packages android.support.v7.recyclerview +LOCAL_MANIFEST_FILE := main/AndroidManifest.xml +LOCAL_MODULE := setup-wizard-lib-full-support +LOCAL_RESOURCE_DIR := \ + $(LOCAL_PATH)/main/res \ + $(LOCAL_PATH)/eclair-mr1/res \ + $(LOCAL_PATH)/full-support/res \ + frameworks/support/v7/appcompat/res \ + frameworks/support/v7/recyclerview/res +LOCAL_SDK_VERSION := current +LOCAL_SRC_FILES := $(call all-java-files-under, main/src eclair-mr1/src) +LOCAL_STATIC_JAVA_LIBRARIES := \ + android-support-v4 \ + android-support-v7-appcompat \ + android-support-v7-recyclerview + +include $(BUILD_STATIC_JAVA_LIBRARY) diff --git a/library/build.gradle b/library/build.gradle index b6e97a1..b9a530c 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -26,7 +26,10 @@ ext { // compile deps['project-name'] // } // - deps = ['support-appcompat-v7': project(':support-appcompat-v7')] + deps = [ + 'support-appcompat-v7': project(':support-appcompat-v7'), + 'support-recyclerview-v7': project(':support-recyclerview-v7') + ] } apply from: 'rules.gradle' diff --git a/library/common-eclair-mr1.mk b/library/common-eclair-mr1.mk index 106ebea..e641d16 100644 --- a/library/common-eclair-mr1.mk +++ b/library/common-eclair-mr1.mk @@ -12,10 +12,30 @@ # include frameworks/opt/setupwizard/library/common-eclair-mr1.mk # +# Check that LOCAL_RESOURCE_DIR is defined +ifeq (,$(LOCAL_RESOURCE_DIR)) +$(error LOCAL_RESOURCE_DIR must be defined) +endif + +# Add --auto-add-overlay flag if not present +ifeq (,$(findstring --auto-add-overlay, $(LOCAL_AAPT_FLAGS))) +LOCAL_AAPT_FLAGS += --auto-add-overlay +endif + +# Include setup wizard library, if not already included +ifeq (,$(findstring setup-wizard-lib-eclair-mr1-compat,$(LOCAL_STATIC_JAVA_LIBRARIES))) LOCAL_RESOURCE_DIR += \ $(call my-dir)/main/res \ $(call my-dir)/eclair-mr1/res -LOCAL_AAPT_FLAGS += --auto-add-overlay \ - --extra-packages com.android.setupwizardlib \ - --extra-packages android.support.v7.appcompat +LOCAL_AAPT_FLAGS += --extra-packages com.android.setupwizardlib LOCAL_STATIC_JAVA_LIBRARIES += setup-wizard-lib-eclair-mr1-compat +endif + +## Include transitive dependencies below + +# Include support-v7-appcompat, if not already included +ifeq (,$(findstring android-support-v7-appcompat,$(LOCAL_STATIC_JAVA_LIBRARIES))) +LOCAL_RESOURCE_DIR += frameworks/support/v7/appcompat/res +LOCAL_AAPT_FLAGS += --extra-packages android.support.v7.appcompat +LOCAL_STATIC_JAVA_LIBRARIES += android-support-v7-appcompat +endif diff --git a/library/common-full-support.mk b/library/common-full-support.mk new file mode 100644 index 0000000..9ff82ce --- /dev/null +++ b/library/common-full-support.mk @@ -0,0 +1,49 @@ +# +# Include this make file to build your application against this module. +# +# Make sure to include it after you've set all your desired LOCAL variables. +# Note that you must explicitly set your LOCAL_RESOURCE_DIR before including this file. +# +# For example: +# +# LOCAL_RESOURCE_DIR := \ +# $(LOCAL_PATH)/res +# +# include frameworks/opt/setupwizard/library/common-eclair-mr1.mk +# + +# Check that LOCAL_RESOURCE_DIR is defined +ifeq (,$(LOCAL_RESOURCE_DIR)) +$(error LOCAL_RESOURCE_DIR must be defined) +endif + +# Add --auto-add-overlay flag if not present +ifeq (,$(findstring --auto-add-overlay, $(LOCAL_AAPT_FLAGS))) +LOCAL_AAPT_FLAGS += --auto-add-overlay +endif + +# Include setup wizard library, if not already included +ifeq (,$(findstring setup-wizard-lib-full-support,$(LOCAL_STATIC_JAVA_LIBRARIES))) +LOCAL_RESOURCE_DIR += \ + $(call my-dir)/main/res \ + $(call my-dir)/eclair-mr1/res \ + $(call my-dir)/full-support/res +LOCAL_AAPT_FLAGS += --extra-packages com.android.setupwizardlib +LOCAL_STATIC_JAVA_LIBRARIES += setup-wizard-lib-full-support +endif + +## Include transitive dependencies below + +# Include support-v7-appcompat, if not already included +ifeq (,$(findstring android-support-v7-appcompat,$(LOCAL_STATIC_JAVA_LIBRARIES))) +LOCAL_RESOURCE_DIR += frameworks/support/v7/appcompat/res +LOCAL_AAPT_FLAGS += --extra-packages android.support.v7.appcompat +LOCAL_STATIC_JAVA_LIBRARIES += android-support-v7-appcompat +endif + +# Include support-v7-recyclerview, if not already included +ifeq (,$(findstring android-support-v7-recyclerview,$(LOCAL_STATIC_JAVA_LIBRARIES))) +LOCAL_RESOURCE_DIR += frameworks/support/v7/recyclerview/res +LOCAL_AAPT_FLAGS += --extra-packages android.support.v7.recyclerview +LOCAL_STATIC_JAVA_LIBRARIES += android-support-v7-recyclerview +endif diff --git a/library/full-support/res/layout/suw_recycler_template_card.xml b/library/full-support/res/layout/suw_recycler_template_card.xml new file mode 100644 index 0000000..053abf9 --- /dev/null +++ b/library/full-support/res/layout/suw_recycler_template_card.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/library/full-support/res/layout/suw_recycler_template_card_wide.xml b/library/full-support/res/layout/suw_recycler_template_card_wide.xml new file mode 100644 index 0000000..33897c6 --- /dev/null +++ b/library/full-support/res/layout/suw_recycler_template_card_wide.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/library/full-support/res/layout/suw_recycler_template_header.xml b/library/full-support/res/layout/suw_recycler_template_header.xml new file mode 100644 index 0000000..b46099d --- /dev/null +++ b/library/full-support/res/layout/suw_recycler_template_header.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/library/full-support/res/layout/suw_recycler_template_header_collapsed.xml b/library/full-support/res/layout/suw_recycler_template_header_collapsed.xml new file mode 100644 index 0000000..e92ee1c --- /dev/null +++ b/library/full-support/res/layout/suw_recycler_template_header_collapsed.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/library/full-support/res/values-land/layouts.xml b/library/full-support/res/values-land/layouts.xml new file mode 100644 index 0000000..5bd3ea8 --- /dev/null +++ b/library/full-support/res/values-land/layouts.xml @@ -0,0 +1,24 @@ + + + + + + @layout/suw_recycler_template_header_collapsed + @layout/suw_recycler_template_header_collapsed + + + diff --git a/library/full-support/res/values-sw600dp-land/layouts.xml b/library/full-support/res/values-sw600dp-land/layouts.xml new file mode 100644 index 0000000..3ac3597 --- /dev/null +++ b/library/full-support/res/values-sw600dp-land/layouts.xml @@ -0,0 +1,24 @@ + + + + + + @layout/suw_recycler_template_card_wide + @layout/suw_recycler_template_card_wide + + + diff --git a/library/full-support/res/values-sw600dp/layouts.xml b/library/full-support/res/values-sw600dp/layouts.xml new file mode 100644 index 0000000..0884c8a --- /dev/null +++ b/library/full-support/res/values-sw600dp/layouts.xml @@ -0,0 +1,24 @@ + + + + + + @layout/suw_recycler_template_card + @layout/suw_recycler_template_card + + + diff --git a/library/full-support/res/values/layouts.xml b/library/full-support/res/values/layouts.xml new file mode 100644 index 0000000..ff5cff1 --- /dev/null +++ b/library/full-support/res/values/layouts.xml @@ -0,0 +1,24 @@ + + + + + + @layout/suw_recycler_template_header + @layout/suw_recycler_template_header_collapsed + + + diff --git a/library/rules.gradle b/library/rules.gradle index fad7f50..8021372 100644 --- a/library/rules.gradle +++ b/library/rules.gradle @@ -58,6 +58,16 @@ android { eclairMr1CompatCompile deps['support-appcompat-v7'] } } + + // This build depends on any support library that setup wizard library integrates with, + // including RecyclerView, AppCompat, and possibly Design support library in the future. + fullSupport { + minSdkVersion 7 + dependencies { + fullSupportCompile deps['support-appcompat-v7'] + fullSupportCompile deps['support-recyclerview-v7'] + } + } } platform { @@ -75,6 +85,11 @@ android { res.srcDirs = ['eclair-mr1/res'] } + fullSupport { + java.srcDirs = ['eclair-mr1/src'] + res.srcDirs = ['eclair-mr1/res', 'full-support/res'] + } + androidTest { manifest.srcFile 'test/AndroidManifest.xml' java.srcDirs = ['test/src'] diff --git a/library/standalone-rules.gradle b/library/standalone-rules.gradle index e607902..5a4290a 100644 --- a/library/standalone-rules.gradle +++ b/library/standalone-rules.gradle @@ -25,7 +25,10 @@ ext { // compile deps['project-name'] // } // - deps = ['support-appcompat-v7': 'com.android.support:appcompat-v7:22.2.1'] + deps = [ + 'support-appcompat-v7': 'com.android.support:appcompat-v7:22.2.1', + 'support-recyclerview-v7': 'com.android.support:recyclerview-v7:22.2.1' + ] } apply from: 'rules.gradle' diff --git a/tools/gradle/settings.gradle b/tools/gradle/settings.gradle index abdad8a..8b24c8f 100644 --- a/tools/gradle/settings.gradle +++ b/tools/gradle/settings.gradle @@ -12,3 +12,6 @@ project(':support-v4').projectDir = new File(supportLibsRoot, 'v4') include(':support-appcompat-v7') project(':support-appcompat-v7').projectDir = new File(supportLibsRoot, 'appcompat') + +include(':support-recyclerview-v7') +project(':support-recyclerview-v7').projectDir = new File(supportLibsRoot, 'recyclerview') -- cgit v1.2.3