Merge "Fix gravity handling in CoordinatorLayout" into nyc-support-25.2-dev
diff --git a/build.gradle b/build.gradle
index 4113929..d67d932 100644
--- a/build.gradle
+++ b/build.gradle
@@ -488,6 +488,14 @@
}
}
}
+
+ // Update the version meta-data in each Manifest
+ project.afterEvaluate { p ->
+ if (p.hasProperty('android')) {
+ p.android.defaultConfig.manifestPlaceholders =
+ ["support-version": rootProject.ext.supportVersion]
+ }
+ }
}
project.gradle.buildFinished { buildResult ->
diff --git a/compat/Android.mk b/compat/Android.mk
index ba5b958..97916ae 100644
--- a/compat/Android.mk
+++ b/compat/Android.mk
@@ -45,6 +45,7 @@
$(call all-java-files-under,java) \
$(call all-Iaidl-files-under,java)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_MANIFEST_FILE := AndroidManifest-make.xml
LOCAL_SHARED_ANDROID_LIBRARIES := \
android-support-annotations
LOCAL_JAR_EXCLUDE_FILES := none
diff --git a/compat/AndroidManifest-make.xml b/compat/AndroidManifest-make.xml
new file mode 100644
index 0000000..b2bd5bb
--- /dev/null
+++ b/compat/AndroidManifest-make.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ package="android.support.compat">
+ <uses-sdk android:minSdkVersion="9" tools:overrideLibrary="android.support.compat"/>
+ <application />
+</manifest>
diff --git a/compat/AndroidManifest.xml b/compat/AndroidManifest.xml
index b2bd5bb..55ddcff 100644
--- a/compat/AndroidManifest.xml
+++ b/compat/AndroidManifest.xml
@@ -17,5 +17,6 @@
xmlns:tools="http://schemas.android.com/tools"
package="android.support.compat">
<uses-sdk android:minSdkVersion="9" tools:overrideLibrary="android.support.compat"/>
+ <meta-data android:name="android.support.VERSION" android:value="${support-version}" />
<application />
</manifest>
diff --git a/core-ui/Android.mk b/core-ui/Android.mk
index bdad9f9..eb9acca 100644
--- a/core-ui/Android.mk
+++ b/core-ui/Android.mk
@@ -33,6 +33,7 @@
$(call all-java-files-under,api21) \
$(call all-java-files-under,java)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_MANIFEST_FILE := AndroidManifest-make.xml
LOCAL_SHARED_ANDROID_LIBRARIES := \
android-support-compat \
android-support-annotations
diff --git a/core-ui/AndroidManifest-make.xml b/core-ui/AndroidManifest-make.xml
new file mode 100644
index 0000000..9bcc44e
--- /dev/null
+++ b/core-ui/AndroidManifest-make.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ package="android.support.coreui">
+ <uses-sdk android:minSdkVersion="9" tools:overrideLibrary="android.support.coreui"/>
+ <application />
+</manifest>
diff --git a/core-ui/AndroidManifest.xml b/core-ui/AndroidManifest.xml
index 9bcc44e..5357112 100644
--- a/core-ui/AndroidManifest.xml
+++ b/core-ui/AndroidManifest.xml
@@ -17,5 +17,6 @@
xmlns:tools="http://schemas.android.com/tools"
package="android.support.coreui">
<uses-sdk android:minSdkVersion="9" tools:overrideLibrary="android.support.coreui"/>
+ <meta-data android:name="android.support.VERSION" android:value="${support-version}" />
<application />
</manifest>
diff --git a/core-utils/Android.mk b/core-utils/Android.mk
index d3f113e..a65a2cd 100644
--- a/core-utils/Android.mk
+++ b/core-utils/Android.mk
@@ -37,6 +37,7 @@
$(call all-java-files-under,api24) \
$(call all-java-files-under,java)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_MANIFEST_FILE := AndroidManifest-make.xml
LOCAL_SHARED_ANDROID_LIBRARIES := \
android-support-compat \
android-support-annotations
diff --git a/core-utils/AndroidManifest-make.xml b/core-utils/AndroidManifest-make.xml
new file mode 100644
index 0000000..586a28e
--- /dev/null
+++ b/core-utils/AndroidManifest-make.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ package="android.support.coreutils">
+ <uses-sdk android:minSdkVersion="9" tools:overrideLibrary="android.support.coreutils"/>
+ <application />
+</manifest>
diff --git a/core-utils/AndroidManifest.xml b/core-utils/AndroidManifest.xml
index 586a28e..03ff3b4 100644
--- a/core-utils/AndroidManifest.xml
+++ b/core-utils/AndroidManifest.xml
@@ -17,5 +17,6 @@
xmlns:tools="http://schemas.android.com/tools"
package="android.support.coreutils">
<uses-sdk android:minSdkVersion="9" tools:overrideLibrary="android.support.coreutils"/>
+ <meta-data android:name="android.support.VERSION" android:value="${support-version}" />
<application />
</manifest>
diff --git a/customtabs/Android.mk b/customtabs/Android.mk
index cfd9971..e6f6ead 100644
--- a/customtabs/Android.mk
+++ b/customtabs/Android.mk
@@ -31,6 +31,7 @@
$(call all-java-files-under,src) \
$(call all-Iaidl-files-under,src)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_MANIFEST_FILE := AndroidManifest-make.xml
LOCAL_SHARED_ANDROID_LIBRARIES := \
android-support-annotations \
android-support-compat
diff --git a/customtabs/AndroidManifest-make.xml b/customtabs/AndroidManifest-make.xml
new file mode 100644
index 0000000..212fab9
--- /dev/null
+++ b/customtabs/AndroidManifest-make.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.support.customtabs">
+ <uses-sdk android:minSdkVersion="15"/>
+ <application />
+</manifest>
diff --git a/customtabs/AndroidManifest.xml b/customtabs/AndroidManifest.xml
index 212fab9..19a1d54 100644
--- a/customtabs/AndroidManifest.xml
+++ b/customtabs/AndroidManifest.xml
@@ -16,5 +16,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.support.customtabs">
<uses-sdk android:minSdkVersion="15"/>
+ <meta-data android:name="android.support.VERSION" android:value="${support-version}" />
<application />
</manifest>
diff --git a/design/Android.mk b/design/Android.mk
index b3bc846..2e634eb 100644
--- a/design/Android.mk
+++ b/design/Android.mk
@@ -38,6 +38,7 @@
$(call all-java-files-under,lollipop) \
$(call all-java-files-under,src)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_MANIFEST_FILE := AndroidManifest-make.xml
LOCAL_SHARED_ANDROID_LIBRARIES := \
android-support-transition \
android-support-v7-appcompat \
diff --git a/design/AndroidManifest-make.xml b/design/AndroidManifest-make.xml
new file mode 100644
index 0000000..d51186d
--- /dev/null
+++ b/design/AndroidManifest-make.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ package="android.support.design">
+ <uses-sdk android:minSdkVersion="9"
+ tools:overrideLibrary="android.support.transition"/>
+ <application />
+</manifest>
diff --git a/design/AndroidManifest.xml b/design/AndroidManifest.xml
index d51186d..2d5fe0b 100644
--- a/design/AndroidManifest.xml
+++ b/design/AndroidManifest.xml
@@ -18,5 +18,6 @@
package="android.support.design">
<uses-sdk android:minSdkVersion="9"
tools:overrideLibrary="android.support.transition"/>
+ <meta-data android:name="android.support.VERSION" android:value="${support-version}" />
<application />
</manifest>
diff --git a/design/src/android/support/design/widget/Snackbar.java b/design/src/android/support/design/widget/Snackbar.java
index a096a3d..82add6f 100644
--- a/design/src/android/support/design/widget/Snackbar.java
+++ b/design/src/android/support/design/widget/Snackbar.java
@@ -324,6 +324,25 @@
public SnackbarLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+ // Work around our backwards-compatible refactoring of Snackbar and inner content
+ // being inflated against snackbar's parent (instead of against the snackbar itself).
+ // Every child that is width=MATCH_PARENT is remeasured again and given the full width
+ // minus the paddings.
+ int childCount = getChildCount();
+ int availableWidth = getMeasuredWidth() - getPaddingLeft() - getPaddingRight();
+ for (int i = 0; i < childCount; i++) {
+ View child = getChildAt(i);
+ if (child.getLayoutParams().width == ViewGroup.LayoutParams.MATCH_PARENT) {
+ child.measure(MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.EXACTLY),
+ MeasureSpec.makeMeasureSpec(child.getMeasuredHeight(),
+ MeasureSpec.EXACTLY));
+ }
+ }
+ }
}
}
diff --git a/documents-archive/AndroidManifest.xml b/documents-archive/AndroidManifest.xml
index 2cd0f7a..fd64ed9 100644
--- a/documents-archive/AndroidManifest.xml
+++ b/documents-archive/AndroidManifest.xml
@@ -16,5 +16,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.support.provider">
<uses-sdk android:minSdkVersion="19"/>
+ <meta-data android:name="android.support.VERSION" android:value="${support-version}" />
<application />
</manifest>
diff --git a/exifinterface/Android.mk b/exifinterface/Android.mk
index 9da8bc5..4d5887c 100644
--- a/exifinterface/Android.mk
+++ b/exifinterface/Android.mk
@@ -25,6 +25,7 @@
LOCAL_SDK_VERSION := $(SUPPORT_CURRENT_SDK_VERSION)
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_MANIFEST_FILE := AndroidManifest-make.xml
LOCAL_SHARED_ANDROID_LIBRARIES := \
android-support-annotations
LOCAL_JAR_EXCLUDE_FILES := none
diff --git a/exifinterface/AndroidManifest-make.xml b/exifinterface/AndroidManifest-make.xml
new file mode 100644
index 0000000..4812a71
--- /dev/null
+++ b/exifinterface/AndroidManifest-make.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.support.exifinterface">
+ <uses-sdk android:minSdkVersion="9"/>
+ <application />
+</manifest>
diff --git a/exifinterface/AndroidManifest.xml b/exifinterface/AndroidManifest.xml
index 4812a71..bacbdbe 100644
--- a/exifinterface/AndroidManifest.xml
+++ b/exifinterface/AndroidManifest.xml
@@ -16,5 +16,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.support.exifinterface">
<uses-sdk android:minSdkVersion="9"/>
+ <meta-data android:name="android.support.VERSION" android:value="${support-version}" />
<application />
</manifest>
diff --git a/fragment/Android.mk b/fragment/Android.mk
index a41b0c2..f55cfb7 100644
--- a/fragment/Android.mk
+++ b/fragment/Android.mk
@@ -36,6 +36,7 @@
$(call all-java-files-under, api21) \
$(call all-java-files-under, java)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_MANIFEST_FILE := AndroidManifest-make.xml
LOCAL_SHARED_ANDROID_LIBRARIES := \
android-support-compat \
android-support-core-ui \
diff --git a/fragment/AndroidManifest-make.xml b/fragment/AndroidManifest-make.xml
new file mode 100644
index 0000000..54e61d3
--- /dev/null
+++ b/fragment/AndroidManifest-make.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ package="android.support.fragment">
+ <uses-sdk android:minSdkVersion="9" tools:overrideLibrary="android.support.fragment"/>
+ <application />
+</manifest>
diff --git a/fragment/AndroidManifest.xml b/fragment/AndroidManifest.xml
index 54e61d3..9b34e14 100644
--- a/fragment/AndroidManifest.xml
+++ b/fragment/AndroidManifest.xml
@@ -17,5 +17,6 @@
xmlns:tools="http://schemas.android.com/tools"
package="android.support.fragment">
<uses-sdk android:minSdkVersion="9" tools:overrideLibrary="android.support.fragment"/>
+ <meta-data android:name="android.support.VERSION" android:value="${support-version}" />
<application />
</manifest>
diff --git a/fragment/java/android/support/v4/app/BackStackRecord.java b/fragment/java/android/support/v4/app/BackStackRecord.java
index acfa924..3b41d60 100644
--- a/fragment/java/android/support/v4/app/BackStackRecord.java
+++ b/fragment/java/android/support/v4/app/BackStackRecord.java
@@ -795,7 +795,7 @@
default:
throw new IllegalArgumentException("Unknown cmd: " + op.cmd);
}
- if (!mAllowOptimization && op.cmd != OP_ADD) {
+ if (!mAllowOptimization && op.cmd != OP_REMOVE) {
mManager.moveFragmentToExpectedState(f);
}
}
@@ -861,6 +861,29 @@
}
}
+ /**
+ * Removes fragments that are added or removed during a pop operation.
+ *
+ * @param added Initialized to the fragments that are in the mManager.mAdded, this
+ * will be modified to contain the fragments that will be in mAdded
+ * after the execution ({@link #executeOps()}.
+ */
+ void trackAddedFragmentsInPop(ArrayList<Fragment> added) {
+ for (int opNum = 0; opNum < mOps.size(); opNum++) {
+ final Op op = mOps.get(opNum);
+ switch (op.cmd) {
+ case OP_ADD:
+ case OP_ATTACH:
+ added.remove(op.fragment);
+ break;
+ case OP_REMOVE:
+ case OP_DETACH:
+ added.add(op.fragment);
+ break;
+ }
+ }
+ }
+
boolean isPostponed() {
for (int opNum = 0; opNum < mOps.size(); opNum++) {
final Op op = mOps.get(opNum);
diff --git a/fragment/java/android/support/v4/app/Fragment.java b/fragment/java/android/support/v4/app/Fragment.java
index 0c7300e..881c2b4 100644
--- a/fragment/java/android/support/v4/app/Fragment.java
+++ b/fragment/java/android/support/v4/app/Fragment.java
@@ -321,6 +321,11 @@
// True if mHidden has been changed and the animation should be scheduled.
boolean mHiddenChanged;
+ // The alpha of the view when the view was added and then postponed. If the value is less
+ // than zero, this means that the view's add was canceled and should not participate in
+ // removal animations.
+ float mPostponedAlpha;
+
/**
* State information that has been retrieved from a fragment instance
* through {@link FragmentManager#saveFragmentInstanceState(Fragment)
diff --git a/fragment/java/android/support/v4/app/FragmentManager.java b/fragment/java/android/support/v4/app/FragmentManager.java
index e7d13ff..071239a 100644
--- a/fragment/java/android/support/v4/app/FragmentManager.java
+++ b/fragment/java/android/support/v4/app/FragmentManager.java
@@ -32,6 +32,7 @@
import android.support.annotation.RestrictTo;
import android.support.annotation.StringRes;
import android.support.v4.os.BuildCompat;
+import android.support.v4.util.ArraySet;
import android.support.v4.util.DebugUtils;
import android.support.v4.util.LogWriter;
import android.support.v4.util.Pair;
@@ -1382,10 +1383,12 @@
if (f.mView != null && f.mContainer != null) {
Animation anim = null;
if (mCurState > Fragment.INITIALIZING && !mDestroyed
- && f.mView.getVisibility() == View.VISIBLE) {
+ && f.mView.getVisibility() == View.VISIBLE
+ && f.mPostponedAlpha >= 0) {
anim = loadAnimation(f, transit, false,
transitionStyle);
}
+ f.mPostponedAlpha = 0;
if (anim != null) {
final Fragment fragment = f;
f.setAnimatingAway(f.mView);
@@ -1540,7 +1543,12 @@
}
if (f.mIsNewlyAdded && f.mContainer != null) {
// Make it visible and run the animations
- f.mView.setVisibility(View.VISIBLE);
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
+ f.mView.setVisibility(View.VISIBLE);
+ } else if (f.mPostponedAlpha > 0f) {
+ f.mView.setAlpha(f.mPostponedAlpha);
+ }
+ f.mPostponedAlpha = 0f;
f.mIsNewlyAdded = false;
// run animations:
Animation anim = loadAnimation(f, f.getNextTransition(), true,
@@ -2078,11 +2086,13 @@
if (startIndex != recordNum) {
executeOpsTogether(records, isRecordPop, startIndex, recordNum);
}
- // execute all unoptimized together
- int optimizeEnd;
- for (optimizeEnd = recordNum + 1; optimizeEnd < numRecords; optimizeEnd++) {
- if (records.get(optimizeEnd).mAllowOptimization) {
- break;
+ // execute all unoptimized pop operations together or one add operation
+ int optimizeEnd = recordNum + 1;
+ if (isRecordPop.get(recordNum)) {
+ while (optimizeEnd < numRecords
+ && isRecordPop.get(optimizeEnd)
+ && !records.get(optimizeEnd).mAllowOptimization) {
+ optimizeEnd++;
}
}
executeOpsTogether(records, isRecordPop, recordNum, optimizeEnd);
@@ -2120,6 +2130,8 @@
final boolean isPop = isRecordPop.get(recordNum);
if (!isPop) {
record.expandReplaceOps(mTmpAddedFragments);
+ } else {
+ record.trackAddedFragmentsInPop(mTmpAddedFragments);
}
final int bumpAmount = isPop ? -1 : 1;
record.bumpBackStackNesting(bumpAmount);
@@ -2135,9 +2147,11 @@
int postponeIndex = endIndex;
if (allowOptimization) {
- moveFragmentsToInvisible();
+ ArraySet<Fragment> addedFragments = new ArraySet<>();
+ addAddedFragments(addedFragments);
postponeIndex = postponePostponableTransactions(records, isRecordPop,
- startIndex, endIndex);
+ startIndex, endIndex, addedFragments);
+ makeRemovedFragmentsInvisible(addedFragments);
}
if (postponeIndex != startIndex && allowOptimization) {
@@ -2161,6 +2175,30 @@
}
/**
+ * Any fragments that were removed because they have been postponed should have their views
+ * made invisible by setting their alpha to 0 on API >= 11 or setting visibility to INVISIBLE
+ * on API < 11.
+ *
+ * @param fragments The fragments that were added during operation execution. Only the ones
+ * that are no longer added will have their alpha changed.
+ */
+ private void makeRemovedFragmentsInvisible(ArraySet<Fragment> fragments) {
+ final int numAdded = fragments.size();
+ for (int i = 0; i < numAdded; i++) {
+ final Fragment fragment = fragments.valueAt(i);
+ if (!fragment.mAdded) {
+ final View view = fragment.getView();
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
+ fragment.getView().setVisibility(View.INVISIBLE);
+ } else {
+ fragment.mPostponedAlpha = view.getAlpha();
+ view.setAlpha(0f);
+ }
+ }
+ }
+ }
+
+ /**
* Examine all transactions and determine which ones are marked as postponed. Those will
* have their operations rolled back and moved to the end of the record list (up to endIndex).
* It will also add the postponed transaction to the queue.
@@ -2173,7 +2211,8 @@
* postponed.
*/
private int postponePostponableTransactions(ArrayList<BackStackRecord> records,
- ArrayList<Boolean> isRecordPop, int startIndex, int endIndex) {
+ ArrayList<Boolean> isRecordPop, int startIndex, int endIndex,
+ ArraySet<Fragment> added) {
int postponeIndex = endIndex;
for (int i = endIndex - 1; i >= startIndex; i--) {
final BackStackRecord record = records.get(i);
@@ -2204,7 +2243,7 @@
}
// different views may be visible now
- moveFragmentsToInvisible();
+ addAddedFragments(added);
}
}
return postponeIndex;
@@ -2237,15 +2276,26 @@
}
if (moveToState) {
moveToState(mCurState, true);
- } else if (mActive != null) {
+ }
+
+ if (mActive != null) {
final int numActive = mActive.size();
for (int i = 0; i < numActive; i++) {
// Allow added fragments to be removed during the pop since we aren't going
// to move them to the final state with moveToState(mCurState).
Fragment fragment = mActive.get(i);
- if (fragment.mView != null && fragment.mIsNewlyAdded
+ if (fragment != null && fragment.mView != null && fragment.mIsNewlyAdded
&& record.interactsWith(fragment.mContainerId)) {
- fragment.mIsNewlyAdded = false;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB
+ && fragment.mPostponedAlpha > 0) {
+ fragment.mView.setAlpha(fragment.mPostponedAlpha);
+ }
+ if (moveToState) {
+ fragment.mPostponedAlpha = 0;
+ } else {
+ fragment.mPostponedAlpha = -1;
+ fragment.mIsNewlyAdded = false;
+ }
}
}
}
@@ -2309,10 +2359,11 @@
/**
* Ensure that fragments that are added are moved to at least the CREATED state.
- * Any newly-added Views are made INVISIBLE so that the Transaction can be postponed
- * with {@link Fragment#postponeEnterTransition()}.
+ * Any newly-added Views are inserted into {@code added} so that the Transaction can be
+ * postponed with {@link Fragment#postponeEnterTransition()}. They will later be made
+ * invisible (by setting their alpha to 0) if they have been removed when postponed.
*/
- private void moveFragmentsToInvisible() {
+ private void addAddedFragments(ArraySet<Fragment> added) {
if (mCurState < Fragment.CREATED) {
return;
}
@@ -2325,7 +2376,7 @@
moveToState(fragment, state, fragment.getNextAnim(), fragment.getNextTransition(),
false);
if (fragment.mView != null && !fragment.mHidden && fragment.mIsNewlyAdded) {
- fragment.mView.setVisibility(View.INVISIBLE);
+ added.add(fragment);
}
}
}
@@ -2355,7 +2406,10 @@
final int stateAfterAnimating = fragment.getStateAfterAnimating();
final View animatingAway = fragment.getAnimatingAway();
fragment.setAnimatingAway(null);
- animatingAway.clearAnimation();
+ Animation animation = animatingAway.getAnimation();
+ if (animation != null) {
+ animation.cancel();
+ }
moveToState(fragment, stateAfterAnimating, 0, 0, false);
}
}
diff --git a/fragment/java/android/support/v4/app/FragmentTransition.java b/fragment/java/android/support/v4/app/FragmentTransition.java
index aa64859..5e0d9e3 100644
--- a/fragment/java/android/support/v4/app/FragmentTransition.java
+++ b/fragment/java/android/support/v4/app/FragmentTransition.java
@@ -186,7 +186,10 @@
private static void configureTransitionsOptimized(FragmentManagerImpl fragmentManager,
int containerId, FragmentContainerTransition fragments,
View nonExistentView, ArrayMap<String, String> nameOverrides) {
- ViewGroup sceneRoot = (ViewGroup) fragmentManager.mContainer.onFindViewById(containerId);
+ ViewGroup sceneRoot = null;
+ if (fragmentManager.mContainer.onHasView()) {
+ sceneRoot = (ViewGroup) fragmentManager.mContainer.onFindViewById(containerId);
+ }
if (sceneRoot == null) {
return;
}
@@ -276,7 +279,10 @@
private static void configureTransitionsUnoptimized(FragmentManagerImpl fragmentManager,
int containerId, FragmentContainerTransition fragments,
View nonExistentView, ArrayMap<String, String> nameOverrides) {
- ViewGroup sceneRoot = (ViewGroup) fragmentManager.mContainer.onFindViewById(containerId);
+ ViewGroup sceneRoot = null;
+ if (fragmentManager.mContainer.onHasView()) {
+ sceneRoot = (ViewGroup) fragmentManager.mContainer.onFindViewById(containerId);
+ }
if (sceneRoot == null) {
return;
}
@@ -1042,7 +1048,8 @@
case BackStackRecord.OP_DETACH:
if (isOptimizedTransaction) {
setFirstOut = !fragment.mAdded && fragment.mView != null
- && fragment.mView.getVisibility() == View.VISIBLE;
+ && fragment.mView.getVisibility() == View.VISIBLE
+ && fragment.mPostponedAlpha >= 0;
} else {
setFirstOut = fragment.mAdded && !fragment.mHidden;
}
diff --git a/fragment/tests/java/android/support/v4/app/FragmentAnimationTest.java b/fragment/tests/java/android/support/v4/app/FragmentAnimationTest.java
index 873e36d..33e20d0 100644
--- a/fragment/tests/java/android/support/v4/app/FragmentAnimationTest.java
+++ b/fragment/tests/java/android/support/v4/app/FragmentAnimationTest.java
@@ -22,6 +22,7 @@
import static org.junit.Assert.assertTrue;
import android.app.Instrumentation;
+import android.os.Build;
import android.os.Parcelable;
import android.support.annotation.AnimRes;
import android.support.fragment.test.R;
@@ -295,6 +296,9 @@
assertPostponed(fragment2, 0);
assertNotNull(fragment1.getView());
assertEquals(View.VISIBLE, fragment1.getView().getVisibility());
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+ assertEquals(1f, fragment1.getView().getAlpha(), 0f);
+ }
assertTrue(ViewCompat.isAttachedToWindow(fragment1.getView()));
fragment2.startPostponedEnterTransition();
@@ -335,6 +339,9 @@
assertNotNull(fragment1.getView());
assertEquals(View.VISIBLE, fragment1.getView().getVisibility());
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+ assertEquals(1f, fragment1.getView().getAlpha(), 0f);
+ }
assertTrue(ViewCompat.isAttachedToWindow(fragment1.getView()));
assertTrue(fragment1.isAdded());
@@ -456,7 +463,12 @@
private void assertPostponed(AnimatorFragment fragment, int expectedAnimators)
throws InterruptedException {
assertTrue(fragment.mOnCreateViewCalled);
- assertEquals(View.INVISIBLE, fragment.getView().getVisibility());
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
+ assertEquals(View.INVISIBLE, fragment.getView().getVisibility());
+ } else {
+ assertEquals(View.VISIBLE, fragment.getView().getVisibility());
+ assertEquals(0f, fragment.getView().getAlpha(), 0f);
+ }
assertEquals(expectedAnimators, fragment.numAnimators);
}
diff --git a/fragment/tests/java/android/support/v4/app/FragmentOptimizationTest.java b/fragment/tests/java/android/support/v4/app/FragmentOptimizationTest.java
index 08be463..06abd69 100644
--- a/fragment/tests/java/android/support/v4/app/FragmentOptimizationTest.java
+++ b/fragment/tests/java/android/support/v4/app/FragmentOptimizationTest.java
@@ -24,7 +24,9 @@
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.support.v4.app.test.FragmentTestActivity;
+import android.view.View;
import android.view.ViewGroup;
+import android.widget.EditText;
import org.junit.Before;
import org.junit.Rule;
@@ -644,4 +646,42 @@
assertEquals(1, fragment1.onCreateViewCount);
}
+ // Test that a fragment view that is created with focus has focus after the transaction
+ // completes.
+ @Test
+ public void focusedView() throws Throwable {
+ FragmentTestUtil.setContentView(mActivityRule, R.layout.double_container);
+ mContainer = (ViewGroup) mActivityRule.getActivity().findViewById(R.id.fragmentContainer1);
+ final EditText firstEditText = new EditText(mContainer.getContext());
+ mInstrumentation.runOnMainSync(new Runnable() {
+ @Override
+ public void run() {
+ mContainer.addView(firstEditText);
+ firstEditText.requestFocus();
+ }
+ });
+ assertTrue(firstEditText.isFocused());
+ final CountCallsFragment fragment1 = new CountCallsFragment();
+ final CountCallsFragment fragment2 = new CountCallsFragment();
+ fragment2.setLayoutId(R.layout.with_edit_text);
+ mInstrumentation.runOnMainSync(new Runnable() {
+ @Override
+ public void run() {
+ mFM.beginTransaction()
+ .add(R.id.fragmentContainer2, fragment1)
+ .addToBackStack(null)
+ .setAllowOptimization(true)
+ .commit();
+ mFM.beginTransaction()
+ .replace(R.id.fragmentContainer2, fragment2)
+ .addToBackStack(null)
+ .setAllowOptimization(true)
+ .commit();
+ mFM.executePendingTransactions();
+ }
+ });
+ final View editText = fragment2.getView().findViewById(R.id.editText);
+ assertTrue(editText.isFocused());
+ assertFalse(firstEditText.isFocused());
+ }
}
diff --git a/fragment/tests/java/android/support/v4/app/FragmentViewTests.java b/fragment/tests/java/android/support/v4/app/FragmentViewTests.java
index ad970c8..521eb84 100644
--- a/fragment/tests/java/android/support/v4/app/FragmentViewTests.java
+++ b/fragment/tests/java/android/support/v4/app/FragmentViewTests.java
@@ -32,6 +32,7 @@
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.support.v4.app.test.FragmentTestActivity;
+import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -902,6 +903,105 @@
assertEquals(View.GONE, fragment2.getView().getVisibility());
}
+ // Test to ensure that popping and adding a fragment properly track the fragments added
+ // and removed.
+ @Test
+ public void popAdd() throws Throwable {
+ FragmentTestUtil.setContentView(mActivityRule, R.layout.simple_container);
+ ViewGroup container = (ViewGroup)
+ mActivityRule.getActivity().findViewById(R.id.fragmentContainer);
+ final FragmentManager fm = mActivityRule.getActivity().getSupportFragmentManager();
+
+ // One fragment with a view
+ final StrictViewFragment fragment1 = new StrictViewFragment();
+ fm.beginTransaction().add(R.id.fragmentContainer, fragment1).addToBackStack(null).commit();
+ FragmentTestUtil.executePendingTransactions(mActivityRule);
+ FragmentTestUtil.assertChildren(container, fragment1);
+
+ final StrictViewFragment fragment2 = new StrictViewFragment();
+ final StrictViewFragment fragment3 = new StrictViewFragment();
+ mInstrumentation.runOnMainSync(new Runnable() {
+ @Override
+ public void run() {
+ fm.popBackStack();
+ fm.beginTransaction()
+ .replace(R.id.fragmentContainer, fragment2)
+ .addToBackStack(null)
+ .commit();
+ fm.executePendingTransactions();
+ fm.popBackStack();
+ fm.beginTransaction()
+ .replace(R.id.fragmentContainer, fragment3)
+ .addToBackStack(null)
+ .commit();
+ fm.executePendingTransactions();
+ }
+ });
+ FragmentTestUtil.assertChildren(container, fragment3);
+ }
+
+ // Ensure that non-optimized transactions are executed individually rather than together.
+ // This forces references from one fragment to another that should be executed earlier
+ // to work.
+ @Test
+ public void nonOptimizeTogether() throws Throwable {
+ FragmentTestUtil.setContentView(mActivityRule, R.layout.simple_container);
+ ViewGroup container = (ViewGroup)
+ mActivityRule.getActivity().findViewById(R.id.fragmentContainer);
+ final FragmentManager fm = mActivityRule.getActivity().getSupportFragmentManager();
+
+ final StrictViewFragment fragment1 = new StrictViewFragment();
+ fragment1.setLayoutId(R.layout.scene1);
+ final StrictViewFragment fragment2 = new StrictViewFragment();
+ fragment2.setLayoutId(R.layout.fragment_a);
+
+ mActivityRule.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ fm.beginTransaction()
+ .add(R.id.fragmentContainer, fragment1)
+ .setAllowOptimization(false)
+ .addToBackStack(null)
+ .commit();
+ fm.beginTransaction()
+ .add(R.id.squareContainer, fragment2)
+ .setAllowOptimization(false)
+ .addToBackStack(null)
+ .commit();
+ fm.executePendingTransactions();
+ }
+ });
+ FragmentTestUtil.assertChildren(container, fragment1);
+ assertNotNull(findViewById(R.id.textA));
+ }
+
+ // Ensure that there is no problem if the child fragment manager is used before
+ // the View has been added.
+ @Test
+ public void childFragmentManager() throws Throwable {
+ FragmentTestUtil.setContentView(mActivityRule, R.layout.simple_container);
+ ViewGroup container = (ViewGroup)
+ mActivityRule.getActivity().findViewById(R.id.fragmentContainer);
+ final FragmentManager fm = mActivityRule.getActivity().getSupportFragmentManager();
+
+ final StrictViewFragment fragment1 = new ParentFragment();
+ fragment1.setLayoutId(R.layout.double_container);
+
+ fm.beginTransaction()
+ .add(R.id.fragmentContainer, fragment1)
+ .addToBackStack(null)
+ .commit();
+
+ FragmentTestUtil.executePendingTransactions(mActivityRule);
+
+ FragmentTestUtil.assertChildren(container, fragment1);
+ ViewGroup innerContainer = (ViewGroup)
+ fragment1.getView().findViewById(R.id.fragmentContainer1);
+
+ Fragment fragment2 = fragment1.getChildFragmentManager().findFragmentByTag("inner");
+ FragmentTestUtil.assertChildren(innerContainer, fragment2);
+ }
+
private View findViewById(int viewId) {
return mActivityRule.getActivity().findViewById(viewId);
}
@@ -925,4 +1025,25 @@
super.onViewCreated(view, savedInstanceState);
}
}
+
+ public static class ParentFragment extends StrictViewFragment {
+ public ParentFragment() {
+ setLayoutId(R.layout.double_container);
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ View view = super.onCreateView(inflater, container, savedInstanceState);
+ final StrictViewFragment fragment2 = new StrictViewFragment();
+ fragment2.setLayoutId(R.layout.fragment_a);
+
+ getChildFragmentManager().beginTransaction()
+ .add(R.id.fragmentContainer1, fragment2, "inner")
+ .addToBackStack(null)
+ .commit();
+ getChildFragmentManager().executePendingTransactions();
+ return view;
+ }
+ }
}
diff --git a/fragment/tests/java/android/support/v4/app/PostponedTransitionTest.java b/fragment/tests/java/android/support/v4/app/PostponedTransitionTest.java
index fe41976..0f07b89 100644
--- a/fragment/tests/java/android/support/v4/app/PostponedTransitionTest.java
+++ b/fragment/tests/java/android/support/v4/app/PostponedTransitionTest.java
@@ -664,6 +664,9 @@
assertNull(fragment.getView());
assertNotNull(mBeginningFragment.getView());
assertEquals(View.VISIBLE, mBeginningFragment.getView().getVisibility());
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+ assertEquals(1f, mBeginningFragment.getView().getAlpha(), 0f);
+ }
assertTrue(mBeginningFragment.getView().isAttachedToWindow());
}
@@ -695,6 +698,9 @@
assertNotNull(fragment2);
assertNotNull(fragment2.getView());
assertEquals(View.VISIBLE, fragment2.getView().getVisibility());
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+ assertEquals(1f, fragment2.getView().getAlpha(), 0f);
+ }
assertTrue(fragment2.isResumed());
assertTrue(fragment2.isAdded());
assertTrue(fragment2.getView().isAttachedToWindow());
@@ -726,7 +732,12 @@
assertTrue(fromFragment.getView().isAttachedToWindow());
assertTrue(toFragment.getView().isAttachedToWindow());
assertEquals(View.VISIBLE, fromFragment.getView().getVisibility());
- assertEquals(View.INVISIBLE, toFragment.getView().getVisibility());
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+ assertEquals(View.VISIBLE, toFragment.getView().getVisibility());
+ assertEquals(0f, toFragment.getView().getAlpha(), 0f);
+ } else {
+ assertEquals(View.INVISIBLE, toFragment.getView().getVisibility());
+ }
assureNoTransition(fromFragment);
assureNoTransition(toFragment);
assertTrue(fromFragment.isResumed());
diff --git a/fragment/tests/res/layout/with_edit_text.xml b/fragment/tests/res/layout/with_edit_text.xml
new file mode 100644
index 0000000..7fd21a0
--- /dev/null
+++ b/fragment/tests/res/layout/with_edit_text.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+ <EditText android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:id="@+id/editText"
+ android:text="@string/hello">
+ <requestFocus/>
+ </EditText>
+</LinearLayout>
diff --git a/gradle.properties b/gradle.properties
index 34b3995..fb870a9 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,3 +1,4 @@
org.gradle.jvmargs=-Xmx3g
org.gradle.daemon=true
-org.gradle.configureondemand=true
\ No newline at end of file
+org.gradle.configureondemand=true
+org.gradle.parallel=true
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index ccfc973..84939b4 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=../../../../tools/external/gradle/gradle-3.2-bin.zip
+distributionUrl=../../../../tools/external/gradle/gradle-3.3-bin.zip
diff --git a/graphics/drawable/Android.mk b/graphics/drawable/Android.mk
index f58493b..78652aa 100644
--- a/graphics/drawable/Android.mk
+++ b/graphics/drawable/Android.mk
@@ -25,7 +25,7 @@
LOCAL_SDK_VERSION := $(SUPPORT_CURRENT_SDK_VERSION)
LOCAL_SRC_FILES := $(call all-java-files-under, static/src)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/static/res
-LOCAL_MANIFEST_FILE := static/AndroidManifest.xml
+LOCAL_MANIFEST_FILE := static/AndroidManifest-make.xml
LOCAL_SHARED_ANDROID_LIBRARIES := \
android-support-compat \
android-support-annotations
@@ -44,7 +44,7 @@
LOCAL_SDK_VERSION := $(SUPPORT_CURRENT_SDK_VERSION)
LOCAL_SRC_FILES := $(call all-java-files-under, animated/src)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/animated/res
-LOCAL_MANIFEST_FILE := animated/AndroidManifest.xml
+LOCAL_MANIFEST_FILE := animated/AndroidManifest-make.xml
LOCAL_SHARED_ANDROID_LIBRARIES := \
android-support-compat \
android-support-vectordrawable \
diff --git a/graphics/drawable/animated/AndroidManifest-make.xml b/graphics/drawable/animated/AndroidManifest-make.xml
new file mode 100644
index 0000000..98f9e17
--- /dev/null
+++ b/graphics/drawable/animated/AndroidManifest-make.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.support.graphics.drawable.animated">
+ <application/>
+</manifest>
diff --git a/graphics/drawable/animated/AndroidManifest.xml b/graphics/drawable/animated/AndroidManifest.xml
index 98f9e17..58017dc 100644
--- a/graphics/drawable/animated/AndroidManifest.xml
+++ b/graphics/drawable/animated/AndroidManifest.xml
@@ -16,5 +16,6 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.support.graphics.drawable.animated">
+ <meta-data android:name="android.support.VERSION" android:value="${support-version}" />
<application/>
</manifest>
diff --git a/graphics/drawable/static/AndroidManifest-make.xml b/graphics/drawable/static/AndroidManifest-make.xml
new file mode 100644
index 0000000..8674cb4
--- /dev/null
+++ b/graphics/drawable/static/AndroidManifest-make.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.support.graphics.drawable">
+ <application/>
+</manifest>
diff --git a/graphics/drawable/static/AndroidManifest.xml b/graphics/drawable/static/AndroidManifest.xml
index e91290d..0383e4c 100644
--- a/graphics/drawable/static/AndroidManifest.xml
+++ b/graphics/drawable/static/AndroidManifest.xml
@@ -14,6 +14,8 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<manifest package="android.support.graphics.drawable">
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.support.graphics.drawable">
<application/>
+ <meta-data android:name="android.support.VERSION" android:value="${support-version}" />
</manifest>
diff --git a/media-compat/Android.mk b/media-compat/Android.mk
index 52dc3d8..0050ea4 100644
--- a/media-compat/Android.mk
+++ b/media-compat/Android.mk
@@ -38,6 +38,7 @@
$(call all-java-files-under,java) \
$(call all-Iaidl-files-under,java)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_MANIFEST_FILE := AndroidManifest-make.xml
LOCAL_SHARED_ANDROID_LIBRARIES := \
android-support-compat \
android-support-annotations
diff --git a/media-compat/AndroidManifest-make.xml b/media-compat/AndroidManifest-make.xml
new file mode 100644
index 0000000..c971549
--- /dev/null
+++ b/media-compat/AndroidManifest-make.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ package="android.support.mediacompat">
+ <uses-sdk android:minSdkVersion="9" tools:overrideLibrary="android.support.mediacompat"/>
+ <application />
+</manifest>
diff --git a/media-compat/AndroidManifest.xml b/media-compat/AndroidManifest.xml
index c971549..5f7b051 100644
--- a/media-compat/AndroidManifest.xml
+++ b/media-compat/AndroidManifest.xml
@@ -17,5 +17,6 @@
xmlns:tools="http://schemas.android.com/tools"
package="android.support.mediacompat">
<uses-sdk android:minSdkVersion="9" tools:overrideLibrary="android.support.mediacompat"/>
+ <meta-data android:name="android.support.VERSION" android:value="${support-version}" />
<application />
</manifest>
diff --git a/media-compat/api21/android/support/v4/media/MediaBrowserServiceCompatApi21.java b/media-compat/api21/android/support/v4/media/MediaBrowserServiceCompatApi21.java
index affb130..4035e63 100644
--- a/media-compat/api21/android/support/v4/media/MediaBrowserServiceCompatApi21.java
+++ b/media-compat/api21/android/support/v4/media/MediaBrowserServiceCompatApi21.java
@@ -71,6 +71,7 @@
mResultObj.sendResult(parcelListToItemList((List<Parcel>)result));
} else if (result instanceof Parcel) {
Parcel parcel = (Parcel) result;
+ parcel.setDataPosition(0);
mResultObj.sendResult(MediaBrowser.MediaItem.CREATOR.createFromParcel(parcel));
parcel.recycle();
} else {
diff --git a/media-compat/java/android/support/v4/media/MediaBrowserServiceCompat.java b/media-compat/java/android/support/v4/media/MediaBrowserServiceCompat.java
index a9fc7e8..de5047b 100644
--- a/media-compat/java/android/support/v4/media/MediaBrowserServiceCompat.java
+++ b/media-compat/java/android/support/v4/media/MediaBrowserServiceCompat.java
@@ -403,6 +403,11 @@
@Override
public Bundle getBrowserRootHints() {
+ // If EXTRA_MESSENGER_BINDER is used, mCurConnection is not null.
+ if (mCurConnection != null) {
+ return mCurConnection.rootHints == null ? null
+ : new Bundle(mCurConnection.rootHints);
+ }
return MediaBrowserServiceCompatApi24.getBrowserRootHints(mServiceObj);
}
}
diff --git a/percent/Android.mk b/percent/Android.mk
index b569224..aaeb65a 100644
--- a/percent/Android.mk
+++ b/percent/Android.mk
@@ -27,6 +27,7 @@
LOCAL_SDK_VERSION := $(SUPPORT_CURRENT_SDK_VERSION)
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_MANIFEST_FILE := AndroidManifest-make.xml
LOCAL_SHARED_ANDROID_LIBRARIES := android-support-v4
LOCAL_JAR_EXCLUDE_FILES := none
LOCAL_JAVA_LANGUAGE_VERSION := 1.7
diff --git a/percent/AndroidManifest-make.xml b/percent/AndroidManifest-make.xml
new file mode 100644
index 0000000..e979013
--- /dev/null
+++ b/percent/AndroidManifest-make.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.support.percent">
+ <uses-sdk android:minSdkVersion="9"/>
+ <application />
+</manifest>
diff --git a/percent/AndroidManifest.xml b/percent/AndroidManifest.xml
index e979013..0d55165 100644
--- a/percent/AndroidManifest.xml
+++ b/percent/AndroidManifest.xml
@@ -16,5 +16,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.support.percent">
<uses-sdk android:minSdkVersion="9"/>
+ <meta-data android:name="android.support.VERSION" android:value="${support-version}" />
<application />
</manifest>
diff --git a/recommendation/Android.mk b/recommendation/Android.mk
index 0e0a9d7..67721bb 100644
--- a/recommendation/Android.mk
+++ b/recommendation/Android.mk
@@ -27,6 +27,7 @@
LOCAL_SDK_VERSION := 21
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_MANIFEST_FILE := AndroidManifest-make.xml
LOCAL_SHARED_ANDROID_LIBRARIES := \
android-support-v4 \
android-support-annotations
diff --git a/recommendation/AndroidManifest-make.xml b/recommendation/AndroidManifest-make.xml
new file mode 100644
index 0000000..ef1223e
--- /dev/null
+++ b/recommendation/AndroidManifest-make.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.support.recommendation">
+ <uses-sdk android:minSdkVersion="21"/>
+ <application />
+</manifest>
diff --git a/recommendation/AndroidManifest.xml b/recommendation/AndroidManifest.xml
index ef1223e..e36c822 100644
--- a/recommendation/AndroidManifest.xml
+++ b/recommendation/AndroidManifest.xml
@@ -16,5 +16,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.support.recommendation">
<uses-sdk android:minSdkVersion="21"/>
+ <meta-data android:name="android.support.VERSION" android:value="${support-version}" />
<application />
</manifest>
diff --git a/transition/Android.mk b/transition/Android.mk
index c468ef1..aefedd7 100644
--- a/transition/Android.mk
+++ b/transition/Android.mk
@@ -34,6 +34,7 @@
$(call all-java-files-under,api23) \
$(call all-java-files-under,src)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_MANIFEST_FILE := AndroidManifest-make.xml
LOCAL_SHARED_ANDROID_LIBRARIES := \
android-support-annotations \
android-support-v4
diff --git a/transition/AndroidManifest-make.xml b/transition/AndroidManifest-make.xml
new file mode 100644
index 0000000..672e1b1
--- /dev/null
+++ b/transition/AndroidManifest-make.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.support.transition">
+ <uses-sdk android:minSdkVersion="14"/>
+ <application />
+</manifest>
diff --git a/transition/AndroidManifest.xml b/transition/AndroidManifest.xml
index 672e1b1..1059f63 100644
--- a/transition/AndroidManifest.xml
+++ b/transition/AndroidManifest.xml
@@ -16,5 +16,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.support.transition">
<uses-sdk android:minSdkVersion="14"/>
+ <meta-data android:name="android.support.VERSION" android:value="${support-version}" />
<application />
</manifest>
diff --git a/v13/Android.mk b/v13/Android.mk
index 1b30d99..9411930 100644
--- a/v13/Android.mk
+++ b/v13/Android.mk
@@ -34,6 +34,7 @@
$(call all-java-files-under, api25) \
$(call all-java-files-under, java)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_MANIFEST_FILE := AndroidManifest-make.xml
# Some projects expect to inherit android-support-v4 from
# android-support-v13, so we need to keep it static until they can be fixed.
LOCAL_STATIC_ANDROID_LIBRARIES := \
diff --git a/v13/AndroidManifest-make.xml b/v13/AndroidManifest-make.xml
new file mode 100644
index 0000000..ea25a74
--- /dev/null
+++ b/v13/AndroidManifest-make.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ package="android.support.v13">
+ <uses-sdk android:minSdkVersion="13" tools:overrideLibrary="android.support.v13"/>
+ <application />
+</manifest>
diff --git a/v13/AndroidManifest.xml b/v13/AndroidManifest.xml
index ea25a74..7449688 100644
--- a/v13/AndroidManifest.xml
+++ b/v13/AndroidManifest.xml
@@ -17,5 +17,6 @@
xmlns:tools="http://schemas.android.com/tools"
package="android.support.v13">
<uses-sdk android:minSdkVersion="13" tools:overrideLibrary="android.support.v13"/>
+ <meta-data android:name="android.support.VERSION" android:value="${support-version}"/>
<application />
</manifest>
diff --git a/v14/preference/Android.mk b/v14/preference/Android.mk
index 7a0b846..195e8a3 100644
--- a/v14/preference/Android.mk
+++ b/v14/preference/Android.mk
@@ -31,6 +31,7 @@
LOCAL_SDK_VERSION := $(SUPPORT_CURRENT_SDK_VERSION)
LOCAL_SRC_FILES := $(call all-java-files-under,src)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_MANIFEST_FILE := AndroidManifest-make.xml
LOCAL_SHARED_ANDROID_LIBRARIES := \
android-support-v7-preference \
android-support-v7-appcompat \
diff --git a/v14/preference/AndroidManifest-make.xml b/v14/preference/AndroidManifest-make.xml
new file mode 100644
index 0000000..b917bb4
--- /dev/null
+++ b/v14/preference/AndroidManifest-make.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.support.v14.preference">
+ <uses-sdk android:minSdkVersion="14" />
+ <application />
+</manifest>
diff --git a/v14/preference/AndroidManifest.xml b/v14/preference/AndroidManifest.xml
index 8b502c9..74cff2e 100644
--- a/v14/preference/AndroidManifest.xml
+++ b/v14/preference/AndroidManifest.xml
@@ -1,8 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="android.support.v14.preference"
- android:versionCode="1"
- android:versionName="1.0">
+ package="android.support.v14.preference">
<uses-sdk android:minSdkVersion="14" />
+ <meta-data android:name="android.support.VERSION" android:value="${support-version}" />
<application />
</manifest>
diff --git a/v17/leanback/Android.mk b/v17/leanback/Android.mk
index c6a50b4..d91436e 100644
--- a/v17/leanback/Android.mk
+++ b/v17/leanback/Android.mk
@@ -35,6 +35,7 @@
$(call all-java-files-under, api23) \
$(call all-java-files-under, src)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_MANIFEST_FILE := AndroidManifest-make.xml
LOCAL_SHARED_ANDROID_LIBRARIES := \
android-support-v7-recyclerview \
android-support-compat \
diff --git a/v17/leanback/AndroidManifest-make.xml b/v17/leanback/AndroidManifest-make.xml
new file mode 100644
index 0000000..20ef094
--- /dev/null
+++ b/v17/leanback/AndroidManifest-make.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.support.v17.leanback">
+ <uses-sdk android:minSdkVersion="17"/>
+ <application />
+</manifest>
diff --git a/v17/leanback/AndroidManifest.xml b/v17/leanback/AndroidManifest.xml
index 20ef094..ded4ce8 100644
--- a/v17/leanback/AndroidManifest.xml
+++ b/v17/leanback/AndroidManifest.xml
@@ -16,5 +16,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.support.v17.leanback">
<uses-sdk android:minSdkVersion="17"/>
+ <meta-data android:name="android.support.VERSION" android:value="${support-version}" />
<application />
</manifest>
diff --git a/v17/leanback/src/android/support/v17/leanback/app/ListRowDataAdapter.java b/v17/leanback/src/android/support/v17/leanback/app/ListRowDataAdapter.java
index 1f2788f..f9af12f 100644
--- a/v17/leanback/src/android/support/v17/leanback/app/ListRowDataAdapter.java
+++ b/v17/leanback/src/android/support/v17/leanback/app/ListRowDataAdapter.java
@@ -41,6 +41,7 @@
}
void initialize() {
+ mLastVisibleRowIndex = -1;
int i = mAdapter.size() - 1;
while (i >= 0) {
Row item = (Row) mAdapter.get(i);
@@ -123,7 +124,7 @@
int totalItems = lastVisibleRowIndex - mLastVisibleRowIndex;
if (totalItems > 0) {
onEventFired(ON_ITEM_RANGE_REMOVED,
- Math.min(lastVisibleRowIndex + 1, positionStart),
+ Math.min(mLastVisibleRowIndex + 1, positionStart),
totalItems);
}
}
diff --git a/v17/leanback/tests/java/android/support/v17/leanback/app/ListRowDataAdapterTest.java b/v17/leanback/tests/java/android/support/v17/leanback/app/ListRowDataAdapterTest.java
index b7cb4e8..0b40920 100644
--- a/v17/leanback/tests/java/android/support/v17/leanback/app/ListRowDataAdapterTest.java
+++ b/v17/leanback/tests/java/android/support/v17/leanback/app/ListRowDataAdapterTest.java
@@ -197,6 +197,48 @@
}
@Test
+ public void adapterSize_rowsRemoveAll() {
+ ArrayObjectAdapter adapter = new ArrayObjectAdapter(presenterSelector);
+ adapter.add(new SectionRow("section 1"));
+ for (int i = 0; i < 4; i++) {
+ HeaderItem headerItem = new HeaderItem(i, "header "+i);
+ adapter.add(new ListRow(headerItem, createListRowAdapter()));
+ }
+
+ ListRowDataAdapter listRowDataAdapter = new ListRowDataAdapter(adapter);
+ assertEquals(5, listRowDataAdapter.size());
+
+ adapter.clear();
+ assertEquals(0, listRowDataAdapter.size());
+
+ HeaderItem headerItem = new HeaderItem(10, "header "+10);
+ adapter.add(new ListRow(headerItem, createListRowAdapter()));
+ assertEquals(1, listRowDataAdapter.size());
+ }
+
+ @Test
+ public void changeRemove_revealInvisibleItems() {
+ ArrayObjectAdapter adapter = new ArrayObjectAdapter(presenterSelector);
+ for (int i = 0; i < 4; i++) {
+ HeaderItem headerItem = new HeaderItem(i, "header "+i);
+ adapter.add(new ListRow(headerItem, createListRowAdapter()));
+ }
+ adapter.add(new SectionRow("section"));
+ for (int i = 4; i < 8; i++) {
+ HeaderItem headerItem = new HeaderItem(i, "header "+i);
+ adapter.add(new ListRow(headerItem, createListRowAdapter()));
+ }
+
+ ListRowDataAdapter listRowDataAdapter = new ListRowDataAdapter(adapter);
+ assertEquals(9, listRowDataAdapter.size());
+
+ listRowDataAdapter.registerObserver(dataObserver);
+ adapter.removeItems(5, 4);
+ verify(dataObserver, times(1)).onItemRangeRemoved(4, 5);
+ assertEquals(4, listRowDataAdapter.size());
+ }
+
+ @Test
public void adapterSize_rowsRemoved() {
int itemCount = 4;
ArrayObjectAdapter adapter = new ArrayObjectAdapter(presenterSelector);
diff --git a/v17/preference-leanback/Android.mk b/v17/preference-leanback/Android.mk
index 263d334..8c0488f 100644
--- a/v17/preference-leanback/Android.mk
+++ b/v17/preference-leanback/Android.mk
@@ -35,6 +35,7 @@
$(call all-java-files-under,api21) \
$(call all-java-files-under,src)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_MANIFEST_FILE := AndroidManifest-make.xml
LOCAL_SHARED_ANDROID_LIBRARIES := \
android-support-v17-leanback \
android-support-v14-preference \
diff --git a/v17/preference-leanback/AndroidManifest-make.xml b/v17/preference-leanback/AndroidManifest-make.xml
new file mode 100644
index 0000000..e2cfe35
--- /dev/null
+++ b/v17/preference-leanback/AndroidManifest-make.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2015 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.support.v17.preference"
+ android:versionCode="1"
+ android:versionName="1.0">
+ <uses-sdk android:minSdkVersion="17" />
+ <application />
+</manifest>
diff --git a/v4/Android.mk b/v4/Android.mk
index a9c9145..c7e35aa 100644
--- a/v4/Android.mk
+++ b/v4/Android.mk
@@ -35,6 +35,7 @@
android-support-fragment \
android-support-annotations
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_MANIFEST_FILE := AndroidManifest-make.xml
LOCAL_JAR_EXCLUDE_FILES := none
LOCAL_JAVA_LANGUAGE_VERSION := 1.7
LOCAL_AAPT_FLAGS := --add-javadoc-annotation doconly
diff --git a/v4/AndroidManifest-make.xml b/v4/AndroidManifest-make.xml
new file mode 100644
index 0000000..d76c581
--- /dev/null
+++ b/v4/AndroidManifest-make.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ package="android.support.v4">
+ <uses-sdk android:minSdkVersion="9" tools:overrideLibrary="android.support.v4"/>
+ <application />
+</manifest>
diff --git a/v4/AndroidManifest.xml b/v4/AndroidManifest.xml
index d76c581..cecc743 100644
--- a/v4/AndroidManifest.xml
+++ b/v4/AndroidManifest.xml
@@ -17,5 +17,6 @@
xmlns:tools="http://schemas.android.com/tools"
package="android.support.v4">
<uses-sdk android:minSdkVersion="9" tools:overrideLibrary="android.support.v4"/>
+ <meta-data android:name="android.support.VERSION" android:value="${support-version}" />
<application />
</manifest>
diff --git a/v7/appcompat/Android.mk b/v7/appcompat/Android.mk
index 93baa95..3c5b44c 100644
--- a/v7/appcompat/Android.mk
+++ b/v7/appcompat/Android.mk
@@ -28,6 +28,7 @@
LOCAL_SDK_VERSION := $(SUPPORT_CURRENT_SDK_VERSION)
LOCAL_SRC_FILES := $(call all-java-files-under,src)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_MANIFEST_FILE := AndroidManifest-make.xml
LOCAL_STATIC_JAVA_LIBRARIES := \
android-support-vectordrawable \
android-support-animatedvectordrawable
diff --git a/v7/appcompat/AndroidManifest-make.xml b/v7/appcompat/AndroidManifest-make.xml
new file mode 100644
index 0000000..99b77ee
--- /dev/null
+++ b/v7/appcompat/AndroidManifest-make.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ package="android.support.v7.appcompat">
+ <uses-sdk android:minSdkVersion="9"
+ tools:overrideLibrary="android.support.graphics.drawable.animated"/>
+ <application/>
+</manifest>
diff --git a/v7/appcompat/AndroidManifest.xml b/v7/appcompat/AndroidManifest.xml
index 99b77ee..d5858d1 100644
--- a/v7/appcompat/AndroidManifest.xml
+++ b/v7/appcompat/AndroidManifest.xml
@@ -18,5 +18,6 @@
package="android.support.v7.appcompat">
<uses-sdk android:minSdkVersion="9"
tools:overrideLibrary="android.support.graphics.drawable.animated"/>
+ <meta-data android:name="android.support.VERSION" android:value="${support-version}" />
<application/>
</manifest>
diff --git a/v7/appcompat/res/layout/abc_action_mode_close_item_material.xml b/v7/appcompat/res/layout/abc_action_mode_close_item_material.xml
index b3babb2..118ce2b 100644
--- a/v7/appcompat/res/layout/abc_action_mode_close_item_material.xml
+++ b/v7/appcompat/res/layout/abc_action_mode_close_item_material.xml
@@ -14,14 +14,17 @@
limitations under the License.
-->
-<ImageView
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
- android:id="@+id/action_mode_close_button"
- android:contentDescription="@string/abc_action_mode_done"
- android:focusable="true"
- android:clickable="true"
- app:srcCompat="?attr/actionModeCloseDrawable"
- style="?attr/actionModeCloseButtonStyle"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"/>
\ No newline at end of file
+<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:id="@+id/action_mode_close_button"
+ style="?attr/actionModeCloseButtonStyle"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_marginEnd="16dip"
+ android:layout_marginRight="16dip"
+ android:clickable="true"
+ android:contentDescription="@string/abc_action_mode_done"
+ android:focusable="true"
+ android:paddingLeft="8dp"
+ android:paddingStart="8dp"
+ app:srcCompat="?attr/actionModeCloseDrawable" />
\ No newline at end of file
diff --git a/v7/appcompat/src/android/support/v7/app/AppCompatActivity.java b/v7/appcompat/src/android/support/v7/app/AppCompatActivity.java
index 89a6bdb..65abe2e 100644
--- a/v7/appcompat/src/android/support/v7/app/AppCompatActivity.java
+++ b/v7/appcompat/src/android/support/v7/app/AppCompatActivity.java
@@ -16,8 +16,6 @@
package android.support.v7.app;
-import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
-
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;
@@ -28,7 +26,6 @@
import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
-import android.support.annotation.RestrictTo;
import android.support.annotation.StyleRes;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.FragmentActivity;
@@ -242,10 +239,7 @@
getDelegate().invalidateOptionsMenu();
}
- /**
- * @hide
- */
- @RestrictTo(LIBRARY_GROUP)
+ @Override
public void invalidateOptionsMenu() {
getDelegate().invalidateOptionsMenu();
}
diff --git a/v7/appcompat/src/android/support/v7/widget/SearchView.java b/v7/appcompat/src/android/support/v7/widget/SearchView.java
index 40793df..5b3b777 100644
--- a/v7/appcompat/src/android/support/v7/widget/SearchView.java
+++ b/v7/appcompat/src/android/support/v7/widget/SearchView.java
@@ -511,8 +511,6 @@
return mSearchSrcTextView.getInputType();
}
- /** @hide */
- @RestrictTo(LIBRARY_GROUP)
@Override
public boolean requestFocus(int direction, Rect previouslyFocusedRect) {
// Don't accept focus if in the middle of clearing focus
@@ -531,8 +529,6 @@
}
}
- /** @hide */
- @RestrictTo(LIBRARY_GROUP)
@Override
public void clearFocus() {
mClearingFocus = true;
diff --git a/v7/cardview/Android.mk b/v7/cardview/Android.mk
index cd3b407..40f6b23 100644
--- a/v7/cardview/Android.mk
+++ b/v7/cardview/Android.mk
@@ -31,6 +31,7 @@
$(call all-java-files-under,api21) \
$(call all-java-files-under,src)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_MANIFEST_FILE := AndroidManifest-make.xml
LOCAL_SHARED_ANDROID_LIBRARIES := \
android-support-annotations
LOCAL_JAR_EXCLUDE_FILES := none
diff --git a/v7/cardview/AndroidManifest-make.xml b/v7/cardview/AndroidManifest-make.xml
new file mode 100644
index 0000000..c35e369
--- /dev/null
+++ b/v7/cardview/AndroidManifest-make.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.support.v7.cardview">
+ <uses-sdk android:minSdkVersion="9"/>
+ <application />
+</manifest>
diff --git a/v7/cardview/AndroidManifest.xml b/v7/cardview/AndroidManifest.xml
index c35e369..e85003c 100644
--- a/v7/cardview/AndroidManifest.xml
+++ b/v7/cardview/AndroidManifest.xml
@@ -16,5 +16,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.support.v7.cardview">
<uses-sdk android:minSdkVersion="9"/>
+ <meta-data android:name="android.support.VERSION" android:value="${support-version}" />
<application />
</manifest>
diff --git a/v7/gridlayout/Android.mk b/v7/gridlayout/Android.mk
index 6eac23b4..c584dbe 100644
--- a/v7/gridlayout/Android.mk
+++ b/v7/gridlayout/Android.mk
@@ -29,6 +29,7 @@
LOCAL_SDK_VERSION := $(SUPPORT_CURRENT_SDK_VERSION)
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_MANIFEST_FILE := AndroidManifest-make.xml
LOCAL_SHARED_ANDROID_LIBRARIES := \
android-support-compat \
android-support-core-ui \
diff --git a/v7/gridlayout/AndroidManifest-make.xml b/v7/gridlayout/AndroidManifest-make.xml
new file mode 100644
index 0000000..d2cc627
--- /dev/null
+++ b/v7/gridlayout/AndroidManifest-make.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.support.v7.gridlayout">
+ <uses-sdk android:minSdkVersion="9"/>
+ <application />
+</manifest>
diff --git a/v7/gridlayout/AndroidManifest.xml b/v7/gridlayout/AndroidManifest.xml
index d2cc627..dfcc942 100644
--- a/v7/gridlayout/AndroidManifest.xml
+++ b/v7/gridlayout/AndroidManifest.xml
@@ -16,5 +16,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.support.v7.gridlayout">
<uses-sdk android:minSdkVersion="9"/>
+ <meta-data android:name="android.support.VERSION" android:value="${support-version}" />
<application />
</manifest>
diff --git a/v7/mediarouter/Android.mk b/v7/mediarouter/Android.mk
index 21b4a62..6162f87 100644
--- a/v7/mediarouter/Android.mk
+++ b/v7/mediarouter/Android.mk
@@ -35,6 +35,7 @@
$(call all-java-files-under,api24) \
$(call all-java-files-under,src)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_MANIFEST_FILE := AndroidManifest-make.xml
LOCAL_SHARED_ANDROID_LIBRARIES := \
android-support-v7-appcompat \
android-support-v7-palette \
diff --git a/v7/mediarouter/AndroidManifest-make.xml b/v7/mediarouter/AndroidManifest-make.xml
new file mode 100644
index 0000000..59d9f99
--- /dev/null
+++ b/v7/mediarouter/AndroidManifest-make.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.support.v7.mediarouter">
+ <uses-sdk android:minSdkVersion="9"/>
+ <application />
+</manifest>
diff --git a/v7/mediarouter/AndroidManifest.xml b/v7/mediarouter/AndroidManifest.xml
index 59d9f99..bbebdfe 100644
--- a/v7/mediarouter/AndroidManifest.xml
+++ b/v7/mediarouter/AndroidManifest.xml
@@ -16,5 +16,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.support.v7.mediarouter">
<uses-sdk android:minSdkVersion="9"/>
+ <meta-data android:name="android.support.VERSION" android:value="${support-version}" />
<application />
</manifest>
diff --git a/v7/palette/Android.mk b/v7/palette/Android.mk
index c21dad3..a9f9a75 100644
--- a/v7/palette/Android.mk
+++ b/v7/palette/Android.mk
@@ -29,7 +29,7 @@
LOCAL_SDK_VERSION := $(SUPPORT_CURRENT_SDK_VERSION)
LOCAL_SRC_FILES := $(call all-java-files-under, src/main)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/src/main/res
-LOCAL_MANIFEST_FILE := src/main/AndroidManifest.xml
+LOCAL_MANIFEST_FILE := src/main/AndroidManifest-make.xml
LOCAL_SHARED_ANDROID_LIBRARIES := \
android-support-compat \
android-support-core-utils \
diff --git a/v7/palette/src/main/AndroidManifest-make.xml b/v7/palette/src/main/AndroidManifest-make.xml
new file mode 100644
index 0000000..5124bc5
--- /dev/null
+++ b/v7/palette/src/main/AndroidManifest-make.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.support.v7.palette">
+ <uses-sdk android:minSdkVersion="9"/>
+ <application />
+</manifest>
diff --git a/v7/palette/src/main/AndroidManifest.xml b/v7/palette/src/main/AndroidManifest.xml
index c44818a..52e90a2 100644
--- a/v7/palette/src/main/AndroidManifest.xml
+++ b/v7/palette/src/main/AndroidManifest.xml
@@ -16,6 +16,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.support.v7.palette">
<uses-sdk android:minSdkVersion="9"/>
- <application>
- </application>
+ <meta-data android:name="android.support.VERSION" android:value="${support-version}" />
+ <application />
</manifest>
diff --git a/v7/preference/Android.mk b/v7/preference/Android.mk
index e751e1c..110aed2 100644
--- a/v7/preference/Android.mk
+++ b/v7/preference/Android.mk
@@ -32,6 +32,7 @@
$(call all-java-files-under,constants) \
$(call all-java-files-under,src)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_MANIFEST_FILE := AndroidManifest-make.xml
LOCAL_SHARED_ANDROID_LIBRARIES := \
android-support-v7-appcompat \
android-support-v7-recyclerview \
diff --git a/v7/preference/AndroidManifest-make.xml b/v7/preference/AndroidManifest-make.xml
new file mode 100644
index 0000000..9231775
--- /dev/null
+++ b/v7/preference/AndroidManifest-make.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.support.v7.preference">
+ <uses-sdk android:minSdkVersion="9" />
+ <application />
+</manifest>
diff --git a/v7/preference/AndroidManifest.xml b/v7/preference/AndroidManifest.xml
index da9c80e..19e6215 100644
--- a/v7/preference/AndroidManifest.xml
+++ b/v7/preference/AndroidManifest.xml
@@ -1,8 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="android.support.v7.preference"
- android:versionCode="1"
- android:versionName="1.0">
+ package="android.support.v7.preference">
<uses-sdk android:minSdkVersion="9" />
+ <meta-data android:name="android.support.VERSION" android:value="${support-version}" />
<application />
</manifest>
diff --git a/v7/recyclerview/Android.mk b/v7/recyclerview/Android.mk
index e434ab2..819b104 100644
--- a/v7/recyclerview/Android.mk
+++ b/v7/recyclerview/Android.mk
@@ -29,6 +29,7 @@
LOCAL_SDK_VERSION := $(SUPPORT_CURRENT_SDK_VERSION)
LOCAL_SRC_FILES := $(call all-java-files-under,src)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_MANIFEST_FILE := AndroidManifest-make.xml
LOCAL_SHARED_ANDROID_LIBRARIES := \
android-support-compat \
android-support-core-ui \
diff --git a/v7/recyclerview/AndroidManifest-make.xml b/v7/recyclerview/AndroidManifest-make.xml
new file mode 100644
index 0000000..d1c1489
--- /dev/null
+++ b/v7/recyclerview/AndroidManifest-make.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.support.v7.recyclerview">
+ <uses-sdk android:minSdkVersion="9"/>
+</manifest>
diff --git a/v7/recyclerview/AndroidManifest.xml b/v7/recyclerview/AndroidManifest.xml
index d1c1489..f4f010d 100644
--- a/v7/recyclerview/AndroidManifest.xml
+++ b/v7/recyclerview/AndroidManifest.xml
@@ -16,4 +16,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.support.v7.recyclerview">
<uses-sdk android:minSdkVersion="9"/>
+ <meta-data android:name="android.support.VERSION" android:value="${support-version}" />
</manifest>
diff --git a/v7/recyclerview/tests/src/android/support/v7/widget/StaggeredGridLayoutManagerTest.java b/v7/recyclerview/tests/src/android/support/v7/widget/StaggeredGridLayoutManagerTest.java
index 64111c5..d92b169 100644
--- a/v7/recyclerview/tests/src/android/support/v7/widget/StaggeredGridLayoutManagerTest.java
+++ b/v7/recyclerview/tests/src/android/support/v7/widget/StaggeredGridLayoutManagerTest.java
@@ -279,7 +279,10 @@
item.mText + " (" + item.mId + ")");
}
});
- waitFirstLayout();
+ mLayoutManager.expectLayouts(1);
+ setRecyclerView(mRecyclerView);
+ mLayoutManager.waitForLayout(10);
+ getInstrumentation().waitForIdleSync();
ViewGroup lastChild = (ViewGroup) mRecyclerView.getChildAt(
mRecyclerView.getChildCount() - 1);
RecyclerView.ViewHolder lastViewHolder = mRecyclerView.getChildViewHolder(lastChild);