Build support libs with AAPT2
Use AAPT2 to build the framework support libraries. Apps built with AAPT2 can more efficiently
link against these libraries by specifying their module name in LOCAL_STATIC_ANDROID_LIBRARIES.
Ex:
LOCAL_STATIC_ANDROID_LIBRARIES := android-support-v7-appcompat android-support-v4
Apps built with AAPT2 do not need to specify --auto-add-overlay or --extra-packages, as these
are automatically added as needed by the build system.
This change will not affect any apps that currently depend on the support libraries.
This is because they import the resources directly.
We use LOCAL_JAR_EXCLUDE_FILES := none only to support javac when building javadoc.
Jack builds are correct because the build system passes in the latest generated R.java
ahead of any previous ones packaged in classes.jack. This means we can dynamically reference
a support lib module, correctly seeing non-final R.java. Then at app package time, we only
include the final R.java generated by the AAPT2 packaging step.
Bug:25958912
Change-Id: I5235b73ac68f2050d089aefc3163901ff80f2d46
diff --git a/annotations/Android.mk b/annotations/Android.mk
index df16cdb..200a6ee 100644
--- a/annotations/Android.mk
+++ b/annotations/Android.mk
@@ -15,8 +15,10 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
+LOCAL_USE_AAPT2 := true
LOCAL_MODULE := android-support-annotations
LOCAL_SDK_VERSION := $(SUPPORT_CURRENT_SDK_VERSION)
LOCAL_SRC_FILES := $(call all-java-files-under,src)
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
LOCAL_JAVA_LANGUAGE_VERSION := 1.7
include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/annotations/AndroidManifest.xml b/annotations/AndroidManifest.xml
new file mode 100644
index 0000000..6f24ecb
--- /dev/null
+++ b/annotations/AndroidManifest.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest package="android.support.annotations" />
diff --git a/design/Android.mk b/design/Android.mk
index c4004f5..12bfbe3 100644
--- a/design/Android.mk
+++ b/design/Android.mk
@@ -14,22 +14,23 @@
LOCAL_PATH := $(call my-dir)
+# Android libraries referenced by this module's resources.
+resource_libs := \
+ android-support-v7-appcompat \
+ android-support-v7-recyclerview
+
# Build the resources using the latest applicable SDK version.
# We do this here because the final static library must be compiled with an older
# SDK version than the resources. The resources library and the R class that it
# contains will not be linked into the final static library.
include $(CLEAR_VARS)
+LOCAL_USE_AAPT2 := true
LOCAL_MODULE := android-support-design-res
LOCAL_SDK_VERSION := $(SUPPORT_CURRENT_SDK_VERSION)
LOCAL_SRC_FILES := $(call all-java-files-under, dummy)
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res \
- frameworks/support/v7/appcompat/res \
- frameworks/support/v7/recyclerview/res
-LOCAL_AAPT_FLAGS := \
- --auto-add-overlay \
- --extra-packages android.support.v7.appcompat \
- --extra-packages android.support.v7.recyclerview \
- --no-version-vectors
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_SHARED_ANDROID_LIBRARIES := $(resource_libs)
+LOCAL_AAPT_FLAGS := --no-version-vectors
LOCAL_JAR_EXCLUDE_FILES := none
LOCAL_JAVA_LANGUAGE_VERSION := 1.7
include $(BUILD_STATIC_JAVA_LIBRARY)
@@ -42,7 +43,8 @@
LOCAL_MODULE := android-support-design-base
LOCAL_SDK_VERSION := 7
LOCAL_SRC_FILES := $(call all-java-files-under, base)
-LOCAL_JAVA_LIBRARIES := android-support-design-res \
+LOCAL_JAVA_LIBRARIES := \
+ android-support-design-res \
android-support-v4 \
android-support-v7-appcompat \
android-support-v7-recyclerview
@@ -57,7 +59,8 @@
LOCAL_SDK_VERSION := 7
LOCAL_SRC_FILES := $(call all-java-files-under, eclair-mr1)
LOCAL_STATIC_JAVA_LIBRARIES := android-support-design-base
-LOCAL_JAVA_LIBRARIES := android-support-design-res \
+LOCAL_JAVA_LIBRARIES := \
+ android-support-design-res \
android-support-v4 \
android-support-v7-appcompat \
android-support-v7-recyclerview
@@ -72,7 +75,8 @@
LOCAL_SDK_VERSION := 11
LOCAL_SRC_FILES := $(call all-java-files-under, honeycomb)
LOCAL_STATIC_JAVA_LIBRARIES := android-support-design-eclair-mr1
-LOCAL_JAVA_LIBRARIES := android-support-design-res \
+LOCAL_JAVA_LIBRARIES := \
+ android-support-design-res \
android-support-v4 \
android-support-v7-appcompat \
android-support-v7-recyclerview
@@ -87,7 +91,8 @@
LOCAL_SDK_VERSION := 12
LOCAL_SRC_FILES := $(call all-java-files-under, honeycomb-mr1)
LOCAL_STATIC_JAVA_LIBRARIES := android-support-design-honeycomb
-LOCAL_JAVA_LIBRARIES := android-support-design-res \
+LOCAL_JAVA_LIBRARIES := \
+ android-support-design-res \
android-support-v4 \
android-support-v7-appcompat \
android-support-v7-recyclerview
@@ -102,7 +107,8 @@
LOCAL_SDK_VERSION := 14
LOCAL_SRC_FILES := $(call all-java-files-under, ics)
LOCAL_STATIC_JAVA_LIBRARIES := android-support-design-honeycomb-mr1
-LOCAL_JAVA_LIBRARIES := android-support-design-res \
+LOCAL_JAVA_LIBRARIES := \
+ android-support-design-res \
android-support-v4 \
android-support-v7-appcompat \
android-support-v7-recyclerview
@@ -117,7 +123,8 @@
LOCAL_SDK_VERSION := 21
LOCAL_SRC_FILES := $(call all-java-files-under, lollipop)
LOCAL_STATIC_JAVA_LIBRARIES := android-support-design-ics
-LOCAL_JAVA_LIBRARIES := android-support-design-res \
+LOCAL_JAVA_LIBRARIES := \
+ android-support-design-res \
android-support-v4 \
android-support-v7-appcompat \
android-support-v7-recyclerview
@@ -127,18 +134,24 @@
support_module_src_files += $(LOCAL_SRC_FILES)
# Here is the final static library that apps can link against.
-# The R class is automatically excluded from the generated library.
-# Applications that use this library must specify LOCAL_RESOURCE_DIR
-# in their makefiles to include the resources in their package.
+# Applications that use this library must specify
+#
+# LOCAL_STATIC_ANDROID_LIBRARIES := \
+# android-support-design \
+# android-support-v7-appcompat \
+# android-support-v7-recyclerview \
+# android-support-v4
+#
+# in their makefiles to include the resources and their dependencies in their package.
include $(CLEAR_VARS)
+LOCAL_USE_AAPT2 := true
LOCAL_MODULE := android-support-design
LOCAL_SDK_VERSION := $(SUPPORT_CURRENT_SDK_VERSION)
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_STATIC_JAVA_LIBRARIES := android-support-design-lollipop
-LOCAL_JAVA_LIBRARIES := android-support-design-res \
- android-support-v4 \
- android-support-v7-appcompat \
- android-support-v7-recyclerview
+LOCAL_STATIC_ANDROID_LIBRARIES := android-support-design-res
+LOCAL_SHARED_ANDROID_LIBRARIES := $(resource_libs) android-support-v4
+LOCAL_JAR_EXCLUDE_FILES := none
LOCAL_JAVA_LANGUAGE_VERSION := 1.7
include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/design/src/android/support/design/internal/NavigationMenuItemView.java b/design/src/android/support/design/internal/NavigationMenuItemView.java
index 0423345..1e2c928 100644
--- a/design/src/android/support/design/internal/NavigationMenuItemView.java
+++ b/design/src/android/support/design/internal/NavigationMenuItemView.java
@@ -108,7 +108,8 @@
private StateListDrawable createDefaultBackground() {
TypedValue value = new TypedValue();
- if (getContext().getTheme().resolveAttribute(R.attr.colorControlHighlight, value, true)) {
+ if (getContext().getTheme().resolveAttribute(
+ android.support.v7.appcompat.R.attr.colorControlHighlight, value, true)) {
StateListDrawable drawable = new StateListDrawable();
drawable.addState(CHECKED_STATE_SET, new ColorDrawable(value.data));
drawable.addState(EMPTY_STATE_SET, new ColorDrawable(Color.TRANSPARENT));
diff --git a/design/src/android/support/design/widget/CollapsingTextHelper.java b/design/src/android/support/design/widget/CollapsingTextHelper.java
index 6f8d51c..4a95a13 100644
--- a/design/src/android/support/design/widget/CollapsingTextHelper.java
+++ b/design/src/android/support/design/widget/CollapsingTextHelper.java
@@ -194,19 +194,26 @@
}
void setCollapsedTextAppearance(int resId) {
- TypedArray a = mView.getContext().obtainStyledAttributes(resId, R.styleable.TextAppearance);
- if (a.hasValue(R.styleable.TextAppearance_android_textColor)) {
+ TypedArray a = mView.getContext().obtainStyledAttributes(resId,
+ android.support.v7.appcompat.R.styleable.TextAppearance);
+ if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor)) {
mCollapsedTextColor = a.getColor(
- R.styleable.TextAppearance_android_textColor, mCollapsedTextColor);
+ android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor,
+ mCollapsedTextColor);
}
- if (a.hasValue(R.styleable.TextAppearance_android_textSize)) {
+ if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textSize)) {
mCollapsedTextSize = a.getDimensionPixelSize(
- R.styleable.TextAppearance_android_textSize, (int) mCollapsedTextSize);
+ android.support.v7.appcompat.R.styleable.TextAppearance_android_textSize,
+ (int) mCollapsedTextSize);
}
- mCollapsedShadowColor = a.getInt(R.styleable.TextAppearance_android_shadowColor, 0);
- mCollapsedShadowDx = a.getFloat(R.styleable.TextAppearance_android_shadowDx, 0);
- mCollapsedShadowDy = a.getFloat(R.styleable.TextAppearance_android_shadowDy, 0);
- mCollapsedShadowRadius = a.getFloat(R.styleable.TextAppearance_android_shadowRadius, 0);
+ mCollapsedShadowColor = a.getInt(
+ android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowColor, 0);
+ mCollapsedShadowDx = a.getFloat(
+ android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowDx, 0);
+ mCollapsedShadowDy = a.getFloat(
+ android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowDy, 0);
+ mCollapsedShadowRadius = a.getFloat(
+ android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowRadius, 0);
a.recycle();
if (Build.VERSION.SDK_INT >= 16) {
@@ -217,19 +224,26 @@
}
void setExpandedTextAppearance(int resId) {
- TypedArray a = mView.getContext().obtainStyledAttributes(resId, R.styleable.TextAppearance);
- if (a.hasValue(R.styleable.TextAppearance_android_textColor)) {
+ TypedArray a = mView.getContext().obtainStyledAttributes(resId,
+ android.support.v7.appcompat.R.styleable.TextAppearance);
+ if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor)) {
mExpandedTextColor = a.getColor(
- R.styleable.TextAppearance_android_textColor, mExpandedTextColor);
+ android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor,
+ mExpandedTextColor);
}
- if (a.hasValue(R.styleable.TextAppearance_android_textSize)) {
+ if (a.hasValue(android.support.v7.appcompat.R.styleable.TextAppearance_android_textSize)) {
mExpandedTextSize = a.getDimensionPixelSize(
- R.styleable.TextAppearance_android_textSize, (int) mExpandedTextSize);
+ android.support.v7.appcompat.R.styleable.TextAppearance_android_textSize,
+ (int) mExpandedTextSize);
}
- mExpandedShadowColor = a.getInt(R.styleable.TextAppearance_android_shadowColor, 0);
- mExpandedShadowDx = a.getFloat(R.styleable.TextAppearance_android_shadowDx, 0);
- mExpandedShadowDy = a.getFloat(R.styleable.TextAppearance_android_shadowDy, 0);
- mExpandedShadowRadius = a.getFloat(R.styleable.TextAppearance_android_shadowRadius, 0);
+ mExpandedShadowColor = a.getInt(
+ android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowColor, 0);
+ mExpandedShadowDx = a.getFloat(
+ android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowDx, 0);
+ mExpandedShadowDy = a.getFloat(
+ android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowDy, 0);
+ mExpandedShadowRadius = a.getFloat(
+ android.support.v7.appcompat.R.styleable.TextAppearance_android_shadowRadius, 0);
a.recycle();
if (Build.VERSION.SDK_INT >= 16) {
diff --git a/design/src/android/support/design/widget/CollapsingToolbarLayout.java b/design/src/android/support/design/widget/CollapsingToolbarLayout.java
index 17fada5..1de2909 100644
--- a/design/src/android/support/design/widget/CollapsingToolbarLayout.java
+++ b/design/src/android/support/design/widget/CollapsingToolbarLayout.java
@@ -179,7 +179,7 @@
mCollapsingTextHelper.setExpandedTextAppearance(
R.style.TextAppearance_Design_CollapsingToolbar_Expanded);
mCollapsingTextHelper.setCollapsedTextAppearance(
- R.style.TextAppearance_AppCompat_Widget_ActionBar_Title);
+ android.support.v7.appcompat.R.style.TextAppearance_AppCompat_Widget_ActionBar_Title);
// Now overlay any custom text appearances
if (a.hasValue(R.styleable.CollapsingToolbarLayout_expandedTitleTextAppearance)) {
diff --git a/design/src/android/support/design/widget/NavigationView.java b/design/src/android/support/design/widget/NavigationView.java
index 696a7e4..05fdedb 100644
--- a/design/src/android/support/design/widget/NavigationView.java
+++ b/design/src/android/support/design/widget/NavigationView.java
@@ -413,7 +413,8 @@
return null;
}
ColorStateList baseColor = getResources().getColorStateList(value.resourceId);
- if (!getContext().getTheme().resolveAttribute(R.attr.colorPrimary, value, true)) {
+ if (!getContext().getTheme().resolveAttribute(
+ android.support.v7.appcompat.R.attr.colorPrimary, value, true)) {
return null;
}
int colorPrimary = value.data;
diff --git a/design/src/android/support/design/widget/TabLayout.java b/design/src/android/support/design/widget/TabLayout.java
index 1059b9a..cf3d1eb 100755
--- a/design/src/android/support/design/widget/TabLayout.java
+++ b/design/src/android/support/design/widget/TabLayout.java
@@ -299,10 +299,12 @@
// Text colors/sizes come from the text appearance first
final TypedArray ta = context.obtainStyledAttributes(mTabTextAppearance,
- R.styleable.TextAppearance);
+ android.support.v7.appcompat.R.styleable.TextAppearance);
try {
- mTabTextSize = ta.getDimensionPixelSize(R.styleable.TextAppearance_android_textSize, 0);
- mTabTextColors = ta.getColorStateList(R.styleable.TextAppearance_android_textColor);
+ mTabTextSize = ta.getDimensionPixelSize(
+ android.support.v7.appcompat.R.styleable.TextAppearance_android_textSize, 0);
+ mTabTextColors = ta.getColorStateList(
+ android.support.v7.appcompat.R.styleable.TextAppearance_android_textColor);
} finally {
ta.recycle();
}
diff --git a/design/src/android/support/design/widget/TextInputLayout.java b/design/src/android/support/design/widget/TextInputLayout.java
index ffd7a83..21c6c53 100644
--- a/design/src/android/support/design/widget/TextInputLayout.java
+++ b/design/src/android/support/design/widget/TextInputLayout.java
@@ -494,7 +494,7 @@
// Probably caused by our theme not extending from Theme.Design*. Instead
// we manually set something appropriate
mErrorView.setTextAppearance(getContext(),
- R.style.TextAppearance_AppCompat_Caption);
+ android.support.v7.appcompat.R.style.TextAppearance_AppCompat_Caption);
mErrorView.setTextColor(ContextCompat.getColor(
getContext(), R.color.design_textinput_error_color_light));
}
@@ -615,7 +615,7 @@
// Probably caused by our theme not extending from Theme.Design*. Instead
// we manually set something appropriate
mCounterView.setTextAppearance(getContext(),
- R.style.TextAppearance_AppCompat_Caption);
+ android.support.v7.appcompat.R.style.TextAppearance_AppCompat_Caption);
mCounterView.setTextColor(ContextCompat.getColor(
getContext(), R.color.design_textinput_error_color_light));
}
diff --git a/design/src/android/support/design/widget/ThemeUtils.java b/design/src/android/support/design/widget/ThemeUtils.java
index 327a44d..ffdc3f4 100644
--- a/design/src/android/support/design/widget/ThemeUtils.java
+++ b/design/src/android/support/design/widget/ThemeUtils.java
@@ -22,7 +22,9 @@
class ThemeUtils {
- private static final int[] APPCOMPAT_CHECK_ATTRS = { R.attr.colorPrimary };
+ private static final int[] APPCOMPAT_CHECK_ATTRS = {
+ android.support.v7.appcompat.R.attr.colorPrimary
+ };
static void checkAppCompatTheme(Context context) {
TypedArray a = context.obtainStyledAttributes(APPCOMPAT_CHECK_ATTRS);
diff --git a/documents-archive/Android.mk b/documents-archive/Android.mk
index 44c9f66..826552c 100644
--- a/documents-archive/Android.mk
+++ b/documents-archive/Android.mk
@@ -15,15 +15,24 @@
LOCAL_PATH := $(call my-dir)
# Here is the final static library that apps can link against.
-# The R class is automatically excluded from the generated library.
-# Applications that use this library must specify LOCAL_RESOURCE_DIR
-# in their makefiles to include the resources in their package.
+# Applications that use this library must specify
+#
+# LOCAL_STATIC_ANDROID_LIBRARIES := \
+# android-support-documents-archive \
+# android-support-v4 \
+# android-support-annotations
+#
+# in their makefiles to include the resources and their dependencies in their package.
include $(CLEAR_VARS)
+LOCAL_USE_AAPT2 := true
LOCAL_MODULE := android-support-documents-archive
LOCAL_SDK_VERSION := $(SUPPORT_CURRENT_SDK_VERSION)
-LOCAL_AIDL_INCLUDES := $LOCAL_PATH/src
+LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/src
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_JAVA_LIBRARIES := android-support-annotations \
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_SHARED_ANDROID_LIBRARIES := \
+ android-support-annotations \
android-support-v4
+LOCAL_JAR_EXCLUDE_FILES := none
LOCAL_JAVA_LANGUAGE_VERSION := 1.7
include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/percent/Android.mk b/percent/Android.mk
index 6e04560..26c5dd4 100644
--- a/percent/Android.mk
+++ b/percent/Android.mk
@@ -14,29 +14,22 @@
LOCAL_PATH := $(call my-dir)
-# Build the resources using the latest applicable SDK version.
-# We do this here because the final static library must be compiled with an older
-# SDK version than the resources. The resources library and the R class that it
-# contains will not be linked into the final static library.
-include $(CLEAR_VARS)
-LOCAL_MODULE := android-support-percent-res
-LOCAL_SDK_VERSION := $(SUPPORT_CURRENT_SDK_VERSION)
-LOCAL_SRC_FILES := $(call all-java-files-under, dummy)
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-LOCAL_JAR_EXCLUDE_FILES := none
-LOCAL_JAVA_LANGUAGE_VERSION := 1.7
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
# Here is the final static library that apps can link against.
-# The R class is automatically excluded from the generated library.
-# Applications that use this library must specify LOCAL_RESOURCE_DIR
-# in their makefiles to include the resources in their package.
+# Applications that use this library must include it with
+#
+# LOCAL_STATIC_ANDROID_LIBRARIES := \
+# android-support-percent \
+# android-support-v4
+#
include $(CLEAR_VARS)
+LOCAL_USE_AAPT2 := true
LOCAL_MODULE := android-support-percent
LOCAL_SDK_VERSION := 8
+LOCAL_SDK_RES_VERSION := $(SUPPORT_CURRENT_SDK_VERSION)
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_JAVA_LIBRARIES := android-support-percent-res \
- android-support-v4
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_SHARED_ANDROID_LIBRARIES := android-support-v4
+LOCAL_JAR_EXCLUDE_FILES := none
LOCAL_JAVA_LANGUAGE_VERSION := 1.7
include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/v14/preference/Android.mk b/v14/preference/Android.mk
index f01c53f..800cac1 100644
--- a/v14/preference/Android.mk
+++ b/v14/preference/Android.mk
@@ -14,40 +14,32 @@
LOCAL_PATH := $(call my-dir)
-# Build the resources using the latest applicable SDK version.
-# We do this here because the final static library must be compiled with an older
-# SDK version than the resources. The resources library and the R class that it
-# contains will not be linked into the final static library.
-include $(CLEAR_VARS)
-LOCAL_MODULE := android-support-v14-preference-res
-LOCAL_SRC_FILES := $(call all-java-files-under, ../../v7/preference/constants)
-LOCAL_SDK_VERSION := $(SUPPORT_CURRENT_SDK_VERSION)
-LOCAL_RESOURCE_DIR := \
- frameworks/support/v7/appcompat/res \
- frameworks/support/v7/preference/res \
- $(LOCAL_PATH)/res
-LOCAL_AAPT_FLAGS := \
- --auto-add-overlay
-LOCAL_JAR_EXCLUDE_FILES := none
-LOCAL_JAVA_LANGUAGE_VERSION := 1.7
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
# Here is the final static library that apps can link against.
-# The R class is automatically excluded from the generated library.
-# Applications that use this library must specify LOCAL_RESOURCE_DIR
+# Applications that use this library must specify
+#
+# LOCAL_STATIC_ANDROID_LIBRARIES := \
+# android-support-v14-preference \
+# android-support-v7-preference \
+# android-support-v7-appcompat \
+# android-support-v7-recyclerview \
+# android-support-v4 \
+# android-support-annotations
+#
# in their makefiles to include the resources in their package.
include $(CLEAR_VARS)
+LOCAL_USE_AAPT2 := true
LOCAL_MODULE := android-support-v14-preference
LOCAL_SDK_VERSION := 14
+LOCAL_SDK_RES_VERSION := $(SUPPORT_CURRENT_SDK_VERSION)
LOCAL_SRC_FILES := $(call all-java-files-under,src)
-# LOCAL_STATIC_JAVA_LIBRARIES :=
-LOCAL_JAVA_LIBRARIES := \
- android-support-v4 \
- android-support-v7-appcompat \
- android-support-v7-recyclerview \
- android-support-v7-preference \
- android-support-annotations \
- android-support-v14-preference-res
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_SHARED_ANDROID_LIBRARIES := \
+ android-support-v7-preference \
+ android-support-v7-appcompat \
+ android-support-v7-recyclerview \
+ android-support-v4 \
+ android-support-annotations
+LOCAL_JAR_EXCLUDE_FILES := none
LOCAL_JAVA_LANGUAGE_VERSION := 1.7
include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/v14/preference/src/android/support/v14/preference/MultiSelectListPreference.java b/v14/preference/src/android/support/v14/preference/MultiSelectListPreference.java
index 8316b0d..1695e92 100644
--- a/v14/preference/src/android/support/v14/preference/MultiSelectListPreference.java
+++ b/v14/preference/src/android/support/v14/preference/MultiSelectListPreference.java
@@ -53,16 +53,16 @@
super(context, attrs, defStyleAttr, defStyleRes);
final TypedArray a = context.obtainStyledAttributes(attrs,
- R.styleable.MultiSelectListPreference, defStyleAttr,
+ android.support.v7.preference.R.styleable.MultiSelectListPreference, defStyleAttr,
defStyleRes);
mEntries = TypedArrayUtils.getTextArray(a,
- R.styleable.MultiSelectListPreference_entries,
- R.styleable.MultiSelectListPreference_android_entries);
+ android.support.v7.preference.R.styleable.MultiSelectListPreference_entries,
+ android.support.v7.preference.R.styleable.MultiSelectListPreference_android_entries);
mEntryValues = TypedArrayUtils.getTextArray(a,
- R.styleable.MultiSelectListPreference_entryValues,
- R.styleable.MultiSelectListPreference_android_entryValues);
+ android.support.v7.preference.R.styleable.MultiSelectListPreference_entryValues,
+ android.support.v7.preference.R.styleable.MultiSelectListPreference_android_entryValues);
a.recycle();
}
@@ -72,7 +72,8 @@
}
public MultiSelectListPreference(Context context, AttributeSet attrs) {
- this(context, attrs, TypedArrayUtils.getAttr(context, R.attr.dialogPreferenceStyle,
+ this(context, attrs, TypedArrayUtils.getAttr(context,
+ android.support.v7.preference.R.attr.dialogPreferenceStyle,
android.R.attr.dialogPreferenceStyle));
}
diff --git a/v14/preference/src/android/support/v14/preference/PreferenceFragment.java b/v14/preference/src/android/support/v14/preference/PreferenceFragment.java
index 52552a6..bf92f89 100644
--- a/v14/preference/src/android/support/v14/preference/PreferenceFragment.java
+++ b/v14/preference/src/android/support/v14/preference/PreferenceFragment.java
@@ -135,7 +135,7 @@
private Context mStyledContext;
- private int mLayoutResId = R.layout.preference_list_fragment;
+ private int mLayoutResId = android.support.v7.preference.R.layout.preference_list_fragment;
private final DividerDecoration mDividerDecoration = new DividerDecoration();
@@ -207,7 +207,8 @@
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final TypedValue tv = new TypedValue();
- getActivity().getTheme().resolveAttribute(R.attr.preferenceTheme, tv, true);
+ getActivity().getTheme().resolveAttribute(
+ android.support.v7.preference.R.attr.preferenceTheme, tv, true);
final int theme = tv.resourceId;
if (theme <= 0) {
throw new IllegalStateException("Must specify preferenceTheme in theme");
@@ -244,7 +245,8 @@
TypedArray a = mStyledContext.obtainStyledAttributes(null,
R.styleable.PreferenceFragment,
- TypedArrayUtils.getAttr(mStyledContext, R.attr.preferenceFragmentStyle,
+ TypedArrayUtils.getAttr(mStyledContext,
+ android.support.v7.preference.R.attr.preferenceFragmentStyle,
AndroidResources.ANDROID_R_PREFERENCE_FRAGMENT_STYLE),
0);
@@ -258,7 +260,8 @@
// Need to theme the inflater to pick up the preferenceFragmentListStyle
final TypedValue tv = new TypedValue();
- getActivity().getTheme().resolveAttribute(R.attr.preferenceTheme, tv, true);
+ getActivity().getTheme().resolveAttribute(
+ android.support.v7.preference.R.attr.preferenceTheme, tv, true);
final int theme = tv.resourceId;
final Context themedContext = new ContextThemeWrapper(inflater.getContext(), theme);
@@ -567,7 +570,8 @@
public RecyclerView onCreateRecyclerView(LayoutInflater inflater, ViewGroup parent,
Bundle savedInstanceState) {
RecyclerView recyclerView = (RecyclerView) inflater
- .inflate(R.layout.preference_recyclerview, parent, false);
+ .inflate(android.support.v7.preference.R.layout.preference_recyclerview,
+ parent, false);
recyclerView.setLayoutManager(onCreateLayoutManager());
diff --git a/v14/preference/src/android/support/v14/preference/SwitchPreference.java b/v14/preference/src/android/support/v14/preference/SwitchPreference.java
index ac2a9c6..6e6b7f8 100644
--- a/v14/preference/src/android/support/v14/preference/SwitchPreference.java
+++ b/v14/preference/src/android/support/v14/preference/SwitchPreference.java
@@ -122,7 +122,8 @@
* @param attrs Style attributes that differ from the default
*/
public SwitchPreference(Context context, AttributeSet attrs) {
- this(context, attrs, TypedArrayUtils.getAttr(context, R.attr.switchPreferenceStyle,
+ this(context, attrs, TypedArrayUtils.getAttr(context,
+ android.support.v7.preference.R.attr.switchPreferenceStyle,
android.R.attr.switchPreferenceStyle));
}
@@ -216,7 +217,7 @@
return;
}
- View switchView = view.findViewById(R.id.switchWidget);
+ View switchView = view.findViewById(android.support.v7.preference.R.id.switchWidget);
syncSwitchView(switchView);
View summaryView = view.findViewById(android.R.id.summary);
diff --git a/v17/leanback/Android.mk b/v17/leanback/Android.mk
index d55ae61..0da668d 100644
--- a/v17/leanback/Android.mk
+++ b/v17/leanback/Android.mk
@@ -19,12 +19,11 @@
# SDK version than the resources. The resources library and the R class that it
# contains will not be linked into the final static library.
include $(CLEAR_VARS)
+LOCAL_USE_AAPT2 := true
LOCAL_MODULE := android-support-v17-leanback-res
LOCAL_SDK_VERSION := $(SUPPORT_CURRENT_SDK_VERSION)
LOCAL_SRC_FILES := $(call all-java-files-under, dummy)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-LOCAL_AAPT_FLAGS := \
- --auto-add-overlay
LOCAL_JAR_EXCLUDE_FILES := none
LOCAL_JAVA_LANGUAGE_VERSION := 1.7
include $(BUILD_STATIC_JAVA_LIBRARY)
@@ -99,20 +98,32 @@
# -----------------------------------------------------------------------
# Here is the final static library that apps can link against.
-# The R class is automatically excluded from the generated library.
-# Applications that use this library must specify LOCAL_RESOURCE_DIR
-# in their makefiles to include the resources in their package.
+# Applications that use this library must specify
+#
+# LOCAL_STATIC_ANDROID_LIBRARIES := \
+# android-support-v17-leanback \
+# android-support-v7-recyclerview \
+# android-support-v4
+#
+# in their makefiles to include the resources and their dependencies in their package.
include $(CLEAR_VARS)
+LOCAL_USE_AAPT2 := true
LOCAL_MODULE := android-support-v17-leanback
LOCAL_SDK_VERSION := 17
+LOCAL_SDK_RES_VERSION := $(SUPPORT_CURRENT_SDK_VERSION)
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-v17-leanback-kitkat android-support-v17-leanback-jbmr2 \
- android-support-v17-leanback-api23 \
- android-support-v17-leanback-api21 android-support-v17-leanback-common
-LOCAL_JAVA_LIBRARIES := \
- android-support-v4 \
- android-support-v7-recyclerview \
- android-support-v17-leanback-res
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ android-support-v17-leanback-kitkat \
+ android-support-v17-leanback-jbmr2 \
+ android-support-v17-leanback-api23 \
+ android-support-v17-leanback-api21 \
+ android-support-v17-leanback-common
+LOCAL_STATIC_ANDROID_LIBRARIES := \
+ android-support-v17-leanback-res
+LOCAL_SHARED_ANDROID_LIBRARIES := \
+ android-support-v7-recyclerview \
+ android-support-v4
+LOCAL_JAR_EXCLUDE_FILES := none
LOCAL_JAVA_LANGUAGE_VERSION := 1.7
include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/v17/preference-leanback/Android.mk b/v17/preference-leanback/Android.mk
index c14c4a6..cd81287 100644
--- a/v17/preference-leanback/Android.mk
+++ b/v17/preference-leanback/Android.mk
@@ -14,25 +14,27 @@
LOCAL_PATH := $(call my-dir)
+# Android libraries referenced by this module's resources.
+resource_libs := \
+ android-support-v17-leanback \
+ android-support-v14-preference \
+ android-support-v7-preference \
+ android-support-v7-appcompat \
+ android-support-v7-recyclerview
+
# Build the resources using the latest applicable SDK version.
# We do this here because the final static library must be compiled with an older
# SDK version than the resources. The resources library and the R class that it
# contains will not be linked into the final static library.
include $(CLEAR_VARS)
+LOCAL_USE_AAPT2 := true
LOCAL_MODULE := android-support-v17-preference-leanback-res
LOCAL_SDK_VERSION := $(SUPPORT_CURRENT_SDK_VERSION)
LOCAL_SRC_FILES := $(call all-java-files-under, dummy)
-LOCAL_RESOURCE_DIR := \
- frameworks/support/v7/appcompat/res \
- frameworks/support/v7/recyclerview/res \
- frameworks/support/v7/preference/res \
- frameworks/support/v14/preference/res \
- frameworks/support/v17/leanback/res \
- $(LOCAL_PATH)/res
-LOCAL_AAPT_FLAGS := \
- --auto-add-overlay
-LOCAL_JAR_EXCLUDE_FILES := none
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_SHARED_ANDROID_LIBRARIES := $(resource_libs)
LOCAL_JAVA_LANGUAGE_VERSION := 1.7
+LOCAL_JAR_EXCLUDE_FILES := none
include $(BUILD_STATIC_JAVA_LIBRARY)
support_module_src_files := $(LOCAL_SRC_FILES)
@@ -44,32 +46,43 @@
LOCAL_MODULE := android-support-v17-preference-leanback-api21
LOCAL_SDK_VERSION := 21
LOCAL_SRC_FILES := $(call all-java-files-under, api21)
-LOCAL_JAVA_LIBRARIES := android-support-v17-preference-leanback-res \
- android-support-v17-leanback
+LOCAL_JAVA_LIBRARIES := \
+ android-support-v17-preference-leanback-res \
+ android-support-v17-leanback
LOCAL_JAVA_LANGUAGE_VERSION := 1.7
include $(BUILD_STATIC_JAVA_LIBRARY)
support_module_src_files += $(LOCAL_SRC_FILES)
# Here is the final static library that apps can link against.
-# The R class is automatically excluded from the generated library.
-# Applications that use this library must specify LOCAL_RESOURCE_DIR
+# Applications that use this library must specify
+#
+# LOCAL_STATIC_ANDROID_LIBRARIES := \
+# android-support-v17-preference-leanback \
+# android-support-v17-leanback \
+# android-support-v14-preference \
+# android-support-v7-preference \
+# android-support-v7-appcompat \
+# android-support-v7-recyclerview \
+# android-support-v4 \
+# android-support-annotions
+#
# in their makefiles to include the resources in their package.
include $(CLEAR_VARS)
+LOCAL_USE_AAPT2 := true
LOCAL_MODULE := android-support-v17-preference-leanback
LOCAL_SDK_VERSION := 17
+LOCAL_SDK_RES_VERSION := $(SUPPORT_CURRENT_SDK_VERSION)
LOCAL_SRC_FILES := $(call all-java-files-under,src)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-v17-preference-leanback-api21
-LOCAL_JAVA_LIBRARIES := \
- android-support-v4 \
- android-support-v7-appcompat \
- android-support-v7-recyclerview \
- android-support-v7-preference \
- android-support-v14-preference \
- android-support-v17-leanback \
- android-support-annotations \
- android-support-v17-preference-leanback-res
+ android-support-v17-preference-leanback-api21
+LOCAL_STATIC_ANDROID_LIBRARIES := \
+ android-support-v17-preference-leanback-res
+LOCAL_SHARED_ANDROID_LIBRARIES := \
+ $(resource_libs) \
+ android-support-v4 \
+ android-support-annotations
+LOCAL_JAR_EXCLUDE_FILES := none
LOCAL_JAVA_LANGUAGE_VERSION := 1.7
include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/v4/Android.mk b/v4/Android.mk
index dd24664..1e8adad 100644
--- a/v4/Android.mk
+++ b/v4/Android.mk
@@ -264,12 +264,15 @@
# Here is the final static library that apps can link against.
include $(CLEAR_VARS)
+LOCAL_USE_AAPT2 := true
LOCAL_MODULE := android-support-v4
LOCAL_SDK_VERSION := 4
LOCAL_AIDL_INCLUDES := frameworks/support/v4/java
LOCAL_SRC_FILES := $(call all-java-files-under, java) \
$(call all-Iaidl-files-under, java)
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
LOCAL_STATIC_JAVA_LIBRARIES += android-support-v4-api24
+LOCAL_JAR_EXCLUDE_FILES := none
LOCAL_JAVA_LANGUAGE_VERSION := 1.7
include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/v7/appcompat/Android.mk b/v7/appcompat/Android.mk
index 6816f54..6d11fcb 100644
--- a/v7/appcompat/Android.mk
+++ b/v7/appcompat/Android.mk
@@ -15,19 +15,25 @@
LOCAL_PATH := $(call my-dir)
# Here is the final static library that apps can link against.
-# The R class is automatically excluded from the generated library.
-# Applications that use this library must specify LOCAL_RESOURCE_DIR
-# in their makefiles to include the resources in their package.
+# Applications that use this library must specify
+#
+# LOCAL_STATIC_ANDROID_LIBRARIES := \
+# android-support-v7-appcompat \
+# android-support-v4
+#
+# in their makefiles to include the resources and their dependencies in their package.
include $(CLEAR_VARS)
+LOCAL_USE_AAPT2 := true
LOCAL_MODULE := android-support-v7-appcompat
LOCAL_SDK_VERSION := $(SUPPORT_CURRENT_SDK_VERSION)
LOCAL_SRC_FILES := $(call all-java-files-under,src)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-vectordrawable \
- android-support-animatedvectordrawable
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ android-support-vectordrawable \
+ android-support-animatedvectordrawable
LOCAL_JAVA_LIBRARIES := android-support-v4
-LOCAL_AAPT_FLAGS += --auto-add-overlay \
- --no-version-vectors
+LOCAL_AAPT_FLAGS := --no-version-vectors
+LOCAL_JAR_EXCLUDE_FILES := none
LOCAL_JAVA_LANGUAGE_VERSION := 1.7
include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/v7/cardview/Android.mk b/v7/cardview/Android.mk
index 7fa5cec..bb8ff9f 100644
--- a/v7/cardview/Android.mk
+++ b/v7/cardview/Android.mk
@@ -19,6 +19,7 @@
# SDK version than the resources. The resources library and the R class that it
# contains will not be linked into the final static library.
include $(CLEAR_VARS)
+LOCAL_USE_AAPT2 := true
LOCAL_MODULE := android-support-v7-cardview-res
LOCAL_SDK_VERSION := $(SUPPORT_CURRENT_SDK_VERSION)
LOCAL_SRC_FILES := $(call all-java-files-under, dummy)
@@ -72,9 +73,8 @@
LOCAL_MODULE := android-support-v7-cardview-api21
LOCAL_SDK_VERSION := 21
LOCAL_SRC_FILES := $(call all-java-files-under, api21)
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-v7-cardview-base \
- android-support-v7-cardview-jellybean-mr1
-LOCAL_JAVA_LIBRARIES := android-support-v7-cardview-res \
+LOCAL_STATIC_JAVA_LIBRARIES := android-support-v7-cardview-jellybean-mr1
+LOCAL_JAVA_LIBRARIES := android-support-v7-cardview-res \
android-support-annotations
LOCAL_JAVA_LANGUAGE_VERSION := 1.7
include $(BUILD_STATIC_JAVA_LIBRARY)
@@ -82,16 +82,21 @@
support_module_src_files += $(LOCAL_SRC_FILES)
# Here is the final static library that apps can link against.
-# The R class is automatically excluded from the generated library.
-# Applications that use this library must specify LOCAL_RESOURCE_DIR
+# Applications that use this library must specify
+#
+# LOCAL_STATIC_ANDROID_LIBRARIES := android-support-v7-cardview
+#
# in their makefiles to include the resources in their package.
include $(CLEAR_VARS)
+LOCAL_USE_AAPT2 := true
LOCAL_MODULE := android-support-v7-cardview
LOCAL_SDK_VERSION := 7
+LOCAL_SDK_RES_VERSION := $(SUPPORT_CURRENT_SDK_VERSION)
LOCAL_SRC_FILES := $(call all-java-files-under,src)
LOCAL_STATIC_JAVA_LIBRARIES := android-support-v7-cardview-api21
-LOCAL_JAVA_LIBRARIES := android-support-v7-cardview-res \
- android-support-annotations
+LOCAL_JAVA_LIBRARIES := android-support-annotations
+LOCAL_STATIC_ANDROID_LIBRARIES := android-support-v7-cardview-res
+LOCAL_JAR_EXCLUDE_FILES := none
LOCAL_JAVA_LANGUAGE_VERSION := 1.7
include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/v7/gridlayout/Android.mk b/v7/gridlayout/Android.mk
index 4617db6..0c56b6e 100644
--- a/v7/gridlayout/Android.mk
+++ b/v7/gridlayout/Android.mk
@@ -15,15 +15,21 @@
LOCAL_PATH := $(call my-dir)
# Here is the final static library that apps can link against.
-# The R class is automatically excluded from the generated library.
-# Applications that use this library must specify LOCAL_RESOURCE_DIR
-# in their makefiles to include the resources in their package.
+# Applications that use this library must specify
+#
+# LOCAL_STATIC_ANDROID_LIBRARIES := \
+# android-support-v7-gridlayout \
+# android-support-v4
+#
+# in their makefiles to include the resources and their dependencies in their package.
include $(CLEAR_VARS)
+LOCAL_USE_AAPT2 := true
LOCAL_MODULE := android-support-v7-gridlayout
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
LOCAL_SDK_VERSION := 7
-LOCAL_JAVA_LIBRARIES := android-support-v4
+LOCAL_SHARED_ANDROID_LIBRARIES := android-support-v4
+LOCAL_JAR_EXCLUDE_FILES := none
LOCAL_JAVA_LANGUAGE_VERSION := 1.7
include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/v7/mediarouter/Android.mk b/v7/mediarouter/Android.mk
index ada74c5..a7b2656 100644
--- a/v7/mediarouter/Android.mk
+++ b/v7/mediarouter/Android.mk
@@ -16,17 +16,14 @@
# Build the resources using the latest applicable SDK version.
# We do this here because the final static library must be compiled with an older
-# SDK version than the resources. The resources library and the R class that it
-# contains will not be linked into the final static library.
+# SDK version than the resources.
include $(CLEAR_VARS)
+LOCAL_USE_AAPT2 := true
LOCAL_MODULE := android-support-v7-mediarouter-res
LOCAL_SDK_VERSION := $(SUPPORT_CURRENT_SDK_VERSION)
LOCAL_SRC_FILES := $(call all-java-files-under, dummy)
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res \
- frameworks/support/v7/appcompat/res
-LOCAL_AAPT_FLAGS := \
- --auto-add-overlay \
- --extra-packages android.support.v7.appcompat
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_SHARED_ANDROID_LIBRARIES := android-support-v7-appcompat
LOCAL_JAR_EXCLUDE_FILES := none
LOCAL_JAVA_LANGUAGE_VERSION := 1.7
include $(BUILD_STATIC_JAVA_LIBRARY)
@@ -77,17 +74,28 @@
support_module_src_files += $(LOCAL_SRC_FILES)
# Here is the final static library that apps can link against.
-# The R class is automatically excluded from the generated library.
-# Applications that use this library must specify LOCAL_RESOURCE_DIR
-# in their makefiles to include the resources in their package.
+# Applications that use this library must specify
+#
+# LOCAL_STATIC_ANDROID_LIBRARIES := \
+# android-support-v7-mediarouter \
+# android-support-v7-appcompat \
+# android-support-v7-palette \
+# android-support-v4
+#
+# in their makefiles to include the resources and their dependencies in their package.
include $(CLEAR_VARS)
+LOCAL_USE_AAPT2 := true
LOCAL_MODULE := android-support-v7-mediarouter
LOCAL_SDK_VERSION := 7
+LOCAL_SDK_RES_VERSION := $(SUPPORT_CURRENT_SDK_VERSION)
LOCAL_SRC_FILES := $(call all-java-files-under,src)
LOCAL_STATIC_JAVA_LIBRARIES := android-support-v7-mediarouter-api24
-LOCAL_JAVA_LIBRARIES := android-support-v4 android-support-v7-mediarouter-res \
+LOCAL_STATIC_ANDROID_LIBRARIES := android-support-v7-mediarouter-res
+LOCAL_SHARED_ANDROID_LIBRARIES := \
android-support-v7-appcompat \
- android-support-v7-palette
+ android-support-v7-palette \
+ android-support-v4
+LOCAL_JAR_EXCLUDE_FILES := none
LOCAL_JAVA_LANGUAGE_VERSION := 1.7
include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/v7/mediarouter/src/android/support/v7/app/MediaRouteVolumeSlider.java b/v7/mediarouter/src/android/support/v7/app/MediaRouteVolumeSlider.java
index a7aafd2..a7a0dd3 100644
--- a/v7/mediarouter/src/android/support/v7/app/MediaRouteVolumeSlider.java
+++ b/v7/mediarouter/src/android/support/v7/app/MediaRouteVolumeSlider.java
@@ -42,7 +42,7 @@
}
public MediaRouteVolumeSlider(Context context, AttributeSet attrs) {
- this(context, attrs, R.attr.seekBarStyle);
+ this(context, attrs, android.support.v7.appcompat.R.attr.seekBarStyle);
}
public MediaRouteVolumeSlider(Context context, AttributeSet attrs, int defStyleAttr) {
diff --git a/v7/mediarouter/src/android/support/v7/app/MediaRouterThemeHelper.java b/v7/mediarouter/src/android/support/v7/app/MediaRouterThemeHelper.java
index 25b1d1d..3d55951 100644
--- a/v7/mediarouter/src/android/support/v7/app/MediaRouterThemeHelper.java
+++ b/v7/mediarouter/src/android/support/v7/app/MediaRouterThemeHelper.java
@@ -84,7 +84,8 @@
}
public static @ControllerColorType int getControllerColor(Context context, int style) {
- int primaryColor = getThemeColor(context, style, R.attr.colorPrimary);
+ int primaryColor = getThemeColor(context, style,
+ android.support.v7.appcompat.R.attr.colorPrimary);
if (ColorUtils.calculateContrast(COLOR_WHITE_ON_DARK_BACKGROUND, primaryColor)
>= MIN_CONTRAST) {
return COLOR_WHITE_ON_DARK_BACKGROUND;
@@ -93,20 +94,23 @@
}
public static int getButtonTextColor(Context context) {
- int primaryColor = getThemeColor(context, 0, R.attr.colorPrimary);
+ int primaryColor = getThemeColor(context, 0,
+ android.support.v7.appcompat.R.attr.colorPrimary);
int backgroundColor = getThemeColor(context, 0, android.R.attr.colorBackground);
if (ColorUtils.calculateContrast(primaryColor, backgroundColor) < MIN_CONTRAST) {
// Default to colorAccent if the contrast ratio is low.
- return getThemeColor(context, 0, R.attr.colorAccent);
+ return getThemeColor(context, 0, android.support.v7.appcompat.R.attr.colorAccent);
}
return primaryColor;
}
public static void setMediaControlsBackgroundColor(
Context context, View mainControls, View groupControls, boolean hasGroup) {
- int primaryColor = getThemeColor(context, 0, R.attr.colorPrimary);
- int primaryDarkColor = getThemeColor(context, 0, R.attr.colorPrimaryDark);
+ int primaryColor = getThemeColor(context, 0,
+ android.support.v7.appcompat.R.attr.colorPrimary);
+ int primaryDarkColor = getThemeColor(context, 0,
+ android.support.v7.appcompat.R.attr.colorPrimaryDark);
if (hasGroup && getControllerColor(context, 0) == COLOR_DARK_ON_LIGHT_BACKGROUND) {
// Instead of showing dark controls in a possibly dark (i.e. the primary dark), model
// the white dialog and use the primary color for the group controls.
@@ -135,7 +139,8 @@
private static boolean isLightTheme(Context context) {
TypedValue value = new TypedValue();
- return context.getTheme().resolveAttribute(R.attr.isLightTheme, value, true)
+ return context.getTheme().resolveAttribute(
+ android.support.v7.appcompat.R.attr.isLightTheme, value, true)
&& value.data != 0;
}
diff --git a/v7/palette/Android.mk b/v7/palette/Android.mk
index 0c4cb05..17d0de7 100644
--- a/v7/palette/Android.mk
+++ b/v7/palette/Android.mk
@@ -15,12 +15,22 @@
LOCAL_PATH := $(call my-dir)
# Here is the final static library that apps can link against.
+# Applications that use this library must specify
+#
+# LOCAL_STATIC_ANDROID_LIBRARIES := \
+# android-support-v7-palette \
+# android-support-v4
+#
+# in their makefiles to include the resources and their dependencies in their package.
include $(CLEAR_VARS)
+LOCAL_USE_AAPT2 := true
LOCAL_MODULE := android-support-v7-palette
LOCAL_SDK_VERSION := 7
LOCAL_SRC_FILES := $(call all-java-files-under, src/main)
-LOCAL_MANIFEST_FILE := $(LOCAL_PATH)/src/main/AndroidManifest.xml
-LOCAL_JAVA_LIBRARIES += android-support-v4
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_MANIFEST_FILE := src/main/AndroidManifest.xml
+LOCAL_SHARED_ANDROID_LIBRARIES += android-support-v4
+LOCAL_JAR_EXCLUDE_FILES := none
LOCAL_JAVA_LANGUAGE_VERSION := 1.7
include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/v7/preference/Android.mk b/v7/preference/Android.mk
index 85ded02..53acb08 100644
--- a/v7/preference/Android.mk
+++ b/v7/preference/Android.mk
@@ -14,39 +14,46 @@
LOCAL_PATH := $(call my-dir)
-# Build the resources using the latest applicable SDK version.
-# We do this here because the final static library must be compiled with an older
-# SDK version than the resources. The resources library and the R class that it
-# contains will not be linked into the final static library.
+# Build the resources separately because the constants built with the resources need to access
+# the latest SDK but the actual code needs to build against SDK 7.
include $(CLEAR_VARS)
+LOCAL_USE_AAPT2 := true
LOCAL_MODULE := android-support-v7-preference-res
-LOCAL_SRC_FILES := $(call all-java-files-under, constants)
LOCAL_SDK_VERSION := $(SUPPORT_CURRENT_SDK_VERSION)
-LOCAL_RESOURCE_DIR := \
- frameworks/support/v7/appcompat/res \
- frameworks/support/v7/recyclerview/res \
- $(LOCAL_PATH)/res
-LOCAL_AAPT_FLAGS := \
- --auto-add-overlay
+LOCAL_SRC_FILES := $(call all-java-files-under,constants)
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_SHARED_ANDROID_LIBRARIES := \
+ android-support-v7-appcompat \
+ android-support-v7-recyclerview
LOCAL_JAR_EXCLUDE_FILES := none
LOCAL_JAVA_LANGUAGE_VERSION := 1.7
include $(BUILD_STATIC_JAVA_LIBRARY)
# Here is the final static library that apps can link against.
-# The R class is automatically excluded from the generated library.
-# Applications that use this library must specify LOCAL_RESOURCE_DIR
-# in their makefiles to include the resources in their package.
+# Applications that use this library must specify
+#
+# LOCAL_STATIC_ANDROID_LIBRARIES := \
+# android-support-v7-preference \
+# android-support-v7-appcompat \
+# android-support-v7-recyclerview \
+# android-support-v4 \
+# android-support-annotations
+#
+# in their makefiles to include the resources and their dependencies in their package.
include $(CLEAR_VARS)
+LOCAL_USE_AAPT2 := true
LOCAL_MODULE := android-support-v7-preference
LOCAL_SDK_VERSION := 7
+LOCAL_SDK_RES_VERSION := $(SUPPORT_CURRENT_SDK_VERSION)
LOCAL_SRC_FILES := $(call all-java-files-under,src)
-# LOCAL_STATIC_JAVA_LIBRARIES :=
-LOCAL_JAVA_LIBRARIES := \
- android-support-v4 \
- android-support-v7-appcompat \
- android-support-v7-recyclerview \
- android-support-annotations \
- android-support-v7-preference-res
+LOCAL_STATIC_ANDROID_LIBRARIES := \
+ android-support-v7-preference-res
+LOCAL_SHARED_ANDROID_LIBRARIES := \
+ android-support-v7-appcompat \
+ android-support-v7-recyclerview \
+ android-support-v4 \
+ android-support-annotations
+LOCAL_JAR_EXCLUDE_FILES := none
LOCAL_JAVA_LANGUAGE_VERSION := 1.7
include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/v7/preference/src/android/support/v7/preference/CheckBoxPreference.java b/v7/preference/src/android/support/v7/preference/CheckBoxPreference.java
index 50ab1db..8ef625b 100644
--- a/v7/preference/src/android/support/v7/preference/CheckBoxPreference.java
+++ b/v7/preference/src/android/support/v7/preference/CheckBoxPreference.java
@@ -109,7 +109,7 @@
return;
}
- View checkboxView = view.findViewById(R.id.checkbox);
+ View checkboxView = view.findViewById(android.support.v7.appcompat.R.id.checkbox);
syncCheckboxView(checkboxView);
View summaryView = view.findViewById(android.R.id.summary);
diff --git a/v7/recyclerview/Android.mk b/v7/recyclerview/Android.mk
index 1a0819c..021296e 100644
--- a/v7/recyclerview/Android.mk
+++ b/v7/recyclerview/Android.mk
@@ -14,34 +14,26 @@
LOCAL_PATH := $(call my-dir)
-# # Build the resources using the latest applicable SDK version.
-# # We do this here because the final static library must be compiled with an older
-# # SDK version than the resources. The resources library and the R class that it
-# # contains will not be linked into the final static library.
-include $(CLEAR_VARS)
-LOCAL_MODULE := android-support-v7-recyclerview-res
-LOCAL_SDK_VERSION := $(SUPPORT_CURRENT_SDK_VERSION)
-LOCAL_SRC_FILES := $(call all-java-files-under, dummy)
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-LOCAL_AAPT_FLAGS := \
- --auto-add-overlay
-LOCAL_JAR_EXCLUDE_FILES := none
-LOCAL_JAVA_LANGUAGE_VERSION := 1.7
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
# Here is the final static library that apps can link against.
-# The R class is automatically excluded from the generated library.
-# Applications that use this library must specify LOCAL_RESOURCE_DIR
-# in their makefiles to include the resources in their package.
+# Applications that use this library must specify
+#
+# LOCAL_STATIC_ANDROID_LIBRARIES := \
+# android-support-v7-recycler-view \
+# android-support-v4 \
+# android-support-annotations
+#
+# in their makefiles to include the resources and their dependencies in their package.
include $(CLEAR_VARS)
+LOCAL_USE_AAPT2 := true
LOCAL_MODULE := android-support-v7-recyclerview
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
LOCAL_SDK_VERSION := 7
+LOCAL_SDK_RES_VERSION := $(SUPPORT_CURRENT_SDK_VERSION)
LOCAL_SRC_FILES := $(call all-java-files-under,src)
-LOCAL_JAVA_LIBRARIES := \
- android-support-v4 \
- android-support-annotations \
- android-support-v7-recyclerview-res
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_SHARED_ANDROID_LIBRARIES := \
+ android-support-v4 \
+ android-support-annotations
+LOCAL_JAR_EXCLUDE_FILES := none
LOCAL_JAVA_LANGUAGE_VERSION := 1.7
include $(BUILD_STATIC_JAVA_LIBRARY)