Merge "Allow the parent to be set for nodes created by ExploreByTouchHelper." into nyc-support-25.1-dev
diff --git a/.gitignore b/.gitignore
index 6c671f7..a59f7e1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@
.project
.settings/
project.properties
+local.properties
**/bin
**/gen
*.iml
diff --git a/annotations/src/android/support/annotation/NonNull.java b/annotations/src/android/support/annotation/NonNull.java
index 226f8c3..708bc6d 100644
--- a/annotations/src/android/support/annotation/NonNull.java
+++ b/annotations/src/android/support/annotation/NonNull.java
@@ -15,15 +15,17 @@
*/
package android.support.annotation;
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PACKAGE;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.CLASS;
+
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.CLASS;
-
/**
* Denotes that a parameter, field or method return value can never be null.
* <p>
@@ -31,6 +33,6 @@
*/
@Documented
@Retention(CLASS)
-@Target({METHOD, PARAMETER, FIELD})
+@Target({METHOD, PARAMETER, FIELD, ANNOTATION_TYPE, PACKAGE})
public @interface NonNull {
}
diff --git a/annotations/src/android/support/annotation/Nullable.java b/annotations/src/android/support/annotation/Nullable.java
index 590b48f..5227625 100644
--- a/annotations/src/android/support/annotation/Nullable.java
+++ b/annotations/src/android/support/annotation/Nullable.java
@@ -15,15 +15,17 @@
*/
package android.support.annotation;
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PACKAGE;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.CLASS;
+
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.CLASS;
-
/**
* Denotes that a parameter, field or method return value can be null.
* <p>
@@ -38,6 +40,6 @@
*/
@Documented
@Retention(CLASS)
-@Target({METHOD, PARAMETER, FIELD})
+@Target({METHOD, PARAMETER, FIELD, ANNOTATION_TYPE, PACKAGE})
public @interface Nullable {
}
diff --git a/annotations/src/android/support/annotation/RestrictTo.java b/annotations/src/android/support/annotation/RestrictTo.java
index 65c8ba0..0aff690 100644
--- a/annotations/src/android/support/annotation/RestrictTo.java
+++ b/annotations/src/android/support/annotation/RestrictTo.java
@@ -15,9 +15,6 @@
*/
package android.support.annotation;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.FIELD;
@@ -26,6 +23,9 @@
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.CLASS;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
/**
* Denotes that the annotated element should only be accessed from within a
* specific scope (as defined by {@link Scope}).
@@ -57,9 +57,24 @@
enum Scope {
/**
- * Restrict usage to code within the same group ID (based on gradle
- * group ID).
+ * Restrict usage to code within the same library (e.g. the same
+ * gradle group ID and artifact ID).
*/
+ LIBRARY,
+
+ /**
+ * Restrict usage to code within the same group of libraries.
+ * This corresponds to the gradle group ID.
+ */
+ LIBRARY_GROUP,
+
+ /**
+ * Restrict usage to code within the same group ID (based on gradle
+ * group ID). This is an alias for {@link #LIBRARY_GROUP}.
+ *
+ * @deprecated Use {@link #LIBRARY_GROUP} instead
+ */
+ @Deprecated
GROUP_ID,
/**
diff --git a/api/current.txt b/api/current.txt
index 2cd420f..7226ce8 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -3322,6 +3322,7 @@
method public abstract PropertyT createProperty(java.lang.String, int);
method public final java.util.List<PropertyT> getProperties();
method public abstract void setListener(android.support.v17.leanback.widget.ParallaxSource.Listener);
+ method public void updateValues();
method public abstract void verifyProperties() throws java.lang.IllegalStateException;
}
@@ -4336,14 +4337,14 @@
method public java.lang.Object getLastCustomNonConfigurationInstance();
method public android.support.v4.app.FragmentManager getSupportFragmentManager();
method public android.support.v4.app.LoaderManager getSupportLoaderManager();
- method public final android.support.v4.media.session.MediaControllerCompat getSupportMediaController();
+ method public final deprecated android.support.v4.media.session.MediaControllerCompat getSupportMediaController();
method public void onAttachFragment(android.support.v4.app.Fragment);
method protected void onResumeFragments();
method public java.lang.Object onRetainCustomNonConfigurationInstance();
method public final java.lang.Object onRetainNonConfigurationInstance();
method public void setEnterSharedElementCallback(android.support.v4.app.SharedElementCallback);
method public void setExitSharedElementCallback(android.support.v4.app.SharedElementCallback);
- method public final void setSupportMediaController(android.support.v4.media.session.MediaControllerCompat);
+ method public final deprecated void setSupportMediaController(android.support.v4.media.session.MediaControllerCompat);
method public void startActivityFromFragment(android.support.v4.app.Fragment, android.content.Intent, int);
method public void startActivityFromFragment(android.support.v4.app.Fragment, android.content.Intent, int, android.os.Bundle);
method public void startIntentSenderFromFragment(android.support.v4.app.Fragment, android.content.IntentSender, int, android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException;
@@ -5734,6 +5735,7 @@
method public boolean dispatchMediaButtonEvent(android.view.KeyEvent);
method public android.os.Bundle getExtras();
method public long getFlags();
+ method public static android.support.v4.media.session.MediaControllerCompat getMediaController(android.app.Activity);
method public java.lang.Object getMediaController();
method public android.support.v4.media.MediaMetadataCompat getMetadata();
method public java.lang.String getPackageName();
@@ -5748,6 +5750,7 @@
method public void registerCallback(android.support.v4.media.session.MediaControllerCompat.Callback);
method public void registerCallback(android.support.v4.media.session.MediaControllerCompat.Callback, android.os.Handler);
method public void sendCommand(java.lang.String, android.os.Bundle, android.os.ResultReceiver);
+ method public static void setMediaController(android.app.Activity, android.support.v4.media.session.MediaControllerCompat);
method public void setVolumeTo(int, int);
method public void unregisterCallback(android.support.v4.media.session.MediaControllerCompat.Callback);
}
@@ -5922,17 +5925,12 @@
field public static final long ACTION_REWIND = 8L; // 0x8L
field public static final long ACTION_SEEK_TO = 256L; // 0x100L
field public static final long ACTION_SET_RATING = 128L; // 0x80L
- field public static final long ACTION_SET_REPEAT_MODE = 262144L; // 0x40000L
- field public static final long ACTION_SET_SHUFFLE_MODE_ENABLED = 524288L; // 0x80000L
field public static final long ACTION_SKIP_TO_NEXT = 32L; // 0x20L
field public static final long ACTION_SKIP_TO_PREVIOUS = 16L; // 0x10L
field public static final long ACTION_SKIP_TO_QUEUE_ITEM = 4096L; // 0x1000L
field public static final long ACTION_STOP = 1L; // 0x1L
field public static final android.os.Parcelable.Creator<android.support.v4.media.session.PlaybackStateCompat> CREATOR;
field public static final long PLAYBACK_POSITION_UNKNOWN = -1L; // 0xffffffffffffffffL
- field public static final int REPEAT_MODE_ALL = 2; // 0x2
- field public static final int REPEAT_MODE_NONE = 0; // 0x0
- field public static final int REPEAT_MODE_ONE = 1; // 0x1
field public static final int STATE_BUFFERING = 6; // 0x6
field public static final int STATE_CONNECTING = 8; // 0x8
field public static final int STATE_ERROR = 7; // 0x7
diff --git a/build.gradle b/build.gradle
index e47de23..b67729e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,6 +1,7 @@
import android.support.doclava.DoclavaMultilineJavadocOptionFileOption
import com.android.build.gradle.internal.coverage.JacocoReportTask
import com.android.build.gradle.internal.tasks.DeviceProviderInstrumentTestTask
+import org.gradle.internal.os.OperatingSystem
import android.support.checkapi.CheckApiTask
import android.support.checkapi.UpdateApiTask
@@ -31,10 +32,11 @@
doclava project(':doclava')
}
+gradle.ext.currentSdk = 25
ext.supportVersion = '25.1.0-SNAPSHOT'
ext.extraVersion = 40
ext.supportRepoOut = ''
-ext.buildToolsVersion = '23.0.2'
+ext.buildToolsVersion = '24.0.1'
ext.buildNumber = Integer.toString(ext.extraVersion)
ext.testRunnerVersion = '0.6-alpha'
@@ -44,6 +46,11 @@
// required for the doclava dependency.
ext.usePrebuilts = "true"
+// Use the embedded SDK by default, which can be overridden by setting the 'sdk.dir' property
+// (e.g. local.properties) or the 'ANDROID_HOME' environment variable.
+final String platform = OperatingSystem.current().isMacOsX() ? 'darwin' : 'linux'
+System.setProperty('android.home', "${rootDir}/../../prebuilts/fullsdk-${platform}")
+
/*
* With the build server you are given two env variables.
* The OUT_DIR is a temporary directory you can use to put things during the build.
@@ -104,8 +111,11 @@
task(prepareRepo) << {
}
+// lint every library
+task(lint) << {
+}
-import android.support.build.ApiModule
+
import com.google.common.io.Files
import com.google.common.base.Charsets
@@ -291,6 +301,11 @@
// enable code coverage for debug builds only if we are not running inside the IDE
// enabling coverage reports breaks the method parameter resolution in the IDE debugger
project.android.buildTypes.debug.testCoverageEnabled = !hasProperty('android.injected.invoked.from.ide')
+
+ // Ensure we run API lint checks.
+ project.android.lintOptions.check 'NewApi'
+ project.android.lintOptions.fatal 'NewApi'
+ project.parent.lint.dependsOn project.lint
}
// Create release and separate zip task for Android libraries (and android-annotations,
diff --git a/buildSrc/apiModule.gradle b/buildSrc/apiModule.gradle
deleted file mode 100644
index b3186b7..0000000
--- a/buildSrc/apiModule.gradle
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Generic build.gradle file that can be used for API specific support lib implementations.
- * This file is used only if Android Studio opens the project.
- */
-apply plugin: 'com.android.library'
-def apiModule = gradle.ext.getApiModule(project)
-logger.info ("apiModule for ${project.projectDir} is $apiModule. "
- + "compileSDK: ${apiModule.apiForSourceSet} minSDK: ${apiModule.api}")
-android {
- compileSdkVersion apiModule.apiForSourceSet
- // these api modules all use the same package name so we should not package their BuildConfig
- // files.
- packageBuildConfig false
-
- sourceSets {
- main.manifest.srcFile '../AndroidManifest.xml'
- main.java.srcDirs = ['.']
- main.res.srcDirs = []
- apiModule.resourceFolders.each {
- main.res.srcDirs += "../$it"
- }
- main.assets.srcDirs = []
- apiModule.assetFolders.each {
- main.assets.srcDirs += "../$it"
- }
- main.resources.srcDirs = []
- apiModule.javaResourceFolders.each {
- main.resources.srcDirs += "../$it"
- }
- }
-
- lintOptions {
- abortOnError false
- }
-
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_7
- targetCompatibility JavaVersion.VERSION_1_7
- }
-
- enforceUniquePackageName = false
-}
-
-
-dependencies {
- if (apiModule.prev != null) {
- compile project(apiModule.prev.moduleName)
- } else {
- apiModule.parentModuleDependencies.each { dep ->
- compile project(dep)
- }
- }
-}
diff --git a/buildSrc/src/main/java/android/support/build/ApiModule.java b/buildSrc/src/main/java/android/support/build/ApiModule.java
deleted file mode 100644
index 4b73f94..0000000
--- a/buildSrc/src/main/java/android/support/build/ApiModule.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * 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.
- */
-
-package android.support.build;
-
-import org.gradle.api.tasks.SourceSet;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Defines an API specific support library modules.
- * e.g. Honeycomb implementation of Support-v4.
- *
- * These ApiModules are converted into real modules when project is opened in AndroidStudio.
- * When project is run from the command line, they are converted into source sets.
- * This allows us to rely on previous compile setup to deploy projects with their dependencies while
- * supporting development on Android Studio.
- */
-public class ApiModule {
- public static final int CURRENT = 99;
- private String mFolderName;
- private int mApi;
- private SourceSet mSourceSet;
- private ApiModule mPrev;
- private String mParentModuleName;
- private List<String> mParentModuleDependencies;
- private List<String> mResourceFolders = new ArrayList<>();
- private List<String> mAssetFolders = new ArrayList<>();
- private List<String> mJavaResourceFolders = new ArrayList<>();
-
- public ApiModule(String folderName, int api) {
- mFolderName = folderName;
- mApi = api;
- }
-
- public ApiModule resources(String... resourceFolders) {
- Collections.addAll(mResourceFolders, resourceFolders);
- return this;
- }
-
- public ApiModule assets(String... assetFolders) {
- Collections.addAll(mAssetFolders, assetFolders);
- return this;
- }
-
- public ApiModule javaResources(String... javaResourceFolders) {
- Collections.addAll(mJavaResourceFolders, javaResourceFolders);
- return this;
- }
-
- public List<String> getResourceFolders() {
- return mResourceFolders;
- }
-
- public List<String> getAssetFolders() {
- return mAssetFolders;
- }
-
- public List<String> getJavaResourceFolders() {
- return mJavaResourceFolders;
- }
-
- public void setResourceFolders(List<String> resourceFolders) {
- mResourceFolders = resourceFolders;
- }
-
- public String getParentModuleName() {
- return mParentModuleName;
- }
-
- public void setParentModuleName(String parentModuleName) {
- mParentModuleName = parentModuleName;
- }
-
- public String getFolderName() {
- return mFolderName;
- }
-
- public int getApi() {
- return mApi;
- }
-
- public Object getApiForSourceSet() {
- return mApi == CURRENT ? "current" : mApi;
- }
-
- public SourceSet getSourceSet() {
- return mSourceSet;
- }
-
- public void setSourceSet(SourceSet sourceSet) {
- mSourceSet = sourceSet;
- }
-
- public ApiModule getPrev() {
- return mPrev;
- }
-
- public void setPrev(ApiModule prev) {
- mPrev = prev;
- }
-
- public String getModuleName() {
- return ":" + mParentModuleName + "-" + mFolderName;
- }
-
- public List<String> getParentModuleDependencies() {
- return mParentModuleDependencies;
- }
-
- public void setParentModuleDependencies(List<String> parentModuleDependencies) {
- mParentModuleDependencies = parentModuleDependencies;
- }
-}
diff --git a/buildSrc/studioCompat.gradle b/buildSrc/studioCompat.gradle
deleted file mode 100644
index 1c58c62..0000000
--- a/buildSrc/studioCompat.gradle
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * 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.
- */
-import android.support.build.ApiModule
-import java.nio.file.Path;
-import java.nio.file.Paths;
-
-/**
- * To add platform specific code to a library:
- * 1) add the related source set into the studioCompat map (defined below)
- * 2) In your build gradle file, call:
- * * createApiSourceSets(project, gradle.ext.studioCompat.modules.<PROJECT>.apiTargets)
- * * setApiModuleDependencies(project, dependencies, gradle.ext.studioCompat.modules.<PROJECT>.dependencies)
- */
-
-def studioCompat = [
- enableApiModules : hasProperty('android.injected.invoked.from.ide'),
- modules : [
- compat : [
- apiTargets : [
- new ApiModule("gingerbread",9),
- new ApiModule("honeycomb",11),
- new ApiModule("honeycomb_mr1",12),
- new ApiModule("honeycomb_mr2",13),
- new ApiModule("ics",14),
- new ApiModule("ics-mr1",15),
- new ApiModule("jellybean", 16),
- new ApiModule("jellybean-mr1",17),
- new ApiModule("jellybean-mr2",18),
- new ApiModule("kitkat",19),
- new ApiModule("api20",20),
- new ApiModule("api21",21),
- new ApiModule("api22",22),
- new ApiModule("api23",23),
- new ApiModule("api24",24)
- ],
- dependencies : [":support-annotations"],
- folder : "compat",
- moduleName : "support-compat"
- ],
- mediacompat : [
- apiTargets : [
- new ApiModule("ics",14),
- new ApiModule("jellybean-mr2",18),
- new ApiModule("kitkat",19),
- new ApiModule("api21",21),
- new ApiModule("api22",22),
- new ApiModule("api23",23),
- new ApiModule("api24",24)
- ],
- dependencies : [":support-compat"],
- folder : "media-compat",
- moduleName : "support-media-compat"
- ],
- coreutils : [
- apiTargets : [
- new ApiModule("gingerbread",9),
- new ApiModule("honeycomb",11),
- new ApiModule("jellybean", 16),
- new ApiModule("kitkat",19),
- new ApiModule("api20",20),
- new ApiModule("api21",21),
- new ApiModule("api23",23),
- new ApiModule("api24",24)
- ],
- dependencies : [":support-compat"],
- folder : "core-utils",
- moduleName : "support-core-utils"
- ],
- coreui : [
- apiTargets : [
- new ApiModule("honeycomb",11),
- new ApiModule("ics",14),
- new ApiModule("jellybean-mr2",18),
- new ApiModule("api21",21)
- ],
- dependencies : [":support-compat"],
- folder : "core-ui",
- moduleName : "support-core-ui"
- ],
- fragment : [
- apiTargets : [
- new ApiModule("gingerbread",9),
- new ApiModule("honeycomb",11),
- new ApiModule("jellybean", 16),
- new ApiModule("api21",21)
- ],
- dependencies : [":support-media-compat", ":support-core-ui", ":support-core-utils"],
- folder : "fragment",
- moduleName : "support-fragment"
- ],
- v13 : [
- apiTargets : [
- new ApiModule("ics", 14),
- new ApiModule("ics-mr1", 15),
- new ApiModule("api23", 23),
- new ApiModule("api24", 24),
- new ApiModule("api25", ApiModule.CURRENT)
- ],
- dependencies : [":support-v4"],
- folder : "v13",
- moduleName : "support-v13"
- ],
- mediaRouter : [
- apiTargets : [
- new ApiModule("jellybean", 16),
- new ApiModule("jellybean-mr1", 17),
- new ApiModule("jellybean-mr2", 18),
- new ApiModule("api24",24)
- ],
- folder : "v7/mediarouter",
- moduleName : "support-mediarouter-v7"
- ]
- ]
-]
-
-/**
- * Adds a link to the previous ApiModule for each module. This information is later used when
- * setting dependencies.
- */
-def setupDependencies(projectConfig) {
- projectConfig.apiTargets.eachWithIndex { entry, index ->
- entry.parentModuleName = projectConfig.moduleName
- entry.prev = index == 0 ? null : projectConfig.apiTargets[index - 1]
- }
-}
-gradle.ext.currentSdk = studioCompat.enableApiModules ? ApiModule.CURRENT : 'current'
-
-// the hashmap from apiModuleProjectFolder -> ApiModule
-gradle.ext.folderToApiModuleMapping = new HashMap()
-
-/**
- * For each APIModule in the given projectConfig, creates a gradle module. These modules use the
- * common `apiModule.gradle` build file.
- */
-def createModules(projectConfig) {
- Path buildFile = Paths.get(file("apiModule.gradle").toURI())
- projectConfig.apiTargets.each { ApiModule module ->
- logger.info "creating ${module.moduleName}"
- module.setParentModuleDependencies(projectConfig.dependencies)
- include "${module.moduleName}"
- def folder = new File(rootDir, "${projectConfig.folder}/${module.folderName}")
- project("${module.moduleName}").projectDir = folder
- project("${module.moduleName}").buildFileName = Paths.get(folder.toURI()).relativize(buildFile)
- gradle.ext.folderToApiModuleMapping[folder.canonicalPath] = module
- }
-}
-
-/**
- * returns the APIModule for the given project.
- */
-ApiModule getApiModule(Project project) {
- return gradle.ext.folderToApiModuleMapping[project.projectDir.canonicalPath]
-}
-
-studioCompat.modules.each { k, v ->
- setupDependencies(v)
-}
-// create these fake modules only if Studio opens the project.
-if (studioCompat.enableApiModules) {
- // validate we have the 99 folder, otherwise it wont work
- def currentSdkPrebuilt = file("${rootProject.projectDir}/../../prebuilts/sdk/" +
- "${ApiModule.CURRENT}/")
- if (!currentSdkPrebuilt.exists()) {
- throw new GradleScriptException(
- "You need a symlink in prebuilts/sdk/${ApiModule.CURRENT} that points to"
- + " prebuilts/sdk/current."
- + "Without it, studio cannot understand current SDK.\n"
- + "> ln -s ../../prebuilts/sdk/current "
- + "../../prebuilts/sdk/${ApiModule.CURRENT}\n"
- , new Exception())
- }
- Properties localProps = new Properties()
- def localPropsStream = new FileInputStream(file("${rootProject.projectDir}/local.properties"))
- try {
- localProps.load(localPropsStream)
- def sdkDir = localProps.get("sdk.dir")
- if (sdkDir != null && sdkDir != "") {
- throw new GradleScriptException("You should not have sdk.dir in local.properties because"
- + " it overrides android.dir and prevents studio from seeing current sdk. "
- + " Studio may add it by mistake, just remove it and it will work fine.",
- new Exception())
- }
- } finally {
- localPropsStream.close()
- }
- studioCompat.modules.each { k, v ->
- createModules(v)
- }
-}
-gradle.ext.studioCompat = studioCompat
-gradle.ext.getApiModule = this.&getApiModule
diff --git a/compat/api21/android/support/v4/app/ActivityCompatApi21.java b/compat/api21/android/support/v4/app/ActivityCompatApi21.java
index 248b0aa..ddc95fd 100644
--- a/compat/api21/android/support/v4/app/ActivityCompatApi21.java
+++ b/compat/api21/android/support/v4/app/ActivityCompatApi21.java
@@ -16,15 +16,14 @@
package android.support.v4.app;
+import android.annotation.TargetApi;
import android.app.Activity;
import android.app.SharedElementCallback;
import android.content.Context;
import android.graphics.Matrix;
import android.graphics.RectF;
-import android.media.session.MediaController;
import android.os.Parcelable;
import android.support.annotation.RequiresApi;
-import android.annotation.TargetApi;
import android.view.View;
import java.util.List;
@@ -34,10 +33,6 @@
@TargetApi(21)
class ActivityCompatApi21 {
- public static void setMediaController(Activity activity, Object mediaControllerObj) {
- activity.setMediaController((MediaController) mediaControllerObj);
- }
-
public static void finishAfterTransition(Activity activity) {
activity.finishAfterTransition();
}
diff --git a/compat/api23/android/support/v4/hardware/fingerprint/FingerprintManagerCompatApi23.java b/compat/api23/android/support/v4/hardware/fingerprint/FingerprintManagerCompatApi23.java
index 7143850..aa6b9ae 100644
--- a/compat/api23/android/support/v4/hardware/fingerprint/FingerprintManagerCompatApi23.java
+++ b/compat/api23/android/support/v4/hardware/fingerprint/FingerprintManagerCompatApi23.java
@@ -16,6 +16,8 @@
package android.support.v4.hardware.fingerprint;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.annotation.TargetApi;
import android.content.Context;
import android.hardware.fingerprint.FingerprintManager;
@@ -28,15 +30,13 @@
import javax.crypto.Cipher;
import javax.crypto.Mac;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Actual FingerprintManagerCompat implementation for API level 23 and later.
* @hide
*/
@RequiresApi(23)
@TargetApi(23)
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public final class FingerprintManagerCompatApi23 {
private static FingerprintManager getFingerprintManager(Context ctx) {
diff --git a/compat/api24/android/support/v4/net/TrafficStatsCompatApi24.java b/compat/api24/android/support/v4/net/TrafficStatsCompatApi24.java
index b2ebec4..834c6ad 100644
--- a/compat/api24/android/support/v4/net/TrafficStatsCompatApi24.java
+++ b/compat/api24/android/support/v4/net/TrafficStatsCompatApi24.java
@@ -16,6 +16,8 @@
package android.support.v4.net;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.annotation.TargetApi;
import android.net.TrafficStats;
import android.support.annotation.RequiresApi;
@@ -24,12 +26,10 @@
import java.net.DatagramSocket;
import java.net.SocketException;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/** @hide */
@RequiresApi(24)
@TargetApi(24)
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class TrafficStatsCompatApi24 {
public static void tagDatagramSocket(DatagramSocket socket) throws SocketException {
TrafficStats.tagDatagramSocket(socket);
diff --git a/compat/api24/android/support/v4/os/UserManagerCompatApi24.java b/compat/api24/android/support/v4/os/UserManagerCompatApi24.java
index 0d96ae0..ab6f91d 100644
--- a/compat/api24/android/support/v4/os/UserManagerCompatApi24.java
+++ b/compat/api24/android/support/v4/os/UserManagerCompatApi24.java
@@ -16,18 +16,18 @@
package android.support.v4.os;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.annotation.TargetApi;
import android.content.Context;
import android.os.UserManager;
import android.support.annotation.RequiresApi;
import android.support.annotation.RestrictTo;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/** @hide */
@RequiresApi(24)
@TargetApi(24)
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class UserManagerCompatApi24 {
public static boolean isUserUnlocked(Context context) {
return context.getSystemService(UserManager.class).isUserUnlocked();
diff --git a/compat/build.gradle b/compat/build.gradle
index 2f43b54..5722998 100644
--- a/compat/build.gradle
+++ b/compat/build.gradle
@@ -54,11 +54,6 @@
androidTest.manifest.srcFile 'tests/AndroidManifest.xml'
}
- lintOptions {
- // TODO: fix errors and reenable.
- abortOnError false
- }
-
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
diff --git a/compat/gingerbread/android/support/v4/animation/AnimatorListenerCompat.java b/compat/gingerbread/android/support/v4/animation/AnimatorListenerCompat.java
index d59ca7d..a2c043f 100644
--- a/compat/gingerbread/android/support/v4/animation/AnimatorListenerCompat.java
+++ b/compat/gingerbread/android/support/v4/animation/AnimatorListenerCompat.java
@@ -16,9 +16,9 @@
package android.support.v4.animation;
-import android.support.annotation.RestrictTo;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import android.support.annotation.RestrictTo;
/**
* <p>An animation listener that receives notifications from an animation.
@@ -27,7 +27,7 @@
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public interface AnimatorListenerCompat {
/**
diff --git a/compat/gingerbread/android/support/v4/animation/AnimatorUpdateListenerCompat.java b/compat/gingerbread/android/support/v4/animation/AnimatorUpdateListenerCompat.java
index ccfbbe2..2cf3fbd 100644
--- a/compat/gingerbread/android/support/v4/animation/AnimatorUpdateListenerCompat.java
+++ b/compat/gingerbread/android/support/v4/animation/AnimatorUpdateListenerCompat.java
@@ -16,9 +16,9 @@
package android.support.v4.animation;
-import android.support.annotation.RestrictTo;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import android.support.annotation.RestrictTo;
/**
* Implementors of this interface can add themselves as update listeners
@@ -28,7 +28,7 @@
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public interface AnimatorUpdateListenerCompat {
/**
diff --git a/compat/gingerbread/android/support/v4/animation/ValueAnimatorCompat.java b/compat/gingerbread/android/support/v4/animation/ValueAnimatorCompat.java
index eceeeb7..b064030 100644
--- a/compat/gingerbread/android/support/v4/animation/ValueAnimatorCompat.java
+++ b/compat/gingerbread/android/support/v4/animation/ValueAnimatorCompat.java
@@ -16,17 +16,17 @@
package android.support.v4.animation;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.support.annotation.RestrictTo;
import android.view.View;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Compatibility implementation for {@code android.animation.ValueAnimator}.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public interface ValueAnimatorCompat {
public void setTarget(View view);
diff --git a/compat/gingerbread/android/support/v4/app/NotificationCompatBase.java b/compat/gingerbread/android/support/v4/app/NotificationCompatBase.java
index 5f1d8fb..33447cc 100644
--- a/compat/gingerbread/android/support/v4/app/NotificationCompatBase.java
+++ b/compat/gingerbread/android/support/v4/app/NotificationCompatBase.java
@@ -16,7 +16,7 @@
package android.support.v4.app;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import android.annotation.TargetApi;
import android.app.Notification;
@@ -32,7 +32,7 @@
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
@RequiresApi(9)
@TargetApi(9)
public class NotificationCompatBase {
diff --git a/compat/gingerbread/android/support/v4/graphics/drawable/DrawableWrapper.java b/compat/gingerbread/android/support/v4/graphics/drawable/DrawableWrapper.java
index 94307dd..1574b36 100644
--- a/compat/gingerbread/android/support/v4/graphics/drawable/DrawableWrapper.java
+++ b/compat/gingerbread/android/support/v4/graphics/drawable/DrawableWrapper.java
@@ -16,18 +16,18 @@
package android.support.v4.graphics.drawable;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.graphics.drawable.Drawable;
import android.support.annotation.RestrictTo;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Interface which allows a {@link android.graphics.drawable.Drawable} to get/set wrapped
* drawables from {@code DrawableCompat}.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public interface DrawableWrapper {
Drawable getWrappedDrawable();
void setWrappedDrawable(Drawable drawable);
diff --git a/compat/gingerbread/android/support/v4/graphics/drawable/TintAwareDrawable.java b/compat/gingerbread/android/support/v4/graphics/drawable/TintAwareDrawable.java
index d51fe8a..81bed7b 100644
--- a/compat/gingerbread/android/support/v4/graphics/drawable/TintAwareDrawable.java
+++ b/compat/gingerbread/android/support/v4/graphics/drawable/TintAwareDrawable.java
@@ -16,21 +16,20 @@
package android.support.v4.graphics.drawable;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
-import android.graphics.drawable.Drawable;
import android.support.annotation.ColorInt;
import android.support.annotation.RestrictTo;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Interface which allows a {@link android.graphics.drawable.Drawable} to receive tinting calls
* from {@code DrawableCompat}.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public interface TintAwareDrawable {
void setTint(@ColorInt int tint);
void setTintList(ColorStateList tint);
diff --git a/compat/honeycomb/android/support/v4/app/NotificationBuilderWithBuilderAccessor.java b/compat/honeycomb/android/support/v4/app/NotificationBuilderWithBuilderAccessor.java
index 2d364e1..c75e6a2 100644
--- a/compat/honeycomb/android/support/v4/app/NotificationBuilderWithBuilderAccessor.java
+++ b/compat/honeycomb/android/support/v4/app/NotificationBuilderWithBuilderAccessor.java
@@ -16,13 +16,13 @@
package android.support.v4.app;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.annotation.TargetApi;
import android.app.Notification;
import android.support.annotation.RequiresApi;
import android.support.annotation.RestrictTo;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Interface implemented by notification compat builders that support
* an accessor for {@link Notification.Builder}. {@link Notification.Builder}
@@ -32,7 +32,7 @@
*/
@RequiresApi(11)
@TargetApi(11)
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public interface NotificationBuilderWithBuilderAccessor {
public Notification.Builder getBuilder();
public Notification build();
diff --git a/compat/java/android/support/v4/animation/AnimatorCompatHelper.java b/compat/java/android/support/v4/animation/AnimatorCompatHelper.java
index 201268a..46b5b15 100644
--- a/compat/java/android/support/v4/animation/AnimatorCompatHelper.java
+++ b/compat/java/android/support/v4/animation/AnimatorCompatHelper.java
@@ -16,16 +16,16 @@
package android.support.v4.animation;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.os.Build;
import android.support.annotation.RestrictTo;
import android.view.View;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public final class AnimatorCompatHelper {
private final static AnimatorProvider IMPL;
diff --git a/compat/java/android/support/v4/app/NotificationCompat.java b/compat/java/android/support/v4/app/NotificationCompat.java
index 41f4832..49bbf9a 100644
--- a/compat/java/android/support/v4/app/NotificationCompat.java
+++ b/compat/java/android/support/v4/app/NotificationCompat.java
@@ -16,6 +16,8 @@
package android.support.v4.app;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.app.Activity;
import android.app.Notification;
import android.app.PendingIntent;
@@ -40,8 +42,6 @@
import java.util.Collections;
import java.util.List;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Helper for accessing features in {@link android.app.Notification}
* introduced after API level 4 in a backwards compatible fashion.
@@ -515,7 +515,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected static class BuilderExtender {
public Notification build(Builder b, NotificationBuilderWithBuilderAccessor builder) {
Notification n = builder.build();
@@ -990,40 +990,40 @@
// extender.
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public Context mContext;
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public CharSequence mContentTitle;
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public CharSequence mContentText;
PendingIntent mContentIntent;
PendingIntent mFullScreenIntent;
RemoteViews mTickerView;
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public Bitmap mLargeIcon;
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public CharSequence mContentInfo;
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public int mNumber;
int mPriority;
boolean mShowWhen = true;
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public boolean mUseChronometer;
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public Style mStyle;
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public CharSequence mSubText;
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public CharSequence[] mRemoteInputHistory;
int mProgressMax;
int mProgress;
@@ -1032,7 +1032,7 @@
boolean mGroupSummary;
String mSortKey;
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public ArrayList<Action> mActions = new ArrayList<Action>();
boolean mLocalOnly = false;
String mCategory;
@@ -1045,7 +1045,7 @@
RemoteViews mHeadsUpContentView;
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public Notification mNotification = new Notification();
public ArrayList<String> mPeople;
@@ -1748,7 +1748,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected BuilderExtender getExtender() {
return new BuilderExtender();
}
@@ -1764,7 +1764,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public RemoteViews getContentView() {
return mContentView;
}
@@ -1772,7 +1772,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public RemoteViews getBigContentView() {
return mBigContentView;
}
@@ -1780,7 +1780,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public RemoteViews getHeadsUpContentView() {
return mHeadsUpContentView;
}
@@ -1790,7 +1790,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public long getWhenIfShowing() {
return mShowWhen ? mNotification.when : 0;
}
@@ -1800,7 +1800,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public int getPriority() {
return mPriority;
}
@@ -1810,7 +1810,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public int getColor() {
return mColor;
}
@@ -1821,7 +1821,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected CharSequence resolveText() {
return mContentText;
}
@@ -1831,7 +1831,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected CharSequence resolveTitle() {
return mContentTitle;
}
@@ -1870,7 +1870,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
// TODO: implement for all styles
public void addCompatExtras(Bundle extras) {
}
@@ -1878,7 +1878,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
// TODO: implement for all styles
protected void restoreFromCompatExtras(Bundle extras) {
}
@@ -2169,7 +2169,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
protected void restoreFromCompatExtras(Bundle extras) {
mMessages.clear();
@@ -2862,7 +2862,7 @@
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public static final Factory FACTORY = new Factory() {
@Override
public NotificationCompatBase.Action build(int icon, CharSequence title,
diff --git a/compat/java/android/support/v4/app/RemoteInput.java b/compat/java/android/support/v4/app/RemoteInput.java
index 9208cf6..1f69520 100644
--- a/compat/java/android/support/v4/app/RemoteInput.java
+++ b/compat/java/android/support/v4/app/RemoteInput.java
@@ -16,14 +16,14 @@
package android.support.v4.app;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.RestrictTo;
import android.util.Log;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Helper for using the {@link android.app.RemoteInput} API
* introduced after API level 4 in a backwards compatible fashion.
@@ -268,7 +268,7 @@
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public static final Factory FACTORY = new Factory() {
@Override
public RemoteInput build(String resultKey,
diff --git a/compat/java/android/support/v4/app/ServiceCompat.java b/compat/java/android/support/v4/app/ServiceCompat.java
index 37b7ab9..3fc6ae8 100644
--- a/compat/java/android/support/v4/app/ServiceCompat.java
+++ b/compat/java/android/support/v4/app/ServiceCompat.java
@@ -16,6 +16,8 @@
package android.support.v4.app;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.app.Notification;
import android.app.Service;
import android.support.annotation.IntDef;
@@ -25,8 +27,6 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Helper for accessing features in {@link android.app.Service}
* introduced after API level 9 in a backwards compatible fashion.
@@ -77,7 +77,7 @@
public static final int STOP_FOREGROUND_DETACH = 1<<1;
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@IntDef(flag = true,
value = {
STOP_FOREGROUND_REMOVE,
diff --git a/compat/java/android/support/v4/app/SupportActivity.java b/compat/java/android/support/v4/app/SupportActivity.java
new file mode 100644
index 0000000..2072506
--- /dev/null
+++ b/compat/java/android/support/v4/app/SupportActivity.java
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ */
+
+package android.support.v4.app;
+
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
+import android.app.Activity;
+import android.support.annotation.RestrictTo;
+import android.support.v4.util.SimpleArrayMap;
+
+/**
+ * Base class for composing together compatibility functionality
+ *
+ * @hide
+ */
+@RestrictTo(LIBRARY_GROUP)
+public class SupportActivity extends Activity {
+ /**
+ * Storage for {@link ExtraData} instances.
+ *
+ * <p>Note that these objects are not retained across configuration changes</p>
+ */
+ private SimpleArrayMap<Class<? extends ExtraData>, ExtraData> mExtraDataMap =
+ new SimpleArrayMap<>();
+
+ /**
+ * Store an instance of {@link ExtraData} for later retrieval by class name
+ * via {@link #getExtraData}.
+ *
+ * <p>Note that these objects are not retained across configuration changes</p>
+ *
+ * @see #getExtraData
+ * @hide
+ */
+ @RestrictTo(LIBRARY_GROUP)
+ public void putExtraData(ExtraData extraData) {
+ mExtraDataMap.put(extraData.getClass(), extraData);
+ }
+
+ /**
+ * Retrieves a previously set {@link ExtraData} by class name.
+ *
+ * @see #putExtraData
+ * @hide
+ */
+ @RestrictTo(LIBRARY_GROUP)
+ public <T extends ExtraData> T getExtraData(Class<T> extraDataClass) {
+ return (T) mExtraDataMap.get(extraDataClass);
+ }
+
+ /**
+ * @hide
+ */
+ @RestrictTo(LIBRARY_GROUP)
+ public static class ExtraData {
+ }
+}
diff --git a/compat/java/android/support/v4/content/ModernAsyncTask.java b/compat/java/android/support/v4/content/ModernAsyncTask.java
index 7e95da6..306d334 100644
--- a/compat/java/android/support/v4/content/ModernAsyncTask.java
+++ b/compat/java/android/support/v4/content/ModernAsyncTask.java
@@ -16,7 +16,7 @@
package android.support.v4.content;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import android.os.Binder;
import android.os.Handler;
@@ -118,7 +118,7 @@
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public static void setDefaultExecutor(Executor exec) {
sDefaultExecutor = exec;
}
diff --git a/compat/java/android/support/v4/content/SharedPreferencesCompat.java b/compat/java/android/support/v4/content/SharedPreferencesCompat.java
index 25c65b0..7d51fed 100644
--- a/compat/java/android/support/v4/content/SharedPreferencesCompat.java
+++ b/compat/java/android/support/v4/content/SharedPreferencesCompat.java
@@ -17,7 +17,6 @@
package android.support.v4.content;
import android.content.SharedPreferences;
-import android.os.Build;
import android.support.annotation.NonNull;
public final class SharedPreferencesCompat {
diff --git a/compat/java/android/support/v4/internal/package-info.java b/compat/java/android/support/v4/internal/package-info.java
index 4efb10a..d2d2d2f 100644
--- a/compat/java/android/support/v4/internal/package-info.java
+++ b/compat/java/android/support/v4/internal/package-info.java
@@ -1,9 +1,9 @@
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
package android.support.v4.internal;
-import android.support.annotation.RestrictTo;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
\ No newline at end of file
+import android.support.annotation.RestrictTo;
\ No newline at end of file
diff --git a/compat/java/android/support/v4/internal/view/SupportMenu.java b/compat/java/android/support/v4/internal/view/SupportMenu.java
index 6a3b126..55b8a95 100644
--- a/compat/java/android/support/v4/internal/view/SupportMenu.java
+++ b/compat/java/android/support/v4/internal/view/SupportMenu.java
@@ -16,9 +16,9 @@
package android.support.v4.internal.view;
-import android.support.annotation.RestrictTo;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import android.support.annotation.RestrictTo;
/**
* Interface for managing the items in a menu.
@@ -29,7 +29,7 @@
* @see android.view.Menu
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public interface SupportMenu extends android.view.Menu {
/**
diff --git a/compat/java/android/support/v4/internal/view/SupportMenuItem.java b/compat/java/android/support/v4/internal/view/SupportMenuItem.java
index 3e3ac1a..a72ae21 100644
--- a/compat/java/android/support/v4/internal/view/SupportMenuItem.java
+++ b/compat/java/android/support/v4/internal/view/SupportMenuItem.java
@@ -16,14 +16,14 @@
package android.support.v4.internal.view;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.support.annotation.RestrictTo;
import android.support.v4.view.ActionProvider;
import android.support.v4.view.MenuItemCompat;
import android.view.MenuItem;
import android.view.View;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Interface for direct access to a previously created menu item.
*
@@ -33,7 +33,7 @@
* @see android.view.MenuItem
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public interface SupportMenuItem extends android.view.MenuItem {
/*
* These should be kept in sync with attrs.xml enum constants for showAsAction
diff --git a/compat/java/android/support/v4/internal/view/SupportSubMenu.java b/compat/java/android/support/v4/internal/view/SupportSubMenu.java
index 3a26e70..08b3a33 100644
--- a/compat/java/android/support/v4/internal/view/SupportSubMenu.java
+++ b/compat/java/android/support/v4/internal/view/SupportSubMenu.java
@@ -16,9 +16,9 @@
package android.support.v4.internal.view;
-import android.support.annotation.RestrictTo;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import android.support.annotation.RestrictTo;
/**
* Subclass of {@link SupportMenu} for sub menus.
@@ -29,6 +29,6 @@
* @see android.view.SubMenu
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public interface SupportSubMenu extends SupportMenu, android.view.SubMenu {
}
diff --git a/compat/java/android/support/v4/net/ConnectivityManagerCompat.java b/compat/java/android/support/v4/net/ConnectivityManagerCompat.java
index 3a85f2e..f9ff971 100644
--- a/compat/java/android/support/v4/net/ConnectivityManagerCompat.java
+++ b/compat/java/android/support/v4/net/ConnectivityManagerCompat.java
@@ -16,6 +16,15 @@
package android.support.v4.net;
+import static android.net.ConnectivityManager.TYPE_MOBILE;
+import static android.net.ConnectivityManager.TYPE_MOBILE_DUN;
+import static android.net.ConnectivityManager.TYPE_MOBILE_HIPRI;
+import static android.net.ConnectivityManager.TYPE_MOBILE_MMS;
+import static android.net.ConnectivityManager.TYPE_MOBILE_SUPL;
+import static android.net.ConnectivityManager.TYPE_WIFI;
+import static android.net.ConnectivityManager.TYPE_WIMAX;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
@@ -26,15 +35,6 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
-import static android.net.ConnectivityManager.TYPE_MOBILE;
-import static android.net.ConnectivityManager.TYPE_MOBILE_DUN;
-import static android.net.ConnectivityManager.TYPE_MOBILE_HIPRI;
-import static android.net.ConnectivityManager.TYPE_MOBILE_MMS;
-import static android.net.ConnectivityManager.TYPE_MOBILE_SUPL;
-import static android.net.ConnectivityManager.TYPE_WIFI;
-import static android.net.ConnectivityManager.TYPE_WIMAX;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Helper for accessing features in {@link ConnectivityManager} introduced after
* API level 16 in a backwards compatible fashion.
@@ -49,7 +49,7 @@
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Retention(RetentionPolicy.SOURCE)
@IntDef(flag = false, value = {
RESTRICT_BACKGROUND_STATUS_DISABLED,
diff --git a/compat/java/android/support/v4/os/ResultReceiver.java b/compat/java/android/support/v4/os/ResultReceiver.java
index 7a34e8a..7c0230a 100644
--- a/compat/java/android/support/v4/os/ResultReceiver.java
+++ b/compat/java/android/support/v4/os/ResultReceiver.java
@@ -16,15 +16,14 @@
package android.support.v4.os;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.os.Bundle;
import android.os.Handler;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.RemoteException;
import android.support.annotation.RestrictTo;
-import android.support.v4.os.IResultReceiver;
-
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
/**
* Generic interface for receiving a callback result from someone. Use this
@@ -40,28 +39,28 @@
* break if your process goes away for any reason, etc.</p>
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class ResultReceiver implements Parcelable {
final boolean mLocal;
final Handler mHandler;
-
+
IResultReceiver mReceiver;
-
+
class MyRunnable implements Runnable {
final int mResultCode;
final Bundle mResultData;
-
+
MyRunnable(int resultCode, Bundle resultData) {
mResultCode = resultCode;
mResultData = resultData;
}
-
+
@Override
public void run() {
onReceiveResult(mResultCode, mResultData);
}
}
-
+
class MyResultReceiver extends IResultReceiver.Stub {
@Override
public void send(int resultCode, Bundle resultData) {
@@ -72,7 +71,7 @@
}
}
}
-
+
/**
* Create a new ResultReceive to receive results. Your
* {@link #onReceiveResult} method will be called from the thread running
@@ -82,7 +81,7 @@
mLocal = true;
mHandler = handler;
}
-
+
/**
* Deliver a result to this receiver. Will call {@link #onReceiveResult},
* always asynchronously if the receiver has supplied a Handler in which
@@ -99,7 +98,7 @@
}
return;
}
-
+
if (mReceiver != null) {
try {
mReceiver.send(resultCode, resultData);
@@ -107,17 +106,17 @@
}
}
}
-
+
/**
* Override to receive results delivered to this object.
- *
+ *
* @param resultCode Arbitrary result code delivered by the sender, as
* defined by the sender.
* @param resultData Any additional data provided by the sender.
*/
protected void onReceiveResult(int resultCode, Bundle resultData) {
}
-
+
@Override
public int describeContents() {
return 0;
@@ -138,7 +137,7 @@
mHandler = null;
mReceiver = IResultReceiver.Stub.asInterface(in.readStrongBinder());
}
-
+
public static final Creator<ResultReceiver> CREATOR
= new Creator<ResultReceiver>() {
@Override
diff --git a/compat/java/android/support/v4/util/DebugUtils.java b/compat/java/android/support/v4/util/DebugUtils.java
index 4f1e95a..8937b7e 100644
--- a/compat/java/android/support/v4/util/DebugUtils.java
+++ b/compat/java/android/support/v4/util/DebugUtils.java
@@ -16,9 +16,9 @@
package android.support.v4.util;
-import android.support.annotation.RestrictTo;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import android.support.annotation.RestrictTo;
/**
* Helper for accessing features in {@link android.util.DebugUtils}
@@ -26,7 +26,7 @@
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class DebugUtils {
public static void buildShortClassTag(Object cls, StringBuilder out) {
diff --git a/compat/java/android/support/v4/util/LogWriter.java b/compat/java/android/support/v4/util/LogWriter.java
index a250ce4..2889f4d 100644
--- a/compat/java/android/support/v4/util/LogWriter.java
+++ b/compat/java/android/support/v4/util/LogWriter.java
@@ -16,20 +16,20 @@
package android.support.v4.util;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.support.annotation.RestrictTo;
import android.util.Log;
import java.io.Writer;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Helper for accessing features in {@link android.util.LogWriter}
* introduced after API level 4 in a backwards compatible fashion.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class LogWriter extends Writer {
private final String mTag;
private StringBuilder mBuilder = new StringBuilder(128);
diff --git a/compat/java/android/support/v4/util/PatternsCompat.java b/compat/java/android/support/v4/util/PatternsCompat.java
index f09f199..2985481 100644
--- a/compat/java/android/support/v4/util/PatternsCompat.java
+++ b/compat/java/android/support/v4/util/PatternsCompat.java
@@ -16,13 +16,12 @@
package android.support.v4.util;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.support.annotation.RestrictTo;
-import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Commonly used regular expression patterns.
*/
@@ -300,7 +299,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public static final Pattern AUTOLINK_WEB_URL = Pattern.compile(
"(" + WEB_URL_WITH_PROTOCOL + "|" + WEB_URL_WITHOUT_PROTOCOL + ")");
@@ -329,7 +328,7 @@
* and the special characters #&~!^`{}/=$*?| that are included in RFC5321.
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public static final Pattern AUTOLINK_EMAIL_ADDRESS = Pattern.compile("(" + WORD_BOUNDARY +
"(?:" + EMAIL_ADDRESS_LOCAL_PART + "@" + EMAIL_ADDRESS_DOMAIN + ")" +
WORD_BOUNDARY + ")"
diff --git a/compat/java/android/support/v4/util/TimeUtils.java b/compat/java/android/support/v4/util/TimeUtils.java
index 3de970f..de75846 100644
--- a/compat/java/android/support/v4/util/TimeUtils.java
+++ b/compat/java/android/support/v4/util/TimeUtils.java
@@ -16,30 +16,30 @@
package android.support.v4.util;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.support.annotation.RestrictTo;
import java.io.PrintWriter;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Helper for accessing features in {@link android.util.TimeUtils}
* introduced after API level 4 in a backwards compatible fashion.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public final class TimeUtils {
/** @hide Field length that can hold 999 days of time */
public static final int HUNDRED_DAY_FIELD_LEN = 19;
-
+
private static final int SECONDS_PER_MINUTE = 60;
private static final int SECONDS_PER_HOUR = 60 * 60;
private static final int SECONDS_PER_DAY = 24 * 60 * 60;
private static final Object sFormatSync = new Object();
private static char[] sFormatStr = new char[HUNDRED_DAY_FIELD_LEN+5];
-
+
static private int accumField(int amt, int suffix, boolean always, int zeropad) {
if (amt > 99 || (always && zeropad >= 3)) {
return 3+suffix;
@@ -52,7 +52,7 @@
}
return 0;
}
-
+
static private int printField(char[] formatStr, int amt, char suffix, int pos,
boolean always, int zeropad) {
if (always || amt > 0) {
@@ -76,14 +76,14 @@
}
return pos;
}
-
+
private static int formatDurationLocked(long duration, int fieldLen) {
if (sFormatStr.length < fieldLen) {
sFormatStr = new char[fieldLen];
}
-
+
char[] formatStr = sFormatStr;
-
+
if (duration == 0) {
int pos = 0;
fieldLen -= 1;
@@ -93,7 +93,7 @@
formatStr[pos] = '0';
return pos+1;
}
-
+
char prefix;
if (duration > 0) {
prefix = '+';
@@ -120,7 +120,7 @@
}
int pos = 0;
-
+
if (fieldLen != 0) {
int myLen = accumField(days, 1, false, 0);
myLen += accumField(hours, 1, myLen > 0, 2);
@@ -133,10 +133,10 @@
myLen++;
}
}
-
+
formatStr[pos] = prefix;
pos++;
-
+
int start = pos;
boolean zeropad = fieldLen != 0;
pos = printField(formatStr, days, 'd', pos, false, 0);
@@ -147,7 +147,7 @@
formatStr[pos] = 's';
return pos + 1;
}
-
+
/** @hide Just for debugging; not internationalized. */
public static void formatDuration(long duration, StringBuilder builder) {
synchronized (sFormatSync) {
@@ -168,7 +168,7 @@
public static void formatDuration(long duration, PrintWriter pw) {
formatDuration(duration, pw, 0);
}
-
+
/** @hide Just for debugging; not internationalized. */
public static void formatDuration(long time, long now, PrintWriter pw) {
if (time == 0) {
diff --git a/compat/java/android/support/v4/view/ActionProvider.java b/compat/java/android/support/v4/view/ActionProvider.java
index fcde05e..e6ffd98 100644
--- a/compat/java/android/support/v4/view/ActionProvider.java
+++ b/compat/java/android/support/v4/view/ActionProvider.java
@@ -16,6 +16,8 @@
package android.support.v4.view;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.support.annotation.RestrictTo;
import android.util.Log;
@@ -23,8 +25,6 @@
import android.view.SubMenu;
import android.view.View;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* This class is a mediator for accomplishing a given task, for example sharing a file. It is
* responsible for creating a view that performs an action that accomplishes the task. This class
@@ -273,7 +273,7 @@
*
* @hide Pending future API approval
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void subUiVisibilityChanged(boolean isVisible) {
if (mSubUiVisibilityListener != null) {
mSubUiVisibilityListener.onSubUiVisibilityChanged(isVisible);
@@ -283,7 +283,7 @@
/**
* @hide Internal use only
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void setSubUiVisibilityListener(SubUiVisibilityListener listener) {
mSubUiVisibilityListener = listener;
}
@@ -306,7 +306,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void reset() {
mVisibilityListener = null;
mSubUiVisibilityListener = null;
@@ -315,7 +315,7 @@
/**
* @hide Internal use only
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public interface SubUiVisibilityListener {
public void onSubUiVisibilityChanged(boolean isVisible);
diff --git a/compat/java/android/support/v4/view/PointerIconCompat.java b/compat/java/android/support/v4/view/PointerIconCompat.java
index 809c891..cea4dfb 100644
--- a/compat/java/android/support/v4/view/PointerIconCompat.java
+++ b/compat/java/android/support/v4/view/PointerIconCompat.java
@@ -16,14 +16,14 @@
package android.support.v4.view;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.support.annotation.RestrictTo;
import android.support.v4.os.BuildCompat;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Helper for accessing features in {@link android.view.PointerIcon} introduced after API
* level 4 in a backwards compatible fashion.
@@ -108,7 +108,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public Object getPointerIcon() {
return mPointerIcon;
}
diff --git a/compat/java/android/support/v4/view/ViewCompat.java b/compat/java/android/support/v4/view/ViewCompat.java
index af621f5..434b850 100644
--- a/compat/java/android/support/v4/view/ViewCompat.java
+++ b/compat/java/android/support/v4/view/ViewCompat.java
@@ -16,6 +16,8 @@
package android.support.v4.view;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.res.ColorStateList;
import android.graphics.Matrix;
import android.graphics.Paint;
@@ -49,8 +51,6 @@
import java.lang.reflect.Method;
import java.util.WeakHashMap;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Helper for accessing features in {@link View} introduced after API
* level 4 in a backwards compatible fashion.
@@ -59,20 +59,20 @@
private static final String TAG = "ViewCompat";
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@IntDef({View.FOCUS_LEFT, View.FOCUS_UP, View.FOCUS_RIGHT, View.FOCUS_DOWN,
View.FOCUS_FORWARD, View.FOCUS_BACKWARD})
@Retention(RetentionPolicy.SOURCE)
public @interface FocusDirection {}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@IntDef({View.FOCUS_LEFT, View.FOCUS_UP, View.FOCUS_RIGHT, View.FOCUS_DOWN})
@Retention(RetentionPolicy.SOURCE)
public @interface FocusRealDirection {}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@IntDef({View.FOCUS_FORWARD, View.FOCUS_BACKWARD})
@Retention(RetentionPolicy.SOURCE)
public @interface FocusRelativeDirection {}
diff --git a/compat/tests/AndroidManifest.xml b/compat/tests/AndroidManifest.xml
index 8228476..8b44567 100644
--- a/compat/tests/AndroidManifest.xml
+++ b/compat/tests/AndroidManifest.xml
@@ -39,6 +39,8 @@
android:theme="@style/YellowTheme" />
<activity android:name="android.support.v4.view.ViewCompatActivity"/>
+
+ <activity android:name="android.support.v4.app.TestSupportActivity" />
</application>
<instrumentation android:name="android.test.InstrumentationTestRunner"
diff --git a/compat/tests/java/android/support/v4/app/SupportActivityTest.java b/compat/tests/java/android/support/v4/app/SupportActivityTest.java
new file mode 100644
index 0000000..859b44e
--- /dev/null
+++ b/compat/tests/java/android/support/v4/app/SupportActivityTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+package android.support.v4.app;
+
+import static junit.framework.Assert.assertEquals;
+
+import static org.junit.Assert.assertNull;
+
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
+import android.support.v4.BaseInstrumentationTestCase;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidJUnit4.class)
+@SmallTest
+public class SupportActivityTest extends BaseInstrumentationTestCase<TestSupportActivity> {
+ private SupportActivity mSupportActivity;
+ private TestExtraData mTestExtraData;
+
+ public SupportActivityTest() {
+ super(TestSupportActivity.class);
+ }
+
+ @Before
+ public void setUp() {
+ mSupportActivity = mActivityTestRule.getActivity();
+ mTestExtraData = new TestExtraData();
+ mSupportActivity.putExtraData(mTestExtraData);
+ }
+
+ @Test
+ public void testGetExtraData_returnsNullForNotAdded() {
+ assertNull(mSupportActivity.getExtraData(NeverAddedExtraData.class));
+ }
+
+ @Test
+ public void testGetExtraData() {
+ assertEquals(mTestExtraData, mSupportActivity.getExtraData(TestExtraData.class));
+ }
+
+ public class NeverAddedExtraData extends SupportActivity.ExtraData {
+ }
+
+ public class TestExtraData extends SupportActivity.ExtraData {
+ }
+}
+
diff --git a/compat/tests/java/android/support/v4/app/TestSupportActivity.java b/compat/tests/java/android/support/v4/app/TestSupportActivity.java
new file mode 100644
index 0000000..a14269e
--- /dev/null
+++ b/compat/tests/java/android/support/v4/app/TestSupportActivity.java
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+
+package android.support.v4.app;
+
+import android.os.Bundle;
+import android.view.WindowManager;
+import android.widget.FrameLayout;
+
+public class TestSupportActivity extends SupportActivity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+ setContentView(new FrameLayout(this));
+ }
+}
diff --git a/core-ui/build.gradle b/core-ui/build.gradle
index 56afd5e..89796ea 100644
--- a/core-ui/build.gradle
+++ b/core-ui/build.gradle
@@ -43,11 +43,6 @@
androidTest.manifest.srcFile 'tests/AndroidManifest.xml'
}
- lintOptions {
- // TODO: fix errors and reenable.
- abortOnError false
- }
-
buildTypes.all {
consumerProguardFiles 'proguard-rules.pro'
}
diff --git a/core-ui/java/android/support/v4/widget/CursorAdapter.java b/core-ui/java/android/support/v4/widget/CursorAdapter.java
index 249f21c..e68229e 100644
--- a/core-ui/java/android/support/v4/widget/CursorAdapter.java
+++ b/core-ui/java/android/support/v4/widget/CursorAdapter.java
@@ -16,6 +16,8 @@
package android.support.v4.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.database.ContentObserver;
import android.database.Cursor;
@@ -30,8 +32,6 @@
import android.widget.FilterQueryProvider;
import android.widget.Filterable;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Static library support version of the framework's {@link android.widget.CursorAdapter}.
* Used to write apps that run on platforms prior to Android 3.0. When running
@@ -45,55 +45,55 @@
* This field should be made private, so it is hidden from the SDK.
* {@hide}
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected boolean mDataValid;
/**
* This field should be made private, so it is hidden from the SDK.
* {@hide}
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected boolean mAutoRequery;
/**
* This field should be made private, so it is hidden from the SDK.
* {@hide}
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected Cursor mCursor;
/**
* This field should be made private, so it is hidden from the SDK.
* {@hide}
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected Context mContext;
/**
* This field should be made private, so it is hidden from the SDK.
* {@hide}
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected int mRowIDColumn;
/**
* This field should be made private, so it is hidden from the SDK.
* {@hide}
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected ChangeObserver mChangeObserver;
/**
* This field should be made private, so it is hidden from the SDK.
* {@hide}
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected DataSetObserver mDataSetObserver;
/**
* This field should be made private, so it is hidden from the SDK.
* {@hide}
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected CursorFilter mCursorFilter;
/**
* This field should be made private, so it is hidden from the SDK.
* {@hide}
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected FilterQueryProvider mFilterQueryProvider;
/**
diff --git a/core-ui/java/android/support/v4/widget/NestedScrollView.java b/core-ui/java/android/support/v4/widget/NestedScrollView.java
index 53e971f..44cc043 100644
--- a/core-ui/java/android/support/v4/widget/NestedScrollView.java
+++ b/core-ui/java/android/support/v4/widget/NestedScrollView.java
@@ -17,6 +17,8 @@
package android.support.v4.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
@@ -56,8 +58,6 @@
import java.util.List;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* NestedScrollView is just like {@link android.widget.ScrollView}, but it supports acting
* as both a nested scrolling parent and child on both new and old versions of Android.
@@ -1334,7 +1334,7 @@
* children.</p>
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public int computeVerticalScrollRange() {
final int count = getChildCount();
@@ -1356,35 +1356,35 @@
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public int computeVerticalScrollOffset() {
return Math.max(0, super.computeVerticalScrollOffset());
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public int computeVerticalScrollExtent() {
return super.computeVerticalScrollExtent();
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public int computeHorizontalScrollRange() {
return super.computeHorizontalScrollRange();
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public int computeHorizontalScrollOffset() {
return super.computeHorizontalScrollOffset();
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public int computeHorizontalScrollExtent() {
return super.computeHorizontalScrollExtent();
diff --git a/core-ui/java/android/support/v4/widget/SimpleCursorAdapter.java b/core-ui/java/android/support/v4/widget/SimpleCursorAdapter.java
index 7050734..291f9e1 100644
--- a/core-ui/java/android/support/v4/widget/SimpleCursorAdapter.java
+++ b/core-ui/java/android/support/v4/widget/SimpleCursorAdapter.java
@@ -16,6 +16,8 @@
package android.support.v4.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
@@ -24,8 +26,6 @@
import android.widget.ImageView;
import android.widget.TextView;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Static library support version of the framework's {@link android.widget.SimpleCursorAdapter}.
* Used to write apps that run on platforms prior to Android 3.0. When running
@@ -39,14 +39,14 @@
* This field should be made private, so it is hidden from the SDK.
* {@hide}
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected int[] mFrom;
/**
* A list of View ids representing the views to which the data must be bound.
* This field should be made private, so it is hidden from the SDK.
* {@hide}
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected int[] mTo;
private int mStringConversionColumn = -1;
diff --git a/core-ui/java/android/support/v4/widget/SwipeRefreshLayout.java b/core-ui/java/android/support/v4/widget/SwipeRefreshLayout.java
index 4ebdeed..107b9e0 100644
--- a/core-ui/java/android/support/v4/widget/SwipeRefreshLayout.java
+++ b/core-ui/java/android/support/v4/widget/SwipeRefreshLayout.java
@@ -16,8 +16,8 @@
package android.support.v4.widget;
+import android.annotation.SuppressLint;
import android.content.Context;
-import android.content.res.Resources;
import android.content.res.TypedArray;
import android.support.annotation.ColorInt;
import android.support.annotation.ColorRes;
@@ -177,6 +177,7 @@
public void onAnimationRepeat(Animation animation) {
}
+ @SuppressLint("NewApi")
@Override
public void onAnimationEnd(Animation animation) {
if (mRefreshing) {
@@ -224,6 +225,7 @@
reset();
}
+ @SuppressLint("NewApi")
private void setColorViewAlpha(int targetAlpha) {
mCircleView.getBackground().setAlpha(targetAlpha);
mProgress.setAlpha(targetAlpha);
@@ -425,6 +427,7 @@
}
}
+ @SuppressLint("NewApi")
private void startScaleUpAnimation(AnimationListener listener) {
mCircleView.setVisibility(View.VISIBLE);
if (android.os.Build.VERSION.SDK_INT >= 11) {
@@ -486,14 +489,17 @@
mCircleView.startAnimation(mScaleDownAnimation);
}
+ @SuppressLint("NewApi")
private void startProgressAlphaStartAnimation() {
mAlphaStartAnimation = startAlphaAnimation(mProgress.getAlpha(), STARTING_PROGRESS_ALPHA);
}
+ @SuppressLint("NewApi")
private void startProgressAlphaMaxAnimation() {
mAlphaMaxAnimation = startAlphaAnimation(mProgress.getAlpha(), MAX_ALPHA);
}
+ @SuppressLint("NewApi")
private Animation startAlphaAnimation(final int startingAlpha, final int endingAlpha) {
// Pre API 11, alpha is used in place of scale. Don't also use it to
// show the trigger point.
@@ -925,6 +931,7 @@
return animation != null && animation.hasStarted() && !animation.hasEnded();
}
+ @SuppressLint("NewApi")
private void moveSpinner(float overscrollTop) {
mProgress.showArrow(true);
float originalDragPercent = overscrollTop / mTotalDragDistance;
@@ -1086,6 +1093,7 @@
return true;
}
+ @SuppressLint("NewApi")
private void startDragging(float y) {
final float yDiff = y - mInitialDownY;
if (yDiff > mTouchSlop && !mIsBeingDragged) {
@@ -1155,6 +1163,7 @@
}
};
+ @SuppressLint("NewApi")
private void startScaleDownReturnToStartAnimation(int from,
Animation.AnimationListener listener) {
mFrom = from;
diff --git a/core-utils/build.gradle b/core-utils/build.gradle
index 97325a1..750cf49 100644
--- a/core-utils/build.gradle
+++ b/core-utils/build.gradle
@@ -44,11 +44,6 @@
androidTest.manifest.srcFile 'tests/AndroidManifest.xml'
}
- lintOptions {
- // TODO: fix errors and reenable.
- abortOnError false
- }
-
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
diff --git a/core-utils/java/android/support/v4/content/AsyncTaskLoader.java b/core-utils/java/android/support/v4/content/AsyncTaskLoader.java
index da24c7f..c31a8cd 100644
--- a/core-utils/java/android/support/v4/content/AsyncTaskLoader.java
+++ b/core-utils/java/android/support/v4/content/AsyncTaskLoader.java
@@ -16,6 +16,8 @@
package android.support.v4.content;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.os.Handler;
import android.os.SystemClock;
@@ -29,8 +31,6 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Static library support version of the framework's {@link android.content.AsyncTaskLoader}.
* Used to write apps that run on platforms prior to Android 3.0. When running
@@ -334,7 +334,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void waitForLoader() {
LoadTask task = mTask;
if (task != null) {
diff --git a/core-utils/java/android/support/v4/content/res/TypedArrayUtils.java b/core-utils/java/android/support/v4/content/res/TypedArrayUtils.java
index 894c708..be4ff11 100644
--- a/core-utils/java/android/support/v4/content/res/TypedArrayUtils.java
+++ b/core-utils/java/android/support/v4/content/res/TypedArrayUtils.java
@@ -15,6 +15,8 @@
*/
package android.support.v4.content.res;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
@@ -23,14 +25,12 @@
import android.support.annotation.StyleableRes;
import android.util.TypedValue;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Compat methods for accessing TypedArray values.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class TypedArrayUtils {
public static boolean getBoolean(TypedArray a, @StyleableRes int index,
@StyleableRes int fallbackIndex, boolean defaultValue) {
diff --git a/customtabs/build.gradle b/customtabs/build.gradle
index 98f3076..a409dba 100644
--- a/customtabs/build.gradle
+++ b/customtabs/build.gradle
@@ -34,10 +34,6 @@
androidTest.java.srcDir('tests/src/')
}
- lintOptions {
- abortOnError false
- }
-
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
diff --git a/customtabs/src/android/support/customtabs/CustomTabsClient.java b/customtabs/src/android/support/customtabs/CustomTabsClient.java
index 73f17a2..548c152 100644
--- a/customtabs/src/android/support/customtabs/CustomTabsClient.java
+++ b/customtabs/src/android/support/customtabs/CustomTabsClient.java
@@ -16,6 +16,8 @@
package android.support.customtabs;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -32,8 +34,6 @@
import java.util.ArrayList;
import java.util.List;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Class to communicate with a {@link CustomTabsService} and create
* {@link CustomTabsSession} from it.
@@ -43,7 +43,7 @@
private final ComponentName mServiceComponentName;
/**@hide*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
CustomTabsClient(ICustomTabsService service, ComponentName componentName) {
mService = service;
mServiceComponentName = componentName;
diff --git a/design/build.gradle b/design/build.gradle
index 1f35a60..abd99c0 100644
--- a/design/build.gradle
+++ b/design/build.gradle
@@ -14,6 +14,9 @@
androidTestCompile ("com.android.support.test.espresso:espresso-core:${project.rootProject.ext.espressoVersion}") {
exclude module: 'support-annotations'
}
+ androidTestCompile ("com.android.support.test.espresso:espresso-contrib:${project.rootProject.ext.espressoVersion}") {
+ exclude group: 'com.android.support'
+ }
androidTestCompile 'org.mockito:mockito-core:1.9.5'
androidTestCompile 'com.google.dexmaker:dexmaker:1.2'
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2'
@@ -63,11 +66,6 @@
targetCompatibility JavaVersion.VERSION_1_7
}
- lintOptions {
- // TODO: fix errors and reenable.
- abortOnError false
- }
-
buildTypes.all {
consumerProguardFiles 'proguard-rules.pro'
}
diff --git a/design/res/layout/design_text_input_password_icon.xml b/design/res/layout/design_text_input_password_icon.xml
index 0dbb9fa..ca1cd09 100644
--- a/design/res/layout/design_text_input_password_icon.xml
+++ b/design/res/layout/design_text_input_password_icon.xml
@@ -16,9 +16,11 @@
-->
<android.support.design.widget.CheckableImageButton
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/text_input_password_toggle"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:background="?attr/selectableItemBackgroundBorderless"
- android:layout_gravity="center_vertical|end|right"/>
\ No newline at end of file
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/text_input_password_toggle"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical|end|right"
+ android:background="?attr/selectableItemBackgroundBorderless"
+ android:minHeight="48dp"
+ android:minWidth="48dp"/>
\ No newline at end of file
diff --git a/design/res/values/strings.xml b/design/res/values/strings.xml
index 35ee706..43a84cd 100644
--- a/design/res/values/strings.xml
+++ b/design/res/values/strings.xml
@@ -21,5 +21,7 @@
<string name="bottom_sheet_behavior" translatable="false">android.support.design.widget.BottomSheetBehavior</string>
<!-- The text pattern for the character counter -->
<string name="character_counter_pattern" translatable="false">%1$d / %2$d</string>
+ <!-- Content description for the password visibility toggle button. [CHAR LIMIT=NONE] -->
+ <string name="password_toggle_content_description">Toggle password visibility</string>
</resources>
diff --git a/design/res/values/styles.xml b/design/res/values/styles.xml
index 1e13d47..0e4b391 100644
--- a/design/res/values/styles.xml
+++ b/design/res/values/styles.xml
@@ -14,7 +14,7 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-<resources>
+<resources xmlns:tools="http://schemas.android.com/tools">
<style name="Widget.Design.FloatingActionButton" parent="android:Widget">
<item name="android:background">@drawable/design_fab_background</item>
@@ -71,6 +71,7 @@
<item name="counterOverflowTextAppearance">@style/TextAppearance.Design.Counter.Overflow</item>
<item name="passwordToggleDrawable">@drawable/design_password_eye</item>
<item name="passwordToggleTint">@color/design_tint_password_toggle</item>
+ <item name="passwordToggleContentDescription">@string/password_toggle_content_description</item>
</style>
<style name="TextAppearance.Design.Hint" parent="TextAppearance.AppCompat.Caption">
@@ -129,7 +130,7 @@
<style name="Widget.Design.BottomSheet.Modal" parent="android:Widget">
<item name="android:background">?android:attr/colorBackground</item>
- <item name="android:elevation">@dimen/design_bottom_sheet_modal_elevation</item>
+ <item tools:ignore="NewApi" name="android:elevation">@dimen/design_bottom_sheet_modal_elevation</item>
<item name="behavior_peekHeight">auto</item>
<item name="behavior_hideable">true</item>
<item name="behavior_skipCollapsed">false</item>
diff --git a/design/src/android/support/design/internal/BottomNavigationItemView.java b/design/src/android/support/design/internal/BottomNavigationItemView.java
index 05a9b89..44db0ea 100644
--- a/design/src/android/support/design/internal/BottomNavigationItemView.java
+++ b/design/src/android/support/design/internal/BottomNavigationItemView.java
@@ -16,6 +16,8 @@
package android.support.design.internal;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
@@ -36,12 +38,10 @@
import android.widget.ImageView;
import android.widget.TextView;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class BottomNavigationItemView extends FrameLayout implements MenuView.ItemView {
public static final int INVALID_ITEM_POSITION = -1;
@@ -131,8 +131,6 @@
@Override
public void setChecked(boolean checked) {
- mItemData.setChecked(checked);
-
ViewCompat.setPivotX(mLargeLabel, mLargeLabel.getWidth() / 2);
ViewCompat.setPivotY(mLargeLabel, mLargeLabel.getBaseline());
ViewCompat.setPivotX(mSmallLabel, mSmallLabel.getWidth() / 2);
diff --git a/design/src/android/support/design/internal/BottomNavigationMenu.java b/design/src/android/support/design/internal/BottomNavigationMenu.java
index 8832097..a86d2ad 100644
--- a/design/src/android/support/design/internal/BottomNavigationMenu.java
+++ b/design/src/android/support/design/internal/BottomNavigationMenu.java
@@ -16,18 +16,19 @@
package android.support.design.internal;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.support.annotation.RestrictTo;
import android.support.v7.view.menu.MenuBuilder;
+import android.support.v7.view.menu.MenuItemImpl;
import android.view.MenuItem;
import android.view.SubMenu;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public final class BottomNavigationMenu extends MenuBuilder {
public static final int MAX_ITEM_COUNT = 5;
@@ -47,6 +48,12 @@
"Maximum number of items supported by BottomNavigationView is " + MAX_ITEM_COUNT
+ ". Limit can be checked with BottomNavigationView#getMaxItemCount()");
}
- return super.addInternal(group, id, categoryOrder, title);
+ stopDispatchingItemsChanged();
+ final MenuItem item = super.addInternal(group, id, categoryOrder, title);
+ if (item instanceof MenuItemImpl) {
+ ((MenuItemImpl) item).setExclusiveCheckable(true);
+ }
+ startDispatchingItemsChanged();
+ return item;
}
}
diff --git a/design/src/android/support/design/internal/BottomNavigationMenuView.java b/design/src/android/support/design/internal/BottomNavigationMenuView.java
index e6ae08f..bc73970 100644
--- a/design/src/android/support/design/internal/BottomNavigationMenuView.java
+++ b/design/src/android/support/design/internal/BottomNavigationMenuView.java
@@ -16,7 +16,7 @@
package android.support.design.internal;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import android.content.Context;
import android.content.res.ColorStateList;
@@ -37,7 +37,7 @@
/**
* @hide For internal use only.
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class BottomNavigationMenuView extends ViewGroup implements MenuView {
private final int mInactiveItemMaxWidth;
private final int mInactiveItemMinWidth;
@@ -287,6 +287,9 @@
}
for (int i = 0; i < menuSize; i++) {
mPresenter.setUpdateSuspended(true);
+ if (mMenu.getItem(i).isChecked()) {
+ mActiveButton = i;
+ }
mButtons[i].initialize((MenuItemImpl) mMenu.getItem(i), 0);
mPresenter.setUpdateSuspended(false);
}
@@ -297,10 +300,7 @@
mAnimationHelper.beginDelayedTransition(this);
- mPresenter.setUpdateSuspended(true);
- mButtons[mActiveButton].setChecked(false);
- mButtons[newButton].setChecked(true);
- mPresenter.setUpdateSuspended(false);
+ mMenu.getItem(newButton).setChecked(true);
mActiveButton = newButton;
}
diff --git a/design/src/android/support/design/internal/BottomNavigationPresenter.java b/design/src/android/support/design/internal/BottomNavigationPresenter.java
index 07e52e3..832e936 100644
--- a/design/src/android/support/design/internal/BottomNavigationPresenter.java
+++ b/design/src/android/support/design/internal/BottomNavigationPresenter.java
@@ -16,6 +16,8 @@
package android.support.design.internal;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.os.Parcelable;
import android.support.annotation.RestrictTo;
@@ -26,12 +28,10 @@
import android.support.v7.view.menu.SubMenuBuilder;
import android.view.ViewGroup;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class BottomNavigationPresenter implements MenuPresenter {
private MenuBuilder mMenu;
private BottomNavigationMenuView mMenuView;
diff --git a/design/src/android/support/design/internal/ForegroundLinearLayout.java b/design/src/android/support/design/internal/ForegroundLinearLayout.java
index 9e690d2..c75603b 100644
--- a/design/src/android/support/design/internal/ForegroundLinearLayout.java
+++ b/design/src/android/support/design/internal/ForegroundLinearLayout.java
@@ -16,6 +16,8 @@
package android.support.design.internal;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.TypedArray;
@@ -30,12 +32,10 @@
import android.util.AttributeSet;
import android.view.Gravity;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class ForegroundLinearLayout extends LinearLayoutCompat {
private Drawable mForeground;
diff --git a/design/src/android/support/design/internal/NavigationMenu.java b/design/src/android/support/design/internal/NavigationMenu.java
index f0931b0..a0ec5e0 100644
--- a/design/src/android/support/design/internal/NavigationMenu.java
+++ b/design/src/android/support/design/internal/NavigationMenu.java
@@ -16,6 +16,8 @@
package android.support.design.internal;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.support.annotation.RestrictTo;
import android.support.v7.view.menu.MenuBuilder;
@@ -23,15 +25,13 @@
import android.support.v7.view.menu.SubMenuBuilder;
import android.view.SubMenu;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* This is a {@link MenuBuilder} that returns an instance of {@link NavigationSubMenu} instead of
* {@link SubMenuBuilder} when a sub menu is created.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class NavigationMenu extends MenuBuilder {
public NavigationMenu(Context context) {
diff --git a/design/src/android/support/design/internal/NavigationMenuItemView.java b/design/src/android/support/design/internal/NavigationMenuItemView.java
index 195791d..8bece63 100644
--- a/design/src/android/support/design/internal/NavigationMenuItemView.java
+++ b/design/src/android/support/design/internal/NavigationMenuItemView.java
@@ -16,6 +16,8 @@
package android.support.design.internal;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Color;
@@ -41,12 +43,10 @@
import android.widget.CheckedTextView;
import android.widget.FrameLayout;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class NavigationMenuItemView extends ForegroundLinearLayout implements MenuView.ItemView {
private static final int[] CHECKED_STATE_SET = {android.R.attr.state_checked};
diff --git a/design/src/android/support/design/internal/NavigationMenuPresenter.java b/design/src/android/support/design/internal/NavigationMenuPresenter.java
index 9f9aaca..a17189c 100644
--- a/design/src/android/support/design/internal/NavigationMenuPresenter.java
+++ b/design/src/android/support/design/internal/NavigationMenuPresenter.java
@@ -16,7 +16,7 @@
package android.support.design.internal;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import android.content.Context;
import android.content.res.ColorStateList;
@@ -52,7 +52,7 @@
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class NavigationMenuPresenter implements MenuPresenter {
private static final String STATE_HIERARCHY = "android:menu:list";
diff --git a/design/src/android/support/design/internal/NavigationMenuView.java b/design/src/android/support/design/internal/NavigationMenuView.java
index 628f7a8..711f71e 100644
--- a/design/src/android/support/design/internal/NavigationMenuView.java
+++ b/design/src/android/support/design/internal/NavigationMenuView.java
@@ -16,6 +16,8 @@
package android.support.design.internal;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.support.annotation.RestrictTo;
import android.support.v7.view.menu.MenuBuilder;
@@ -24,12 +26,10 @@
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class NavigationMenuView extends RecyclerView implements MenuView {
public NavigationMenuView(Context context) {
diff --git a/design/src/android/support/design/internal/NavigationSubMenu.java b/design/src/android/support/design/internal/NavigationSubMenu.java
index 6c62033..1ff1e4f 100644
--- a/design/src/android/support/design/internal/NavigationSubMenu.java
+++ b/design/src/android/support/design/internal/NavigationSubMenu.java
@@ -16,21 +16,21 @@
package android.support.design.internal;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.support.annotation.RestrictTo;
import android.support.v7.view.menu.MenuBuilder;
import android.support.v7.view.menu.MenuItemImpl;
import android.support.v7.view.menu.SubMenuBuilder;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* This is a {@link SubMenuBuilder} that it notifies the parent {@link NavigationMenu} of its menu
* updates.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class NavigationSubMenu extends SubMenuBuilder {
public NavigationSubMenu(Context context, NavigationMenu menu, MenuItemImpl item) {
diff --git a/design/src/android/support/design/internal/ParcelableSparseArray.java b/design/src/android/support/design/internal/ParcelableSparseArray.java
index 05870b0..746ba00 100644
--- a/design/src/android/support/design/internal/ParcelableSparseArray.java
+++ b/design/src/android/support/design/internal/ParcelableSparseArray.java
@@ -16,6 +16,8 @@
package android.support.design.internal;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.RestrictTo;
@@ -23,12 +25,10 @@
import android.support.v4.os.ParcelableCompatCreatorCallbacks;
import android.util.SparseArray;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class ParcelableSparseArray extends SparseArray<Parcelable> implements Parcelable {
public ParcelableSparseArray() {
diff --git a/design/src/android/support/design/internal/ScrimInsetsFrameLayout.java b/design/src/android/support/design/internal/ScrimInsetsFrameLayout.java
index 17223d1..38f5b29 100644
--- a/design/src/android/support/design/internal/ScrimInsetsFrameLayout.java
+++ b/design/src/android/support/design/internal/ScrimInsetsFrameLayout.java
@@ -16,6 +16,8 @@
package android.support.design.internal;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
@@ -30,12 +32,10 @@
import android.view.View;
import android.widget.FrameLayout;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class ScrimInsetsFrameLayout extends FrameLayout {
Drawable mInsetForeground;
diff --git a/design/src/android/support/design/internal/SnackbarContentLayout.java b/design/src/android/support/design/internal/SnackbarContentLayout.java
index 43a2763..dca1d6b 100644
--- a/design/src/android/support/design/internal/SnackbarContentLayout.java
+++ b/design/src/android/support/design/internal/SnackbarContentLayout.java
@@ -15,7 +15,7 @@
*/
package android.support.design.internal;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import android.content.Context;
import android.content.res.TypedArray;
@@ -32,7 +32,7 @@
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class SnackbarContentLayout extends LinearLayout implements
BaseTransientBottomBar.ContentViewCallback {
private TextView mMessageView;
diff --git a/design/src/android/support/design/internal/package-info.java b/design/src/android/support/design/internal/package-info.java
index 92fc776..6b6f7bb 100644
--- a/design/src/android/support/design/internal/package-info.java
+++ b/design/src/android/support/design/internal/package-info.java
@@ -1,9 +1,9 @@
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
package android.support.design.internal;
-import android.support.annotation.RestrictTo;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import android.support.annotation.RestrictTo;
diff --git a/design/src/android/support/design/widget/AppBarLayout.java b/design/src/android/support/design/widget/AppBarLayout.java
index 4a1993d..4c7ef0a 100644
--- a/design/src/android/support/design/widget/AppBarLayout.java
+++ b/design/src/android/support/design/widget/AppBarLayout.java
@@ -16,6 +16,9 @@
package android.support.design.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+import static android.support.design.widget.ViewUtils.objectEquals;
+
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.TypedArray;
@@ -47,9 +50,6 @@
import java.util.ArrayList;
import java.util.List;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-import static android.support.design.widget.ViewUtils.objectEquals;
-
/**
* AppBarLayout is a vertical {@link LinearLayout} which implements many of the features of
* material designs app bar concept, namely scrolling gestures.
@@ -590,7 +590,7 @@
public static class LayoutParams extends LinearLayout.LayoutParams {
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@IntDef(flag=true, value={
SCROLL_FLAG_SCROLL,
SCROLL_FLAG_EXIT_UNTIL_COLLAPSED,
diff --git a/design/src/android/support/design/widget/BaseTransientBottomBar.java b/design/src/android/support/design/widget/BaseTransientBottomBar.java
index d47e08b..a2e7e26 100644
--- a/design/src/android/support/design/widget/BaseTransientBottomBar.java
+++ b/design/src/android/support/design/widget/BaseTransientBottomBar.java
@@ -16,7 +16,7 @@
package android.support.design.widget;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import static android.support.design.widget.AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR;
import android.content.Context;
@@ -77,7 +77,7 @@
public static final int DISMISS_EVENT_CONSECUTIVE = 4;
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@IntDef({DISMISS_EVENT_SWIPE, DISMISS_EVENT_ACTION, DISMISS_EVENT_TIMEOUT,
DISMISS_EVENT_MANUAL, DISMISS_EVENT_CONSECUTIVE})
@Retention(RetentionPolicy.SOURCE)
@@ -134,7 +134,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@IntDef({LENGTH_INDEFINITE, LENGTH_SHORT, LENGTH_LONG})
@IntRange(from = 1)
@Retention(RetentionPolicy.SOURCE)
@@ -200,7 +200,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
interface OnLayoutChangeListener {
void onLayoutChange(View view, int left, int top, int right, int bottom);
}
@@ -208,7 +208,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
interface OnAttachStateChangeListener {
void onViewAttachedToWindow(View v);
void onViewDetachedFromWindow(View v);
@@ -651,7 +651,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
static class SnackbarBaseLayout extends FrameLayout {
private BaseTransientBottomBar.OnLayoutChangeListener mOnLayoutChangeListener;
private BaseTransientBottomBar.OnAttachStateChangeListener mOnAttachStateChangeListener;
diff --git a/design/src/android/support/design/widget/BottomSheetBehavior.java b/design/src/android/support/design/widget/BottomSheetBehavior.java
index c3362a8..e745217 100644
--- a/design/src/android/support/design/widget/BottomSheetBehavior.java
+++ b/design/src/android/support/design/widget/BottomSheetBehavior.java
@@ -16,6 +16,8 @@
package android.support.design.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Parcel;
@@ -46,8 +48,6 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.ref.WeakReference;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* An interaction behavior plugin for a child view of {@link CoordinatorLayout} to make it work as
@@ -108,7 +108,7 @@
public static final int STATE_HIDDEN = 5;
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@IntDef({STATE_EXPANDED, STATE_COLLAPSED, STATE_DRAGGING, STATE_SETTLING, STATE_HIDDEN})
@Retention(RetentionPolicy.SOURCE)
public @interface State {}
diff --git a/design/src/android/support/design/widget/BottomSheetDialog.java b/design/src/android/support/design/widget/BottomSheetDialog.java
index f07a36f..de48937 100644
--- a/design/src/android/support/design/widget/BottomSheetDialog.java
+++ b/design/src/android/support/design/widget/BottomSheetDialog.java
@@ -24,6 +24,9 @@
import android.support.annotation.NonNull;
import android.support.annotation.StyleRes;
import android.support.design.R;
+import android.support.v4.view.AccessibilityDelegateCompat;
+import android.support.v4.view.ViewCompat;
+import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
import android.support.v7.app.AppCompatDialog;
import android.util.TypedValue;
import android.view.View;
@@ -127,6 +130,29 @@
}
}
});
+ // Handle accessibility events
+ ViewCompat.setAccessibilityDelegate(bottomSheet, new AccessibilityDelegateCompat() {
+ @Override
+ public void onInitializeAccessibilityNodeInfo(View host,
+ AccessibilityNodeInfoCompat info) {
+ super.onInitializeAccessibilityNodeInfo(host, info);
+ if (mCancelable) {
+ info.addAction(AccessibilityNodeInfoCompat.ACTION_DISMISS);
+ info.setDismissable(true);
+ } else {
+ info.setDismissable(false);
+ }
+ }
+
+ @Override
+ public boolean performAccessibilityAction(View host, int action, Bundle args) {
+ if (action == AccessibilityNodeInfoCompat.ACTION_DISMISS && mCancelable) {
+ cancel();
+ return true;
+ }
+ return super.performAccessibilityAction(host, action, args);
+ }
+ });
return coordinator;
}
diff --git a/design/src/android/support/design/widget/CheckableImageButton.java b/design/src/android/support/design/widget/CheckableImageButton.java
index 13e99b2..f274581 100644
--- a/design/src/android/support/design/widget/CheckableImageButton.java
+++ b/design/src/android/support/design/widget/CheckableImageButton.java
@@ -16,6 +16,8 @@
package android.support.design.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.support.annotation.RestrictTo;
import android.support.v4.view.AccessibilityDelegateCompat;
@@ -28,12 +30,10 @@
import android.view.accessibility.AccessibilityEvent;
import android.widget.Checkable;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class CheckableImageButton extends AppCompatImageButton implements Checkable {
private static final int[] DRAWABLE_STATE_CHECKED = new int[]{android.R.attr.state_checked};
diff --git a/design/src/android/support/design/widget/CollapsingToolbarLayout.java b/design/src/android/support/design/widget/CollapsingToolbarLayout.java
index 40f2d5e..8fcf796 100644
--- a/design/src/android/support/design/widget/CollapsingToolbarLayout.java
+++ b/design/src/android/support/design/widget/CollapsingToolbarLayout.java
@@ -16,6 +16,10 @@
package android.support.design.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+import static android.support.design.widget.MathUtils.constrain;
+import static android.support.design.widget.ViewUtils.objectEquals;
+
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.ColorStateList;
@@ -52,10 +56,6 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-import static android.support.design.widget.MathUtils.constrain;
-import static android.support.design.widget.ViewUtils.objectEquals;
-
/**
* CollapsingToolbarLayout is a wrapper for {@link Toolbar} which implements a collapsing app bar.
* It is designed to be used as a direct child of a {@link AppBarLayout}.
@@ -1126,7 +1126,7 @@
private static final float DEFAULT_PARALLAX_MULTIPLIER = 0.5f;
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@IntDef({
COLLAPSE_MODE_OFF,
COLLAPSE_MODE_PIN,
diff --git a/design/src/android/support/design/widget/CoordinatorLayout.java b/design/src/android/support/design/widget/CoordinatorLayout.java
index 42fdb24..a942d16 100644
--- a/design/src/android/support/design/widget/CoordinatorLayout.java
+++ b/design/src/android/support/design/widget/CoordinatorLayout.java
@@ -16,7 +16,7 @@
package android.support.design.widget;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import static android.support.design.widget.ViewUtils.objectEquals;
import android.content.Context;
@@ -139,7 +139,7 @@
static final int EVENT_VIEW_REMOVED = 2;
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Retention(RetentionPolicy.SOURCE)
@IntDef({EVENT_PRE_DRAW, EVENT_NESTED_SCROLL, EVENT_VIEW_REMOVED})
public @interface DispatchChangeEvent {}
@@ -1651,6 +1651,10 @@
final int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
final View view = getChildAt(i);
+ if (view.getVisibility() == View.GONE) {
+ // If it's GONE, don't dispatch
+ continue;
+ }
final LayoutParams lp = (LayoutParams) view.getLayoutParams();
final Behavior viewBehavior = lp.getBehavior();
if (viewBehavior != null) {
@@ -1719,6 +1723,11 @@
for (int i = 0; i < childCount; i++) {
final View view = getChildAt(i);
+ if (view.getVisibility() == GONE) {
+ // If the child is GONE, skip...
+ continue;
+ }
+
final LayoutParams lp = (LayoutParams) view.getLayoutParams();
if (!lp.isNestedScrollAccepted()) {
continue;
@@ -1746,6 +1755,11 @@
final int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
final View view = getChildAt(i);
+ if (view.getVisibility() == GONE) {
+ // If the child is GONE, skip...
+ continue;
+ }
+
final LayoutParams lp = (LayoutParams) view.getLayoutParams();
if (!lp.isNestedScrollAccepted()) {
continue;
@@ -1780,6 +1794,11 @@
final int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
final View view = getChildAt(i);
+ if (view.getVisibility() == GONE) {
+ // If the child is GONE, skip...
+ continue;
+ }
+
final LayoutParams lp = (LayoutParams) view.getLayoutParams();
if (!lp.isNestedScrollAccepted()) {
continue;
@@ -1804,6 +1823,11 @@
final int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
final View view = getChildAt(i);
+ if (view.getVisibility() == GONE) {
+ // If the child is GONE, skip...
+ continue;
+ }
+
final LayoutParams lp = (LayoutParams) view.getLayoutParams();
if (!lp.isNestedScrollAccepted()) {
continue;
diff --git a/design/src/android/support/design/widget/FloatingActionButton.java b/design/src/android/support/design/widget/FloatingActionButton.java
index 09269a7..592ccef 100644
--- a/design/src/android/support/design/widget/FloatingActionButton.java
+++ b/design/src/android/support/design/widget/FloatingActionButton.java
@@ -16,6 +16,8 @@
package android.support.design.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.ColorStateList;
@@ -49,8 +51,6 @@
import java.lang.annotation.RetentionPolicy;
import java.util.List;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Floating action buttons are used for a special type of promoted action. They are distinguished
* by a circled icon floating above the UI and have special motion behaviors related to morphing,
@@ -123,7 +123,7 @@
private static final int AUTO_MINI_LARGEST_SCREEN_WIDTH = 470;
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Retention(RetentionPolicy.SOURCE)
@IntDef({SIZE_MINI, SIZE_NORMAL, SIZE_AUTO})
public @interface Size {}
diff --git a/design/src/android/support/design/widget/NavigationView.java b/design/src/android/support/design/widget/NavigationView.java
index 8e5d31c..044f096 100644
--- a/design/src/android/support/design/widget/NavigationView.java
+++ b/design/src/android/support/design/widget/NavigationView.java
@@ -16,6 +16,8 @@
package android.support.design.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable;
@@ -51,8 +53,6 @@
import android.view.MenuItem;
import android.view.View;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Represents a standard navigation menu for application. The menu contents can be populated
* by a menu resource file.
@@ -232,7 +232,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
protected void onInsetsChanged(WindowInsetsCompat insets) {
mPresenter.dispatchApplyWindowInsets(insets);
diff --git a/design/src/android/support/design/widget/Snackbar.java b/design/src/android/support/design/widget/Snackbar.java
index f29305b..621ddc5 100644
--- a/design/src/android/support/design/widget/Snackbar.java
+++ b/design/src/android/support/design/widget/Snackbar.java
@@ -16,7 +16,7 @@
package android.support.design.widget;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import android.content.Context;
import android.content.res.ColorStateList;
@@ -240,7 +240,7 @@
* Note: this class is here to provide backwards-compatible way for apps written before
* the existence of the base {@link BaseTransientBottomBar} class.
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public static final class SnackbarLayout extends BaseTransientBottomBar.SnackbarBaseLayout {
public SnackbarLayout(Context context) {
super(context);
diff --git a/design/src/android/support/design/widget/SwipeDismissBehavior.java b/design/src/android/support/design/widget/SwipeDismissBehavior.java
index 2d1cebe..1bf3d5a 100644
--- a/design/src/android/support/design/widget/SwipeDismissBehavior.java
+++ b/design/src/android/support/design/widget/SwipeDismissBehavior.java
@@ -16,6 +16,8 @@
package android.support.design.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.support.annotation.IntDef;
import android.support.annotation.NonNull;
import android.support.annotation.RestrictTo;
@@ -30,8 +32,6 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* An interaction behavior plugin for child views of {@link CoordinatorLayout} to provide support
* for the 'swipe-to-dismiss' gesture.
@@ -56,7 +56,7 @@
public static final int STATE_SETTLING = ViewDragHelper.STATE_SETTLING;
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@IntDef({SWIPE_DIRECTION_START_TO_END, SWIPE_DIRECTION_END_TO_START, SWIPE_DIRECTION_ANY})
@Retention(RetentionPolicy.SOURCE)
private @interface SwipeDirection {}
diff --git a/design/src/android/support/design/widget/TabLayout.java b/design/src/android/support/design/widget/TabLayout.java
index 904c904..b6f94a4 100755
--- a/design/src/android/support/design/widget/TabLayout.java
+++ b/design/src/android/support/design/widget/TabLayout.java
@@ -16,7 +16,7 @@
package android.support.design.widget;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import static android.support.v4.view.ViewPager.SCROLL_STATE_DRAGGING;
import static android.support.v4.view.ViewPager.SCROLL_STATE_IDLE;
import static android.support.v4.view.ViewPager.SCROLL_STATE_SETTLING;
@@ -182,7 +182,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@IntDef(value = {MODE_SCROLLABLE, MODE_FIXED})
@Retention(RetentionPolicy.SOURCE)
public @interface Mode {}
@@ -207,7 +207,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@IntDef(flag = true, value = {GRAVITY_FILL, GRAVITY_CENTER})
@Retention(RetentionPolicy.SOURCE)
public @interface TabGravity {}
diff --git a/design/src/android/support/design/widget/TextInputLayout.java b/design/src/android/support/design/widget/TextInputLayout.java
index 94b4be3..89f09dd 100644
--- a/design/src/android/support/design/widget/TextInputLayout.java
+++ b/design/src/android/support/design/widget/TextInputLayout.java
@@ -266,7 +266,11 @@
@Override
public void addView(View child, int index, final ViewGroup.LayoutParams params) {
if (child instanceof EditText) {
- mInputFrame.addView(child, new FrameLayout.LayoutParams(params));
+ // Make sure that the EditText is vertically at the bottom, so that it sits on the
+ // EditText's underline
+ FrameLayout.LayoutParams flp = new FrameLayout.LayoutParams(params);
+ flp.gravity = Gravity.CENTER_VERTICAL | (flp.gravity & ~Gravity.VERTICAL_GRAVITY_MASK);
+ mInputFrame.addView(child, flp);
// Now use the EditText's LayoutParams as our own and update them to make enough space
// for the label
@@ -322,7 +326,7 @@
final int editTextGravity = mEditText.getGravity();
mCollapsingTextHelper.setCollapsedTextGravity(
- Gravity.TOP | (editTextGravity & GravityCompat.RELATIVE_HORIZONTAL_GRAVITY_MASK));
+ Gravity.TOP | (editTextGravity & ~Gravity.VERTICAL_GRAVITY_MASK));
mCollapsingTextHelper.setExpandedTextGravity(editTextGravity);
// Add a TextWatcher so that we know when the text input has changed
diff --git a/design/tests/res/layout/activity_coordinator_layout.xml b/design/tests/res/layout/activity_coordinator_layout.xml
index 2aa36f5..93bf947 100644
--- a/design/tests/res/layout/activity_coordinator_layout.xml
+++ b/design/tests/res/layout/activity_coordinator_layout.xml
@@ -22,6 +22,6 @@
<android.support.design.widget.CoordinatorLayout
android:id="@+id/coordinator"
android:layout_width="match_parent"
- android:layout_height="match_parent"/>
+ android:layout_height="match_parent" />
</FrameLayout>
\ No newline at end of file
diff --git a/design/tests/res/layout/include_nestedscrollview.xml b/design/tests/res/layout/include_nestedscrollview.xml
new file mode 100644
index 0000000..2d02f93
--- /dev/null
+++ b/design/tests/res/layout/include_nestedscrollview.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.
+-->
+
+<android.support.v4.widget.NestedScrollView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/nested_scrollview"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <View android:layout_width="match_parent"
+ android:layout_height="5000dp"/>
+
+</android.support.v4.widget.NestedScrollView>
diff --git a/design/tests/src/android/support/design/testutils/TextInputLayoutMatchers.java b/design/tests/src/android/support/design/testutils/TextInputLayoutMatchers.java
new file mode 100755
index 0000000..d13a39d
--- /dev/null
+++ b/design/tests/src/android/support/design/testutils/TextInputLayoutMatchers.java
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ */
+
+package android.support.design.testutils;
+
+import android.support.design.widget.TextInputLayout;
+import android.text.TextUtils;
+
+import org.hamcrest.Description;
+import org.hamcrest.Matcher;
+import org.hamcrest.TypeSafeMatcher;
+
+public class TextInputLayoutMatchers {
+
+ /**
+ * Returns a matcher that matches TextInputLayouts with non-empty content descriptions for
+ * the password toggle.
+ */
+ public static Matcher hasPasswordToggleContentDescription() {
+ return new TypeSafeMatcher<TextInputLayout>() {
+ @Override
+ public void describeTo(Description description) {
+ description.appendText("TextInputLayout has non-empty content description"
+ + "for password toggle.");
+ }
+
+ @Override
+ protected boolean matchesSafely(TextInputLayout item) {
+ return !TextUtils.isEmpty(item.getPasswordVisibilityToggleContentDescription());
+ }
+ };
+ }
+
+}
diff --git a/design/tests/src/android/support/design/widget/BottomNavigationViewTest.java b/design/tests/src/android/support/design/widget/BottomNavigationViewTest.java
index 9c1c6ca..37a58a6 100644
--- a/design/tests/src/android/support/design/widget/BottomNavigationViewTest.java
+++ b/design/tests/src/android/support/design/widget/BottomNavigationViewTest.java
@@ -47,7 +47,6 @@
import android.support.v4.content.res.ResourcesCompat;
import android.view.Menu;
import android.view.MenuItem;
-import android.view.ViewGroup;
import org.junit.Before;
import org.junit.Test;
@@ -212,4 +211,27 @@
onView(allOf(withId(R.id.icon), isDescendantOfA(withId(R.id.destination_people)))).check(
matches(TestUtilsMatchers.drawable(blueFill, allowedComponentVariance)));
}
+
+ @UiThreadTest
+ @Test
+ @SmallTest
+ public void testItemChecking() throws Throwable {
+ final Menu menu = mBottomNavigation.getMenu();
+ assertTrue(menu.getItem(0).isChecked());
+ checkAndVerifyExclusiveItem(menu, R.id.destination_home);
+ checkAndVerifyExclusiveItem(menu, R.id.destination_profile);
+ checkAndVerifyExclusiveItem(menu, R.id.destination_people);
+ }
+
+ private void checkAndVerifyExclusiveItem(final Menu menu, final int id) throws Throwable {
+ menu.findItem(id).setChecked(true);
+ for (int i = 0; i < menu.size(); i++) {
+ final MenuItem item = menu.getItem(i);
+ if (item.getItemId() == id) {
+ assertTrue(item.isChecked());
+ } else {
+ assertFalse(item.isChecked());
+ }
+ }
+ }
}
diff --git a/design/tests/src/android/support/design/widget/CoordinatorLayoutTest.java b/design/tests/src/android/support/design/widget/CoordinatorLayoutTest.java
index cab0419..69c30b8 100644
--- a/design/tests/src/android/support/design/widget/CoordinatorLayoutTest.java
+++ b/design/tests/src/android/support/design/widget/CoordinatorLayoutTest.java
@@ -16,11 +16,16 @@
package android.support.design.widget;
+import static android.support.test.espresso.Espresso.onView;
+import static android.support.test.espresso.action.ViewActions.swipeUp;
+import static android.support.test.espresso.matcher.ViewMatchers.withId;
+
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
import static org.mockito.Matchers.same;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.doCallRealMethod;
@@ -33,6 +38,7 @@
import android.app.Instrumentation;
import android.graphics.Rect;
+import android.support.design.test.R;
import android.support.design.testutils.CoordinatorLayoutUtils;
import android.support.design.widget.CoordinatorLayout.Behavior;
import android.support.test.InstrumentationRegistry;
@@ -41,8 +47,10 @@
import android.support.v4.view.ViewCompat;
import android.support.v4.view.WindowInsetsCompat;
import android.view.Gravity;
+import android.view.LayoutInflater;
import android.view.View;
import android.view.View.MeasureSpec;
+import android.widget.ImageView;
import org.junit.Before;
import org.junit.Test;
@@ -395,7 +403,7 @@
}
@Test
- public void testGoneNotMeasuredLaidOut() throws Throwable {
+ public void testGoneViewsNotMeasuredLaidOut() throws Throwable {
final CoordinatorLayoutActivity activity = mActivityTestRule.getActivity();
final CoordinatorLayout col = activity.mCoordinatorLayout;
@@ -431,4 +439,144 @@
assertTrue(imageView.getMeasuredHeight() > 0);
assertTrue(ViewCompat.isLaidOut(imageView));
}
+
+ @Test
+ public void testNestedScrollingDispatchesToBehavior() throws Throwable {
+ final CoordinatorLayoutActivity activity = mActivityTestRule.getActivity();
+ final CoordinatorLayout col = activity.mCoordinatorLayout;
+
+ // Now create a view and add it to the CoordinatorLayout with the spy behavior,
+ // along with a NestedScrollView
+ final ImageView imageView = new ImageView(activity);
+ final CoordinatorLayout.Behavior behavior = spy(new NestedScrollingBehavior());
+ mActivityTestRule.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ LayoutInflater.from(activity).inflate(R.layout.include_nestedscrollview, col, true);
+
+ CoordinatorLayout.LayoutParams clp = new CoordinatorLayout.LayoutParams(200, 200);
+ clp.setBehavior(behavior);
+ col.addView(imageView, clp);
+ }
+ });
+
+ // Now vertically swipe up on the NSV, causing nested scrolling to occur
+ onView(withId(R.id.nested_scrollview)).perform(swipeUp());
+
+ // Verify that the Behavior's onStartNestedScroll was called once
+ verify(behavior, times(1)).onStartNestedScroll(
+ eq(col), // parent
+ eq(imageView), // child
+ any(View.class), // target
+ any(View.class), // direct child target
+ any(int.class)); // axes
+
+ // Verify that the Behavior's onNestedScrollAccepted was called once
+ verify(behavior, times(1)).onNestedScrollAccepted(
+ eq(col), // parent
+ eq(imageView), // child
+ any(View.class), // target
+ any(View.class), // direct child target
+ any(int.class)); // axes
+
+ // Verify that the Behavior's onNestedPreScroll was called at least once
+ verify(behavior, atLeastOnce()).onNestedPreScroll(
+ eq(col), // parent
+ eq(imageView), // child
+ any(View.class), // target
+ any(int.class), // dx
+ any(int.class), // dy
+ any(int[].class)); // consumed
+
+ // Verify that the Behavior's onNestedScroll was called at least once
+ verify(behavior, atLeastOnce()).onNestedScroll(
+ eq(col), // parent
+ eq(imageView), // child
+ any(View.class), // target
+ any(int.class), // dx consumed
+ any(int.class), // dy consumed
+ any(int.class), // dx unconsumed
+ any(int.class)); // dy unconsumed
+
+ // Verify that the Behavior's onStopNestedScroll was called once
+ verify(behavior, times(1)).onStopNestedScroll(
+ eq(col), // parent
+ eq(imageView), // child
+ any(View.class)); // target
+ }
+
+ @Test
+ public void testNestedScrollingDispatchingToBehaviorWithGoneView() throws Throwable {
+ final CoordinatorLayoutActivity activity = mActivityTestRule.getActivity();
+ final CoordinatorLayout col = activity.mCoordinatorLayout;
+
+ // Now create a GONE view and add it to the CoordinatorLayout with the spy behavior,
+ // along with a NestedScrollView
+ final ImageView imageView = new ImageView(activity);
+ imageView.setVisibility(View.GONE);
+ final CoordinatorLayout.Behavior behavior = spy(new NestedScrollingBehavior());
+ mActivityTestRule.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ LayoutInflater.from(activity).inflate(R.layout.include_nestedscrollview, col, true);
+
+ CoordinatorLayout.LayoutParams clp = new CoordinatorLayout.LayoutParams(200, 200);
+ clp.setBehavior(behavior);
+ col.addView(imageView, clp);
+ }
+ });
+
+ // Now vertically swipe up on the NSV, causing nested scrolling to occur
+ onView(withId(R.id.nested_scrollview)).perform(swipeUp());
+
+ // Verify that the Behavior's onStartNestedScroll was not called
+ verify(behavior, never()).onStartNestedScroll(
+ eq(col), // parent
+ eq(imageView), // child
+ any(View.class), // target
+ any(View.class), // direct child target
+ any(int.class)); // axes
+
+ // Verify that the Behavior's onNestedScrollAccepted was not called
+ verify(behavior, never()).onNestedScrollAccepted(
+ eq(col), // parent
+ eq(imageView), // child
+ any(View.class), // target
+ any(View.class), // direct child target
+ any(int.class)); // axes
+
+ // Verify that the Behavior's onNestedPreScroll was not called
+ verify(behavior, never()).onNestedPreScroll(
+ eq(col), // parent
+ eq(imageView), // child
+ any(View.class), // target
+ any(int.class), // dx
+ any(int.class), // dy
+ any(int[].class)); // consumed
+
+ // Verify that the Behavior's onNestedScroll was not called
+ verify(behavior, never()).onNestedScroll(
+ eq(col), // parent
+ eq(imageView), // child
+ any(View.class), // target
+ any(int.class), // dx consumed
+ any(int.class), // dy consumed
+ any(int.class), // dx unconsumed
+ any(int.class)); // dy unconsumed
+
+ // Verify that the Behavior's onStopNestedScroll was not called
+ verify(behavior, never()).onStopNestedScroll(
+ eq(col), // parent
+ eq(imageView), // child
+ any(View.class)); // target
+ }
+
+ public static class NestedScrollingBehavior extends CoordinatorLayout.Behavior<ImageView> {
+ @Override
+ public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, ImageView child,
+ View directTargetChild, View target, int nestedScrollAxes) {
+ // Return true so that we always accept nested scroll events
+ return true;
+ }
+ }
}
diff --git a/design/tests/src/android/support/design/widget/TextInputLayoutTest.java b/design/tests/src/android/support/design/widget/TextInputLayoutTest.java
index 27d79c3..45af34f 100755
--- a/design/tests/src/android/support/design/widget/TextInputLayoutTest.java
+++ b/design/tests/src/android/support/design/widget/TextInputLayoutTest.java
@@ -23,11 +23,15 @@
import static android.support.design.testutils.TextInputLayoutActions.setErrorEnabled;
import static android.support.design.testutils.TextInputLayoutActions
.setPasswordVisibilityToggleEnabled;
+import static android.support.design.testutils.TextInputLayoutMatchers
+ .hasPasswordToggleContentDescription;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.typeText;
import static android.support.test.espresso.assertion.ViewAssertions.doesNotExist;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
+import static android.support.test.espresso.matcher.ViewMatchers.hasContentDescription;
+import static android.support.test.espresso.contrib.AccessibilityChecks.accessibilityAssertion;
import static android.support.test.espresso.matcher.ViewMatchers.isChecked;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.isEnabled;
@@ -50,6 +54,7 @@
import android.support.test.annotation.UiThreadTest;
import android.support.test.espresso.NoMatchingViewException;
import android.support.test.espresso.ViewAssertion;
+import android.support.test.espresso.contrib.AccessibilityChecks;
import android.support.test.filters.SmallTest;
import android.support.v4.widget.TextViewCompat;
import android.util.AttributeSet;
@@ -383,6 +388,27 @@
assertSame(bottom, compoundDrawables[3]);
}
+ @Test
+ public void testPasswordToggleHasDefaultContentDescription() {
+ // Check that the TextInputLayout says that it has a content description
+ onView(withId(R.id.textinput_password))
+ .check(matches(hasPasswordToggleContentDescription()));
+
+ // Check that the underlying toggle view says that it also has a content description
+ onView(withId(R.id.text_input_password_toggle))
+ .check(matches(hasContentDescription()));
+ }
+
+ /**
+ * Simple test that uses AccessibilityChecks to check that the password toggle icon is
+ * 'accessible'.
+ */
+ @Test
+ public void testPasswordToggleIsAccessible() {
+ onView(withId(R.id.text_input_password_toggle))
+ .check(accessibilityAssertion());
+ }
+
static ViewAssertion isHintExpanded(final boolean expanded) {
return new ViewAssertion() {
@Override
diff --git a/documents-archive/src/android/support/provider/DocumentArchive.java b/documents-archive/src/android/support/provider/DocumentArchive.java
index 91cd5e7..4b0b0b9 100644
--- a/documents-archive/src/android/support/provider/DocumentArchive.java
+++ b/documents-archive/src/android/support/provider/DocumentArchive.java
@@ -16,6 +16,8 @@
package android.support.provider;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.AssetFileDescriptor;
import android.database.Cursor;
@@ -42,12 +44,8 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
-import java.lang.IllegalArgumentException;
-import java.lang.IllegalStateException;
-import java.lang.UnsupportedOperationException;
import java.util.Collections;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -56,9 +54,6 @@
import java.util.concurrent.Executors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
-import java.util.zip.ZipInputStream;
-
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
/**
* Provides basic implementation for creating, extracting and accessing
@@ -70,7 +65,7 @@
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class DocumentArchive implements Closeable {
private static final String TAG = "DocumentArchive";
diff --git a/documents-archive/src/android/support/provider/DocumentArchiveHelper.java b/documents-archive/src/android/support/provider/DocumentArchiveHelper.java
index fd5ff94..6c5e198 100644
--- a/documents-archive/src/android/support/provider/DocumentArchiveHelper.java
+++ b/documents-archive/src/android/support/provider/DocumentArchiveHelper.java
@@ -16,11 +16,11 @@
package android.support.provider;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.res.AssetFileDescriptor;
-import android.content.res.Configuration;
import android.database.ContentObserver;
import android.database.Cursor;
-import android.database.MatrixCursor;
import android.graphics.Point;
import android.net.Uri;
import android.os.CancellationSignal;
@@ -36,15 +36,9 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.Callable;
import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Provides basic implementation for creating, extracting and accessing
* files within archives exposed by a document provider.
@@ -55,7 +49,7 @@
* TODO: Update the documentation. b/26047732
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class DocumentArchiveHelper implements Closeable {
/**
* Cursor column to be used for passing the local file path for documents.
diff --git a/documents-archive/src/android/support/provider/IoUtils.java b/documents-archive/src/android/support/provider/IoUtils.java
index 4806575..55c293d 100644
--- a/documents-archive/src/android/support/provider/IoUtils.java
+++ b/documents-archive/src/android/support/provider/IoUtils.java
@@ -16,20 +16,19 @@
package android.support.provider;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.support.annotation.Nullable;
import android.support.annotation.RestrictTo;
import java.io.Closeable;
import java.io.InputStream;
-import java.util.Collection;
-
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
/**
* Simple static methods to perform common IO operations.
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
final class IoUtils {
static void closeQuietly(@Nullable Closeable closeable) {
if (closeable != null) {
diff --git a/documents-archive/src/android/support/provider/ParsedDocumentId.java b/documents-archive/src/android/support/provider/ParsedDocumentId.java
index 2834455..a8c7810 100644
--- a/documents-archive/src/android/support/provider/ParsedDocumentId.java
+++ b/documents-archive/src/android/support/provider/ParsedDocumentId.java
@@ -16,14 +16,14 @@
package android.support.provider;
-import android.support.annotation.RestrictTo;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import android.support.annotation.RestrictTo;
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
class ParsedDocumentId {
public final String mArchiveId;
public final String mPath;
diff --git a/documents-archive/src/android/support/provider/Preconditions.java b/documents-archive/src/android/support/provider/Preconditions.java
index 050ca9a..e3971aa 100644
--- a/documents-archive/src/android/support/provider/Preconditions.java
+++ b/documents-archive/src/android/support/provider/Preconditions.java
@@ -16,20 +16,18 @@
package android.support.provider;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.support.annotation.Nullable;
import android.support.annotation.RestrictTo;
import android.text.TextUtils;
-import java.util.Collection;
-
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Simple static methods to be called at the start of your own methods to verify
* correct arguments and state.
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
final class Preconditions {
static void checkArgument(boolean expression, String message) {
if (!expression) {
diff --git a/fragment/build.gradle b/fragment/build.gradle
index 0a862d4..26e9f1c 100644
--- a/fragment/build.gradle
+++ b/fragment/build.gradle
@@ -46,11 +46,6 @@
androidTest.manifest.srcFile 'tests/AndroidManifest.xml'
}
- lintOptions {
- // TODO: fix errors and reenable.
- abortOnError false
- }
-
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
diff --git a/fragment/gingerbread/android/support/v4/app/BaseFragmentActivityGingerbread.java b/fragment/gingerbread/android/support/v4/app/BaseFragmentActivityGingerbread.java
index f2f5154..01e9f22 100644
--- a/fragment/gingerbread/android/support/v4/app/BaseFragmentActivityGingerbread.java
+++ b/fragment/gingerbread/android/support/v4/app/BaseFragmentActivityGingerbread.java
@@ -17,7 +17,6 @@
package android.support.v4.app;
import android.annotation.TargetApi;
-import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.IntentSender;
@@ -35,7 +34,7 @@
*/
@RequiresApi(9)
@TargetApi(9)
-abstract class BaseFragmentActivityGingerbread extends Activity {
+abstract class BaseFragmentActivityGingerbread extends SupportActivity {
// We need to keep track of whether startIntentSenderForResult originated from a Fragment, so we
// can conditionally check whether the requestCode collides with our reserved ID space for the
diff --git a/fragment/java/android/support/v4/app/DialogFragment.java b/fragment/java/android/support/v4/app/DialogFragment.java
index c67026a..baec333 100644
--- a/fragment/java/android/support/v4/app/DialogFragment.java
+++ b/fragment/java/android/support/v4/app/DialogFragment.java
@@ -16,6 +16,8 @@
package android.support.v4.app;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
@@ -35,8 +37,6 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Static library support version of the framework's {@link android.app.DialogFragment}.
* Used to write apps that run on platforms prior to Android 3.0. When running
@@ -48,7 +48,7 @@
implements DialogInterface.OnCancelListener, DialogInterface.OnDismissListener {
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@IntDef({STYLE_NORMAL, STYLE_NO_TITLE, STYLE_NO_FRAME, STYLE_NO_INPUT})
@Retention(RetentionPolicy.SOURCE)
private @interface DialogStyle {}
@@ -206,7 +206,7 @@
}
}
}
-
+
public Dialog getDialog() {
return mDialog;
}
@@ -302,7 +302,7 @@
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public LayoutInflater getLayoutInflater(Bundle savedInstanceState) {
if (!mShowsDialog) {
@@ -322,7 +322,7 @@
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void setupDialog(Dialog dialog, int style) {
switch (style) {
case STYLE_NO_INPUT:
@@ -335,27 +335,27 @@
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
}
}
-
+
/**
* Override to build your own custom Dialog container. This is typically
* used to show an AlertDialog instead of a generic Dialog; when doing so,
* {@link #onCreateView(LayoutInflater, ViewGroup, Bundle)} does not need
* to be implemented since the AlertDialog takes care of its own content.
- *
+ *
* <p>This method will be called after {@link #onCreate(Bundle)} and
* before {@link #onCreateView(LayoutInflater, ViewGroup, Bundle)}. The
* default implementation simply instantiates and returns a {@link Dialog}
* class.
- *
+ *
* <p><em>Note: DialogFragment own the {@link Dialog#setOnCancelListener
* Dialog.setOnCancelListener} and {@link Dialog#setOnDismissListener
* Dialog.setOnDismissListener} callbacks. You must not set them yourself.</em>
* To find out about these events, override {@link #onCancel(DialogInterface)}
* and {@link #onDismiss(DialogInterface)}.</p>
- *
+ *
* @param savedInstanceState The last saved instance state of the Fragment,
* or null if this is a freshly created Fragment.
- *
+ *
* @return Return a new Dialog instance to be displayed by the Fragment.
*/
@NonNull
diff --git a/fragment/java/android/support/v4/app/Fragment.java b/fragment/java/android/support/v4/app/Fragment.java
index 0adde93..0c7300e 100644
--- a/fragment/java/android/support/v4/app/Fragment.java
+++ b/fragment/java/android/support/v4/app/Fragment.java
@@ -16,7 +16,7 @@
package android.support.v4.app;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import android.app.Activity;
import android.content.ComponentCallbacks;
@@ -792,13 +792,13 @@
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
final public boolean hasOptionsMenu() {
return mHasMenu;
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
final public boolean isMenuVisible() {
return mMenuVisible;
}
@@ -1120,7 +1120,7 @@
* inflation. Maybe this should become a public API. Note sure.
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public LayoutInflater getLayoutInflater(Bundle savedInstanceState) {
LayoutInflater result = mHost.onGetLayoutInflater();
getChildFragmentManager(); // Init if needed; use raw implementation below.
diff --git a/fragment/java/android/support/v4/app/FragmentActivity.java b/fragment/java/android/support/v4/app/FragmentActivity.java
index 50fa584..0b38fd4 100644
--- a/fragment/java/android/support/v4/app/FragmentActivity.java
+++ b/fragment/java/android/support/v4/app/FragmentActivity.java
@@ -16,8 +16,9 @@
package android.support.v4.app;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
@@ -136,8 +137,6 @@
SimpleArrayMap<String, LoaderManager> loaders;
}
- MediaControllerCompat mMediaController;
-
// ------------------------------------------------------------------------
// HOOKS INTO ACTIVITY
// ------------------------------------------------------------------------
@@ -196,12 +195,12 @@
* media keys and volume changes on API 21 and later.
* @see #getSupportMediaController()
* @see #setMediaController(android.media.session.MediaController)
+ * @deprecated Use {@link MediaControllerCompat#setMediaController} instead. This API will be
+ * removed in a future release.
*/
+ @Deprecated
final public void setSupportMediaController(MediaControllerCompat mediaController) {
- mMediaController = mediaController;
- if (android.os.Build.VERSION.SDK_INT >= 21) {
- ActivityCompatApi21.setMediaController(this, mediaController.getMediaController());
- }
+ MediaControllerCompat.setMediaController(this, mediaController);
}
/**
@@ -210,9 +209,12 @@
* @return The controller which should receive events.
* @see #setSupportMediaController(MediaControllerCompat)
* @see #getMediaController()
+ * @deprecated Use {@link MediaControllerCompat#getMediaController} instead. This API will be
+ * removed in a future release.
*/
+ @Deprecated
final public MediaControllerCompat getSupportMediaController() {
- return mMediaController;
+ return MediaControllerCompat.getMediaController(this);
}
/**
@@ -528,7 +530,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected boolean onPrepareOptionsPanel(View view, Menu menu) {
return super.onPreparePanel(Window.FEATURE_OPTIONS_PANEL, view, menu);
}
@@ -1008,6 +1010,7 @@
super(FragmentActivity.this /*fragmentActivity*/);
}
+ @SuppressLint("NewApi")
@Override
public void onDump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
FragmentActivity.this.dump(prefix, fd, writer, args);
diff --git a/fragment/java/android/support/v4/app/FragmentManager.java b/fragment/java/android/support/v4/app/FragmentManager.java
index 77325cb..829e974 100644
--- a/fragment/java/android/support/v4/app/FragmentManager.java
+++ b/fragment/java/android/support/v4/app/FragmentManager.java
@@ -16,7 +16,7 @@
package android.support.v4.app;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import android.content.Context;
import android.content.res.Configuration;
@@ -158,7 +158,7 @@
* @hide -- remove once prebuilts are in.
* @deprecated
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Deprecated
public FragmentTransaction openTransaction() {
return beginTransaction();
@@ -331,7 +331,7 @@
* @return The list of all fragments or null if none.
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public abstract List<Fragment> getFragments();
/**
diff --git a/fragment/java/android/support/v4/app/FragmentTransaction.java b/fragment/java/android/support/v4/app/FragmentTransaction.java
index 9be99b2..b03f002 100644
--- a/fragment/java/android/support/v4/app/FragmentTransaction.java
+++ b/fragment/java/android/support/v4/app/FragmentTransaction.java
@@ -16,7 +16,7 @@
package android.support.v4.app;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import android.support.annotation.AnimRes;
import android.support.annotation.IdRes;
@@ -164,7 +164,7 @@
public static final int TRANSIT_EXIT_MASK = 0x2000;
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@IntDef({TRANSIT_NONE, TRANSIT_FRAGMENT_OPEN, TRANSIT_FRAGMENT_CLOSE, TRANSIT_FRAGMENT_FADE})
@Retention(RetentionPolicy.SOURCE)
private @interface Transit {}
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index a1d65af..ccfc973 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.0-all.zip
+distributionUrl=../../../../tools/external/gradle/gradle-3.2-bin.zip
diff --git a/gradlew b/gradlew
index 9d82f78..30aa96f 100755
--- a/gradlew
+++ b/gradlew
@@ -6,8 +6,15 @@
##
##############################################################################
+# Pick the correct fullsdk for this OS.
+if [ "$os" = "Darwin" ]; then
+ plat="darwin"
+else
+ plat="linux"
+fi
+DEFAULT_JVM_OPTS="-DLINT_API_DATABASE=../../prebuilts/fullsdk-$plat/platform-tools/api/api-versions.xml"
+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
diff --git a/graphics/drawable/animated/build.gradle b/graphics/drawable/animated/build.gradle
index 31cb13d..bb110a1 100644
--- a/graphics/drawable/animated/build.gradle
+++ b/graphics/drawable/animated/build.gradle
@@ -14,7 +14,7 @@
}
android {
- compileSdkVersion 23
+ compileSdkVersion project.ext.currentSdk
defaultConfig {
minSdkVersion 11
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@@ -37,10 +37,6 @@
targetCompatibility JavaVersion.VERSION_1_7
}
- lintOptions {
- abortOnError false
- }
-
aaptOptions {
additionalParameters "--no-version-vectors"
}
diff --git a/graphics/drawable/animated/src/android/support/graphics/drawable/AnimatedVectorDrawableCompat.java b/graphics/drawable/animated/src/android/support/graphics/drawable/AnimatedVectorDrawableCompat.java
index b0b5fa1..8c0a7be 100644
--- a/graphics/drawable/animated/src/android/support/graphics/drawable/AnimatedVectorDrawableCompat.java
+++ b/graphics/drawable/animated/src/android/support/graphics/drawable/AnimatedVectorDrawableCompat.java
@@ -19,6 +19,7 @@
import android.animation.AnimatorSet;
import android.animation.ArgbEvaluator;
import android.animation.ObjectAnimator;
+import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
@@ -61,6 +62,7 @@
* API. In order to refer to AnimatedVectorDrawableCompat inside a XML file, you can use
* app:srcCompat attribute in AppCompat library's ImageButton or ImageView.
*/
+@SuppressLint("NewApi")
public class AnimatedVectorDrawableCompat extends VectorDrawableCommon implements Animatable {
private static final String LOGTAG = "AnimatedVDCompat";
@@ -97,13 +99,18 @@
}
}
+ /**
+ * mutate() will be effective only if the getConstantState() is returning non-null.
+ * Otherwise, it just return the current object without modification.
+ */
@Override
public Drawable mutate() {
if (mDelegateDrawable != null) {
mDelegateDrawable.mutate();
- return this;
}
- throw new IllegalStateException("Mutate() is not supported for older platform");
+ // For older platforms that there is no delegated drawable, we just return this without
+ // any modification here, and the getConstantState() will return null in this case.
+ return this;
}
diff --git a/graphics/drawable/animated/tests/src/android/support/graphics/drawable/tests/AnimatedVectorDrawableTest.java b/graphics/drawable/animated/tests/src/android/support/graphics/drawable/tests/AnimatedVectorDrawableTest.java
index 0d6e367..aeaaf2a 100644
--- a/graphics/drawable/animated/tests/src/android/support/graphics/drawable/tests/AnimatedVectorDrawableTest.java
+++ b/graphics/drawable/animated/tests/src/android/support/graphics/drawable/tests/AnimatedVectorDrawableTest.java
@@ -270,6 +270,8 @@
assertEquals(0x40, d1.getAlpha());
assertEquals(0x20, d2.getAlpha());
assertEquals(originalAlpha, d3.getAlpha());
+ } else {
+ assertEquals(d1.mutate(), d1);
}
}
}
diff --git a/graphics/drawable/static/build.gradle b/graphics/drawable/static/build.gradle
index 24d0d50..2c72f9f 100644
--- a/graphics/drawable/static/build.gradle
+++ b/graphics/drawable/static/build.gradle
@@ -39,10 +39,6 @@
targetCompatibility JavaVersion.VERSION_1_7
}
- lintOptions {
- abortOnError false
- }
-
aaptOptions {
additionalParameters "--no-version-vectors"
}
diff --git a/graphics/drawable/static/src/android/support/graphics/drawable/TypedArrayUtils.java b/graphics/drawable/static/src/android/support/graphics/drawable/TypedArrayUtils.java
index aedd502..14200c1 100644
--- a/graphics/drawable/static/src/android/support/graphics/drawable/TypedArrayUtils.java
+++ b/graphics/drawable/static/src/android/support/graphics/drawable/TypedArrayUtils.java
@@ -15,6 +15,7 @@
package android.support.graphics.drawable;
import android.content.res.TypedArray;
+
import org.xmlpull.v1.XmlPullParser;
class TypedArrayUtils {
diff --git a/graphics/drawable/static/src/android/support/graphics/drawable/VectorDrawableCompat.java b/graphics/drawable/static/src/android/support/graphics/drawable/VectorDrawableCompat.java
index 8c93919..3166df7 100644
--- a/graphics/drawable/static/src/android/support/graphics/drawable/VectorDrawableCompat.java
+++ b/graphics/drawable/static/src/android/support/graphics/drawable/VectorDrawableCompat.java
@@ -14,8 +14,9 @@
package android.support.graphics.drawable;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+import android.annotation.SuppressLint;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.Resources.Theme;
@@ -418,6 +419,7 @@
return new PorterDuffColorFilter(color, tintMode);
}
+ @SuppressLint("NewApi")
@Override
public void setTint(int tint) {
if (mDelegateDrawable != null) {
@@ -542,7 +544,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public float getPixelSize() {
if (mVectorState == null && mVectorState.mVPathRenderer == null ||
mVectorState.mVPathRenderer.mBaseWidth == 0 ||
@@ -568,6 +570,7 @@
* @param theme the theme of this vector drawable, it can be null.
* @return a new VectorDrawableCompat or null if parsing error is found.
*/
+ @SuppressLint("NewApi")
@Nullable
public static VectorDrawableCompat create(@NonNull Resources res, @DrawableRes int resId,
@Nullable Theme theme) {
@@ -605,6 +608,7 @@
* document, tries to create a Drawable from that tag. Returns {@code null}
* if the tag is not a valid drawable.
*/
+ @SuppressLint("NewApi")
public static VectorDrawableCompat createFromXmlInner(Resources r, XmlPullParser parser,
AttributeSet attrs, Theme theme) throws XmlPullParserException, IOException {
final VectorDrawableCompat drawable = new VectorDrawableCompat();
@@ -619,6 +623,7 @@
return color;
}
+ @SuppressLint("NewApi")
@Override
public void inflate(Resources res, XmlPullParser parser, AttributeSet attrs)
throws XmlPullParserException, IOException {
@@ -842,6 +847,7 @@
}
// We don't support RTL auto mirroring since the getLayoutDirection() is for API 17+.
+ @SuppressLint("NewApi")
private boolean needMirroring() {
if (Build.VERSION.SDK_INT < 17) {
return false;
diff --git a/local.properties b/local.properties
deleted file mode 100644
index 7b7f7a0..0000000
--- a/local.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-## This file is automatically generated by Android Studio.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must *NOT* be checked into Version Control Systems,
-# as it contains information specific to your local configuration.
-#
-# Location of the SDK. This is only used by Gradle.
-# For customization when using a Version Control System, please read the
-# header note.
-#Mon Apr 11 17:16:19 PDT 2016
-#do not define sdk.dir here, it will confuse android studio
-android.dir=../../
diff --git a/media-compat/api21/android/support/v4/media/session/MediaControllerCompatApi21.java b/media-compat/api21/android/support/v4/media/session/MediaControllerCompatApi21.java
index 9b00e8c..c498f7f 100644
--- a/media-compat/api21/android/support/v4/media/session/MediaControllerCompatApi21.java
+++ b/media-compat/api21/android/support/v4/media/session/MediaControllerCompatApi21.java
@@ -17,6 +17,7 @@
package android.support.v4.media.session;
import android.annotation.TargetApi;
+import android.app.Activity;
import android.app.PendingIntent;
import android.content.Context;
import android.media.AudioAttributes;
@@ -56,6 +57,18 @@
.unregisterCallback((MediaController.Callback) callbackObj);
}
+ public static void setMediaController(Activity activity, Object controllerObj) {
+ activity.setMediaController((MediaController) controllerObj);
+ }
+
+ public static Object getMediaController(Activity activity) {
+ return activity.getMediaController();
+ }
+
+ public static Object getSessionToken(Object controllerObj) {
+ return ((MediaController) controllerObj).getSessionToken();
+ }
+
public static Object getTransportControls(Object controllerObj) {
return ((MediaController)controllerObj).getTransportControls();
}
diff --git a/media-compat/build.gradle b/media-compat/build.gradle
index 6c20ad0..e26a1bc 100644
--- a/media-compat/build.gradle
+++ b/media-compat/build.gradle
@@ -40,11 +40,6 @@
main.aidl.srcDirs = ['java']
}
- lintOptions {
- // TODO: fix errors and reenable.
- abortOnError false
- }
-
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
diff --git a/media-compat/java/android/support/v4/media/MediaBrowserCompat.java b/media-compat/java/android/support/v4/media/MediaBrowserCompat.java
index 79f61c3..be0959d 100644
--- a/media-compat/java/android/support/v4/media/MediaBrowserCompat.java
+++ b/media-compat/java/android/support/v4/media/MediaBrowserCompat.java
@@ -15,6 +15,30 @@
*/
package android.support.v4.media;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+import static android.support.v4.media.MediaBrowserProtocol.CLIENT_MSG_ADD_SUBSCRIPTION;
+import static android.support.v4.media.MediaBrowserProtocol.CLIENT_MSG_CONNECT;
+import static android.support.v4.media.MediaBrowserProtocol.CLIENT_MSG_DISCONNECT;
+import static android.support.v4.media.MediaBrowserProtocol.CLIENT_MSG_GET_MEDIA_ITEM;
+import static android.support.v4.media.MediaBrowserProtocol.CLIENT_MSG_REGISTER_CALLBACK_MESSENGER;
+import static android.support.v4.media.MediaBrowserProtocol.CLIENT_MSG_REMOVE_SUBSCRIPTION;
+import static android.support.v4.media.MediaBrowserProtocol
+ .CLIENT_MSG_UNREGISTER_CALLBACK_MESSENGER;
+import static android.support.v4.media.MediaBrowserProtocol.CLIENT_VERSION_CURRENT;
+import static android.support.v4.media.MediaBrowserProtocol.DATA_CALLBACK_TOKEN;
+import static android.support.v4.media.MediaBrowserProtocol.DATA_MEDIA_ITEM_ID;
+import static android.support.v4.media.MediaBrowserProtocol.DATA_MEDIA_ITEM_LIST;
+import static android.support.v4.media.MediaBrowserProtocol.DATA_MEDIA_SESSION_TOKEN;
+import static android.support.v4.media.MediaBrowserProtocol.DATA_OPTIONS;
+import static android.support.v4.media.MediaBrowserProtocol.DATA_PACKAGE_NAME;
+import static android.support.v4.media.MediaBrowserProtocol.DATA_RESULT_RECEIVER;
+import static android.support.v4.media.MediaBrowserProtocol.DATA_ROOT_HINTS;
+import static android.support.v4.media.MediaBrowserProtocol.EXTRA_CLIENT_VERSION;
+import static android.support.v4.media.MediaBrowserProtocol.EXTRA_MESSENGER_BINDER;
+import static android.support.v4.media.MediaBrowserProtocol.SERVICE_MSG_ON_CONNECT;
+import static android.support.v4.media.MediaBrowserProtocol.SERVICE_MSG_ON_CONNECT_FAILED;
+import static android.support.v4.media.MediaBrowserProtocol.SERVICE_MSG_ON_LOAD_CHILDREN;
+
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -34,7 +58,7 @@
import android.support.annotation.Nullable;
import android.support.annotation.RestrictTo;
import android.support.v4.app.BundleCompat;
-import android.support.v4.media.session.MediaControllerCompat;
+import android.support.v4.media.session.MediaControllerCompat.TransportControls;
import android.support.v4.media.session.MediaSessionCompat;
import android.support.v4.os.BuildCompat;
import android.support.v4.os.ResultReceiver;
@@ -50,9 +74,6 @@
import java.util.List;
import java.util.Map;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-import static android.support.v4.media.MediaBrowserProtocol.*;
-
/**
* Browses media content offered by a {@link MediaBrowserServiceCompat}.
* <p>
@@ -309,7 +330,7 @@
private final MediaDescriptionCompat mDescription;
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Retention(RetentionPolicy.SOURCE)
@IntDef(flag=true, value = { FLAG_BROWSABLE, FLAG_PLAYABLE })
public @interface Flags { }
@@ -323,7 +344,7 @@
* Flag: Indicates that the item is playable.
* <p>
* The id of this item may be passed to
- * {@link MediaControllerCompat.TransportControls#playFromMediaId(String, Bundle)}
+ * {@link TransportControls#playFromMediaId(String, Bundle)}
* to start playing it.
* </p>
*/
diff --git a/media-compat/java/android/support/v4/media/MediaBrowserCompatUtils.java b/media-compat/java/android/support/v4/media/MediaBrowserCompatUtils.java
index 1ffc9f5..296b4c6 100644
--- a/media-compat/java/android/support/v4/media/MediaBrowserCompatUtils.java
+++ b/media-compat/java/android/support/v4/media/MediaBrowserCompatUtils.java
@@ -16,15 +16,15 @@
package android.support.v4.media;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.os.Bundle;
import android.support.annotation.RestrictTo;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class MediaBrowserCompatUtils {
public static boolean areSameOptions(Bundle options1, Bundle options2) {
if (options1 == options2) {
diff --git a/media-compat/java/android/support/v4/media/MediaBrowserServiceCompat.java b/media-compat/java/android/support/v4/media/MediaBrowserServiceCompat.java
index 23c0cb0..a9fc7e8 100644
--- a/media-compat/java/android/support/v4/media/MediaBrowserServiceCompat.java
+++ b/media-compat/java/android/support/v4/media/MediaBrowserServiceCompat.java
@@ -16,7 +16,7 @@
package android.support.v4.media;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import static android.support.v4.media.MediaBrowserProtocol.CLIENT_MSG_ADD_SUBSCRIPTION;
import static android.support.v4.media.MediaBrowserProtocol.CLIENT_MSG_CONNECT;
import static android.support.v4.media.MediaBrowserProtocol.CLIENT_MSG_DISCONNECT;
@@ -113,14 +113,14 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public static final String KEY_MEDIA_ITEM = "media_item";
static final int RESULT_FLAG_OPTION_NOT_HANDLED = 0x00000001;
static final int RESULT_FLAG_ON_LOAD_ITEM_NOT_IMPLEMENTED = 0x00000002;
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Retention(RetentionPolicy.SOURCE)
@IntDef(flag=true, value = { RESULT_FLAG_OPTION_NOT_HANDLED,
RESULT_FLAG_ON_LOAD_ITEM_NOT_IMPLEMENTED })
diff --git a/media-compat/java/android/support/v4/media/MediaDescriptionCompat.java b/media-compat/java/android/support/v4/media/MediaDescriptionCompat.java
index 1a597fc..1a617e9 100644
--- a/media-compat/java/android/support/v4/media/MediaDescriptionCompat.java
+++ b/media-compat/java/android/support/v4/media/MediaDescriptionCompat.java
@@ -15,6 +15,8 @@
*/
package android.support.v4.media;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build;
@@ -25,8 +27,6 @@
import android.support.annotation.RestrictTo;
import android.text.TextUtils;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* A simple set of metadata for a media item suitable for display. This can be
* created using the Builder or retrieved from existing metadata using
@@ -101,7 +101,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public static final String DESCRIPTION_KEY_MEDIA_URI =
"android.support.v4.media.description.MEDIA_URI";
/**
@@ -109,7 +109,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public static final String DESCRIPTION_KEY_NULL_BUNDLE_FLAG =
"android.support.v4.media.description.NULL_BUNDLE_FLAG";
/**
diff --git a/media-compat/java/android/support/v4/media/MediaMetadataCompat.java b/media-compat/java/android/support/v4/media/MediaMetadataCompat.java
index 6116e6d..8792982 100644
--- a/media-compat/java/android/support/v4/media/MediaMetadataCompat.java
+++ b/media-compat/java/android/support/v4/media/MediaMetadataCompat.java
@@ -15,6 +15,8 @@
*/
package android.support.v4.media;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build;
@@ -23,9 +25,8 @@
import android.os.Parcelable;
import android.support.annotation.RestrictTo;
import android.support.annotation.StringDef;
+import android.support.v4.media.session.MediaControllerCompat.TransportControls;
import android.support.v4.util.ArrayMap;
-import android.support.v4.media.MediaBrowserCompat;
-import android.support.v4.media.session.MediaControllerCompat;
import android.text.TextUtils;
import android.util.Log;
@@ -33,8 +34,6 @@
import java.lang.annotation.RetentionPolicy;
import java.util.Set;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Contains metadata about an item, such as the title, artist, etc.
*/
@@ -216,7 +215,7 @@
/**
* A Uri formatted String representing the content. This value is specific to the
* service providing the content. It may be used with
- * {@link MediaControllerCompat.TransportControls#playFromUri(Uri, Bundle)}
+ * {@link TransportControls#playFromUri(Uri, Bundle)}
* to initiate playback when provided by a {@link MediaBrowserCompat} connected to
* the same app.
*/
@@ -241,7 +240,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@StringDef({METADATA_KEY_TITLE, METADATA_KEY_ARTIST, METADATA_KEY_ALBUM, METADATA_KEY_AUTHOR,
METADATA_KEY_WRITER, METADATA_KEY_COMPOSER, METADATA_KEY_COMPILATION,
METADATA_KEY_DATE, METADATA_KEY_GENRE, METADATA_KEY_ALBUM_ARTIST, METADATA_KEY_ART_URI,
@@ -254,7 +253,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@StringDef({METADATA_KEY_DURATION, METADATA_KEY_YEAR, METADATA_KEY_TRACK_NUMBER,
METADATA_KEY_NUM_TRACKS, METADATA_KEY_DISC_NUMBER, METADATA_KEY_BT_FOLDER_TYPE})
@Retention(RetentionPolicy.SOURCE)
@@ -263,7 +262,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@StringDef({METADATA_KEY_ART, METADATA_KEY_ALBUM_ART, METADATA_KEY_DISPLAY_ICON})
@Retention(RetentionPolicy.SOURCE)
public @interface BitmapKey {}
@@ -271,7 +270,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@StringDef({METADATA_KEY_USER_RATING, METADATA_KEY_RATING})
@Retention(RetentionPolicy.SOURCE)
public @interface RatingKey {}
@@ -662,7 +661,7 @@
* in the metadata.
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public Builder(MediaMetadataCompat source, int maxBitmapSize) {
this(source);
for (String key : mBundle.keySet()) {
diff --git a/media-compat/java/android/support/v4/media/RatingCompat.java b/media-compat/java/android/support/v4/media/RatingCompat.java
index af53bff..f61a686 100644
--- a/media-compat/java/android/support/v4/media/RatingCompat.java
+++ b/media-compat/java/android/support/v4/media/RatingCompat.java
@@ -16,6 +16,8 @@
package android.support.v4.media;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
@@ -26,8 +28,6 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* A class to encapsulate rating information used as content metadata.
* A rating is defined by its rating style (see {@link #RATING_HEART},
@@ -42,7 +42,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@IntDef({RATING_NONE, RATING_HEART, RATING_THUMB_UP_DOWN, RATING_3_STARS, RATING_4_STARS,
RATING_5_STARS, RATING_PERCENTAGE})
@Retention(RetentionPolicy.SOURCE)
@@ -51,7 +51,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@IntDef({RATING_3_STARS, RATING_4_STARS, RATING_5_STARS})
@Retention(RetentionPolicy.SOURCE)
public @interface StarStyle {}
diff --git a/media-compat/java/android/support/v4/media/VolumeProviderCompat.java b/media-compat/java/android/support/v4/media/VolumeProviderCompat.java
index 4213720..a3aa047 100644
--- a/media-compat/java/android/support/v4/media/VolumeProviderCompat.java
+++ b/media-compat/java/android/support/v4/media/VolumeProviderCompat.java
@@ -16,6 +16,8 @@
package android.support.v4.media;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.os.Build;
import android.support.annotation.IntDef;
import android.support.annotation.RestrictTo;
@@ -24,8 +26,6 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Handles requests to adjust or set the volume on a session. This is also used
* to push volume updates back to the session after a request has been handled.
@@ -37,7 +37,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@IntDef({VOLUME_CONTROL_FIXED, VOLUME_CONTROL_RELATIVE, VOLUME_CONTROL_ABSOLUTE})
@Retention(RetentionPolicy.SOURCE)
public @interface ControlType {}
diff --git a/media-compat/java/android/support/v4/media/session/MediaControllerCompat.java b/media-compat/java/android/support/v4/media/session/MediaControllerCompat.java
index 68bd31f..4ef4319 100644
--- a/media-compat/java/android/support/v4/media/session/MediaControllerCompat.java
+++ b/media-compat/java/android/support/v4/media/session/MediaControllerCompat.java
@@ -16,6 +16,7 @@
package android.support.v4.media.session;
+import android.app.Activity;
import android.app.PendingIntent;
import android.content.Context;
import android.media.AudioManager;
@@ -28,6 +29,7 @@
import android.os.RemoteException;
import android.os.ResultReceiver;
import android.support.v4.app.BundleCompat;
+import android.support.v4.app.SupportActivity;
import android.support.v4.media.MediaMetadataCompat;
import android.support.v4.media.RatingCompat;
import android.support.v4.media.VolumeProviderCompat;
@@ -60,6 +62,78 @@
static final String COMMAND_GET_EXTRA_BINDER =
"android.support.v4.media.session.command.GET_EXTRA_BINDER";
+ private static class MediaControllerExtraData extends SupportActivity.ExtraData {
+ private final MediaControllerCompat mMediaController;
+
+ MediaControllerExtraData(MediaControllerCompat mediaController) {
+ mMediaController = mediaController;
+ }
+
+ MediaControllerCompat getMediaController() {
+ return mMediaController;
+ }
+ }
+
+ /**
+ * Sets a {@link MediaControllerCompat} for later retrieval via
+ * {@link #getMediaController()}.
+ *
+ * <p>On API 21 and later, this controller will be tied to the window of the activity and
+ * media key and volume events which are received while the Activity is in the foreground
+ * will be forwarded to the controller and used to invoke transport controls or adjust the
+ * volume. Prior to API 21, the global handling of media key and volume events through an
+ * active {@link android.support.v4.media.session.MediaSessionCompat} and media button receiver
+ * will still be respected.</p>
+ *
+ * @param mediaController The controller for the session which should receive
+ * media keys and volume changes on API 21 and later.
+ * @see #getMediaController()
+ * @see Activity#setMediaController(android.media.session.MediaController)
+ */
+ public static void setMediaController(Activity activity,
+ MediaControllerCompat mediaController) {
+ if (activity instanceof SupportActivity) {
+ ((SupportActivity) activity).putExtraData(
+ new MediaControllerExtraData(mediaController));
+ }
+ if (android.os.Build.VERSION.SDK_INT >= 21) {
+ Object controllerObj = null;
+ if (mediaController != null) {
+ Object sessionTokenObj = mediaController.getSessionToken().getToken();
+ controllerObj = MediaControllerCompatApi21.fromToken(activity, sessionTokenObj);
+ }
+ MediaControllerCompatApi21.setMediaController(activity, controllerObj);
+ }
+ }
+
+ /**
+ * Retrieves the current {@link MediaControllerCompat} for sending media key and volume events.
+ *
+ * @return The controller which should receive events.
+ * @see #setMediaController(Activity,MediaControllerCompat)
+ * @see #getMediaController()
+ */
+ public static MediaControllerCompat getMediaController(Activity activity) {
+ if (activity instanceof SupportActivity) {
+ MediaControllerExtraData extraData =
+ ((SupportActivity) activity).getExtraData(MediaControllerExtraData.class);
+ return extraData != null ? extraData.getMediaController() : null;
+ } else if (android.os.Build.VERSION.SDK_INT >= 21) {
+ Object controllerObj = MediaControllerCompatApi21.getMediaController(activity);
+ if (controllerObj == null) {
+ return null;
+ }
+ Object sessionTokenObj = MediaControllerCompatApi21.getSessionToken(controllerObj);
+ try {
+ return new MediaControllerCompat(activity,
+ MediaSessionCompat.Token.fromToken(sessionTokenObj));
+ } catch (RemoteException e) {
+ Log.e(TAG, "Dead object in getMediaController. " + e);
+ }
+ }
+ return null;
+ }
+
private final MediaControllerImpl mImpl;
private final MediaSessionCompat.Token mToken;
diff --git a/media-compat/java/android/support/v4/media/session/MediaSessionCompat.java b/media-compat/java/android/support/v4/media/session/MediaSessionCompat.java
index 4e3bc36..78b0c50 100644
--- a/media-compat/java/android/support/v4/media/session/MediaSessionCompat.java
+++ b/media-compat/java/android/support/v4/media/session/MediaSessionCompat.java
@@ -17,7 +17,7 @@
package android.support.v4.media.session;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import android.app.Activity;
import android.app.PendingIntent;
@@ -93,7 +93,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@IntDef(flag=true, value={FLAG_HANDLES_MEDIA_BUTTONS, FLAG_HANDLES_TRANSPORT_CONTROLS})
@Retention(RetentionPolicy.SOURCE)
public @interface SessionFlags {}
@@ -533,7 +533,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public String getCallingPackage() {
return mImpl.getCallingPackage();
}
diff --git a/media-compat/java/android/support/v4/media/session/PlaybackStateCompat.java b/media-compat/java/android/support/v4/media/session/PlaybackStateCompat.java
index 569e2c9..be6e4b1 100644
--- a/media-compat/java/android/support/v4/media/session/PlaybackStateCompat.java
+++ b/media-compat/java/android/support/v4/media/session/PlaybackStateCompat.java
@@ -16,7 +16,7 @@
package android.support.v4.media.session;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import android.os.Build;
import android.os.Bundle;
@@ -44,20 +44,19 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@IntDef(flag=true, value={ACTION_STOP, ACTION_PAUSE, ACTION_PLAY, ACTION_REWIND,
ACTION_SKIP_TO_PREVIOUS, ACTION_SKIP_TO_NEXT, ACTION_FAST_FORWARD, ACTION_SET_RATING,
ACTION_SEEK_TO, ACTION_PLAY_PAUSE, ACTION_PLAY_FROM_MEDIA_ID, ACTION_PLAY_FROM_SEARCH,
ACTION_SKIP_TO_QUEUE_ITEM, ACTION_PLAY_FROM_URI, ACTION_PREPARE,
- ACTION_PREPARE_FROM_MEDIA_ID, ACTION_PREPARE_FROM_SEARCH, ACTION_PREPARE_FROM_URI,
- ACTION_SET_REPEAT_MODE, ACTION_SET_SHUFFLE_MODE_ENABLED})
+ ACTION_PREPARE_FROM_MEDIA_ID, ACTION_PREPARE_FROM_SEARCH, ACTION_PREPARE_FROM_URI})
@Retention(RetentionPolicy.SOURCE)
public @interface Actions {}
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@IntDef({ACTION_STOP, ACTION_PAUSE, ACTION_PLAY, ACTION_REWIND, ACTION_SKIP_TO_PREVIOUS,
ACTION_SKIP_TO_NEXT, ACTION_FAST_FORWARD, ACTION_PLAY_PAUSE})
@Retention(RetentionPolicy.SOURCE)
@@ -190,23 +189,9 @@
public static final long ACTION_PREPARE_FROM_URI = 1 << 17;
/**
- * Indicates this session supports the set repeat mode command.
- *
- * @see Builder#setActions(long)
- */
- public static final long ACTION_SET_REPEAT_MODE = 1 << 18;
-
- /**
- * Indicates this session supports the set shuffle mode enabled command.
- *
- * @see Builder#setActions(long)
- */
- public static final long ACTION_SET_SHUFFLE_MODE_ENABLED = 1 << 19;
-
- /**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@IntDef({STATE_NONE, STATE_STOPPED, STATE_PAUSED, STATE_PLAYING, STATE_FAST_FORWARDING,
STATE_REWINDING, STATE_BUFFERING, STATE_ERROR, STATE_CONNECTING,
STATE_SKIPPING_TO_PREVIOUS, STATE_SKIPPING_TO_NEXT, STATE_SKIPPING_TO_QUEUE_ITEM})
@@ -315,31 +300,6 @@
*/
public final static long PLAYBACK_POSITION_UNKNOWN = -1;
- /**
- * @hide
- */
- @IntDef({REPEAT_MODE_NONE, REPEAT_MODE_ONE, REPEAT_MODE_ALL})
- @Retention(RetentionPolicy.SOURCE)
- public @interface RepeatMode {}
-
- /**
- * Use this value with {@link MediaControllerCompat.TransportControls#setRepeatMode}
- * to indicate that the playback will be stopped at the end of the playing media list.
- */
- public static final int REPEAT_MODE_NONE = 0;
-
- /**
- * Use this value with {@link MediaControllerCompat.TransportControls#setRepeatMode}
- * to indicate that the playback of the current playing media item will be repeated.
- */
- public static final int REPEAT_MODE_ONE = 1;
-
- /**
- * Use this value with {@link MediaControllerCompat.TransportControls#setRepeatMode}
- * to indicate that the playback of the playing media list will be repeated.
- */
- public static final int REPEAT_MODE_ALL = 2;
-
// KeyEvent constants only available on API 11+
private static final int KEYCODE_MEDIA_PAUSE = 127;
private static final int KEYCODE_MEDIA_PLAY = 126;
@@ -530,8 +490,6 @@
* <li> {@link PlaybackStateCompat#ACTION_PREPARE_FROM_MEDIA_ID}</li>
* <li> {@link PlaybackStateCompat#ACTION_PREPARE_FROM_SEARCH}</li>
* <li> {@link PlaybackStateCompat#ACTION_PREPARE_FROM_URI}</li>
- * <li> {@link PlaybackStateCompat#ACTION_SET_REPEAT_MODE}</li>
- * <li> {@link PlaybackStateCompat#ACTION_SET_SHUFFLE_MODE_ENABLED}</li>
* </ul>
*/
@Actions
@@ -1042,8 +1000,6 @@
* <li> {@link PlaybackStateCompat#ACTION_PREPARE_FROM_MEDIA_ID}</li>
* <li> {@link PlaybackStateCompat#ACTION_PREPARE_FROM_SEARCH}</li>
* <li> {@link PlaybackStateCompat#ACTION_PREPARE_FROM_URI}</li>
- * <li> {@link PlaybackStateCompat#ACTION_SET_REPEAT_MODE}</li>
- * <li> {@link PlaybackStateCompat#ACTION_SET_SHUFFLE_MODE_ENABLED}</li>
* </ul>
*
* @return this
diff --git a/percent/build.gradle b/percent/build.gradle
index 4fe4630..c3f386e 100644
--- a/percent/build.gradle
+++ b/percent/build.gradle
@@ -39,10 +39,6 @@
androidTest.manifest.srcFile 'tests/AndroidManifest.xml'
}
- lintOptions {
- abortOnError false
- }
-
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
diff --git a/recommendation/build.gradle b/recommendation/build.gradle
index e356402..75d68d1 100644
--- a/recommendation/build.gradle
+++ b/recommendation/build.gradle
@@ -27,10 +27,6 @@
androidTest.java.srcDir 'tests/src'
}
- lintOptions {
- abortOnError false
- }
-
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
diff --git a/samples/Support13Demos/build.gradle b/samples/Support13Demos/build.gradle
index 3f78d64..1b58043 100644
--- a/samples/Support13Demos/build.gradle
+++ b/samples/Support13Demos/build.gradle
@@ -19,7 +19,6 @@
}
lintOptions {
- // TODO: fix errors and reenable.
abortOnError false
}
diff --git a/samples/Support4Demos/build.gradle b/samples/Support4Demos/build.gradle
index 26d8113..959968a 100644
--- a/samples/Support4Demos/build.gradle
+++ b/samples/Support4Demos/build.gradle
@@ -19,7 +19,6 @@
}
lintOptions {
- // TODO: fix errors and reenable.
abortOnError false
}
diff --git a/samples/Support7Demos/build.gradle b/samples/Support7Demos/build.gradle
index ac8dc3c..d87479a 100644
--- a/samples/Support7Demos/build.gradle
+++ b/samples/Support7Demos/build.gradle
@@ -24,7 +24,6 @@
}
lintOptions {
- // TODO: fix errors and reenable.
abortOnError false
}
diff --git a/samples/SupportDesignDemos/build.gradle b/samples/SupportDesignDemos/build.gradle
index 163bb61..b03e63e 100644
--- a/samples/SupportDesignDemos/build.gradle
+++ b/samples/SupportDesignDemos/build.gradle
@@ -19,7 +19,6 @@
}
lintOptions {
- // TODO: fix errors and reenable.
abortOnError false
}
diff --git a/samples/SupportDesignDemos/res/layout/design_bottom_navigation_view.xml b/samples/SupportDesignDemos/res/layout/design_bottom_navigation_view.xml
index 3add119..b2a4d59 100644
--- a/samples/SupportDesignDemos/res/layout/design_bottom_navigation_view.xml
+++ b/samples/SupportDesignDemos/res/layout/design_bottom_navigation_view.xml
@@ -52,11 +52,18 @@
android:text="@string/bottomnavigation_tint"
android:layout_below="@+id/button_remove"/>
+ <Button
+ android:id="@+id/button_select_next"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/bottomnavigation_select_next"
+ android:layout_below="@+id/button_tint"/>
+
<TextView
android:id="@+id/selected_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_below="@+id/button_tint"/>
+ android:layout_below="@+id/button_select_next"/>
</RelativeLayout>
</ScrollView>
<android.support.design.widget.BottomNavigationView
diff --git a/samples/SupportDesignDemos/res/values/strings.xml b/samples/SupportDesignDemos/res/values/strings.xml
index 10ffd86..74630d9 100644
--- a/samples/SupportDesignDemos/res/values/strings.xml
+++ b/samples/SupportDesignDemos/res/values/strings.xml
@@ -129,4 +129,5 @@
<string name="bottomnavigation_add">Add an item</string>
<string name="bottomnavigation_remove">Remove an item</string>
<string name="bottomnavigation_tint">Toggle tint</string>
+ <string name="bottomnavigation_select_next">Select next item</string>
</resources>
diff --git a/samples/SupportDesignDemos/src/com/example/android/support/design/widget/BottomNavigationViewUsage.java b/samples/SupportDesignDemos/src/com/example/android/support/design/widget/BottomNavigationViewUsage.java
index 3442218..fa9b0b6 100644
--- a/samples/SupportDesignDemos/src/com/example/android/support/design/widget/BottomNavigationViewUsage.java
+++ b/samples/SupportDesignDemos/src/com/example/android/support/design/widget/BottomNavigationViewUsage.java
@@ -76,6 +76,20 @@
}
}
});
+ Button buttonNext = (Button) findViewById(R.id.button_select_next);
+ buttonNext.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ final int menuSize = bottom.getMenu().size();
+ int currentlySelected = 0;
+ for (int i = 0; i < menuSize; i++) {
+ if (bottom.getMenu().getItem(i).isChecked()) {
+ currentlySelected = i;
+ }
+ }
+ bottom.getMenu().getItem((currentlySelected + 1) % menuSize).setChecked(true);
+ }
+ });
final TextView selectedItem = (TextView) findViewById(R.id.selected_item);
bottom.setOnNavigationItemSelectedListener(
new BottomNavigationView.OnNavigationItemSelectedListener() {
diff --git a/samples/SupportLeanbackDemos/build.gradle b/samples/SupportLeanbackDemos/build.gradle
index 67cfe4d..e0cc44b 100644
--- a/samples/SupportLeanbackDemos/build.gradle
+++ b/samples/SupportLeanbackDemos/build.gradle
@@ -20,7 +20,6 @@
}
lintOptions {
- // TODO: fix errors and reenable.
abortOnError false
}
diff --git a/samples/SupportPercentDemos/build.gradle b/samples/SupportPercentDemos/build.gradle
index a31b343..e3caf1d 100644
--- a/samples/SupportPercentDemos/build.gradle
+++ b/samples/SupportPercentDemos/build.gradle
@@ -19,7 +19,6 @@
}
lintOptions {
- // TODO: fix errors and reenable.
abortOnError false
}
diff --git a/samples/SupportPreferenceDemos/build.gradle b/samples/SupportPreferenceDemos/build.gradle
index 717532a..e59a348 100644
--- a/samples/SupportPreferenceDemos/build.gradle
+++ b/samples/SupportPreferenceDemos/build.gradle
@@ -24,7 +24,6 @@
}
lintOptions {
- // TODO: fix errors and reenable.
abortOnError false
}
diff --git a/samples/SupportTransitionDemos/build.gradle b/samples/SupportTransitionDemos/build.gradle
index c3131ff..5ebdc1b 100644
--- a/samples/SupportTransitionDemos/build.gradle
+++ b/samples/SupportTransitionDemos/build.gradle
@@ -20,7 +20,6 @@
}
lintOptions {
- // TODO: fix errors and reenable.
abortOnError false
}
diff --git a/settings.gradle b/settings.gradle
index fcdd6c3..b7dce9c 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,5 +1,3 @@
-apply from:'buildSrc/studioCompat.gradle'
-
/////////////////////////////
//
// Libraries
diff --git a/transition/build.gradle b/transition/build.gradle
index 4d4e96f..05675f9 100644
--- a/transition/build.gradle
+++ b/transition/build.gradle
@@ -51,11 +51,6 @@
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
-
- lintOptions {
- // TODO: fix errors and reenable.
- abortOnError false
- }
}
android.libraryVariants.all { variant ->
diff --git a/transition/ics/android/support/transition/TransitionManagerPort.java b/transition/ics/android/support/transition/TransitionManagerPort.java
index 3acad62..2ea7656 100644
--- a/transition/ics/android/support/transition/TransitionManagerPort.java
+++ b/transition/ics/android/support/transition/TransitionManagerPort.java
@@ -16,6 +16,8 @@
package android.support.transition;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.annotation.TargetApi;
import android.support.annotation.RequiresApi;
import android.support.annotation.RestrictTo;
@@ -29,8 +31,6 @@
import java.lang.ref.WeakReference;
import java.util.ArrayList;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
@RequiresApi(14)
@TargetApi(14)
class TransitionManagerPort {
@@ -64,7 +64,7 @@
* @hide pending later changes
* @see #setDefaultTransition(TransitionPort)
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public static TransitionPort getDefaultTransition() {
return sDefaultTransition;
}
@@ -77,7 +77,7 @@
* @param transition The default transition to be used for scene changes.
* @hide pending later changes
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void setDefaultTransition(TransitionPort transition) {
sDefaultTransition = transition;
}
diff --git a/transition/ics/android/support/transition/TransitionPort.java b/transition/ics/android/support/transition/TransitionPort.java
index 4e6a9d7..98b217d 100644
--- a/transition/ics/android/support/transition/TransitionPort.java
+++ b/transition/ics/android/support/transition/TransitionPort.java
@@ -16,6 +16,8 @@
package android.support.transition;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.TimeInterpolator;
@@ -33,8 +35,6 @@
import java.util.ArrayList;
import java.util.List;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
@RequiresApi(14)
@TargetApi(14)
abstract class TransitionPort implements Cloneable {
@@ -178,7 +178,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected void createAnimators(ViewGroup sceneRoot, TransitionValuesMaps startValues,
TransitionValuesMaps endValues) {
if (DBG) {
@@ -414,7 +414,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected void runAnimators() {
if (DBG) {
Log.d(LOG_TAG, "runAnimators() on " + this);
@@ -798,7 +798,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void pause(View sceneRoot) {
if (!mEnded) {
ArrayMap<Animator, AnimationInfo> runningAnimators = getRunningAnimators();
@@ -830,7 +830,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void resume(View sceneRoot) {
if (mPaused) {
if (!mEnded) {
@@ -929,7 +929,7 @@
* @param animator The Animator to be run during this transition.
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected void animate(Animator animator) {
// TODO: maybe pass auto-end as a boolean parameter?
if (animator == null) {
@@ -962,7 +962,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected void start() {
if (mNumInstances == 0) {
if (mListeners != null && mListeners.size() > 0) {
@@ -989,7 +989,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected void end() {
--mNumInstances;
if (mNumInstances == 0) {
@@ -1024,7 +1024,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected void cancel() {
int numAnimators = mCurrentAnimators.size();
for (int i = numAnimators - 1; i >= 0; i--) {
@@ -1197,7 +1197,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public static class TransitionListenerAdapter implements TransitionListener {
@Override
diff --git a/transition/ics/android/support/transition/TransitionSetPort.java b/transition/ics/android/support/transition/TransitionSetPort.java
index 1d5ddd6..d88e046 100644
--- a/transition/ics/android/support/transition/TransitionSetPort.java
+++ b/transition/ics/android/support/transition/TransitionSetPort.java
@@ -16,6 +16,8 @@
package android.support.transition;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.animation.TimeInterpolator;
import android.annotation.TargetApi;
import android.support.annotation.RequiresApi;
@@ -26,8 +28,6 @@
import java.util.ArrayList;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
@RequiresApi(14)
@TargetApi(14)
class TransitionSetPort extends TransitionPort {
@@ -169,7 +169,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
protected void createAnimators(ViewGroup sceneRoot, TransitionValuesMaps startValues,
TransitionValuesMaps endValues) {
@@ -181,7 +181,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
protected void runAnimators() {
if (mTransitions.isEmpty()) {
@@ -240,7 +240,7 @@
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public void pause(View sceneRoot) {
super.pause(sceneRoot);
@@ -251,7 +251,7 @@
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public void resume(View sceneRoot) {
super.resume(sceneRoot);
@@ -262,7 +262,7 @@
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
protected void cancel() {
super.cancel();
diff --git a/transition/ics/android/support/transition/ViewOverlay.java b/transition/ics/android/support/transition/ViewOverlay.java
index a95d8f1..8b36850 100644
--- a/transition/ics/android/support/transition/ViewOverlay.java
+++ b/transition/ics/android/support/transition/ViewOverlay.java
@@ -16,6 +16,8 @@
package android.support.transition;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.R;
import android.annotation.TargetApi;
import android.content.Context;
@@ -34,8 +36,6 @@
import java.lang.reflect.Method;
import java.util.ArrayList;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
@RequiresApi(14)
@TargetApi(14)
class ViewOverlay {
@@ -330,7 +330,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected ViewParent invalidateChildInParentFast(int left, int top, Rect dirty) {
if (mHostView instanceof ViewGroup && sInvalidateChildInParentFastMethod != null) {
try {
diff --git a/v13/build.gradle b/v13/build.gradle
index 5e1a026..85aa8a8 100644
--- a/v13/build.gradle
+++ b/v13/build.gradle
@@ -4,6 +4,16 @@
dependencies {
compile project(':support-annotations')
compile project(':support-v4')
+
+ androidTestCompile ("com.android.support.test:runner:${project.rootProject.ext.testRunnerVersion}") {
+ exclude module: 'support-annotations'
+ }
+ androidTestCompile ("com.android.support.test.espresso:espresso-core:${project.rootProject.ext.espressoVersion}") {
+ exclude module: 'support-annotations'
+ }
+ androidTestCompile "org.mockito:mockito-core:1.9.5"
+ androidTestCompile "com.google.dexmaker:dexmaker:1.2"
+ androidTestCompile "com.google.dexmaker:dexmaker-mockito:1.2"
}
android {
@@ -11,6 +21,7 @@
defaultConfig {
minSdkVersion 13
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
sourceSets {
@@ -23,11 +34,11 @@
'api25',
'java'
]
- }
- lintOptions {
- // TODO: fix errors and reenable.
- abortOnError false
+ androidTest.setRoot('tests')
+ androidTest.java.srcDir 'tests/java'
+ androidTest.res.srcDir 'tests/res'
+ androidTest.manifest.srcFile 'tests/AndroidManifest.xml'
}
compileOptions {
diff --git a/v13/java/android/support/v13/view/DragAndDropPermissionsCompat.java b/v13/java/android/support/v13/view/DragAndDropPermissionsCompat.java
index f10a548..46484da 100644
--- a/v13/java/android/support/v13/view/DragAndDropPermissionsCompat.java
+++ b/v13/java/android/support/v13/view/DragAndDropPermissionsCompat.java
@@ -16,6 +16,8 @@
package android.support.v13.view;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.annotation.TargetApi;
import android.app.Activity;
import android.support.annotation.RequiresApi;
@@ -23,8 +25,6 @@
import android.support.v4.os.BuildCompat;
import android.view.DragEvent;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Helper for accessing features in {@link android.view.DragAndDropPermissions}
* introduced after API level 13 in a backwards compatible fashion.
@@ -79,7 +79,7 @@
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public static DragAndDropPermissionsCompat request(Activity activity, DragEvent dragEvent) {
Object dragAndDropPermissions = IMPL.request(activity, dragEvent);
if (dragAndDropPermissions != null) {
diff --git a/v13/java/android/support/v13/view/DragStartHelper.java b/v13/java/android/support/v13/view/DragStartHelper.java
index b1fd913..16c54b9 100644
--- a/v13/java/android/support/v13/view/DragStartHelper.java
+++ b/v13/java/android/support/v13/view/DragStartHelper.java
@@ -77,6 +77,7 @@
final private OnDragStartListener mListener;
private int mLastTouchX, mLastTouchY;
+ private boolean mDragging;
/**
* Interface definition for a callback to be invoked when a drag start gesture is detected.
@@ -87,7 +88,7 @@
*
* @param v The view over which the drag start gesture has been detected.
* @param helper The DragStartHelper object which detected the gesture.
- * @return True if the listener has consumed the event, false otherwise.
+ * @return True if the listener has started the drag operation, false otherwise.
*/
boolean onDragStart(View v, DragStartHelper helper);
}
@@ -131,15 +132,37 @@
* @return True if the listener has consumed the event, false otherwise.
*/
public boolean onTouch(View v, MotionEvent event) {
- if (event.getAction() == MotionEvent.ACTION_DOWN ||
- event.getAction() == MotionEvent.ACTION_MOVE) {
- mLastTouchX = (int) event.getX();
- mLastTouchY = (int) event.getY();
- }
- if (event.getAction() == MotionEvent.ACTION_MOVE &&
- MotionEventCompat.isFromSource(event, InputDeviceCompat.SOURCE_MOUSE) &&
- (MotionEventCompat.getButtonState(event) & MotionEventCompat.BUTTON_PRIMARY) != 0) {
- return mListener.onDragStart(v, this);
+ final int x = (int) event.getX();
+ final int y = (int) event.getY();
+ switch (event.getAction()) {
+ case MotionEvent.ACTION_DOWN:
+ mLastTouchX = x;
+ mLastTouchY = y;
+ break;
+
+ case MotionEvent.ACTION_MOVE:
+ if (!MotionEventCompat.isFromSource(event, InputDeviceCompat.SOURCE_MOUSE)
+ || (MotionEventCompat.getButtonState(event)
+ & MotionEventCompat.BUTTON_PRIMARY) == 0) {
+ break;
+ }
+ if (mDragging) {
+ // Ignore ACTION_MOVE events once the drag operation is in progress.
+ break;
+ }
+ if (mLastTouchX == x && mLastTouchY == y) {
+ // Do not call the listener unless the pointer position has actually changed.
+ break;
+ }
+ mLastTouchX = x;
+ mLastTouchY = y;
+ mDragging = mListener.onDragStart(v, this);
+ return mDragging;
+
+ case MotionEvent.ACTION_UP:
+ case MotionEvent.ACTION_CANCEL:
+ mDragging = false;
+ break;
}
return false;
}
diff --git a/v13/tests/AndroidManifest.xml b/v13/tests/AndroidManifest.xml
new file mode 100644
index 0000000..4ce99ee
--- /dev/null
+++ b/v13/tests/AndroidManifest.xml
@@ -0,0 +1,39 @@
+<?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"
+ xmlns:tools="http://schemas.android.com/tools"
+ package="android.support.v13.test">
+
+ <uses-sdk
+ android:minSdkVersion="13"
+ android:targetSdkVersion="24"
+ tools:overrideLibrary="android.support.test, android.app, android.support.test.rule,
+ android.support.test.espresso, android.support.test.espresso.idling"/>
+
+ <application>
+
+ <uses-library android:name="android.test.runner"/>
+
+ <activity android:name="android.support.v13.view.DragStartHelperTestActivity"/>
+
+ </application>
+
+ <instrumentation
+ android:name="android.test.InstrumentationTestRunner"
+ android:targetPackage="android.support.v13.test"/>
+
+</manifest>
diff --git a/v13/tests/NO_DOCS b/v13/tests/NO_DOCS
new file mode 100644
index 0000000..092a39c
--- /dev/null
+++ b/v13/tests/NO_DOCS
@@ -0,0 +1,17 @@
+# 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.
+
+Having this file, named NO_DOCS, in a directory will prevent
+Android javadocs from being generated for java files under
+the directory. This is especially useful for test projects.
diff --git a/v13/tests/java/android/support/v13/view/DragStartHelperTest.java b/v13/tests/java/android/support/v13/view/DragStartHelperTest.java
new file mode 100644
index 0000000..ad6625f
--- /dev/null
+++ b/v13/tests/java/android/support/v13/view/DragStartHelperTest.java
@@ -0,0 +1,366 @@
+/*
+ * 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.
+ */
+
+package android.support.v13.view;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.argThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.inOrder;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+import static org.mockito.Mockito.when;
+
+import android.annotation.TargetApi;
+import android.app.Instrumentation;
+import android.graphics.Point;
+import android.os.Build;
+import android.os.SystemClock;
+import android.support.annotation.NonNull;
+import android.support.annotation.RequiresApi;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.filters.SdkSuppress;
+import android.support.test.filters.SmallTest;
+import android.support.test.rule.ActivityTestRule;
+import android.support.test.runner.AndroidJUnit4;
+import android.support.v13.test.R;
+import android.view.InputDevice;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewConfiguration;
+
+import org.hamcrest.Description;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentMatcher;
+import org.mockito.InOrder;
+
+@RequiresApi(13)
+@TargetApi(13)
+@SmallTest
+@RunWith(AndroidJUnit4.class)
+public class DragStartHelperTest {
+
+ @Rule
+ public ActivityTestRule<DragStartHelperTestActivity> mActivityRule =
+ new ActivityTestRule<>(DragStartHelperTestActivity.class);
+
+ private Instrumentation mInstrumentation;
+ private View mDragSource;
+
+ interface DragStartListener {
+ boolean onDragStart(View view, DragStartHelper helper, Point touchPosition);
+ }
+
+ @NonNull
+ private DragStartListener createListener(boolean returnValue) {
+ final DragStartListener listener = mock(DragStartListener.class);
+ when(listener.onDragStart(any(View.class), any(DragStartHelper.class), any(Point.class)))
+ .thenReturn(returnValue);
+ return listener;
+ }
+
+ @NonNull
+ private DragStartHelper createDragStartHelper(final DragStartListener listener) {
+ return new DragStartHelper(mDragSource, new DragStartHelper.OnDragStartListener() {
+ @Override
+ public boolean onDragStart(View v, DragStartHelper helper) {
+ Point touchPosition = new Point();
+ helper.getTouchPosition(touchPosition);
+ return listener.onDragStart(v, helper, touchPosition);
+ }
+ });
+ }
+
+ private static int[] getViewCenter(View view) {
+ final int[] xy = new int[2];
+ view.getLocationOnScreen(xy);
+ xy[0] += view.getWidth() / 2;
+ xy[1] += view.getHeight() / 2;
+ return xy;
+ }
+
+ private static MotionEvent obtainTouchEvent(
+ int action, View anchor, int offsetX, int offsetY) {
+ final long eventTime = SystemClock.uptimeMillis();
+ final int[] xy = getViewCenter(anchor);
+ return MotionEvent.obtain(
+ eventTime, eventTime, action, xy[0] + offsetX, xy[1] + offsetY, 0);
+ }
+
+ private void sendTouchEvent(int action, View anchor, int offsetX, int offsetY) {
+ mInstrumentation.sendPointerSync(obtainTouchEvent(action, anchor, offsetX, offsetY));
+ }
+
+ private static MotionEvent obtainMouseEvent(
+ int action, int buttonState, View anchor, int offsetX, int offsetY) {
+ final long eventTime = SystemClock.uptimeMillis();
+
+ final int[] xy = getViewCenter(anchor);
+
+ MotionEvent.PointerProperties[] props = new MotionEvent.PointerProperties[] {
+ new MotionEvent.PointerProperties()
+ };
+ props[0].id = 0;
+ props[0].toolType = MotionEvent.TOOL_TYPE_MOUSE;
+
+ MotionEvent.PointerCoords[] coords = new MotionEvent.PointerCoords[] {
+ new MotionEvent.PointerCoords()
+ };
+ coords[0].x = xy[0] + offsetX;
+ coords[0].y = xy[1] + offsetY;
+
+ return MotionEvent.obtain(eventTime, eventTime, action, 1, props, coords, 0,
+ buttonState, 0, 0, -1, 0, InputDevice.SOURCE_MOUSE, 0);
+ }
+
+ private void sendMouseEvent(
+ int action, int buttonState, View anchor, int offsetX, int offsetY) {
+ mInstrumentation.sendPointerSync(obtainMouseEvent(
+ action, buttonState, anchor, offsetX, offsetY));
+ }
+
+ static class TouchPositionMatcher extends ArgumentMatcher<Point> {
+
+ private final Point mExpectedPosition;
+
+ TouchPositionMatcher(int x, int y) {
+ mExpectedPosition = new Point(x, y);
+ }
+
+ TouchPositionMatcher(View anchor, int x, int y) {
+ this(anchor.getWidth() / 2 + x, anchor.getHeight() / 2 + y);
+ }
+
+ public boolean matches(Object actual) {
+ return mExpectedPosition.equals(actual);
+ }
+
+ public void describeTo(Description description) {
+ description.appendText("TouchPositionMatcher: " + mExpectedPosition);
+ }
+ }
+
+ private void waitForLongPress() {
+ SystemClock.sleep(ViewConfiguration.getLongPressTimeout() * 2);
+ }
+
+ @Before
+ public void setUp() {
+ mInstrumentation = InstrumentationRegistry.getInstrumentation();
+ mDragSource = mActivityRule.getActivity().findViewById(R.id.drag_source);
+ }
+
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.ICE_CREAM_SANDWICH)
+ @Test
+ public void mouseClick() throws Throwable {
+ final DragStartListener listener = createListener(true);
+ final DragStartHelper helper = createDragStartHelper(listener);
+ helper.attach();
+
+ sendMouseEvent(MotionEvent.ACTION_DOWN, MotionEvent.BUTTON_PRIMARY, mDragSource, 0, 0);
+ sendMouseEvent(MotionEvent.ACTION_UP, MotionEvent.BUTTON_PRIMARY, mDragSource, 0, 0);
+
+ // A simple mouse click does not trigger OnDragStart.
+ verifyNoMoreInteractions(listener);
+ }
+
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.ICE_CREAM_SANDWICH)
+ @Test
+ public void mousePressWithSecondaryButton() throws Throwable {
+ final DragStartListener listener = createListener(true);
+ final DragStartHelper helper = createDragStartHelper(listener);
+ helper.attach();
+
+ sendMouseEvent(MotionEvent.ACTION_DOWN, MotionEvent.BUTTON_PRIMARY, mDragSource, 0, 0);
+ sendMouseEvent(MotionEvent.ACTION_MOVE,
+ MotionEvent.BUTTON_PRIMARY | MotionEvent.BUTTON_SECONDARY, mDragSource, 0, 0);
+ sendMouseEvent(MotionEvent.ACTION_MOVE, MotionEvent.BUTTON_PRIMARY, mDragSource, 0, 0);
+
+ // ACTION_MOVE with the same position does not trigger OnDragStart.
+ verifyNoMoreInteractions(listener);
+ }
+
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.ICE_CREAM_SANDWICH)
+ @Test
+ public void mouseDrag() throws Throwable {
+ final DragStartListener listener = createListener(true);
+ final DragStartHelper helper = createDragStartHelper(listener);
+ helper.attach();
+
+ sendMouseEvent(MotionEvent.ACTION_DOWN, MotionEvent.BUTTON_PRIMARY, mDragSource, 0, 0);
+ sendMouseEvent(MotionEvent.ACTION_MOVE, MotionEvent.BUTTON_PRIMARY, mDragSource, 1, 2);
+ sendMouseEvent(MotionEvent.ACTION_MOVE, MotionEvent.BUTTON_PRIMARY, mDragSource, 3, 4);
+ sendMouseEvent(MotionEvent.ACTION_MOVE, MotionEvent.BUTTON_PRIMARY, mDragSource, 5, 6);
+
+ // Returning true from the callback prevents further callbacks.
+ verify(listener, times(1)).onDragStart(
+ eq(mDragSource), eq(helper), argThat(new TouchPositionMatcher(mDragSource, 1, 2)));
+ verifyNoMoreInteractions(listener);
+ }
+
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.ICE_CREAM_SANDWICH)
+ @Test
+ public void mouseDragWithNonprimaryButton() throws Throwable {
+ final DragStartListener listener = createListener(true);
+ final DragStartHelper helper = createDragStartHelper(listener);
+ helper.attach();
+
+ sendMouseEvent(MotionEvent.ACTION_DOWN, MotionEvent.BUTTON_SECONDARY, mDragSource, 0, 0);
+ sendMouseEvent(MotionEvent.ACTION_MOVE, MotionEvent.BUTTON_SECONDARY, mDragSource, 1, 2);
+ sendMouseEvent(MotionEvent.ACTION_UP, MotionEvent.BUTTON_SECONDARY, mDragSource, 3, 4);
+
+ sendMouseEvent(MotionEvent.ACTION_DOWN, MotionEvent.BUTTON_TERTIARY, mDragSource, 0, 0);
+ sendMouseEvent(MotionEvent.ACTION_MOVE, MotionEvent.BUTTON_TERTIARY, mDragSource, 1, 2);
+ sendMouseEvent(MotionEvent.ACTION_UP, MotionEvent.BUTTON_TERTIARY, mDragSource, 3, 4);
+
+ // Dragging mouse with a non-primary button down does not trigger OnDragStart.
+ verifyNoMoreInteractions(listener);
+ }
+
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.ICE_CREAM_SANDWICH)
+ @Test
+ public void mouseDragUsingTouchListener() throws Throwable {
+ final DragStartListener listener = createListener(true);
+ final DragStartHelper helper = createDragStartHelper(listener);
+
+ mDragSource.setOnTouchListener(new View.OnTouchListener() {
+ @Override
+ public boolean onTouch(View view, MotionEvent motionEvent) {
+ helper.onTouch(view, motionEvent);
+ return true;
+ }
+ });
+
+ sendMouseEvent(MotionEvent.ACTION_DOWN, MotionEvent.BUTTON_PRIMARY, mDragSource, 0, 0);
+ sendMouseEvent(MotionEvent.ACTION_MOVE, MotionEvent.BUTTON_PRIMARY, mDragSource, 1, 2);
+ sendMouseEvent(MotionEvent.ACTION_MOVE, MotionEvent.BUTTON_PRIMARY, mDragSource, 3, 4);
+ sendMouseEvent(MotionEvent.ACTION_MOVE, MotionEvent.BUTTON_PRIMARY, mDragSource, 5, 6);
+
+ // Returning true from the callback prevents further callbacks.
+ verify(listener, times(1)).onDragStart(
+ eq(mDragSource), eq(helper), argThat(new TouchPositionMatcher(mDragSource, 1, 2)));
+ verifyNoMoreInteractions(listener);
+ }
+
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.ICE_CREAM_SANDWICH)
+ @Test
+ public void mouseDragWhenListenerReturnsFalse() throws Throwable {
+ final DragStartListener listener = createListener(false);
+ final DragStartHelper helper = createDragStartHelper(listener);
+ helper.attach();
+
+ sendMouseEvent(MotionEvent.ACTION_DOWN, MotionEvent.BUTTON_PRIMARY, mDragSource, 0, 0);
+ sendMouseEvent(MotionEvent.ACTION_MOVE, MotionEvent.BUTTON_PRIMARY, mDragSource, 1, 2);
+ sendMouseEvent(MotionEvent.ACTION_MOVE, MotionEvent.BUTTON_PRIMARY, mDragSource, 3, 4);
+ sendMouseEvent(MotionEvent.ACTION_MOVE, MotionEvent.BUTTON_PRIMARY, mDragSource, 5, 6);
+
+ // When the listener returns false every ACTION_MOVE triggers OnDragStart.
+ InOrder inOrder = inOrder(listener);
+ inOrder.verify(listener, times(1)).onDragStart(
+ eq(mDragSource), eq(helper), argThat(new TouchPositionMatcher(mDragSource, 1, 2)));
+ inOrder.verify(listener, times(1)).onDragStart(
+ eq(mDragSource), eq(helper), argThat(new TouchPositionMatcher(mDragSource, 3, 4)));
+ inOrder.verify(listener, times(1)).onDragStart(
+ eq(mDragSource), eq(helper), argThat(new TouchPositionMatcher(mDragSource, 5, 6)));
+ inOrder.verifyNoMoreInteractions();
+ }
+
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.ICE_CREAM_SANDWICH)
+ @Test
+ public void mouseLongPress() throws Throwable {
+ final DragStartListener listener = createListener(true);
+ final DragStartHelper helper = createDragStartHelper(listener);
+ helper.attach();
+
+ sendMouseEvent(MotionEvent.ACTION_DOWN, MotionEvent.BUTTON_PRIMARY, mDragSource, 1, 2);
+ waitForLongPress();
+
+ // Long press triggers OnDragStart.
+ verify(listener, times(1)).onDragStart(
+ eq(mDragSource), eq(helper), argThat(new TouchPositionMatcher(mDragSource, 1, 2)));
+ verifyNoMoreInteractions(listener);
+ }
+
+ @Test
+ public void touchDrag() throws Throwable {
+ final DragStartListener listener = createListener(false);
+ final DragStartHelper helper = createDragStartHelper(listener);
+ helper.attach();
+
+ sendTouchEvent(MotionEvent.ACTION_DOWN, mDragSource, 0, 0);
+ sendTouchEvent(MotionEvent.ACTION_MOVE, mDragSource, 1, 2);
+ sendTouchEvent(MotionEvent.ACTION_MOVE, mDragSource, 3, 4);
+ sendTouchEvent(MotionEvent.ACTION_MOVE, mDragSource, 5, 6);
+
+ // Touch and drag (without delay) does not trigger OnDragStart.
+ verifyNoMoreInteractions(listener);
+ }
+
+ @Test
+ public void touchTap() throws Throwable {
+ final DragStartListener listener = createListener(false);
+ final DragStartHelper helper = createDragStartHelper(listener);
+ helper.attach();
+
+ sendTouchEvent(MotionEvent.ACTION_DOWN, mDragSource, 0, 0);
+ sendTouchEvent(MotionEvent.ACTION_UP, mDragSource, 0, 0);
+
+ // A simple tap does not trigger OnDragStart.
+ verifyNoMoreInteractions(listener);
+ }
+
+ @Test
+ public void touchLongPress() throws Throwable {
+ final DragStartListener listener = createListener(true);
+ final DragStartHelper helper = createDragStartHelper(listener);
+ helper.attach();
+
+ sendTouchEvent(MotionEvent.ACTION_DOWN, mDragSource, 1, 2);
+ waitForLongPress();
+
+ // Long press triggers OnDragStart.
+ verify(listener, times(1)).onDragStart(
+ eq(mDragSource), eq(helper), argThat(new TouchPositionMatcher(mDragSource, 1, 2)));
+ verifyNoMoreInteractions(listener);
+ }
+
+ @Test
+ public void touchLongPressUsingLongClickListener() throws Throwable {
+ final DragStartListener listener = createListener(true);
+
+ final DragStartHelper helper = createDragStartHelper(listener);
+ mDragSource.setOnLongClickListener(new View.OnLongClickListener() {
+ @Override
+ public boolean onLongClick(View view) {
+ return helper.onLongClick(view);
+ }
+ });
+
+ sendTouchEvent(MotionEvent.ACTION_DOWN, mDragSource, 1, 2);
+ waitForLongPress();
+
+ // Long press triggers OnDragStart.
+ // Since ACTION_DOWN is not handled, the touch offset is not available.
+ verify(listener, times(1)).onDragStart(
+ eq(mDragSource), eq(helper), argThat(new TouchPositionMatcher(0, 0)));
+ verifyNoMoreInteractions(listener);
+ }
+}
diff --git a/v13/tests/java/android/support/v13/view/DragStartHelperTestActivity.java b/v13/tests/java/android/support/v13/view/DragStartHelperTestActivity.java
new file mode 100644
index 0000000..6a3605b
--- /dev/null
+++ b/v13/tests/java/android/support/v13/view/DragStartHelperTestActivity.java
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+package android.support.v13.view;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.support.v13.test.R;
+
+public class DragStartHelperTestActivity extends Activity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.drag_source_activity);
+ }
+}
diff --git a/v13/tests/res/layout/drag_source_activity.xml b/v13/tests/res/layout/drag_source_activity.xml
new file mode 100644
index 0000000..27cae38
--- /dev/null
+++ b/v13/tests/res/layout/drag_source_activity.xml
@@ -0,0 +1,28 @@
+<?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">
+ <View
+ android:id="@+id/drag_source"
+ android:layout_width="100dp"
+ android:layout_height="100dp"
+ android:layout_margin="10dp"
+ android:background="#ccc"/>
+</LinearLayout>
diff --git a/v14/preference/build.gradle b/v14/preference/build.gradle
index 33d616e..a7e63d5 100644
--- a/v14/preference/build.gradle
+++ b/v14/preference/build.gradle
@@ -52,11 +52,6 @@
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
-
- lintOptions {
- // TODO: fix errors and reenable.
- abortOnError false
- }
}
android.libraryVariants.all { variant ->
diff --git a/v14/preference/res/layout/preference_widget_switch.xml b/v14/preference/res/layout/preference_widget_switch.xml
index afc4351..47e9397 100644
--- a/v14/preference/res/layout/preference_widget_switch.xml
+++ b/v14/preference/res/layout/preference_widget_switch.xml
@@ -18,9 +18,11 @@
<!-- Layout used by SwitchPreference for the switch widget style. This is inflated
inside android.R.layout.preference. -->
<Switch xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@android:id/switch_widget"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:focusable="false"
- android:clickable="false"
- android:background="@null" />
+ xmlns:tools="http://schemas.android.com/tools"
+ tools:ignore="NewApi"
+ android:id="@android:id/switch_widget"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:focusable="false"
+ android:clickable="false"
+ android:background="@null" />
diff --git a/v14/preference/res/values/styles.xml b/v14/preference/res/values/styles.xml
index a83417a..baef67f 100644
--- a/v14/preference/res/values/styles.xml
+++ b/v14/preference/res/values/styles.xml
@@ -15,7 +15,7 @@
~ limitations under the License
-->
-<resources>
+<resources xmlns:tools="http://schemas.android.com/tools">
<style name="Preference.SwitchPreference">
<item name="android:widgetLayout">@layout/preference_widget_switch</item>
<item name="android:switchTextOn">@string/v7_preference_on</item>
@@ -66,14 +66,14 @@
<style name="Preference_TextAppearanceMaterialBody2">
<item name="android:textSize">14sp</item>
- <item name="android:fontFamily">sans-serif</item>
+ <item tools:ignore="NewApi" name="android:fontFamily">sans-serif</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:textStyle">normal</item>
</style>
<style name="Preference_TextAppearanceMaterialSubhead">
<item name="android:textSize">16sp</item>
- <item name="android:fontFamily">sans-serif</item>
+ <item tools:ignore="NewApi" name="android:fontFamily">sans-serif</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:textStyle">normal</item>
</style>
diff --git a/v14/preference/src/android/support/v14/preference/EditTextPreferenceDialogFragment.java b/v14/preference/src/android/support/v14/preference/EditTextPreferenceDialogFragment.java
index 829f29b..3ee5872 100644
--- a/v14/preference/src/android/support/v14/preference/EditTextPreferenceDialogFragment.java
+++ b/v14/preference/src/android/support/v14/preference/EditTextPreferenceDialogFragment.java
@@ -16,6 +16,8 @@
package android.support.v14.preference;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.RestrictTo;
@@ -23,8 +25,6 @@
import android.view.View;
import android.widget.EditText;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
public class EditTextPreferenceDialogFragment extends PreferenceDialogFragment {
private static final String SAVE_STATE_TEXT = "EditTextPreferenceDialogFragment.text";
@@ -77,7 +77,7 @@
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
protected boolean needInputMethod() {
// We want the input method to show, if possible, when dialog is displayed
diff --git a/v14/preference/src/android/support/v14/preference/MultiSelectListPreference.java b/v14/preference/src/android/support/v14/preference/MultiSelectListPreference.java
index 284b9aa..cb38c44 100644
--- a/v14/preference/src/android/support/v14/preference/MultiSelectListPreference.java
+++ b/v14/preference/src/android/support/v14/preference/MultiSelectListPreference.java
@@ -16,6 +16,8 @@
package android.support.v14.preference;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.TypedArray;
@@ -33,8 +35,6 @@
import java.util.HashSet;
import java.util.Set;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* A {@link android.support.v7.preference.Preference} that displays a list of entries as
* a dialog.
@@ -99,7 +99,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected boolean persistStringSet(Set<String> values) {
if (shouldPersist()) {
// Shouldn't store null
@@ -132,7 +132,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected Set<String> getPersistedStringSet(Set<String> defaultReturnValue) {
if (!shouldPersist()) {
return defaultReturnValue;
diff --git a/v14/preference/src/android/support/v14/preference/PreferenceDialogFragment.java b/v14/preference/src/android/support/v14/preference/PreferenceDialogFragment.java
index c05f427..e7b9f40 100644
--- a/v14/preference/src/android/support/v14/preference/PreferenceDialogFragment.java
+++ b/v14/preference/src/android/support/v14/preference/PreferenceDialogFragment.java
@@ -16,6 +16,8 @@
package android.support.v14.preference;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
@@ -38,8 +40,6 @@
import android.view.WindowManager;
import android.widget.TextView;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Abstract base class which presents a dialog associated with a
* {@link android.support.v7.preference.DialogPreference}. Since the preference object may
@@ -195,7 +195,7 @@
* the soft input method brought up automatically.
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected boolean needInputMethod() {
return false;
}
diff --git a/v14/preference/src/android/support/v14/preference/PreferenceFragment.java b/v14/preference/src/android/support/v14/preference/PreferenceFragment.java
index 2904cae..d2519d1 100644
--- a/v14/preference/src/android/support/v14/preference/PreferenceFragment.java
+++ b/v14/preference/src/android/support/v14/preference/PreferenceFragment.java
@@ -16,6 +16,8 @@
package android.support.v14.preference;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.app.DialogFragment;
import android.app.Fragment;
import android.content.Context;
@@ -50,8 +52,6 @@
import android.view.View;
import android.view.ViewGroup;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Shows a hierarchy of {@link Preference} objects as
* lists. These preferences will
@@ -555,12 +555,12 @@
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected void onBindPreferences() {
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected void onUnbindPreferences() {
}
@@ -663,7 +663,7 @@
* @return Fragment to possibly use as a callback
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public Fragment getCallbackFragment() {
return null;
}
diff --git a/v14/preference/src/android/support/v14/preference/SwitchPreference.java b/v14/preference/src/android/support/v14/preference/SwitchPreference.java
index 1d6bbaf..eae20b8 100644
--- a/v14/preference/src/android/support/v14/preference/SwitchPreference.java
+++ b/v14/preference/src/android/support/v14/preference/SwitchPreference.java
@@ -16,6 +16,8 @@
package android.support.v14.preference;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.TypedArray;
import android.support.annotation.RestrictTo;
@@ -30,8 +32,6 @@
import android.widget.CompoundButton;
import android.widget.Switch;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* A {@link android.support.v7.preference.Preference} that provides a two-state toggleable option.
* <p>
@@ -206,7 +206,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
protected void performClick(View view) {
super.performClick(view);
diff --git a/v17/leanback/api21/android/support/v17/leanback/transition/FadeAndShortSlide.java b/v17/leanback/api21/android/support/v17/leanback/transition/FadeAndShortSlide.java
index d4f063d..76e237b 100644
--- a/v17/leanback/api21/android/support/v17/leanback/transition/FadeAndShortSlide.java
+++ b/v17/leanback/api21/android/support/v17/leanback/transition/FadeAndShortSlide.java
@@ -15,6 +15,8 @@
*/
package android.support.v17.leanback.transition;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.TimeInterpolator;
@@ -35,15 +37,13 @@
import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Execute horizontal slide of 1/4 width and fade (to workaround bug 23718734)
* @hide
*/
@RequiresApi(21)
@TargetApi(21)
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class FadeAndShortSlide extends Visibility {
private static final TimeInterpolator sDecelerate = new DecelerateInterpolator();
diff --git a/v17/leanback/api21/android/support/v17/leanback/transition/SlideNoPropagation.java b/v17/leanback/api21/android/support/v17/leanback/transition/SlideNoPropagation.java
index f5a1cc7..5158992 100644
--- a/v17/leanback/api21/android/support/v17/leanback/transition/SlideNoPropagation.java
+++ b/v17/leanback/api21/android/support/v17/leanback/transition/SlideNoPropagation.java
@@ -13,6 +13,8 @@
*/
package android.support.v17.leanback.transition;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.annotation.TargetApi;
import android.content.Context;
import android.support.annotation.RequiresApi;
@@ -20,14 +22,12 @@
import android.transition.Slide;
import android.util.AttributeSet;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* @hide
*/
@RequiresApi(21)
@TargetApi(21)
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class SlideNoPropagation extends Slide {
public SlideNoPropagation() {
diff --git a/v17/leanback/api21/android/support/v17/leanback/transition/TranslationAnimationCreator.java b/v17/leanback/api21/android/support/v17/leanback/transition/TranslationAnimationCreator.java
index d493bdd..15b9081 100644
--- a/v17/leanback/api21/android/support/v17/leanback/transition/TranslationAnimationCreator.java
+++ b/v17/leanback/api21/android/support/v17/leanback/transition/TranslationAnimationCreator.java
@@ -1,22 +1,21 @@
package android.support.v17.leanback.transition;
-import android.annotation.TargetApi;
-import android.support.annotation.RequiresApi;
-import android.support.annotation.RestrictTo;
-import android.support.v17.leanback.R;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.animation.TimeInterpolator;
+import android.annotation.TargetApi;
import android.graphics.Path;
+import android.support.annotation.RequiresApi;
+import android.support.annotation.RestrictTo;
+import android.support.v17.leanback.R;
import android.transition.Transition;
-import android.transition.TransitionValues;
import android.transition.Transition.TransitionListener;
+import android.transition.TransitionValues;
import android.view.View;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* This class is used by Slide and Explode to create an animator that goes from the start
* position to the end position. It takes into account the canceled position so that it
@@ -25,7 +24,7 @@
*/
@RequiresApi(21)
@TargetApi(21)
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
class TranslationAnimationCreator {
/**
diff --git a/v17/leanback/build.gradle b/v17/leanback/build.gradle
index 270f552..f5befa7 100644
--- a/v17/leanback/build.gradle
+++ b/v17/leanback/build.gradle
@@ -45,15 +45,15 @@
androidTest.manifest.srcFile 'tests/AndroidManifest.xml'
}
+ lintOptions {
+ // Remove this once all NewApi breakages have been fixed.
+ disable "NewApi"
+ }
+
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
-
- lintOptions {
- // TODO: fix errors and reenable.
- abortOnError false
- }
}
android.libraryVariants.all { variant ->
diff --git a/v17/leanback/common/android/support/v17/leanback/transition/TransitionListener.java b/v17/leanback/common/android/support/v17/leanback/transition/TransitionListener.java
index b1a4a08..b3f5672 100644
--- a/v17/leanback/common/android/support/v17/leanback/transition/TransitionListener.java
+++ b/v17/leanback/common/android/support/v17/leanback/transition/TransitionListener.java
@@ -13,15 +13,15 @@
*/
package android.support.v17.leanback.transition;
-import android.support.annotation.RestrictTo;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import android.support.annotation.RestrictTo;
/**
* Listeners for transition start and stop.
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class TransitionListener {
protected Object mImpl;
diff --git a/v17/leanback/res/layout/lb_details_fragment.xml b/v17/leanback/res/layout/lb_details_fragment.xml
index bb02902..fd0133f 100644
--- a/v17/leanback/res/layout/lb_details_fragment.xml
+++ b/v17/leanback/res/layout/lb_details_fragment.xml
@@ -25,7 +25,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent" />
- <FrameLayout
+ <android.support.v17.leanback.widget.NonOverlappingFrameLayout
android:id="@+id/details_background_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
diff --git a/v17/leanback/res/layout/lb_guidedstep_fragment.xml b/v17/leanback/res/layout/lb_guidedstep_fragment.xml
index adf9d4f..bbe21ba 100644
--- a/v17/leanback/res/layout/lb_guidedstep_fragment.xml
+++ b/v17/leanback/res/layout/lb_guidedstep_fragment.xml
@@ -33,6 +33,7 @@
<LinearLayout
android:id="@+id/content_frame"
android:orientation="horizontal"
+ android:baselineAligned="false"
android:layout_width="match_parent"
android:layout_height="match_parent">
@@ -40,8 +41,7 @@
android:id="@+id/content_fragment"
android:layout_width="0dp"
android:layout_weight="1"
- android:layout_height="match_parent"
- android:layout_alignParentStart="true" />
+ android:layout_height="match_parent" />
<android.support.v17.leanback.widget.NonOverlappingFrameLayout
android:id="@+id/action_fragment_root"
@@ -53,8 +53,7 @@
android:paddingStart="@dimen/lb_guidedactions_section_shadow_width"
android:layout_width="0dp"
android:layout_weight="?attr/guidedActionContentWidthWeight"
- android:layout_height="match_parent"
- android:layout_alignParentEnd="true">
+ android:layout_height="match_parent" >
<android.support.v17.leanback.widget.NonOverlappingView
android:id="@+id/action_fragment_background"
diff --git a/v17/leanback/res/transition-v21/lb_details_enter_transition.xml b/v17/leanback/res/transition-v21/lb_details_enter_transition.xml
index 618ef64..3bb7c9f 100644
--- a/v17/leanback/res/transition-v21/lb_details_enter_transition.xml
+++ b/v17/leanback/res/transition-v21/lb_details_enter_transition.xml
@@ -25,10 +25,17 @@
<target android:excludeId="@id/title_text" />
<target android:excludeId="@id/title_orb" />
<target android:excludeId="@id/details_background_view" />
- </targets>4
+ </targets>
+ </transition>
+ <!-- The ParallaxTransition runs with with Slide transition, must use same duration
+ and same startDelay-->
+ <transition class="android.support.v17.leanback.transition.ParallaxTransition"
+ android:duration="500">
+ <targets>
+ <target android:targetId="@id/details_frame" />
+ </targets>
</transition>
<fade
- android:interpolator="@android:interpolator/linear_out_slow_in"
android:duration="350">
</fade>
</transitionSet>
\ No newline at end of file
diff --git a/v17/leanback/res/transition-v21/lb_details_return_transition.xml b/v17/leanback/res/transition-v21/lb_details_return_transition.xml
index 2a70cc9..5e54d2c 100644
--- a/v17/leanback/res/transition-v21/lb_details_return_transition.xml
+++ b/v17/leanback/res/transition-v21/lb_details_return_transition.xml
@@ -26,8 +26,15 @@
<target android:excludeId="@id/details_background_view" />
</targets>
</transition>
+ <!-- The ParallaxTransition runs with with Slide transition, must use same duration
+ and same startDelay-->
+ <transition class="android.support.v17.leanback.transition.ParallaxTransition"
+ android:duration="350">
+ <targets>
+ <target android:targetId="@id/details_frame" />
+ </targets>
+ </transition>
<fade
- android:interpolator="@android:interpolator/fast_out_linear_in"
android:duration="350">
</fade>
</transitionSet>
\ No newline at end of file
diff --git a/v17/leanback/res/values/ids.xml b/v17/leanback/res/values/ids.xml
index ab7f568..59b8b8f 100644
--- a/v17/leanback/res/values/ids.xml
+++ b/v17/leanback/res/values/ids.xml
@@ -20,6 +20,8 @@
<item type="id" name="lb_slide_transition_value" />
<item type="id" name="transitionPosition" />
+ <item type="id" name="lb_parallax_source" />
+
<item type="id" name="lb_guidedstep_background" />
<item type="id" name="lb_control_play_pause" />
diff --git a/v17/leanback/src/android/support/v17/leanback/animation/LogAccelerateInterpolator.java b/v17/leanback/src/android/support/v17/leanback/animation/LogAccelerateInterpolator.java
index 4b98f44..9a41f4a 100644
--- a/v17/leanback/src/android/support/v17/leanback/animation/LogAccelerateInterpolator.java
+++ b/v17/leanback/src/android/support/v17/leanback/animation/LogAccelerateInterpolator.java
@@ -13,15 +13,15 @@
*/
package android.support.v17.leanback.animation;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.animation.TimeInterpolator;
import android.support.annotation.RestrictTo;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class LogAccelerateInterpolator implements TimeInterpolator {
int mBase;
diff --git a/v17/leanback/src/android/support/v17/leanback/animation/LogDecelerateInterpolator.java b/v17/leanback/src/android/support/v17/leanback/animation/LogDecelerateInterpolator.java
index d9a4282..3a11ffd 100644
--- a/v17/leanback/src/android/support/v17/leanback/animation/LogDecelerateInterpolator.java
+++ b/v17/leanback/src/android/support/v17/leanback/animation/LogDecelerateInterpolator.java
@@ -13,15 +13,15 @@
*/
package android.support.v17.leanback.animation;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.animation.TimeInterpolator;
import android.support.annotation.RestrictTo;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class LogDecelerateInterpolator implements TimeInterpolator {
int mBase;
diff --git a/v17/leanback/src/android/support/v17/leanback/app/BackgroundFragment.java b/v17/leanback/src/android/support/v17/leanback/app/BackgroundFragment.java
index 6b442c1..705124a 100644
--- a/v17/leanback/src/android/support/v17/leanback/app/BackgroundFragment.java
+++ b/v17/leanback/src/android/support/v17/leanback/app/BackgroundFragment.java
@@ -13,7 +13,7 @@
*/
package android.support.v17.leanback.app;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import android.app.Fragment;
import android.support.annotation.RestrictTo;
@@ -22,7 +22,7 @@
* Fragment used by the background manager.
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public final class BackgroundFragment extends Fragment {
private BackgroundManager mBackgroundManager;
diff --git a/v17/leanback/src/android/support/v17/leanback/app/BackgroundManager.java b/v17/leanback/src/android/support/v17/leanback/app/BackgroundManager.java
index bcd6f33..1989791 100644
--- a/v17/leanback/src/android/support/v17/leanback/app/BackgroundManager.java
+++ b/v17/leanback/src/android/support/v17/leanback/app/BackgroundManager.java
@@ -659,7 +659,6 @@
*/
public void attachToView(View sceneRoot) {
attachToViewInternal(sceneRoot);
- mContext.getWindow().getDecorView().setBackground(null);
}
void attachToViewInternal(View sceneRoot) {
diff --git a/v17/leanback/src/android/support/v17/leanback/app/BrowseFragment.java b/v17/leanback/src/android/support/v17/leanback/app/BrowseFragment.java
index a94b7f3..fc6561e 100644
--- a/v17/leanback/src/android/support/v17/leanback/app/BrowseFragment.java
+++ b/v17/leanback/src/android/support/v17/leanback/app/BrowseFragment.java
@@ -1021,11 +1021,8 @@
&& mMainFragment.getView().requestFocus(direction, previouslyFocusedRect)) {
return true;
}
- if (getTitleView() != null
- && getTitleView().requestFocus(direction, previouslyFocusedRect)) {
- return true;
- }
- return false;
+ return getTitleView() != null
+ && getTitleView().requestFocus(direction, previouslyFocusedRect);
}
@Override
@@ -1136,7 +1133,7 @@
mMainFragmentAdapter.setFragmentHost(new FragmentHostImpl());
mIsPageRow = savedInstanceState != null
- ? savedInstanceState.getBoolean(IS_PAGE_ROW, false) : false;
+ && savedInstanceState.getBoolean(IS_PAGE_ROW, false);
mSelectedPosition = savedInstanceState != null
? savedInstanceState.getInt(CURRENT_SELECTED_POSITION, 0) : 0;
@@ -1542,9 +1539,11 @@
mHeadersFragment.setAlignment(mContainerListAlignTop);
setMainFragmentAlignment();
- if (mCanShowHeaders && mShowingHeaders && mHeadersFragment.getView() != null) {
+ if (mCanShowHeaders && mShowingHeaders && mHeadersFragment != null
+ && mHeadersFragment.getView() != null) {
mHeadersFragment.getView().requestFocus();
- } else if ((!mCanShowHeaders || !mShowingHeaders) && mMainFragment.getView() != null) {
+ } else if ((!mCanShowHeaders || !mShowingHeaders) && mMainFragment != null
+ && mMainFragment.getView() != null) {
mMainFragment.getView().requestFocus();
}
diff --git a/v17/leanback/src/android/support/v17/leanback/app/BrowseSupportFragment.java b/v17/leanback/src/android/support/v17/leanback/app/BrowseSupportFragment.java
index a08ce67..7bcc43d 100644
--- a/v17/leanback/src/android/support/v17/leanback/app/BrowseSupportFragment.java
+++ b/v17/leanback/src/android/support/v17/leanback/app/BrowseSupportFragment.java
@@ -1024,11 +1024,8 @@
&& mMainFragment.getView().requestFocus(direction, previouslyFocusedRect)) {
return true;
}
- if (getTitleView() != null
- && getTitleView().requestFocus(direction, previouslyFocusedRect)) {
- return true;
- }
- return false;
+ return getTitleView() != null
+ && getTitleView().requestFocus(direction, previouslyFocusedRect);
}
@Override
@@ -1139,7 +1136,7 @@
mMainFragmentAdapter.setFragmentHost(new FragmentHostImpl());
mIsPageRow = savedInstanceState != null
- ? savedInstanceState.getBoolean(IS_PAGE_ROW, false) : false;
+ && savedInstanceState.getBoolean(IS_PAGE_ROW, false);
mSelectedPosition = savedInstanceState != null
? savedInstanceState.getInt(CURRENT_SELECTED_POSITION, 0) : 0;
@@ -1545,9 +1542,11 @@
mHeadersSupportFragment.setAlignment(mContainerListAlignTop);
setMainFragmentAlignment();
- if (mCanShowHeaders && mShowingHeaders && mHeadersSupportFragment.getView() != null) {
+ if (mCanShowHeaders && mShowingHeaders && mHeadersSupportFragment != null
+ && mHeadersSupportFragment.getView() != null) {
mHeadersSupportFragment.getView().requestFocus();
- } else if ((!mCanShowHeaders || !mShowingHeaders) && mMainFragment.getView() != null) {
+ } else if ((!mCanShowHeaders || !mShowingHeaders) && mMainFragment != null
+ && mMainFragment.getView() != null) {
mMainFragment.getView().requestFocus();
}
diff --git a/v17/leanback/src/android/support/v17/leanback/app/DetailsBackgroundParallaxHelper.java b/v17/leanback/src/android/support/v17/leanback/app/DetailsBackgroundParallaxHelper.java
index 48d2060..47d46a8 100644
--- a/v17/leanback/src/android/support/v17/leanback/app/DetailsBackgroundParallaxHelper.java
+++ b/v17/leanback/src/android/support/v17/leanback/app/DetailsBackgroundParallaxHelper.java
@@ -228,11 +228,13 @@
// Add solid color parallax effect:
// When frameBottom moves from bottom of the screen to top of the screen,
// change solid ColorDrawable's top from bottom of screen to top of the screen.
- // Also we are changing the drawing the bitmap from bottom to top of the screen.
parallax.addEffect(frameBottom.atFraction(1f), frameBottom.atFraction(0f))
.target(mCompositeDrawable.getChildAt(1),
PropertyValuesHolder.ofFloat(
- CompositeDrawable.ChildDrawable.TOP_FRACTION, 1f, 0f))
+ CompositeDrawable.ChildDrawable.TOP_FRACTION, 1f, 0f));
+ // Also when frameTop moves from bottom of screen to top of the screen,
+ // we are changing bottom of the bitmap from bottom of screen to top of screen.
+ parallax.addEffect(frameTop.atFraction(1f), frameTop.atFraction(0f))
.target(mCompositeDrawable.getChildAt(0),
PropertyValuesHolder.ofFloat(
CompositeDrawable.ChildDrawable.BOTTOM_FRACTION, 1f, 0f));
diff --git a/v17/leanback/src/android/support/v17/leanback/app/DetailsFragment.java b/v17/leanback/src/android/support/v17/leanback/app/DetailsFragment.java
index 6a7d31f..4964cb1 100644
--- a/v17/leanback/src/android/support/v17/leanback/app/DetailsFragment.java
+++ b/v17/leanback/src/android/support/v17/leanback/app/DetailsFragment.java
@@ -15,6 +15,7 @@
import android.app.Fragment;
import android.app.FragmentTransaction;
+import android.os.Build;
import android.os.Bundle;
import android.support.v17.leanback.R;
import android.support.v17.leanback.transition.TransitionHelper;
@@ -200,12 +201,27 @@
}
});
- setupVideoPlayback();
+ setupDpadNavigation();
+ if (Build.VERSION.SDK_INT >= 21) {
+ // Setup adapter listener to work with ParallaxTransition (>= API 21).
+ mRowsFragment.setExternalAdapterListener(new ItemBridgeAdapter.AdapterListener() {
+ @Override
+ public void onCreate(ItemBridgeAdapter.ViewHolder vh) {
+ if (mDetailsParallaxManager != null && vh.getViewHolder()
+ instanceof FullWidthDetailsOverviewRowPresenter.ViewHolder) {
+ FullWidthDetailsOverviewRowPresenter.ViewHolder rowVh =
+ (FullWidthDetailsOverviewRowPresenter.ViewHolder)
+ vh.getViewHolder();
+ rowVh.getOverviewView().setTag(R.id.lb_parallax_source,
+ mDetailsParallaxManager.getParallax().getSource());
+ }
+ }
+ });
+ }
return mRootView;
}
-
/**
* @deprecated override {@link #onInflateTitleView(LayoutInflater,ViewGroup,Bundle)} instead.
*/
@@ -493,7 +509,7 @@
public DetailsParallaxManager getParallaxManager() {
if (mDetailsParallaxManager == null) {
mDetailsParallaxManager = onCreateParallaxManager();
- if (mRowsFragment != null) {
+ if (mRowsFragment != null && mRowsFragment.getView() != null) {
mDetailsParallaxManager.setRecyclerView(mRowsFragment.getVerticalGridView());
}
}
@@ -520,7 +536,7 @@
* transition to appropriate mode like half/full screen video.</li>
* </ul>
*/
- void setupVideoPlayback() {
+ void setupDpadNavigation() {
mRootView.setOnFocusSearchListener(new BrowseFrameLayout.OnFocusSearchListener() {
@Override
public View onFocusSearch(View focused, int direction) {
diff --git a/v17/leanback/src/android/support/v17/leanback/app/DetailsParallaxManager.java b/v17/leanback/src/android/support/v17/leanback/app/DetailsParallaxManager.java
index 59c7ae6..fd65420 100644
--- a/v17/leanback/src/android/support/v17/leanback/app/DetailsParallaxManager.java
+++ b/v17/leanback/src/android/support/v17/leanback/app/DetailsParallaxManager.java
@@ -26,10 +26,10 @@
* half/full screen.
*/
public class DetailsParallaxManager {
- private final ParallaxRecyclerViewSource mParallaxSource;
- private final ParallaxRecyclerViewSource.ChildPositionProperty mFrameTop;
- private final ParallaxRecyclerViewSource.ChildPositionProperty mFrameBottom;
- private Parallax mParallax;
+ final ParallaxRecyclerViewSource mParallaxSource;
+ final ParallaxRecyclerViewSource.ChildPositionProperty mFrameTop;
+ final ParallaxRecyclerViewSource.ChildPositionProperty mFrameBottom;
+ final Parallax mParallax;
public DetailsParallaxManager() {
mParallaxSource = new ParallaxRecyclerViewSource();
diff --git a/v17/leanback/src/android/support/v17/leanback/app/DetailsSupportFragment.java b/v17/leanback/src/android/support/v17/leanback/app/DetailsSupportFragment.java
index bd8e143..4dcebbd 100644
--- a/v17/leanback/src/android/support/v17/leanback/app/DetailsSupportFragment.java
+++ b/v17/leanback/src/android/support/v17/leanback/app/DetailsSupportFragment.java
@@ -18,6 +18,7 @@
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
+import android.os.Build;
import android.os.Bundle;
import android.support.v17.leanback.R;
import android.support.v17.leanback.transition.TransitionHelper;
@@ -203,12 +204,27 @@
}
});
- setupVideoPlayback();
+ setupDpadNavigation();
+ if (Build.VERSION.SDK_INT >= 21) {
+ // Setup adapter listener to work with ParallaxTransition (>= API 21).
+ mRowsSupportFragment.setExternalAdapterListener(new ItemBridgeAdapter.AdapterListener() {
+ @Override
+ public void onCreate(ItemBridgeAdapter.ViewHolder vh) {
+ if (mDetailsParallaxManager != null && vh.getViewHolder()
+ instanceof FullWidthDetailsOverviewRowPresenter.ViewHolder) {
+ FullWidthDetailsOverviewRowPresenter.ViewHolder rowVh =
+ (FullWidthDetailsOverviewRowPresenter.ViewHolder)
+ vh.getViewHolder();
+ rowVh.getOverviewView().setTag(R.id.lb_parallax_source,
+ mDetailsParallaxManager.getParallax().getSource());
+ }
+ }
+ });
+ }
return mRootView;
}
-
/**
* @deprecated override {@link #onInflateTitleView(LayoutInflater,ViewGroup,Bundle)} instead.
*/
@@ -496,7 +512,7 @@
public DetailsParallaxManager getParallaxManager() {
if (mDetailsParallaxManager == null) {
mDetailsParallaxManager = onCreateParallaxManager();
- if (mRowsSupportFragment != null) {
+ if (mRowsSupportFragment != null && mRowsSupportFragment.getView() != null) {
mDetailsParallaxManager.setRecyclerView(mRowsSupportFragment.getVerticalGridView());
}
}
@@ -523,7 +539,7 @@
* transition to appropriate mode like half/full screen video.</li>
* </ul>
*/
- void setupVideoPlayback() {
+ void setupDpadNavigation() {
mRootView.setOnFocusSearchListener(new BrowseFrameLayout.OnFocusSearchListener() {
@Override
public View onFocusSearch(View focused, int direction) {
diff --git a/v17/leanback/src/android/support/v17/leanback/app/GuidedStepFragment.java b/v17/leanback/src/android/support/v17/leanback/app/GuidedStepFragment.java
index db1bed5..da44fde 100644
--- a/v17/leanback/src/android/support/v17/leanback/app/GuidedStepFragment.java
+++ b/v17/leanback/src/android/support/v17/leanback/app/GuidedStepFragment.java
@@ -13,7 +13,7 @@
*/
package android.support.v17.leanback.app;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import android.animation.Animator;
import android.animation.AnimatorSet;
@@ -223,14 +223,14 @@
* Animation to slide the contents from the side (left/right).
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public static final int SLIDE_FROM_SIDE = 0;
/**
* Animation to slide the contents from the bottom.
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public static final int SLIDE_FROM_BOTTOM = 1;
private static final String TAG = "GuidedStepFragment";
@@ -239,7 +239,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public static class DummyFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
@@ -1319,7 +1319,7 @@
* For now clients(subclasses) can call this method inside the constructor.
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void setEntranceTransitionType(int transitionType) {
this.entranceTransitionType = transitionType;
}
diff --git a/v17/leanback/src/android/support/v17/leanback/app/GuidedStepSupportFragment.java b/v17/leanback/src/android/support/v17/leanback/app/GuidedStepSupportFragment.java
index 307c94b..32de1fd 100644
--- a/v17/leanback/src/android/support/v17/leanback/app/GuidedStepSupportFragment.java
+++ b/v17/leanback/src/android/support/v17/leanback/app/GuidedStepSupportFragment.java
@@ -16,7 +16,7 @@
*/
package android.support.v17.leanback.app;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import android.animation.Animator;
import android.animation.AnimatorSet;
@@ -226,14 +226,14 @@
* Animation to slide the contents from the side (left/right).
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public static final int SLIDE_FROM_SIDE = 0;
/**
* Animation to slide the contents from the bottom.
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public static final int SLIDE_FROM_BOTTOM = 1;
private static final String TAG = "GuidedStepSupportFragment";
@@ -242,7 +242,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public static class DummyFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
@@ -1322,7 +1322,7 @@
* For now clients(subclasses) can call this method inside the constructor.
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void setEntranceTransitionType(int transitionType) {
this.entranceTransitionType = transitionType;
}
diff --git a/v17/leanback/src/android/support/v17/leanback/app/PermissionHelper.java b/v17/leanback/src/android/support/v17/leanback/app/PermissionHelper.java
index e6edadb..c6630af 100644
--- a/v17/leanback/src/android/support/v17/leanback/app/PermissionHelper.java
+++ b/v17/leanback/src/android/support/v17/leanback/app/PermissionHelper.java
@@ -13,15 +13,15 @@
*/
package android.support.v17.leanback.app;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.os.Build;
import android.support.annotation.RestrictTo;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class PermissionHelper {
public static void requestPermissions(android.app.Fragment fragment, String[] permissions,
diff --git a/v17/leanback/src/android/support/v17/leanback/app/PlaybackControlGlue.java b/v17/leanback/src/android/support/v17/leanback/app/PlaybackControlGlue.java
index 9cae90e..4892b69 100644
--- a/v17/leanback/src/android/support/v17/leanback/app/PlaybackControlGlue.java
+++ b/v17/leanback/src/android/support/v17/leanback/app/PlaybackControlGlue.java
@@ -34,6 +34,8 @@
import android.view.KeyEvent;
import android.view.View;
+import java.lang.ref.WeakReference;
+
/**
* A helper class for managing a {@link android.support.v17.leanback.widget.PlaybackControlsRow}
* and {@link android.support.v17.leanback.app.PlaybackGlue.PlaybackGlueHost} that implements a
@@ -188,14 +190,21 @@
private int mPlaybackSpeed = PLAYBACK_SPEED_NORMAL;
private boolean mFadeWhenPlaying = true;
- private final Handler mHandler = new Handler() {
+ static class UpdatePlaybackStateHandler extends Handler {
@Override
public void handleMessage(Message msg) {
if (msg.what == MSG_UPDATE_PLAYBACK_STATE) {
- updatePlaybackState();
+ PlaybackControlGlue glue = ((WeakReference<PlaybackControlGlue>) msg.obj).get();
+ if (glue != null) {
+ glue.updatePlaybackState();
+ }
}
}
- };
+ }
+
+ static final Handler sHandler = new UpdatePlaybackStateHandler();
+
+ final WeakReference<PlaybackControlGlue> mGlueWeakReference = new WeakReference(this);
/**
* Interface allowing the application to handle input events.
@@ -595,16 +604,16 @@
private void updateControlsRow() {
updateRowMetadata();
- mHandler.removeMessages(MSG_UPDATE_PLAYBACK_STATE);
+ sHandler.removeMessages(MSG_UPDATE_PLAYBACK_STATE, mGlueWeakReference);
updatePlaybackState();
}
private void updatePlaybackStatusAfterUserAction() {
updatePlaybackState(mPlaybackSpeed);
// Sync playback state after a delay
- mHandler.removeMessages(MSG_UPDATE_PLAYBACK_STATE);
- mHandler.sendEmptyMessageDelayed(MSG_UPDATE_PLAYBACK_STATE,
- UPDATE_PLAYBACK_STATE_DELAY_MS);
+ sHandler.removeMessages(MSG_UPDATE_PLAYBACK_STATE, mGlueWeakReference);
+ sHandler.sendMessageDelayed(sHandler.obtainMessage(MSG_UPDATE_PLAYBACK_STATE,
+ mGlueWeakReference), UPDATE_PLAYBACK_STATE_DELAY_MS);
}
private void updateRowMetadata() {
@@ -885,12 +894,12 @@
if (!hasValidMedia()) {
return;
}
- if (mHandler.hasMessages(MSG_UPDATE_PLAYBACK_STATE)) {
- mHandler.removeMessages(MSG_UPDATE_PLAYBACK_STATE);
+ if (sHandler.hasMessages(MSG_UPDATE_PLAYBACK_STATE, mGlueWeakReference)) {
+ sHandler.removeMessages(MSG_UPDATE_PLAYBACK_STATE, mGlueWeakReference);
if (getCurrentSpeedId() != mPlaybackSpeed) {
if (DEBUG) Log.v(TAG, "Status expectation mismatch, delaying update");
- mHandler.sendEmptyMessageDelayed(MSG_UPDATE_PLAYBACK_STATE,
- UPDATE_PLAYBACK_STATE_DELAY_MS);
+ sHandler.sendMessageDelayed(sHandler.obtainMessage(MSG_UPDATE_PLAYBACK_STATE,
+ mGlueWeakReference), UPDATE_PLAYBACK_STATE_DELAY_MS);
} else {
if (DEBUG) Log.v(TAG, "Update state matches expectation");
updatePlaybackState();
diff --git a/v17/leanback/src/android/support/v17/leanback/app/PlaybackOverlayFragment.java b/v17/leanback/src/android/support/v17/leanback/app/PlaybackOverlayFragment.java
index c2566d6..32b9c92 100644
--- a/v17/leanback/src/android/support/v17/leanback/app/PlaybackOverlayFragment.java
+++ b/v17/leanback/src/android/support/v17/leanback/app/PlaybackOverlayFragment.java
@@ -45,6 +45,7 @@
import android.view.ViewGroup;
import android.view.animation.AccelerateInterpolator;
+import java.lang.ref.WeakReference;
import java.util.ArrayList;
/**
@@ -121,9 +122,7 @@
private ValueAnimator mControlRowFadeInAnimator, mControlRowFadeOutAnimator;
private ValueAnimator mDescriptionFadeInAnimator, mDescriptionFadeOutAnimator;
private ValueAnimator mOtherRowFadeInAnimator, mOtherRowFadeOutAnimator;
- private boolean mTranslateAnimationEnabled;
boolean mResetControlsToPrimaryActionsPending;
- private RecyclerView.ItemAnimator mItemAnimator;
private final Animator.AnimatorListener mFadeListener =
new Animator.AnimatorListener() {
@@ -160,14 +159,22 @@
}
};
- private final Handler mHandler = new Handler() {
+ static class FadeHandler extends Handler {
@Override
public void handleMessage(Message message) {
- if (message.what == START_FADE_OUT && mFadingEnabled) {
- fade(false);
+ PlaybackOverlayFragment fragment;
+ if (message.what == START_FADE_OUT) {
+ fragment = ((WeakReference<PlaybackOverlayFragment>) message.obj).get();
+ if (fragment != null && fragment.mFadingEnabled) {
+ fragment.fade(false);
+ }
}
}
- };
+ }
+
+ static final Handler sHandler = new FadeHandler();
+
+ final WeakReference<PlaybackOverlayFragment> mFragmentReference = new WeakReference(this);
private final VerticalGridView.OnTouchInterceptListener mOnTouchInterceptListener =
new VerticalGridView.OnTouchInterceptListener() {
@@ -224,12 +231,12 @@
mFadingEnabled = enabled;
if (mFadingEnabled) {
if (isResumed() && mFadingStatus == IDLE
- && !mHandler.hasMessages(START_FADE_OUT)) {
+ && !sHandler.hasMessages(START_FADE_OUT, mFragmentReference)) {
startFadeTimer();
}
} else {
// Ensure fully opaque
- mHandler.removeMessages(START_FADE_OUT);
+ sHandler.removeMessages(START_FADE_OUT, mFragmentReference);
fade(true);
}
}
@@ -300,7 +307,7 @@
if (!mFadingEnabled || !isResumed()) {
return;
}
- if (mHandler.hasMessages(START_FADE_OUT)) {
+ if (sHandler.hasMessages(START_FADE_OUT, mFragmentReference)) {
// Restart the timer
startFadeTimer();
} else {
@@ -312,7 +319,7 @@
* Fades out the playback overlay immediately.
*/
public void fadeOut() {
- mHandler.removeMessages(START_FADE_OUT);
+ sHandler.removeMessages(START_FADE_OUT, mFragmentReference);
fade(false);
}
@@ -352,7 +359,7 @@
// them out (even if the key was consumed by the handler).
if (mFadingEnabled && !controlsHidden) {
consumeEvent = true;
- mHandler.removeMessages(START_FADE_OUT);
+ sHandler.removeMessages(START_FADE_OUT, mFragmentReference);
fade(false);
} else if (consumeEvent) {
tickle();
@@ -378,10 +385,9 @@
}
void startFadeTimer() {
- if (mHandler != null) {
- mHandler.removeMessages(START_FADE_OUT);
- mHandler.sendEmptyMessageDelayed(START_FADE_OUT, mShowTimeMs);
- }
+ sHandler.removeMessages(START_FADE_OUT, mFragmentReference);
+ sHandler.sendMessageDelayed(sHandler.obtainMessage(START_FADE_OUT, mFragmentReference),
+ mShowTimeMs);
}
private static ValueAnimator loadAnimator(Context context, int resId) {
diff --git a/v17/leanback/src/android/support/v17/leanback/app/PlaybackOverlaySupportFragment.java b/v17/leanback/src/android/support/v17/leanback/app/PlaybackOverlaySupportFragment.java
index 5603c09..c1d1452 100644
--- a/v17/leanback/src/android/support/v17/leanback/app/PlaybackOverlaySupportFragment.java
+++ b/v17/leanback/src/android/support/v17/leanback/app/PlaybackOverlaySupportFragment.java
@@ -48,6 +48,7 @@
import android.view.ViewGroup;
import android.view.animation.AccelerateInterpolator;
+import java.lang.ref.WeakReference;
import java.util.ArrayList;
/**
@@ -124,9 +125,7 @@
private ValueAnimator mControlRowFadeInAnimator, mControlRowFadeOutAnimator;
private ValueAnimator mDescriptionFadeInAnimator, mDescriptionFadeOutAnimator;
private ValueAnimator mOtherRowFadeInAnimator, mOtherRowFadeOutAnimator;
- private boolean mTranslateAnimationEnabled;
boolean mResetControlsToPrimaryActionsPending;
- private RecyclerView.ItemAnimator mItemAnimator;
private final Animator.AnimatorListener mFadeListener =
new Animator.AnimatorListener() {
@@ -163,14 +162,22 @@
}
};
- private final Handler mHandler = new Handler() {
+ static class FadeHandler extends Handler {
@Override
public void handleMessage(Message message) {
- if (message.what == START_FADE_OUT && mFadingEnabled) {
- fade(false);
+ PlaybackOverlaySupportFragment fragment;
+ if (message.what == START_FADE_OUT) {
+ fragment = ((WeakReference<PlaybackOverlaySupportFragment>) message.obj).get();
+ if (fragment != null && fragment.mFadingEnabled) {
+ fragment.fade(false);
+ }
}
}
- };
+ }
+
+ static final Handler sHandler = new FadeHandler();
+
+ final WeakReference<PlaybackOverlaySupportFragment> mFragmentReference = new WeakReference(this);
private final VerticalGridView.OnTouchInterceptListener mOnTouchInterceptListener =
new VerticalGridView.OnTouchInterceptListener() {
@@ -227,12 +234,12 @@
mFadingEnabled = enabled;
if (mFadingEnabled) {
if (isResumed() && mFadingStatus == IDLE
- && !mHandler.hasMessages(START_FADE_OUT)) {
+ && !sHandler.hasMessages(START_FADE_OUT, mFragmentReference)) {
startFadeTimer();
}
} else {
// Ensure fully opaque
- mHandler.removeMessages(START_FADE_OUT);
+ sHandler.removeMessages(START_FADE_OUT, mFragmentReference);
fade(true);
}
}
@@ -303,7 +310,7 @@
if (!mFadingEnabled || !isResumed()) {
return;
}
- if (mHandler.hasMessages(START_FADE_OUT)) {
+ if (sHandler.hasMessages(START_FADE_OUT, mFragmentReference)) {
// Restart the timer
startFadeTimer();
} else {
@@ -315,7 +322,7 @@
* Fades out the playback overlay immediately.
*/
public void fadeOut() {
- mHandler.removeMessages(START_FADE_OUT);
+ sHandler.removeMessages(START_FADE_OUT, mFragmentReference);
fade(false);
}
@@ -355,7 +362,7 @@
// them out (even if the key was consumed by the handler).
if (mFadingEnabled && !controlsHidden) {
consumeEvent = true;
- mHandler.removeMessages(START_FADE_OUT);
+ sHandler.removeMessages(START_FADE_OUT, mFragmentReference);
fade(false);
} else if (consumeEvent) {
tickle();
@@ -381,10 +388,9 @@
}
void startFadeTimer() {
- if (mHandler != null) {
- mHandler.removeMessages(START_FADE_OUT);
- mHandler.sendEmptyMessageDelayed(START_FADE_OUT, mShowTimeMs);
- }
+ sHandler.removeMessages(START_FADE_OUT, mFragmentReference);
+ sHandler.sendMessageDelayed(sHandler.obtainMessage(START_FADE_OUT, mFragmentReference),
+ mShowTimeMs);
}
private static ValueAnimator loadAnimator(Context context, int resId) {
diff --git a/v17/leanback/src/android/support/v17/leanback/system/Settings.java b/v17/leanback/src/android/support/v17/leanback/system/Settings.java
index cdd2633..a723c84 100644
--- a/v17/leanback/src/android/support/v17/leanback/system/Settings.java
+++ b/v17/leanback/src/android/support/v17/leanback/system/Settings.java
@@ -16,7 +16,7 @@
package android.support.v17.leanback.system;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import android.content.Context;
import android.content.Intent;
@@ -69,7 +69,7 @@
* Returns true if static shadows are recommended.
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public boolean preferStaticShadows() {
return mPreferStaticShadows;
}
diff --git a/v17/leanback/src/android/support/v17/leanback/transition/LeanbackTransitionHelper.java b/v17/leanback/src/android/support/v17/leanback/transition/LeanbackTransitionHelper.java
index d4eecdb..2598969 100644
--- a/v17/leanback/src/android/support/v17/leanback/transition/LeanbackTransitionHelper.java
+++ b/v17/leanback/src/android/support/v17/leanback/transition/LeanbackTransitionHelper.java
@@ -13,23 +13,18 @@
*/
package android.support.v17.leanback.transition;
-import android.animation.AnimatorInflater;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.os.Build;
import android.support.annotation.RestrictTo;
import android.support.v17.leanback.R;
-import android.view.Gravity;
-import android.view.View;
-import android.view.animation.DecelerateInterpolator;
-import android.view.animation.Interpolator;
-
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
/**
* Helper class to load Leanback specific transition.
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class LeanbackTransitionHelper {
interface LeanbackTransitionHelperVersion {
diff --git a/v17/leanback/src/android/support/v17/leanback/transition/ParallaxTransition.java b/v17/leanback/src/android/support/v17/leanback/transition/ParallaxTransition.java
new file mode 100644
index 0000000..03af625
--- /dev/null
+++ b/v17/leanback/src/android/support/v17/leanback/transition/ParallaxTransition.java
@@ -0,0 +1,92 @@
+/*
+ * 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.
+ */
+
+package android.support.v17.leanback.transition;
+
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
+import android.animation.Animator;
+import android.animation.ValueAnimator;
+import android.annotation.TargetApi;
+import android.content.Context;
+import android.support.annotation.RequiresApi;
+import android.support.annotation.RestrictTo;
+import android.support.v17.leanback.R;
+import android.support.v17.leanback.widget.ParallaxSource;
+import android.transition.TransitionValues;
+import android.transition.Visibility;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.animation.Interpolator;
+import android.view.animation.LinearInterpolator;
+
+/**
+ * A slide transition changes TRANSLATION attribute of view which is not exposed by any event.
+ * In order to run a parallax effect with Slide transition, ParallaxTransition is running on the
+ * side, calling ParallaxSource.updateValues() on every frame. User should make sure slide
+ * and ParallaxTransition are using same duration and startDelay.
+ *
+ * @hide
+ */
+@RequiresApi(21)
+@TargetApi(21)
+@RestrictTo(LIBRARY_GROUP)
+public class ParallaxTransition extends Visibility {
+
+ static Interpolator sInterpolator = new LinearInterpolator();
+
+ public ParallaxTransition() {
+ }
+
+ public ParallaxTransition(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ Animator createAnimator(View view) {
+ final ParallaxSource<?> source = (ParallaxSource) view.getTag(R.id.lb_parallax_source);
+ if (source == null) {
+ return null;
+ }
+ ValueAnimator animator = ValueAnimator.ofFloat(0, 1);
+ animator.setInterpolator(sInterpolator);
+ animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
+ @Override
+ public void onAnimationUpdate(ValueAnimator animation) {
+ source.updateValues();
+ }
+ });
+ return animator;
+ }
+
+ @Override
+ public Animator onAppear(ViewGroup sceneRoot, View view,
+ TransitionValues startValues, TransitionValues endValues) {
+ if (endValues == null) {
+ return null;
+ }
+ return createAnimator(view);
+ }
+
+ @Override
+ public Animator onDisappear(ViewGroup sceneRoot, View view,
+ TransitionValues startValues, TransitionValues endValues) {
+ if (startValues == null) {
+ return null;
+ }
+ return createAnimator(view);
+ }
+}
diff --git a/v17/leanback/src/android/support/v17/leanback/transition/TransitionHelper.java b/v17/leanback/src/android/support/v17/leanback/transition/TransitionHelper.java
index c514323..bef3d8d 100644
--- a/v17/leanback/src/android/support/v17/leanback/transition/TransitionHelper.java
+++ b/v17/leanback/src/android/support/v17/leanback/transition/TransitionHelper.java
@@ -13,6 +13,8 @@
*/
package android.support.v17.leanback.transition;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.os.Build;
import android.support.annotation.RestrictTo;
@@ -23,13 +25,11 @@
import java.util.ArrayList;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Helper for view transitions.
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public final class TransitionHelper {
public static final int FADE_IN = 0x1;
@@ -48,11 +48,8 @@
* @return True if Transition animations are supported.
*/
public static boolean systemSupportsTransitions() {
- if (Build.VERSION.SDK_INT >= 19) {
- // Supported on Android 4.4 or later.
- return true;
- }
- return false;
+ // Supported on Android 4.4 or later.
+ return Build.VERSION.SDK_INT >= 19;
}
/**
diff --git a/v17/leanback/src/android/support/v17/leanback/util/StateMachine.java b/v17/leanback/src/android/support/v17/leanback/util/StateMachine.java
index 18b2133..a00bbc5 100644
--- a/v17/leanback/src/android/support/v17/leanback/util/StateMachine.java
+++ b/v17/leanback/src/android/support/v17/leanback/util/StateMachine.java
@@ -13,6 +13,8 @@
*/
package android.support.v17.leanback.util;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.support.annotation.RestrictTo;
import java.util.ArrayList;
@@ -20,8 +22,6 @@
import java.util.Iterator;
import java.util.Map;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Linear or DAG of {@link State}s. StateMachine is by default a linear model, until
* {@link #addState(State, State)} is called. Each State has three status:
@@ -31,7 +31,7 @@
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public final class StateMachine {
/**
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/BackgroundHelper.java b/v17/leanback/src/android/support/v17/leanback/widget/BackgroundHelper.java
index e9e1581..62d94d2 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/BackgroundHelper.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/BackgroundHelper.java
@@ -15,20 +15,19 @@
*/
package android.support.v17.leanback.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.RestrictTo;
-import android.support.v17.leanback.widget.BackgroundHelperKitkat;
import android.view.View;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Helper for view backgrounds.
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public final class BackgroundHelper {
final static BackgroundHelperVersionImpl sImpl;
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/BaseGridView.java b/v17/leanback/src/android/support/v17/leanback/widget/BaseGridView.java
index 1288ed1..2d007e8 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/BaseGridView.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/BaseGridView.java
@@ -13,7 +13,7 @@
*/
package android.support.v17.leanback.widget;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import android.content.Context;
import android.content.res.TypedArray;
@@ -35,7 +35,7 @@
* Do not directly use this class, use {@link VerticalGridView} and {@link HorizontalGridView}.
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
abstract class BaseGridView extends RecyclerView {
/**
@@ -897,10 +897,7 @@
if (super.dispatchKeyEvent(event)) {
return true;
}
- if (mOnUnhandledKeyListener != null && mOnUnhandledKeyListener.onUnhandledKey(event)) {
- return true;
- }
- return false;
+ return mOnUnhandledKeyListener != null && mOnUnhandledKeyListener.onUnhandledKey(event);
}
@Override
@@ -986,7 +983,7 @@
* Must be bigger or equals to 0.
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void setExtraLayoutSpace(int extraLayoutSpace) {
mLayoutManager.setExtraLayoutSpace(extraLayoutSpace);
}
@@ -996,7 +993,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public int getExtraLayoutSpace() {
return mLayoutManager.getExtraLayoutSpace();
}
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/BrowseRowsFrameLayout.java b/v17/leanback/src/android/support/v17/leanback/widget/BrowseRowsFrameLayout.java
index ec42537..9c65bd1 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/BrowseRowsFrameLayout.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/BrowseRowsFrameLayout.java
@@ -13,21 +13,21 @@
*/
package android.support.v17.leanback.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.support.annotation.RestrictTo;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Customized FrameLayout excludes margin of child from calculating the child size.
* So we can change left margin of rows while keep the width of rows unchanged without
* using hardcoded DIPS.
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class BrowseRowsFrameLayout extends FrameLayout {
public BrowseRowsFrameLayout(Context context) {
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/DividerPresenter.java b/v17/leanback/src/android/support/v17/leanback/widget/DividerPresenter.java
index 44a2578..42da2ff 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/DividerPresenter.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/DividerPresenter.java
@@ -13,15 +13,13 @@
*/
package android.support.v17.leanback.widget;
-import android.graphics.Paint;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.support.annotation.RestrictTo;
import android.support.v17.leanback.R;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.TextView;
-
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
/**
* DividerPresenter provides a default presentation for {@link DividerRow} in HeadersFragment.
@@ -37,7 +35,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public DividerPresenter(int layoutResourceId) {
mLayoutResourceId = layoutResourceId;
}
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/FocusHighlightHandler.java b/v17/leanback/src/android/support/v17/leanback/widget/FocusHighlightHandler.java
index 9e11a4c..83c248a 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/FocusHighlightHandler.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/FocusHighlightHandler.java
@@ -13,11 +13,11 @@
*/
package android.support.v17.leanback.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.support.annotation.RestrictTo;
import android.view.View;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Interface for highlighting the item that has focus.
*/
@@ -29,7 +29,7 @@
* @param view The view whose focus is changing.
* @param hasFocus True if focus is gained; false otherwise.
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
void onItemFocused(View view, boolean hasFocus);
/**
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/FocusHighlightHelper.java b/v17/leanback/src/android/support/v17/leanback/widget/FocusHighlightHelper.java
index 0990327..641bfcc 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/FocusHighlightHelper.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/FocusHighlightHelper.java
@@ -13,18 +13,19 @@
*/
package android.support.v17.leanback.widget;
+import static android.support.v17.leanback.widget.FocusHighlight.ZOOM_FACTOR_LARGE;
+import static android.support.v17.leanback.widget.FocusHighlight.ZOOM_FACTOR_MEDIUM;
+import static android.support.v17.leanback.widget.FocusHighlight.ZOOM_FACTOR_NONE;
+import static android.support.v17.leanback.widget.FocusHighlight.ZOOM_FACTOR_SMALL;
+import static android.support.v17.leanback.widget.FocusHighlight.ZOOM_FACTOR_XSMALL;
+
+import android.animation.TimeAnimator;
+import android.content.res.Resources;
import android.support.v17.leanback.R;
import android.support.v17.leanback.graphics.ColorOverlayDimmer;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Interpolator;
-import android.animation.TimeAnimator;
-import android.content.res.Resources;
-import static android.support.v17.leanback.widget.FocusHighlight.ZOOM_FACTOR_NONE;
-import static android.support.v17.leanback.widget.FocusHighlight.ZOOM_FACTOR_SMALL;
-import static android.support.v17.leanback.widget.FocusHighlight.ZOOM_FACTOR_XSMALL;
-import static android.support.v17.leanback.widget.FocusHighlight.ZOOM_FACTOR_MEDIUM;
-import static android.support.v17.leanback.widget.FocusHighlight.ZOOM_FACTOR_LARGE;
/**
* Sets up the highlighting behavior when an item gains focus.
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/GuidedActionAdapter.java b/v17/leanback/src/android/support/v17/leanback/widget/GuidedActionAdapter.java
index 66335f4..ca6ee77 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/GuidedActionAdapter.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/GuidedActionAdapter.java
@@ -13,7 +13,7 @@
*/
package android.support.v17.leanback.widget;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import android.support.annotation.RestrictTo;
import android.support.v7.widget.RecyclerView;
@@ -38,7 +38,7 @@
* {@link GuidedActionAdapter.ClickListener} and {@link GuidedActionAdapter.FocusListener}.
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class GuidedActionAdapter extends RecyclerView.Adapter {
static final String TAG = "GuidedActionAdapter";
static final boolean DEBUG = false;
@@ -210,7 +210,7 @@
* Used for serialization only.
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public List<GuidedAction> getActions() {
return new ArrayList<GuidedAction>(mActions);
}
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/GuidedActionAdapterGroup.java b/v17/leanback/src/android/support/v17/leanback/widget/GuidedActionAdapterGroup.java
index 075232a..287ae3b 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/GuidedActionAdapterGroup.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/GuidedActionAdapterGroup.java
@@ -13,30 +13,25 @@
*/
package android.support.v17.leanback.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.support.annotation.RestrictTo;
-import android.support.v17.leanback.widget.GuidedActionAdapter.ClickListener;
import android.support.v17.leanback.widget.GuidedActionAdapter.EditListener;
import android.util.Log;
import android.util.Pair;
-import android.view.KeyEvent;
import android.view.View;
-import android.view.ViewParent;
import android.view.inputmethod.InputMethodManager;
-import android.widget.EditText;
import android.widget.TextView;
-import android.widget.TextView.OnEditorActionListener;
import java.util.ArrayList;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Internal implementation manages a group of GuidedActionAdapters, control the next action after
* editing finished, maintain the Ime open/close status.
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class GuidedActionAdapterGroup {
private static final String TAG_EDIT = "EditableAction";
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/GuidedActionItemContainer.java b/v17/leanback/src/android/support/v17/leanback/widget/GuidedActionItemContainer.java
index f00b870..bbb0865 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/GuidedActionItemContainer.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/GuidedActionItemContainer.java
@@ -14,12 +14,8 @@
package android.support.v17.leanback.widget;
import android.content.Context;
-import android.support.annotation.RestrictTo;
import android.util.AttributeSet;
import android.view.View;
-import android.view.ViewParent;
-
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
/**
* Root view of GuidedAction item, it supports a foreground drawable and can disable focus out
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/GuidedActionsStylist.java b/v17/leanback/src/android/support/v17/leanback/widget/GuidedActionsStylist.java
index faf537d..a03408d 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/GuidedActionsStylist.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/GuidedActionsStylist.java
@@ -13,7 +13,7 @@
*/
package android.support.v17.leanback.widget;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import static android.support.v17.leanback.widget.GuidedAction.EDITING_ACTIVATOR_VIEW;
import static android.support.v17.leanback.widget.GuidedAction.EDITING_DESCRIPTION;
import static android.support.v17.leanback.widget.GuidedAction.EDITING_NONE;
@@ -945,7 +945,7 @@
* Sets listener for reporting view being edited.
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void setEditListener(EditListener listener) {
mEditListener = listener;
}
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/InvisibleRowPresenter.java b/v17/leanback/src/android/support/v17/leanback/widget/InvisibleRowPresenter.java
index 2b5c7f0..bf898c2 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/InvisibleRowPresenter.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/InvisibleRowPresenter.java
@@ -13,17 +13,16 @@
*/
package android.support.v17.leanback.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.support.annotation.RestrictTo;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
-import android.widget.TextView;
-
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class InvisibleRowPresenter extends RowPresenter {
public InvisibleRowPresenter() {
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/ListRowPresenter.java b/v17/leanback/src/android/support/v17/leanback/widget/ListRowPresenter.java
index c4658e7..1577082 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/ListRowPresenter.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/ListRowPresenter.java
@@ -450,16 +450,13 @@
});
rowViewHolder.mGridView.setOnUnhandledKeyListener(
new BaseGridView.OnUnhandledKeyListener() {
- @Override
- public boolean onUnhandledKey(KeyEvent event) {
- if (rowViewHolder.getOnKeyListener() != null
- && rowViewHolder.getOnKeyListener().onKey(
- rowViewHolder.view, event.getKeyCode(), event)) {
- return true;
- }
- return false;
- }
- });
+ @Override
+ public boolean onUnhandledKey(KeyEvent event) {
+ return rowViewHolder.getOnKeyListener() != null
+ && rowViewHolder.getOnKeyListener().onKey(
+ rowViewHolder.view, event.getKeyCode(), event);
+ }
+ });
rowViewHolder.mGridView.setNumRows(mNumRows);
}
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/MediaNowPlayingView.java b/v17/leanback/src/android/support/v17/leanback/widget/MediaNowPlayingView.java
index 901ff55..88ae7d3 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/MediaNowPlayingView.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/MediaNowPlayingView.java
@@ -13,7 +13,7 @@
*/
package android.support.v17.leanback.widget;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import android.animation.Animator;
import android.animation.ObjectAnimator;
@@ -32,7 +32,7 @@
* The view displaying 3 animated peak meters next to each other when a media item is playing.
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class MediaNowPlayingView extends LinearLayout{
private final ImageView mImage1;
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/NonOverlappingLinearLayoutWithForeground.java b/v17/leanback/src/android/support/v17/leanback/widget/NonOverlappingLinearLayoutWithForeground.java
index 8242caa..89a5497 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/NonOverlappingLinearLayoutWithForeground.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/NonOverlappingLinearLayoutWithForeground.java
@@ -19,12 +19,9 @@
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Build.VERSION;
-import android.support.annotation.RestrictTo;
import android.util.AttributeSet;
import android.widget.LinearLayout;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Implements foreground drawable before M and falls back to M's foreground implementation.
*/
@@ -60,6 +57,7 @@
if (d != null) {
setForegroundCompat(d);
}
+ a.recycle();
}
}
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/PagingIndicator.java b/v17/leanback/src/android/support/v17/leanback/widget/PagingIndicator.java
index ea39399..b0bdacd 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/PagingIndicator.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/PagingIndicator.java
@@ -16,7 +16,7 @@
package android.support.v17.leanback.widget;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import android.animation.Animator;
import android.animation.AnimatorSet;
@@ -45,7 +45,7 @@
* A page indicator with dots.
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class PagingIndicator extends View {
private static final long DURATION_ALPHA = 167;
private static final long DURATION_DIAMETER = 417;
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/ParallaxRecyclerViewSource.java b/v17/leanback/src/android/support/v17/leanback/widget/ParallaxRecyclerViewSource.java
index f102695..acfb656 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/ParallaxRecyclerViewSource.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/ParallaxRecyclerViewSource.java
@@ -162,6 +162,15 @@
Rect rect = new Rect(
0, 0, trackingView.getWidth(), trackingView.getHeight());
recyclerView.offsetDescendantRectToMyCoords(trackingView, rect);
+ // Slide transition may change the trackingView's translationX/translationY,
+ // add up translation values in parent.
+ float tx = 0, ty = 0;
+ while (trackingView != recyclerView && trackingView != null) {
+ tx += trackingView.getTranslationX();
+ ty += trackingView.getTranslationY();
+ trackingView = (View) trackingView.getParent();
+ }
+ rect.offset((int) tx, (int) ty);
if (source.mIsVertical) {
source.setPropertyValue(getIndex(), rect.top + mOffset
+ (int) (mFraction * rect.height()));
@@ -173,6 +182,7 @@
}
}
+
@Override
public ChildPositionProperty createProperty(String name, int index) {
return new ChildPositionProperty(name, index);
@@ -212,9 +222,23 @@
}
/**
+ * Manually update values. This is used for changes not controlled by RecyclerView. E.g.
+ * called by a Slide transition that changes translation of the view.
+ */
+ @Override
+ public void updateValues() {
+ for (ChildPositionProperty prop: getProperties()) {
+ prop.updateValue(ParallaxRecyclerViewSource.this);
+ }
+ if (mListener != null) {
+ mListener.onPropertiesChanged(ParallaxRecyclerViewSource.this);
+ }
+ }
+
+ /**
* @return Currently RecylerView that the source has registered onScrollListener.
*/
public RecyclerView getRecyclerView() {
return mRecylerView;
}
-}
\ No newline at end of file
+}
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/ParallaxSource.java b/v17/leanback/src/android/support/v17/leanback/widget/ParallaxSource.java
index 02809af..91459c9 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/ParallaxSource.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/ParallaxSource.java
@@ -515,4 +515,10 @@
*/
public abstract void setListener(Listener listener);
+ /**
+ * This is used when the source is unaware of the updates and requires caller to update the
+ * values at the right time.
+ */
+ public void updateValues() {
+ }
}
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/PlaybackControlsRowView.java b/v17/leanback/src/android/support/v17/leanback/widget/PlaybackControlsRowView.java
index 277f427..c10d202 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/PlaybackControlsRowView.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/PlaybackControlsRowView.java
@@ -57,10 +57,7 @@
if (super.dispatchKeyEvent(event)) {
return true;
}
- if (mOnUnhandledKeyListener != null && mOnUnhandledKeyListener.onUnhandledKey(event)) {
- return true;
- }
- return false;
+ return mOnUnhandledKeyListener != null && mOnUnhandledKeyListener.onUnhandledKey(event);
}
@Override
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/RowHeaderPresenter.java b/v17/leanback/src/android/support/v17/leanback/widget/RowHeaderPresenter.java
index c3a2cce..66dc12d 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/RowHeaderPresenter.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/RowHeaderPresenter.java
@@ -13,7 +13,7 @@
*/
package android.support.v17.leanback.widget;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import android.graphics.Paint;
import android.support.annotation.RestrictTo;
@@ -42,7 +42,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public RowHeaderPresenter(int layoutResourceId) {
this(layoutResourceId, true);
}
@@ -50,7 +50,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public RowHeaderPresenter(int layoutResourceId, boolean animateSelect) {
mLayoutResourceId = layoutResourceId;
mAnimateSelect = animateSelect;
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/ScaleFrameLayout.java b/v17/leanback/src/android/support/v17/leanback/widget/ScaleFrameLayout.java
index 047d83c..c394272 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/ScaleFrameLayout.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/ScaleFrameLayout.java
@@ -13,7 +13,7 @@
*/
package android.support.v17.leanback.widget;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import android.content.Context;
import android.graphics.drawable.Drawable;
@@ -28,7 +28,7 @@
* Subclass of FrameLayout that support scale layout area size for children.
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class ScaleFrameLayout extends FrameLayout {
private static final int DEFAULT_CHILD_GRAVITY = Gravity.TOP | Gravity.START;
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/Util.java b/v17/leanback/src/android/support/v17/leanback/widget/Util.java
index 544e18f..7e89ea6 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/Util.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/Util.java
@@ -13,17 +13,17 @@
*/
package android.support.v17.leanback.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.support.annotation.RestrictTo;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class Util {
/**
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/picker/DatePicker.java b/v17/leanback/src/android/support/v17/leanback/widget/picker/DatePicker.java
index 8000f5f..31863a9 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/picker/DatePicker.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/picker/DatePicker.java
@@ -14,6 +14,8 @@
package android.support.v17.leanback.widget.picker;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.TypedArray;
import android.support.annotation.RestrictTo;
@@ -30,8 +32,6 @@
import java.util.Locale;
import java.util.TimeZone;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* {@link DatePicker} is a directly subclass of {@link Picker}.
* This class is a widget for selecting a date. The date can be selected by a
@@ -44,7 +44,7 @@
* @attr ref R.styleable#lbDatePicker_datePickerFormat
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class DatePicker extends Picker {
static final String LOG_TAG = "DatePicker";
diff --git a/v17/leanback/tests/java/android/support/v17/leanback/app/DetailsFragmentTest.java b/v17/leanback/tests/java/android/support/v17/leanback/app/DetailsFragmentTest.java
index 51b532a..c6662ab 100644
--- a/v17/leanback/tests/java/android/support/v17/leanback/app/DetailsFragmentTest.java
+++ b/v17/leanback/tests/java/android/support/v17/leanback/app/DetailsFragmentTest.java
@@ -83,7 +83,7 @@
detailsFrameRect.set(0, 0, detailsFrame.getWidth(), detailsFrame.getHeight());
verticalGridView.offsetDescendantRectToMyCoords(detailsFrame, detailsFrameRect);
- assertEquals(Math.min(windowHeight, detailsFrameRect.bottom),
+ assertEquals(Math.min(windowHeight, detailsFrameRect.top),
bitmapDrawable.getBounds().height());
assertEquals(0, bitmapDrawable.getVerticalOffset());
@@ -103,13 +103,14 @@
detailsFrameRect.set(0, 0, detailsFrame.getWidth(), detailsFrame.getHeight());
verticalGridView.offsetDescendantRectToMyCoords(detailsFrame, detailsFrameRect);
- assertEquals(detailsFrameRect.bottom, bitmapDrawable.getBounds().height());
+
+ assertEquals(0, bitmapDrawable.getBounds().top);
+ assertEquals(Math.max(detailsFrameRect.top, 0), bitmapDrawable.getBounds().bottom);
assertEquals(windowWidth, bitmapDrawable.getBounds().width());
ColorDrawable colorDrawable = (ColorDrawable) (drawable.getChildAt(1).getDrawable());
assertEquals(windowWidth, colorDrawable.getBounds().width());
- // Since bottom is using float mapping, using float compare with delta
- assertEquals(windowHeight - detailsFrameRect.bottom,
- (float) colorDrawable.getBounds().height(), 2 /*delta*/);
+ assertEquals(detailsFrameRect.bottom, colorDrawable.getBounds().top);
+ assertEquals(windowHeight, colorDrawable.getBounds().bottom);
}
}
diff --git a/v17/preference-leanback/api21/android/support/v17/internal/widget/OutlineOnlyWithChildrenFrameLayout.java b/v17/preference-leanback/api21/android/support/v17/internal/widget/OutlineOnlyWithChildrenFrameLayout.java
index 1054949..893af77 100644
--- a/v17/preference-leanback/api21/android/support/v17/internal/widget/OutlineOnlyWithChildrenFrameLayout.java
+++ b/v17/preference-leanback/api21/android/support/v17/internal/widget/OutlineOnlyWithChildrenFrameLayout.java
@@ -16,6 +16,8 @@
package android.support.v17.internal.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Outline;
@@ -26,8 +28,6 @@
import android.view.ViewOutlineProvider;
import android.widget.FrameLayout;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* {@link FrameLayout} subclass that provides an outline only when it has children, so that it does
* not cast a shadow when empty.
@@ -36,7 +36,7 @@
*/
@RequiresApi(21)
@TargetApi(21)
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class OutlineOnlyWithChildrenFrameLayout extends FrameLayout {
private ViewOutlineProvider mMagicalOutlineProvider;
diff --git a/v17/preference-leanback/api21/android/support/v17/preference/LeanbackPreferenceFragmentTransitionHelperApi21.java b/v17/preference-leanback/api21/android/support/v17/preference/LeanbackPreferenceFragmentTransitionHelperApi21.java
index 1b320a5..e258686 100644
--- a/v17/preference-leanback/api21/android/support/v17/preference/LeanbackPreferenceFragmentTransitionHelperApi21.java
+++ b/v17/preference-leanback/api21/android/support/v17/preference/LeanbackPreferenceFragmentTransitionHelperApi21.java
@@ -16,22 +16,22 @@
package android.support.v17.preference;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.annotation.TargetApi;
+import android.app.Fragment;
import android.support.annotation.RequiresApi;
import android.support.annotation.RestrictTo;
import android.support.v17.leanback.transition.FadeAndShortSlide;
-import android.app.Fragment;
import android.transition.Transition;
import android.view.Gravity;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* @hide
*/
@RequiresApi(21)
@TargetApi(21)
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class LeanbackPreferenceFragmentTransitionHelperApi21 {
public static void addTransitions(Fragment f) {
diff --git a/v17/preference-leanback/build.gradle b/v17/preference-leanback/build.gradle
index 2f4ec5b..9bfd0f3 100644
--- a/v17/preference-leanback/build.gradle
+++ b/v17/preference-leanback/build.gradle
@@ -22,18 +22,10 @@
main.res.srcDir 'res'
}
- lintOptions {
- }
-
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
-
- lintOptions {
- // TODO: fix errors and reenable.
- abortOnError false
- }
}
android.libraryVariants.all { variant ->
diff --git a/v17/preference-leanback/src/android/support/v17/preference/BaseLeanbackPreferenceFragment.java b/v17/preference-leanback/src/android/support/v17/preference/BaseLeanbackPreferenceFragment.java
index 29d1ed9..15db3d6 100644
--- a/v17/preference-leanback/src/android/support/v17/preference/BaseLeanbackPreferenceFragment.java
+++ b/v17/preference-leanback/src/android/support/v17/preference/BaseLeanbackPreferenceFragment.java
@@ -16,6 +16,8 @@
package android.support.v17.preference;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.RestrictTo;
@@ -26,8 +28,6 @@
import android.view.LayoutInflater;
import android.view.ViewGroup;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* This fragment provides a preference fragment with leanback-style behavior, suitable for
* embedding into broader UI elements.
@@ -49,7 +49,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public Fragment getCallbackFragment() {
return getParentFragment();
diff --git a/v17/preference-leanback/src/android/support/v17/preference/LeanbackSettingsFragment.java b/v17/preference-leanback/src/android/support/v17/preference/LeanbackSettingsFragment.java
index a9b7788..cac02b7 100644
--- a/v17/preference-leanback/src/android/support/v17/preference/LeanbackSettingsFragment.java
+++ b/v17/preference-leanback/src/android/support/v17/preference/LeanbackSettingsFragment.java
@@ -16,6 +16,8 @@
package android.support.v17.preference;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.os.Build;
@@ -34,8 +36,6 @@
import android.view.ViewGroup;
import android.widget.Space;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* This fragment provides a container for displaying a {@link LeanbackPreferenceFragment}
*
@@ -188,7 +188,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public static class DummyFragment extends Fragment {
@Override
diff --git a/v17/preference-leanback/src/android/support/v17/preference/LeanbackSettingsRootView.java b/v17/preference-leanback/src/android/support/v17/preference/LeanbackSettingsRootView.java
index 463ed08..fa221e6 100644
--- a/v17/preference-leanback/src/android/support/v17/preference/LeanbackSettingsRootView.java
+++ b/v17/preference-leanback/src/android/support/v17/preference/LeanbackSettingsRootView.java
@@ -16,6 +16,8 @@
package android.support.v17.preference;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.RestrictTo;
@@ -23,12 +25,10 @@
import android.view.KeyEvent;
import android.widget.FrameLayout;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class LeanbackSettingsRootView extends FrameLayout {
private OnKeyListener mOnBackKeyListener;
diff --git a/v4/build.gradle b/v4/build.gradle
index a55aed5..f0226e3 100644
--- a/v4/build.gradle
+++ b/v4/build.gradle
@@ -23,10 +23,6 @@
main.manifest.srcFile 'AndroidManifest.xml'
}
- lintOptions {
- abortOnError false
- }
-
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
diff --git a/v7/appcompat/build.gradle b/v7/appcompat/build.gradle
index e6bb42b..aa62632 100644
--- a/v7/appcompat/build.gradle
+++ b/v7/appcompat/build.gradle
@@ -51,11 +51,6 @@
aaptOptions {
additionalParameters "--no-version-vectors"
}
-
- lintOptions {
- // TODO: fix errors and reenable.
- abortOnError false
- }
}
android.libraryVariants.all { variant ->
diff --git a/v7/appcompat/src/android/support/v7/app/ActionBar.java b/v7/appcompat/src/android/support/v7/app/ActionBar.java
index 4e63b74..e26e813 100644
--- a/v7/appcompat/src/android/support/v7/app/ActionBar.java
+++ b/v7/appcompat/src/android/support/v7/app/ActionBar.java
@@ -16,6 +16,8 @@
package android.support.v7.app;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.TypedArray;
@@ -42,8 +44,6 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* A primary toolbar within the activity that may display the activity title, application-level
* navigation affordances, and other interactive items.
@@ -91,7 +91,7 @@
public abstract class ActionBar {
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Retention(RetentionPolicy.SOURCE)
@IntDef({NAVIGATION_MODE_STANDARD, NAVIGATION_MODE_LIST, NAVIGATION_MODE_TABS})
public @interface NavigationMode {}
@@ -136,7 +136,7 @@
public static final int NAVIGATION_MODE_TABS = 2;
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@IntDef(flag=true, value={
DISPLAY_USE_LOGO,
DISPLAY_SHOW_HOME,
@@ -865,7 +865,7 @@
* @return true if the Title field has been truncated
* @hide pending API approval
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public boolean isTitleTruncated() { return false; }
/**
@@ -1036,63 +1036,63 @@
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void setDefaultDisplayHomeAsUpEnabled(boolean enabled) {
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void setShowHideAnimationEnabled(boolean enabled) {
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void onConfigurationChanged(Configuration config) {
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void dispatchMenuVisibilityChanged(boolean visible) {
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public ActionMode startActionMode(ActionMode.Callback callback) {
return null;
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public boolean openOptionsMenu() {
return false;
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public boolean invalidateOptionsMenu() {
return false;
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public boolean onMenuKeyEvent(KeyEvent event) {
return false;
}
/** @hide **/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public boolean onKeyShortcut(int keyCode, KeyEvent ev) {
return false;
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public boolean collapseActionView() {
return false;
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void setWindowTitle(CharSequence title) {
}
diff --git a/v7/appcompat/src/android/support/v7/app/AlertDialog.java b/v7/appcompat/src/android/support/v7/app/AlertDialog.java
index e9bec36..529a10c 100644
--- a/v7/appcompat/src/android/support/v7/app/AlertDialog.java
+++ b/v7/appcompat/src/android/support/v7/app/AlertDialog.java
@@ -16,6 +16,8 @@
package android.support.v7.app;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
@@ -36,14 +38,11 @@
import android.view.ContextThemeWrapper;
import android.view.KeyEvent;
import android.view.View;
-import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListAdapter;
import android.widget.ListView;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* A subclass of Dialog that can display one, two or three buttons. If you only want to
* display a String in this dialog box, use the setMessage() method. If you
@@ -56,8 +55,8 @@
* </pre>
*
* <p>The AlertDialog class takes care of automatically setting
- * {@link WindowManager.LayoutParams#FLAG_ALT_FOCUSABLE_IM
- * WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM} for you based on whether
+ * {@link android.view.WindowManager.LayoutParams#FLAG_ALT_FOCUSABLE_IM
+ * android.view.WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM} for you based on whether
* any views in the dialog return true from {@link View#onCheckIsTextEditor()
* View.onCheckIsTextEditor()}. Generally you want this set for a Dialog
* without text editors, so that it will be placed on top of the current
@@ -876,7 +875,7 @@
* be able to put padding around the view.
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Deprecated
public Builder setView(View view, int viewSpacingLeft, int viewSpacingTop,
int viewSpacingRight, int viewSpacingBottom) {
@@ -909,7 +908,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public Builder setRecycleOnMeasureEnabled(boolean enabled) {
P.mRecycleOnMeasure = enabled;
return this;
diff --git a/v7/appcompat/src/android/support/v7/app/AppCompatActivity.java b/v7/appcompat/src/android/support/v7/app/AppCompatActivity.java
index 35e5ddc..89a6bdb 100644
--- a/v7/appcompat/src/android/support/v7/app/AppCompatActivity.java
+++ b/v7/appcompat/src/android/support/v7/app/AppCompatActivity.java
@@ -16,6 +16,8 @@
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;
@@ -43,8 +45,6 @@
import android.view.View;
import android.view.ViewGroup;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Base class for activities that use the
* <a href="{@docRoot}tools/extras/support-library.html">support library</a> action bar features.
@@ -245,7 +245,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void invalidateOptionsMenu() {
getDelegate().invalidateOptionsMenu();
}
diff --git a/v7/appcompat/src/android/support/v7/app/AppCompatDelegate.java b/v7/appcompat/src/android/support/v7/app/AppCompatDelegate.java
index 606fcba..7349b09 100644
--- a/v7/appcompat/src/android/support/v7/app/AppCompatDelegate.java
+++ b/v7/appcompat/src/android/support/v7/app/AppCompatDelegate.java
@@ -16,6 +16,8 @@
package android.support.v7.app;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
@@ -44,8 +46,6 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* This class represents a delegate which you can use to extend AppCompat's support to any
* {@link android.app.Activity}.
@@ -133,7 +133,7 @@
private static boolean sCompatVectorFromResourcesEnabled = false;
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@IntDef({MODE_NIGHT_NO, MODE_NIGHT_YES, MODE_NIGHT_AUTO, MODE_NIGHT_FOLLOW_SYSTEM,
MODE_NIGHT_UNSPECIFIED})
@Retention(RetentionPolicy.SOURCE)
diff --git a/v7/appcompat/src/android/support/v7/app/AppCompatDialog.java b/v7/appcompat/src/android/support/v7/app/AppCompatDialog.java
index 89a9368..dd0a4a5 100644
--- a/v7/appcompat/src/android/support/v7/app/AppCompatDialog.java
+++ b/v7/appcompat/src/android/support/v7/app/AppCompatDialog.java
@@ -16,6 +16,8 @@
package android.support.v7.app;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
@@ -29,8 +31,6 @@
import android.view.View;
import android.view.ViewGroup;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Base class for AppCompat themed {@link android.app.Dialog}s.
*/
@@ -143,7 +143,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void invalidateOptionsMenu() {
getDelegate().invalidateOptionsMenu();
}
diff --git a/v7/appcompat/src/android/support/v7/app/AppCompatDialogFragment.java b/v7/appcompat/src/android/support/v7/app/AppCompatDialogFragment.java
index dcccfad..bdf222a 100644
--- a/v7/appcompat/src/android/support/v7/app/AppCompatDialogFragment.java
+++ b/v7/appcompat/src/android/support/v7/app/AppCompatDialogFragment.java
@@ -17,6 +17,8 @@
package android.support.v7.app;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.app.Dialog;
import android.os.Bundle;
import android.support.annotation.RestrictTo;
@@ -24,8 +26,6 @@
import android.view.Window;
import android.view.WindowManager;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* A special version of {@link DialogFragment} which uses an {@link AppCompatDialog} in place of a
* platform-styled dialog.
@@ -40,7 +40,7 @@
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public void setupDialog(Dialog dialog, int style) {
if (dialog instanceof AppCompatDialog) {
diff --git a/v7/appcompat/src/android/support/v7/app/NotificationCompat.java b/v7/appcompat/src/android/support/v7/app/NotificationCompat.java
index d1c3f45..bd72879 100644
--- a/v7/appcompat/src/android/support/v7/app/NotificationCompat.java
+++ b/v7/appcompat/src/android/support/v7/app/NotificationCompat.java
@@ -16,7 +16,7 @@
package android.support.v7.app;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import android.annotation.TargetApi;
import android.app.Notification;
@@ -397,7 +397,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
protected CharSequence resolveText() {
if (mStyle instanceof MessagingStyle) {
@@ -417,7 +417,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
protected CharSequence resolveTitle() {
if (mStyle instanceof MessagingStyle) {
@@ -434,7 +434,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
protected BuilderExtender getExtender() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
diff --git a/v7/appcompat/src/android/support/v7/app/WindowDecorActionBar.java b/v7/appcompat/src/android/support/v7/app/WindowDecorActionBar.java
index 0279cb0..2f7eba3 100644
--- a/v7/appcompat/src/android/support/v7/app/WindowDecorActionBar.java
+++ b/v7/appcompat/src/android/support/v7/app/WindowDecorActionBar.java
@@ -16,6 +16,8 @@
package android.support.v7.app;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
@@ -66,15 +68,13 @@
import java.lang.ref.WeakReference;
import java.util.ArrayList;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* WindowDecorActionBar is the ActionBar implementation used
* by devices of all screen sizes as part of the window decor layout.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class WindowDecorActionBar extends ActionBar implements
ActionBarOverlayLayout.ActionBarVisibilityCallback {
private static final String TAG = "WindowDecorActionBar";
@@ -188,7 +188,7 @@
* Only for edit mode.
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public WindowDecorActionBar(View layout) {
assert layout.isInEditMode();
init(layout);
@@ -961,7 +961,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public class ActionModeImpl extends ActionMode implements MenuBuilder.Callback {
private final Context mActionModeContext;
private final MenuBuilder mMenu;
@@ -1135,7 +1135,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public class TabImpl extends ActionBar.Tab {
private ActionBar.TabListener mCallback;
private Object mTag;
diff --git a/v7/appcompat/src/android/support/v7/graphics/drawable/DrawableWrapper.java b/v7/appcompat/src/android/support/v7/graphics/drawable/DrawableWrapper.java
index adef493..3878943 100644
--- a/v7/appcompat/src/android/support/v7/graphics/drawable/DrawableWrapper.java
+++ b/v7/appcompat/src/android/support/v7/graphics/drawable/DrawableWrapper.java
@@ -16,6 +16,8 @@
package android.support.v7.graphics.drawable;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.res.ColorStateList;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
@@ -27,8 +29,6 @@
import android.support.v4.graphics.drawable.DrawableCompat;
import android.view.View;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Drawable which delegates all calls to it's wrapped {@link Drawable}.
* <p>
@@ -37,7 +37,7 @@
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class DrawableWrapper extends Drawable implements Drawable.Callback {
private Drawable mDrawable;
diff --git a/v7/appcompat/src/android/support/v7/graphics/drawable/DrawerArrowDrawable.java b/v7/appcompat/src/android/support/v7/graphics/drawable/DrawerArrowDrawable.java
index e9af7b1..07a61c7 100644
--- a/v7/appcompat/src/android/support/v7/graphics/drawable/DrawerArrowDrawable.java
+++ b/v7/appcompat/src/android/support/v7/graphics/drawable/DrawerArrowDrawable.java
@@ -16,6 +16,8 @@
package android.support.v7.graphics.drawable;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
@@ -36,8 +38,6 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* A drawable that can draw a "Drawer hamburger" menu or an arrow and animate between them.
* <p>
@@ -87,7 +87,7 @@
public static final int ARROW_DIRECTION_END = 3;
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@IntDef({ARROW_DIRECTION_LEFT, ARROW_DIRECTION_RIGHT,
ARROW_DIRECTION_START, ARROW_DIRECTION_END})
@Retention(RetentionPolicy.SOURCE)
diff --git a/v7/appcompat/src/android/support/v7/text/AllCapsTransformationMethod.java b/v7/appcompat/src/android/support/v7/text/AllCapsTransformationMethod.java
index 73f02e2..1f670a5 100644
--- a/v7/appcompat/src/android/support/v7/text/AllCapsTransformationMethod.java
+++ b/v7/appcompat/src/android/support/v7/text/AllCapsTransformationMethod.java
@@ -16,6 +16,8 @@
package android.support.v7.text;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.graphics.Rect;
import android.support.annotation.RestrictTo;
@@ -24,12 +26,10 @@
import java.util.Locale;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class AllCapsTransformationMethod implements TransformationMethod {
private Locale mLocale;
diff --git a/v7/appcompat/src/android/support/v7/transition/ActionBarTransition.java b/v7/appcompat/src/android/support/v7/transition/ActionBarTransition.java
index 8df2796..4deaeff 100644
--- a/v7/appcompat/src/android/support/v7/transition/ActionBarTransition.java
+++ b/v7/appcompat/src/android/support/v7/transition/ActionBarTransition.java
@@ -17,15 +17,15 @@
package android.support.v7.transition;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.support.annotation.RestrictTo;
import android.view.ViewGroup;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class ActionBarTransition {
private static final boolean TRANSITIONS_ENABLED = false;
diff --git a/v7/appcompat/src/android/support/v7/view/ActionBarPolicy.java b/v7/appcompat/src/android/support/v7/view/ActionBarPolicy.java
index e8415ac..7cd7d24 100644
--- a/v7/appcompat/src/android/support/v7/view/ActionBarPolicy.java
+++ b/v7/appcompat/src/android/support/v7/view/ActionBarPolicy.java
@@ -16,8 +16,9 @@
package android.support.v7.view;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
-import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.os.Build;
@@ -25,18 +26,15 @@
import android.support.v4.content.res.ConfigurationHelper;
import android.support.v4.view.ViewConfigurationCompat;
import android.support.v7.appcompat.R;
-import android.util.DisplayMetrics;
import android.view.ViewConfiguration;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Allows components to query for various configuration policy decisions about how the action bar
* should lay out and behave on the current device.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class ActionBarPolicy {
private Context mContext;
diff --git a/v7/appcompat/src/android/support/v7/view/ActionMode.java b/v7/appcompat/src/android/support/v7/view/ActionMode.java
index 50fae7e..55d02b8 100644
--- a/v7/appcompat/src/android/support/v7/view/ActionMode.java
+++ b/v7/appcompat/src/android/support/v7/view/ActionMode.java
@@ -16,14 +16,14 @@
package android.support.v7.view;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.support.annotation.RestrictTo;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Represents a contextual mode of the user interface. Action modes can be used to provide
* alternative interaction modes and replace parts of the normal UI until finished.
@@ -219,7 +219,7 @@
* @return true if the UI used to show this action mode can take focus
* @hide Internal use only
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public boolean isUiFocusable() {
return true;
}
diff --git a/v7/appcompat/src/android/support/v7/view/ContextThemeWrapper.java b/v7/appcompat/src/android/support/v7/view/ContextThemeWrapper.java
index 1fd0e61..44c0478 100644
--- a/v7/appcompat/src/android/support/v7/view/ContextThemeWrapper.java
+++ b/v7/appcompat/src/android/support/v7/view/ContextThemeWrapper.java
@@ -16,6 +16,8 @@
package android.support.v7.view;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.AssetManager;
@@ -25,15 +27,13 @@
import android.support.v7.appcompat.R;
import android.view.LayoutInflater;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* A ContextWrapper that allows you to modify the theme from what is in the
* wrapped context.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class ContextThemeWrapper extends ContextWrapper {
private int mThemeResource;
private Resources.Theme mTheme;
diff --git a/v7/appcompat/src/android/support/v7/view/StandaloneActionMode.java b/v7/appcompat/src/android/support/v7/view/StandaloneActionMode.java
index d328de8..d1bb05b 100644
--- a/v7/appcompat/src/android/support/v7/view/StandaloneActionMode.java
+++ b/v7/appcompat/src/android/support/v7/view/StandaloneActionMode.java
@@ -15,6 +15,8 @@
*/
package android.support.v7.view;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.support.annotation.RestrictTo;
import android.support.v4.view.MenuItemCompat;
@@ -30,12 +32,10 @@
import java.lang.ref.WeakReference;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class StandaloneActionMode extends ActionMode implements MenuBuilder.Callback {
private Context mContext;
private ActionBarContextView mContextView;
diff --git a/v7/appcompat/src/android/support/v7/view/SupportActionModeWrapper.java b/v7/appcompat/src/android/support/v7/view/SupportActionModeWrapper.java
index ddbfacb..ff929ba 100644
--- a/v7/appcompat/src/android/support/v7/view/SupportActionModeWrapper.java
+++ b/v7/appcompat/src/android/support/v7/view/SupportActionModeWrapper.java
@@ -16,6 +16,8 @@
package android.support.v7.view;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
@@ -31,15 +33,13 @@
import java.util.ArrayList;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Wraps a support {@link android.support.v7.view.ActionMode} as a framework
* {@link android.view.ActionMode}.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public class SupportActionModeWrapper extends ActionMode {
@@ -140,7 +140,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public static class CallbackWrapper implements android.support.v7.view.ActionMode.Callback {
final Callback mWrappedCallback;
final Context mContext;
diff --git a/v7/appcompat/src/android/support/v7/view/SupportMenuInflater.java b/v7/appcompat/src/android/support/v7/view/SupportMenuInflater.java
index c11bb77..4f71d02 100644
--- a/v7/appcompat/src/android/support/v7/view/SupportMenuInflater.java
+++ b/v7/appcompat/src/android/support/v7/view/SupportMenuInflater.java
@@ -16,8 +16,7 @@
package android.support.v7.view;
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import android.app.Activity;
import android.content.Context;
@@ -41,12 +40,13 @@
import android.view.SubMenu;
import android.view.View;
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* This class is used to instantiate menu XML files into Menu objects.
* <p>
@@ -58,7 +58,7 @@
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class SupportMenuInflater extends MenuInflater {
static final String LOG_TAG = "SupportMenuInflater";
diff --git a/v7/appcompat/src/android/support/v7/view/ViewPropertyAnimatorCompatSet.java b/v7/appcompat/src/android/support/v7/view/ViewPropertyAnimatorCompatSet.java
index c5e9c72..735030e 100644
--- a/v7/appcompat/src/android/support/v7/view/ViewPropertyAnimatorCompatSet.java
+++ b/v7/appcompat/src/android/support/v7/view/ViewPropertyAnimatorCompatSet.java
@@ -16,6 +16,8 @@
package android.support.v7.view;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.support.annotation.RestrictTo;
import android.support.v4.view.ViewPropertyAnimatorCompat;
import android.support.v4.view.ViewPropertyAnimatorListener;
@@ -25,15 +27,13 @@
import java.util.ArrayList;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* A very naive implementation of a set of
* {@link android.support.v4.view.ViewPropertyAnimatorCompat}.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class ViewPropertyAnimatorCompatSet {
final ArrayList<ViewPropertyAnimatorCompat> mAnimators;
diff --git a/v7/appcompat/src/android/support/v7/view/WindowCallbackWrapper.java b/v7/appcompat/src/android/support/v7/view/WindowCallbackWrapper.java
index b05de9a..4fbdd50 100644
--- a/v7/appcompat/src/android/support/v7/view/WindowCallbackWrapper.java
+++ b/v7/appcompat/src/android/support/v7/view/WindowCallbackWrapper.java
@@ -16,6 +16,8 @@
package android.support.v7.view;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.annotation.TargetApi;
import android.support.annotation.RequiresApi;
import android.support.annotation.RestrictTo;
@@ -33,8 +35,6 @@
import java.util.List;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* A simple decorator stub for Window.Callback that passes through any calls
* to the wrapped instance as a base implementation. Call super.foo() to call into
@@ -42,7 +42,7 @@
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class WindowCallbackWrapper implements Window.Callback {
final Window.Callback mWrapped;
diff --git a/v7/appcompat/src/android/support/v7/view/menu/ActionMenuItem.java b/v7/appcompat/src/android/support/v7/view/menu/ActionMenuItem.java
index c62cd18..2d13a56 100644
--- a/v7/appcompat/src/android/support/v7/view/menu/ActionMenuItem.java
+++ b/v7/appcompat/src/android/support/v7/view/menu/ActionMenuItem.java
@@ -16,6 +16,8 @@
package android.support.v7.view.menu;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
@@ -29,12 +31,10 @@
import android.view.SubMenu;
import android.view.View;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class ActionMenuItem implements SupportMenuItem {
private final int mId;
diff --git a/v7/appcompat/src/android/support/v7/view/menu/ActionMenuItemView.java b/v7/appcompat/src/android/support/v7/view/menu/ActionMenuItemView.java
index 2429ad4..77f5f17 100644
--- a/v7/appcompat/src/android/support/v7/view/menu/ActionMenuItemView.java
+++ b/v7/appcompat/src/android/support/v7/view/menu/ActionMenuItemView.java
@@ -16,13 +16,14 @@
package android.support.v7.view.menu;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
-import android.os.Build;
import android.os.Parcelable;
import android.support.annotation.RestrictTo;
import android.support.v4.content.res.ConfigurationHelper;
@@ -32,21 +33,17 @@
import android.support.v7.widget.ActionMenuView;
import android.support.v7.widget.AppCompatTextView;
import android.support.v7.widget.ForwardingListener;
-import android.support.v7.widget.ListPopupWindow;
import android.text.TextUtils;
import android.util.AttributeSet;
-import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Toast;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class ActionMenuItemView extends AppCompatTextView
implements MenuView.ItemView, View.OnClickListener, View.OnLongClickListener,
ActionMenuView.ActionMenuChildView {
diff --git a/v7/appcompat/src/android/support/v7/view/menu/BaseMenuPresenter.java b/v7/appcompat/src/android/support/v7/view/menu/BaseMenuPresenter.java
index 0e3cf5b..1cf72c3 100644
--- a/v7/appcompat/src/android/support/v7/view/menu/BaseMenuPresenter.java
+++ b/v7/appcompat/src/android/support/v7/view/menu/BaseMenuPresenter.java
@@ -16,6 +16,8 @@
package android.support.v7.view.menu;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.support.annotation.RestrictTo;
import android.support.v4.view.ViewCompat;
@@ -25,8 +27,6 @@
import java.util.ArrayList;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Base class for MenuPresenters that have a consistent container view and item views. Behaves
* similarly to an AdapterView in that existing item views will be reused if possible when items
@@ -34,7 +34,7 @@
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public abstract class BaseMenuPresenter implements MenuPresenter {
protected Context mSystemContext;
diff --git a/v7/appcompat/src/android/support/v7/view/menu/ExpandedMenuView.java b/v7/appcompat/src/android/support/v7/view/menu/ExpandedMenuView.java
index 5b06be7..113d56b 100644
--- a/v7/appcompat/src/android/support/v7/view/menu/ExpandedMenuView.java
+++ b/v7/appcompat/src/android/support/v7/view/menu/ExpandedMenuView.java
@@ -16,6 +16,8 @@
package android.support.v7.view.menu;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.support.annotation.RestrictTo;
import android.support.v7.view.menu.MenuBuilder.ItemInvoker;
@@ -26,15 +28,13 @@
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* The expanded menu view is a list-like menu with all of the available menu items. It is opened
* by the user clicking no the 'More' button on the icon menu view.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public final class ExpandedMenuView extends ListView
implements ItemInvoker, MenuView, OnItemClickListener {
diff --git a/v7/appcompat/src/android/support/v7/view/menu/ListMenuItemView.java b/v7/appcompat/src/android/support/v7/view/menu/ListMenuItemView.java
index 8498350..6a736aa 100644
--- a/v7/appcompat/src/android/support/v7/view/menu/ListMenuItemView.java
+++ b/v7/appcompat/src/android/support/v7/view/menu/ListMenuItemView.java
@@ -16,6 +16,8 @@
package android.support.v7.view.menu;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.support.annotation.RestrictTo;
@@ -33,14 +35,12 @@
import android.widget.RadioButton;
import android.widget.TextView;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* The item view for each item in the ListView-based MenuViews.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class ListMenuItemView extends LinearLayout implements MenuView.ItemView {
private static final String TAG = "ListMenuItemView";
private MenuItemImpl mItemData;
diff --git a/v7/appcompat/src/android/support/v7/view/menu/ListMenuPresenter.java b/v7/appcompat/src/android/support/v7/view/menu/ListMenuPresenter.java
index 580d7f9..41d5576 100644
--- a/v7/appcompat/src/android/support/v7/view/menu/ListMenuPresenter.java
+++ b/v7/appcompat/src/android/support/v7/view/menu/ListMenuPresenter.java
@@ -16,6 +16,8 @@
package android.support.v7.view.menu;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.os.Bundle;
import android.os.Parcelable;
@@ -32,14 +34,12 @@
import java.util.ArrayList;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* MenuPresenter for list-style menus.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class ListMenuPresenter implements MenuPresenter, AdapterView.OnItemClickListener {
private static final String TAG = "ListMenuPresenter";
diff --git a/v7/appcompat/src/android/support/v7/view/menu/MenuAdapter.java b/v7/appcompat/src/android/support/v7/view/menu/MenuAdapter.java
index eba2d89..3d34a16 100644
--- a/v7/appcompat/src/android/support/v7/view/menu/MenuAdapter.java
+++ b/v7/appcompat/src/android/support/v7/view/menu/MenuAdapter.java
@@ -15,6 +15,8 @@
*/
package android.support.v7.view.menu;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.support.annotation.RestrictTo;
import android.support.v7.appcompat.R;
import android.view.LayoutInflater;
@@ -24,12 +26,10 @@
import java.util.ArrayList;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class MenuAdapter extends BaseAdapter {
static final int ITEM_LAYOUT = R.layout.abc_popup_menu_item_layout;
diff --git a/v7/appcompat/src/android/support/v7/view/menu/MenuBuilder.java b/v7/appcompat/src/android/support/v7/view/menu/MenuBuilder.java
index 2ee07d8..714f801 100644
--- a/v7/appcompat/src/android/support/v7/view/menu/MenuBuilder.java
+++ b/v7/appcompat/src/android/support/v7/view/menu/MenuBuilder.java
@@ -16,6 +16,8 @@
package android.support.v7.view.menu;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -47,15 +49,13 @@
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Implementation of the {@link android.support.v4.internal.view.SupportMenu} interface for creating a
* standard menu UI.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class MenuBuilder implements SupportMenu {
private static final String TAG = "MenuBuilder";
@@ -165,6 +165,8 @@
private boolean mItemsChangedWhileDispatchPrevented = false;
+ private boolean mStructureChangedWhileDispatchPrevented = false;
+
private boolean mOptionalIconsVisible = false;
private boolean mIsClosing = false;
@@ -189,7 +191,7 @@
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public interface Callback {
/**
@@ -213,7 +215,7 @@
* Called by menu items to execute their associated action
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public interface ItemInvoker {
boolean invokeItem(MenuItemImpl item);
}
@@ -582,6 +584,7 @@
clearHeader();
mPreventDispatchingItemsChanged = false;
mItemsChangedWhileDispatchPrevented = false;
+ mStructureChangedWhileDispatchPrevented = false;
onItemsChanged(true);
}
@@ -599,6 +602,7 @@
final int group = item.getGroupId();
final int N = mItems.size();
+ stopDispatchingItemsChanged();
for (int i = 0; i < N; i++) {
MenuItemImpl curItem = mItems.get(i);
if (curItem.getGroupId() == group) {
@@ -609,6 +613,7 @@
curItem.setCheckedInt(curItem == item);
}
}
+ startDispatchingItemsChanged();
}
@Override
@@ -1042,6 +1047,9 @@
dispatchPresenterUpdate(structureChanged);
} else {
mItemsChangedWhileDispatchPrevented = true;
+ if (structureChanged) {
+ mStructureChangedWhileDispatchPrevented = true;
+ }
}
}
@@ -1054,6 +1062,7 @@
if (!mPreventDispatchingItemsChanged) {
mPreventDispatchingItemsChanged = true;
mItemsChangedWhileDispatchPrevented = false;
+ mStructureChangedWhileDispatchPrevented = false;
}
}
@@ -1062,7 +1071,7 @@
if (mItemsChangedWhileDispatchPrevented) {
mItemsChangedWhileDispatchPrevented = false;
- onItemsChanged(true);
+ onItemsChanged(mStructureChangedWhileDispatchPrevented);
}
}
diff --git a/v7/appcompat/src/android/support/v7/view/menu/MenuItemImpl.java b/v7/appcompat/src/android/support/v7/view/menu/MenuItemImpl.java
index b6374db..f1b94b0 100644
--- a/v7/appcompat/src/android/support/v7/view/menu/MenuItemImpl.java
+++ b/v7/appcompat/src/android/support/v7/view/menu/MenuItemImpl.java
@@ -16,6 +16,8 @@
package android.support.v7.view.menu;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
@@ -35,12 +37,10 @@
import android.view.ViewDebug;
import android.widget.LinearLayout;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public final class MenuItemImpl implements SupportMenuItem {
private static final String TAG = "MenuItemImpl";
diff --git a/v7/appcompat/src/android/support/v7/view/menu/MenuItemWrapperICS.java b/v7/appcompat/src/android/support/v7/view/menu/MenuItemWrapperICS.java
index 649b253..4ba3c89 100644
--- a/v7/appcompat/src/android/support/v7/view/menu/MenuItemWrapperICS.java
+++ b/v7/appcompat/src/android/support/v7/view/menu/MenuItemWrapperICS.java
@@ -16,11 +16,12 @@
package android.support.v7.view.menu;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.annotation.TargetApi;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
-import android.os.Build;
import android.support.annotation.RequiresApi;
import android.support.annotation.RestrictTo;
import android.support.v4.internal.view.SupportMenuItem;
@@ -36,13 +37,11 @@
import java.lang.reflect.Method;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Wraps a support {@link SupportMenuItem} as a framework {@link android.view.MenuItem}
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
@TargetApi(14)
@RequiresApi(14)
public class MenuItemWrapperICS extends BaseMenuWrapper<SupportMenuItem> implements MenuItem {
diff --git a/v7/appcompat/src/android/support/v7/view/menu/MenuItemWrapperJB.java b/v7/appcompat/src/android/support/v7/view/menu/MenuItemWrapperJB.java
index fd6c141..07db707 100644
--- a/v7/appcompat/src/android/support/v7/view/menu/MenuItemWrapperJB.java
+++ b/v7/appcompat/src/android/support/v7/view/menu/MenuItemWrapperJB.java
@@ -16,9 +16,10 @@
package android.support.v7.view.menu;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.annotation.TargetApi;
import android.content.Context;
-import android.os.Build;
import android.support.annotation.RequiresApi;
import android.support.annotation.RestrictTo;
import android.support.v4.internal.view.SupportMenuItem;
@@ -26,13 +27,11 @@
import android.view.MenuItem;
import android.view.View;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Wraps a support {@link SupportMenuItem} as a framework {@link android.view.MenuItem}
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
@TargetApi(16)
@RequiresApi(16)
class MenuItemWrapperJB extends MenuItemWrapperICS {
diff --git a/v7/appcompat/src/android/support/v7/view/menu/MenuPopupHelper.java b/v7/appcompat/src/android/support/v7/view/menu/MenuPopupHelper.java
index dde4bb4..18642ec 100644
--- a/v7/appcompat/src/android/support/v7/view/menu/MenuPopupHelper.java
+++ b/v7/appcompat/src/android/support/v7/view/menu/MenuPopupHelper.java
@@ -16,6 +16,8 @@
package android.support.v7.view.menu;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.graphics.Point;
import android.graphics.Rect;
@@ -34,14 +36,12 @@
import android.view.WindowManager;
import android.widget.PopupWindow.OnDismissListener;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Presents a menu as a small, simple popup anchored to another view.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class MenuPopupHelper implements MenuHelper {
private static final int TOUCH_EPICENTER_SIZE_DP = 48;
diff --git a/v7/appcompat/src/android/support/v7/view/menu/MenuPresenter.java b/v7/appcompat/src/android/support/v7/view/menu/MenuPresenter.java
index b8cca24..35d6860 100644
--- a/v7/appcompat/src/android/support/v7/view/menu/MenuPresenter.java
+++ b/v7/appcompat/src/android/support/v7/view/menu/MenuPresenter.java
@@ -16,20 +16,20 @@
package android.support.v7.view.menu;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.os.Parcelable;
import android.support.annotation.RestrictTo;
import android.view.ViewGroup;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* A MenuPresenter is responsible for building views for a Menu object. It takes over some
* responsibility from the old style monolithic MenuBuilder class.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public interface MenuPresenter {
/**
diff --git a/v7/appcompat/src/android/support/v7/view/menu/MenuView.java b/v7/appcompat/src/android/support/v7/view/menu/MenuView.java
index 9e542e4..2d2f027 100644
--- a/v7/appcompat/src/android/support/v7/view/menu/MenuView.java
+++ b/v7/appcompat/src/android/support/v7/view/menu/MenuView.java
@@ -16,18 +16,18 @@
package android.support.v7.view.menu;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.graphics.drawable.Drawable;
import android.support.annotation.RestrictTo;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Minimal interface for a menu view. {@link #initialize(MenuBuilder)} must be called for the
* menu to be functional.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public interface MenuView {
/**
* Initializes the menu to the given menu. This should be called after the
diff --git a/v7/appcompat/src/android/support/v7/view/menu/MenuWrapperFactory.java b/v7/appcompat/src/android/support/v7/view/menu/MenuWrapperFactory.java
index aa261aa..4bb9bca 100644
--- a/v7/appcompat/src/android/support/v7/view/menu/MenuWrapperFactory.java
+++ b/v7/appcompat/src/android/support/v7/view/menu/MenuWrapperFactory.java
@@ -16,6 +16,8 @@
package android.support.v7.view.menu;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.os.Build;
import android.support.annotation.RestrictTo;
@@ -26,12 +28,10 @@
import android.view.MenuItem;
import android.view.SubMenu;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public final class MenuWrapperFactory {
private MenuWrapperFactory() {
}
diff --git a/v7/appcompat/src/android/support/v7/view/menu/ShowableListMenu.java b/v7/appcompat/src/android/support/v7/view/menu/ShowableListMenu.java
index 49be9ec..40b7f4e 100644
--- a/v7/appcompat/src/android/support/v7/view/menu/ShowableListMenu.java
+++ b/v7/appcompat/src/android/support/v7/view/menu/ShowableListMenu.java
@@ -16,17 +16,17 @@
package android.support.v7.view.menu;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.support.annotation.RestrictTo;
import android.widget.ListView;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* A list menu which can be shown and hidden and which is internally represented by a ListView.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public interface ShowableListMenu {
void show();
diff --git a/v7/appcompat/src/android/support/v7/view/menu/SubMenuBuilder.java b/v7/appcompat/src/android/support/v7/view/menu/SubMenuBuilder.java
index f1d2980..fdd1b14 100644
--- a/v7/appcompat/src/android/support/v7/view/menu/SubMenuBuilder.java
+++ b/v7/appcompat/src/android/support/v7/view/menu/SubMenuBuilder.java
@@ -16,24 +16,23 @@
package android.support.v7.view.menu;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.support.annotation.RestrictTo;
-import android.support.v4.content.ContextCompat;
import android.view.Menu;
import android.view.MenuItem;
import android.view.SubMenu;
import android.view.View;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* The model for a sub menu, which is an extension of the menu. Most methods are proxied to the
* parent menu.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class SubMenuBuilder extends MenuBuilder implements SubMenu {
private MenuBuilder mParentMenu;
private MenuItemImpl mItem;
diff --git a/v7/appcompat/src/android/support/v7/view/menu/SubMenuWrapperICS.java b/v7/appcompat/src/android/support/v7/view/menu/SubMenuWrapperICS.java
index 4952d5d..55245f6 100644
--- a/v7/appcompat/src/android/support/v7/view/menu/SubMenuWrapperICS.java
+++ b/v7/appcompat/src/android/support/v7/view/menu/SubMenuWrapperICS.java
@@ -16,6 +16,8 @@
package android.support.v7.view.menu;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.drawable.Drawable;
@@ -26,13 +28,11 @@
import android.view.SubMenu;
import android.view.View;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Wraps a support {@link SupportSubMenu} as a framework {@link android.view.SubMenu}
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
@RequiresApi(14)
@TargetApi(14)
class SubMenuWrapperICS extends MenuWrapperICS implements SubMenu {
diff --git a/v7/appcompat/src/android/support/v7/widget/ActionBarContainer.java b/v7/appcompat/src/android/support/v7/widget/ActionBarContainer.java
index abac33e..de4484c 100644
--- a/v7/appcompat/src/android/support/v7/widget/ActionBarContainer.java
+++ b/v7/appcompat/src/android/support/v7/widget/ActionBarContainer.java
@@ -16,6 +16,8 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
@@ -23,21 +25,18 @@
import android.support.annotation.RestrictTo;
import android.support.v4.view.ViewCompat;
import android.support.v7.appcompat.R;
-import android.support.v7.view.ActionMode;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* This class acts as a container for the action bar view and action mode context views.
* It applies special styles as needed to help handle animated transitions between them.
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class ActionBarContainer extends FrameLayout {
private boolean mIsTransitioning;
private View mTabContainer;
diff --git a/v7/appcompat/src/android/support/v7/widget/ActionBarContextView.java b/v7/appcompat/src/android/support/v7/widget/ActionBarContextView.java
index 580bfd6..4f05080 100644
--- a/v7/appcompat/src/android/support/v7/widget/ActionBarContextView.java
+++ b/v7/appcompat/src/android/support/v7/widget/ActionBarContextView.java
@@ -16,6 +16,8 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.os.Build;
import android.support.annotation.RestrictTo;
@@ -32,12 +34,10 @@
import android.widget.LinearLayout;
import android.widget.TextView;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class ActionBarContextView extends AbsActionBarView {
private static final String TAG = "ActionBarContextView";
diff --git a/v7/appcompat/src/android/support/v7/widget/ActionBarOverlayLayout.java b/v7/appcompat/src/android/support/v7/widget/ActionBarOverlayLayout.java
index 98c64b4..b685b4c 100644
--- a/v7/appcompat/src/android/support/v7/widget/ActionBarOverlayLayout.java
+++ b/v7/appcompat/src/android/support/v7/widget/ActionBarOverlayLayout.java
@@ -16,6 +16,8 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.TypedArray;
@@ -42,15 +44,13 @@
import android.view.ViewGroup;
import android.view.Window;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Special layout for the containing of an overlay action bar (and its content) to correctly handle
* fitting system windows when the content has request that its layout ignore them.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class ActionBarOverlayLayout extends ViewGroup implements DecorContentParent,
NestedScrollingParent {
private static final String TAG = "ActionBarOverlayLayout";
diff --git a/v7/appcompat/src/android/support/v7/widget/ActionMenuView.java b/v7/appcompat/src/android/support/v7/widget/ActionMenuView.java
index c9aecc0..da56faa 100644
--- a/v7/appcompat/src/android/support/v7/widget/ActionMenuView.java
+++ b/v7/appcompat/src/android/support/v7/widget/ActionMenuView.java
@@ -15,10 +15,11 @@
*/
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.drawable.Drawable;
-import android.os.Build;
import android.support.annotation.Nullable;
import android.support.annotation.RestrictTo;
import android.support.annotation.StyleRes;
@@ -37,8 +38,6 @@
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* ActionMenuView is a presentation of a series of menu options as a View. It provides
* several top level options as action buttons while spilling remaining options over as
@@ -117,7 +116,7 @@
* @param presenter Menu presenter used to display popup menu
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void setPresenter(ActionMenuPresenter presenter) {
mPresenter = presenter;
mPresenter.setMenuView(this);
@@ -567,13 +566,13 @@
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public boolean isOverflowReserved() {
return mReserveOverflow;
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void setOverflowReserved(boolean reserveOverflow) {
mReserveOverflow = reserveOverflow;
}
@@ -611,7 +610,7 @@
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public LayoutParams generateOverflowButtonLayoutParams() {
LayoutParams result = generateDefaultLayoutParams();
result.isOverflowButton = true;
@@ -619,19 +618,19 @@
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public boolean invokeItem(MenuItemImpl item) {
return mMenu.performItemAction(item, 0);
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public int getWindowAnimations() {
return 0;
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void initialize(MenuBuilder menu) {
mMenu = menu;
}
@@ -664,7 +663,7 @@
* Must be called before the first call to getMenu()
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void setMenuCallbacks(MenuPresenter.Callback pcb, MenuBuilder.Callback mcb) {
mActionMenuPresenterCallback = pcb;
mMenuBuilderCallback = mcb;
@@ -674,7 +673,7 @@
* Returns the current menu or null if one has not yet been configured.
* @hide Internal use only for action bar integration
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public MenuBuilder peekMenu() {
return mMenu;
}
@@ -708,7 +707,7 @@
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public boolean isOverflowMenuShowPending() {
return mPresenter != null && mPresenter.isOverflowMenuShowPending();
}
@@ -725,7 +724,7 @@
/**
* @hide Private LinearLayout (superclass) API. Un-hide if LinearLayout API is made public.
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected boolean hasSupportDividerBeforeChildAt(int childIndex) {
if (childIndex == 0) {
return false;
@@ -747,7 +746,7 @@
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void setExpandedActionViewsExclusive(boolean exclusive) {
mPresenter.setExpandedActionViewsExclusive(exclusive);
}
@@ -800,7 +799,7 @@
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public interface ActionMenuChildView {
boolean needsDividerBefore();
boolean needsDividerAfter();
diff --git a/v7/appcompat/src/android/support/v7/widget/ActivityChooserView.java b/v7/appcompat/src/android/support/v7/widget/ActivityChooserView.java
index 7a6f688..a1f5018 100644
--- a/v7/appcompat/src/android/support/v7/widget/ActivityChooserView.java
+++ b/v7/appcompat/src/android/support/v7/widget/ActivityChooserView.java
@@ -16,6 +16,8 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
@@ -42,8 +44,6 @@
import android.widget.PopupWindow;
import android.widget.TextView;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* This class is a view for choosing an activity for handling a given {@link Intent}.
* <p>
@@ -67,7 +67,7 @@
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class ActivityChooserView extends ViewGroup implements
ActivityChooserModel.ActivityChooserModelClient {
@@ -325,7 +325,7 @@
* Set the provider hosting this view, if applicable.
* @hide Internal use only
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void setProvider(ActionProvider provider) {
mProvider = provider;
}
@@ -845,7 +845,7 @@
* Allows us to set the background using TintTypedArray
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public static class InnerLayout extends LinearLayoutCompat {
private static final int[] TINT_ATTRS = {
diff --git a/v7/appcompat/src/android/support/v7/widget/AlertDialogLayout.java b/v7/appcompat/src/android/support/v7/widget/AlertDialogLayout.java
index e7600e9..5e650b2 100644
--- a/v7/appcompat/src/android/support/v7/widget/AlertDialogLayout.java
+++ b/v7/appcompat/src/android/support/v7/widget/AlertDialogLayout.java
@@ -16,7 +16,7 @@
package android.support.v7.widget;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import android.content.Context;
import android.graphics.drawable.Drawable;
@@ -47,7 +47,7 @@
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class AlertDialogLayout extends LinearLayoutCompat {
public AlertDialogLayout(@Nullable Context context) {
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatAutoCompleteTextView.java b/v7/appcompat/src/android/support/v7/widget/AppCompatAutoCompleteTextView.java
index c996cef..edbd1a7 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatAutoCompleteTextView.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatAutoCompleteTextView.java
@@ -16,6 +16,8 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
@@ -29,8 +31,6 @@
import android.util.AttributeSet;
import android.widget.AutoCompleteTextView;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* A {@link AutoCompleteTextView} which supports compatible features on older version of the
* platform, including:
@@ -109,7 +109,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public void setSupportBackgroundTintList(@Nullable ColorStateList tint) {
if (mBackgroundTintHelper != null) {
@@ -123,7 +123,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
@Nullable
public ColorStateList getSupportBackgroundTintList() {
@@ -137,7 +137,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public void setSupportBackgroundTintMode(@Nullable PorterDuff.Mode tintMode) {
if (mBackgroundTintHelper != null) {
@@ -151,7 +151,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
@Nullable
public PorterDuff.Mode getSupportBackgroundTintMode() {
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatBackgroundHelper.java b/v7/appcompat/src/android/support/v7/widget/AppCompatBackgroundHelper.java
index 3fffb9f..a4551db 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatBackgroundHelper.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatBackgroundHelper.java
@@ -33,9 +33,9 @@
private int mBackgroundResId = -1;
- private BackgroundTintInfo mInternalBackgroundTint;
- private BackgroundTintInfo mBackgroundTint;
- private BackgroundTintInfo mTmpInfo;
+ private TintInfo mInternalBackgroundTint;
+ private TintInfo mBackgroundTint;
+ private TintInfo mTmpInfo;
AppCompatBackgroundHelper(View view) {
mView = view;
@@ -76,62 +76,23 @@
setInternalBackgroundTint(mDrawableManager != null
? mDrawableManager.getTintList(mView.getContext(), resId)
: null);
-
- if (updateBackgroundTint()) {
- applySupportBackgroundTint();
- }
+ applySupportBackgroundTint();
}
void onSetBackgroundDrawable(Drawable background) {
mBackgroundResId = -1;
// We don't know that this drawable is, so we need to clear the default background tint
setInternalBackgroundTint(null);
-
- if (updateBackgroundTint()) {
- applySupportBackgroundTint();
- }
+ applySupportBackgroundTint();
}
void setSupportBackgroundTintList(ColorStateList tint) {
if (mBackgroundTint == null) {
- mBackgroundTint = new BackgroundTintInfo();
+ mBackgroundTint = new TintInfo();
}
-
- // Store the original tint and null out the applicable tint. updateBackgroundTint() will
- // set mTintList to the tint to actually use
- mBackgroundTint.mOriginalTintList = tint;
- mBackgroundTint.mTintList = null;
+ mBackgroundTint.mTintList = tint;
mBackgroundTint.mHasTintList = true;
-
- if (updateBackgroundTint()) {
- applySupportBackgroundTint();
- }
- }
-
- /**
- * Updates the background tint state
- * @return true if the state was changed and requires an apply
- */
- private boolean updateBackgroundTint() {
- if (mBackgroundTint != null && mBackgroundTint.mHasTintList) {
- if (mBackgroundResId >= 0) {
- // If we have a background resource id, lets see if we need to modify the tint
- // list to add any touch highlights in (for example, Button needs this)
- final ColorStateList updated = mDrawableManager.getTintList(
- mView.getContext(), mBackgroundResId, mBackgroundTint.mOriginalTintList);
- if (updated != null) {
- mBackgroundTint.mTintList = updated;
- return true;
- }
- }
- // If we reach here then we should just be using the original tint list. Check if we
- // need to set and apply
- if (mBackgroundTint.mTintList != mBackgroundTint.mOriginalTintList) {
- mBackgroundTint.mTintList = mBackgroundTint.mOriginalTintList;
- return true;
- }
- }
- return false;
+ applySupportBackgroundTint();
}
ColorStateList getSupportBackgroundTintList() {
@@ -140,7 +101,7 @@
void setSupportBackgroundTintMode(PorterDuff.Mode tintMode) {
if (mBackgroundTint == null) {
- mBackgroundTint = new BackgroundTintInfo();
+ mBackgroundTint = new TintInfo();
}
mBackgroundTint.mTintMode = tintMode;
mBackgroundTint.mHasTintMode = true;
@@ -175,7 +136,7 @@
void setInternalBackgroundTint(ColorStateList tint) {
if (tint != null) {
if (mInternalBackgroundTint == null) {
- mInternalBackgroundTint = new BackgroundTintInfo();
+ mInternalBackgroundTint = new TintInfo();
}
mInternalBackgroundTint.mTintList = tint;
mInternalBackgroundTint.mHasTintList = true;
@@ -209,7 +170,7 @@
*/
private boolean applyFrameworkTintUsingColorFilter(@NonNull Drawable background) {
if (mTmpInfo == null) {
- mTmpInfo = new BackgroundTintInfo();
+ mTmpInfo = new TintInfo();
}
final TintInfo info = mTmpInfo;
info.clear();
@@ -232,19 +193,4 @@
return false;
}
-
- private static class BackgroundTintInfo extends TintInfo {
- // The original tint list given to the call. We need this distinction because create a
- // modified for actual tinting purposes
- public ColorStateList mOriginalTintList;
-
- BackgroundTintInfo() {
- }
-
- @Override
- void clear() {
- super.clear();
- mOriginalTintList = null;
- }
- }
}
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatButton.java b/v7/appcompat/src/android/support/v7/widget/AppCompatButton.java
index 613be53..f7fa23f 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatButton.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatButton.java
@@ -16,6 +16,8 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.ColorStateList;
@@ -32,8 +34,6 @@
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.Button;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* A {@link Button} which supports compatible features on older version of the platform,
* including:
@@ -95,7 +95,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public void setSupportBackgroundTintList(@Nullable ColorStateList tint) {
if (mBackgroundTintHelper != null) {
@@ -109,7 +109,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
@Nullable
public ColorStateList getSupportBackgroundTintList() {
@@ -123,7 +123,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public void setSupportBackgroundTintMode(@Nullable PorterDuff.Mode tintMode) {
if (mBackgroundTintHelper != null) {
@@ -137,7 +137,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
@Nullable
public PorterDuff.Mode getSupportBackgroundTintMode() {
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatCheckBox.java b/v7/appcompat/src/android/support/v7/widget/AppCompatCheckBox.java
index 2f5bd90..6942cc5 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatCheckBox.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatCheckBox.java
@@ -16,6 +16,8 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
@@ -29,8 +31,6 @@
import android.util.AttributeSet;
import android.widget.CheckBox;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* A {@link CheckBox} which supports compatible features on older version of the platform,
* including:
@@ -87,7 +87,7 @@
* This should be accessed from {@link android.support.v4.widget.CompoundButtonCompat}
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public void setSupportButtonTintList(@Nullable ColorStateList tint) {
if (mCompoundButtonHelper != null) {
@@ -99,7 +99,7 @@
* This should be accessed from {@link android.support.v4.widget.CompoundButtonCompat}
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Nullable
@Override
public ColorStateList getSupportButtonTintList() {
@@ -112,7 +112,7 @@
* This should be accessed from {@link android.support.v4.widget.CompoundButtonCompat}
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public void setSupportButtonTintMode(@Nullable PorterDuff.Mode tintMode) {
if (mCompoundButtonHelper != null) {
@@ -124,7 +124,7 @@
* This should be accessed from {@link android.support.v4.widget.CompoundButtonCompat}
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Nullable
@Override
public PorterDuff.Mode getSupportButtonTintMode() {
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatDrawableManager.java b/v7/appcompat/src/android/support/v7/widget/AppCompatDrawableManager.java
index 1e943e9..50a17cd 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatDrawableManager.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatDrawableManager.java
@@ -16,13 +16,14 @@
package android.support.v7.widget;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import static android.support.v4.graphics.ColorUtils.compositeColors;
import static android.support.v7.content.res.AppCompatResources.getColorStateList;
import static android.support.v7.widget.ThemeUtils.getDisabledThemeAttrColor;
import static android.support.v7.widget.ThemeUtils.getThemeAttrColor;
import static android.support.v7.widget.ThemeUtils.getThemeAttrColorStateList;
+import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.ColorStateList;
@@ -63,7 +64,7 @@
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public final class AppCompatDrawableManager {
private interface InflateDelegate {
@@ -522,17 +523,8 @@
}
ColorStateList getTintList(@NonNull Context context, @DrawableRes int resId) {
- return getTintList(context, resId, null);
- }
-
- ColorStateList getTintList(@NonNull Context context, @DrawableRes int resId,
- @Nullable ColorStateList customTint) {
- // We only want to use the cache for the standard tints, not ones created using custom
- // tints
- final boolean useCache = customTint == null;
-
// Try the cache first (if it exists)
- ColorStateList tint = useCache ? getTintListFromCache(context, resId) : null;
+ ColorStateList tint = getTintListFromCache(context, resId);
if (tint == null) {
// ...if the cache did not contain a color state list, try and create one
@@ -543,11 +535,11 @@
} else if (resId == R.drawable.abc_switch_thumb_material) {
tint = getColorStateList(context, R.color.abc_tint_switch_thumb);
} else if (resId == R.drawable.abc_btn_default_mtrl_shape) {
- tint = createDefaultButtonColorStateList(context, customTint);
+ tint = createDefaultButtonColorStateList(context);
} else if (resId == R.drawable.abc_btn_borderless_material) {
- tint = createBorderlessButtonColorStateList(context, customTint);
+ tint = createBorderlessButtonColorStateList(context);
} else if (resId == R.drawable.abc_btn_colored_material) {
- tint = createColoredButtonColorStateList(context, customTint);
+ tint = createColoredButtonColorStateList(context);
} else if (resId == R.drawable.abc_spinner_mtrl_am_alpha
|| resId == R.drawable.abc_spinner_textfield_background_material) {
tint = getColorStateList(context, R.color.abc_tint_spinner);
@@ -561,7 +553,7 @@
tint = getColorStateList(context, R.color.abc_tint_seek_thumb);
}
- if (useCache && tint != null) {
+ if (tint != null) {
addTintListToCache(context, resId, tint);
}
}
@@ -589,26 +581,23 @@
themeTints.append(resId, tintList);
}
- private ColorStateList createDefaultButtonColorStateList(@NonNull Context context,
- @Nullable ColorStateList customTint) {
+ private ColorStateList createDefaultButtonColorStateList(@NonNull Context context) {
return createButtonColorStateList(context,
- getThemeAttrColor(context, R.attr.colorButtonNormal), customTint);
+ getThemeAttrColor(context, R.attr.colorButtonNormal));
}
- private ColorStateList createBorderlessButtonColorStateList(@NonNull Context context,
- @Nullable ColorStateList customTint) {
+ private ColorStateList createBorderlessButtonColorStateList(@NonNull Context context) {
// We ignore the custom tint for borderless buttons
- return createButtonColorStateList(context, Color.TRANSPARENT, null);
+ return createButtonColorStateList(context, Color.TRANSPARENT);
}
- private ColorStateList createColoredButtonColorStateList(@NonNull Context context,
- @Nullable ColorStateList customTint) {
+ private ColorStateList createColoredButtonColorStateList(@NonNull Context context) {
return createButtonColorStateList(context,
- getThemeAttrColor(context, R.attr.colorAccent), customTint);
+ getThemeAttrColor(context, R.attr.colorAccent));
}
private ColorStateList createButtonColorStateList(@NonNull final Context context,
- @ColorInt final int baseColor, final @Nullable ColorStateList tint) {
+ @ColorInt final int baseColor) {
final int[][] states = new int[4][];
final int[] colors = new int[4];
int i = 0;
@@ -618,22 +607,20 @@
// Disabled state
states[i] = ThemeUtils.DISABLED_STATE_SET;
- colors[i] = tint == null ? disabledColor : tint.getColorForState(states[i], 0);
+ colors[i] = disabledColor;
i++;
states[i] = ThemeUtils.PRESSED_STATE_SET;
- colors[i] = compositeColors(colorControlHighlight,
- tint == null ? baseColor : tint.getColorForState(states[i], 0));
+ colors[i] = compositeColors(colorControlHighlight, baseColor);
i++;
states[i] = ThemeUtils.FOCUSED_STATE_SET;
- colors[i] = compositeColors(colorControlHighlight,
- tint == null ? baseColor : tint.getColorForState(states[i], 0));
+ colors[i] = compositeColors(colorControlHighlight, baseColor);
i++;
// Default enabled state
states[i] = ThemeUtils.EMPTY_STATE_SET;
- colors[i] = tint == null ? baseColor : tint.getColorForState(states[i], 0);
+ colors[i] = baseColor;
i++;
return new ColorStateList(states, colors);
@@ -738,6 +725,7 @@
VdcInflateDelegate() {
}
+ @SuppressLint("NewApi")
@Override
public Drawable createFromXmlInner(@NonNull Context context, @NonNull XmlPullParser parser,
@NonNull AttributeSet attrs, @Nullable Resources.Theme theme) {
@@ -757,6 +745,7 @@
AvdcInflateDelegate() {
}
+ @SuppressLint("NewApi")
@Override
public Drawable createFromXmlInner(@NonNull Context context, @NonNull XmlPullParser parser,
@NonNull AttributeSet attrs, @Nullable Resources.Theme theme) {
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatEditText.java b/v7/appcompat/src/android/support/v7/widget/AppCompatEditText.java
index 4d62ea5..9ea02c6 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatEditText.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatEditText.java
@@ -16,6 +16,8 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
@@ -28,8 +30,6 @@
import android.util.AttributeSet;
import android.widget.EditText;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* A {@link EditText} which supports compatible features on older version of the platform,
* including:
@@ -91,7 +91,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public void setSupportBackgroundTintList(@Nullable ColorStateList tint) {
if (mBackgroundTintHelper != null) {
@@ -105,7 +105,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
@Nullable
public ColorStateList getSupportBackgroundTintList() {
@@ -119,7 +119,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public void setSupportBackgroundTintMode(@Nullable PorterDuff.Mode tintMode) {
if (mBackgroundTintHelper != null) {
@@ -133,7 +133,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
@Nullable
public PorterDuff.Mode getSupportBackgroundTintMode() {
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatImageButton.java b/v7/appcompat/src/android/support/v7/widget/AppCompatImageButton.java
index 653ed26..f8280c9 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatImageButton.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatImageButton.java
@@ -16,6 +16,8 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
@@ -28,8 +30,6 @@
import android.util.AttributeSet;
import android.widget.ImageButton;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* A {@link ImageButton} which supports compatible features on older version of the platform,
* including:
@@ -94,7 +94,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public void setSupportBackgroundTintList(@Nullable ColorStateList tint) {
if (mBackgroundTintHelper != null) {
@@ -108,7 +108,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
@Nullable
public ColorStateList getSupportBackgroundTintList() {
@@ -122,7 +122,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public void setSupportBackgroundTintMode(@Nullable PorterDuff.Mode tintMode) {
if (mBackgroundTintHelper != null) {
@@ -136,7 +136,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
@Nullable
public PorterDuff.Mode getSupportBackgroundTintMode() {
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatImageHelper.java b/v7/appcompat/src/android/support/v7/widget/AppCompatImageHelper.java
index 87a45b7..fe733f7 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatImageHelper.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatImageHelper.java
@@ -16,6 +16,8 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.RestrictTo;
@@ -24,12 +26,10 @@
import android.util.AttributeSet;
import android.widget.ImageView;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class AppCompatImageHelper {
private final ImageView mView;
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatImageView.java b/v7/appcompat/src/android/support/v7/widget/AppCompatImageView.java
index 87df13d..b749d6c 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatImageView.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatImageView.java
@@ -16,6 +16,8 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
@@ -28,8 +30,6 @@
import android.util.AttributeSet;
import android.widget.ImageView;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* A {@link ImageView} which supports compatible features on older version of the platform,
* including:
@@ -103,7 +103,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public void setSupportBackgroundTintList(@Nullable ColorStateList tint) {
if (mBackgroundTintHelper != null) {
@@ -117,7 +117,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
@Nullable
public ColorStateList getSupportBackgroundTintList() {
@@ -131,7 +131,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public void setSupportBackgroundTintMode(@Nullable PorterDuff.Mode tintMode) {
if (mBackgroundTintHelper != null) {
@@ -145,7 +145,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
@Nullable
public PorterDuff.Mode getSupportBackgroundTintMode() {
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatMultiAutoCompleteTextView.java b/v7/appcompat/src/android/support/v7/widget/AppCompatMultiAutoCompleteTextView.java
index c850f11..381169d 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatMultiAutoCompleteTextView.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatMultiAutoCompleteTextView.java
@@ -16,6 +16,8 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
@@ -29,8 +31,6 @@
import android.util.AttributeSet;
import android.widget.MultiAutoCompleteTextView;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* A {@link MultiAutoCompleteTextView} which supports compatible features on older version of the
* platform, including:
@@ -109,7 +109,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public void setSupportBackgroundTintList(@Nullable ColorStateList tint) {
if (mBackgroundTintHelper != null) {
@@ -123,7 +123,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
@Nullable
public ColorStateList getSupportBackgroundTintList() {
@@ -137,7 +137,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public void setSupportBackgroundTintMode(@Nullable PorterDuff.Mode tintMode) {
if (mBackgroundTintHelper != null) {
@@ -151,7 +151,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
@Nullable
public PorterDuff.Mode getSupportBackgroundTintMode() {
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatPopupWindow.java b/v7/appcompat/src/android/support/v7/widget/AppCompatPopupWindow.java
index 3b6cf44..c9e778d 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatPopupWindow.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatPopupWindow.java
@@ -16,6 +16,8 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
@@ -35,8 +37,6 @@
import java.lang.ref.WeakReference;
import java.lang.reflect.Field;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
class AppCompatPopupWindow extends PopupWindow {
private static final String TAG = "AppCompatPopupWindow";
@@ -151,7 +151,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void setSupportOverlapAnchor(boolean overlapAnchor) {
if (COMPAT_OVERLAP_ANCHOR) {
mOverlapAnchor = overlapAnchor;
@@ -163,7 +163,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public boolean getSupportOverlapAnchor() {
if (COMPAT_OVERLAP_ANCHOR) {
return mOverlapAnchor;
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatRadioButton.java b/v7/appcompat/src/android/support/v7/widget/AppCompatRadioButton.java
index 5edbc83..768d610 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatRadioButton.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatRadioButton.java
@@ -16,6 +16,8 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
@@ -29,8 +31,6 @@
import android.util.AttributeSet;
import android.widget.RadioButton;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* A {@link RadioButton} which supports compatible features on older version of the platform,
* including:
@@ -87,7 +87,7 @@
* This should be accessed from {@link android.support.v4.widget.CompoundButtonCompat}
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public void setSupportButtonTintList(@Nullable ColorStateList tint) {
if (mCompoundButtonHelper != null) {
@@ -99,7 +99,7 @@
* This should be accessed from {@link android.support.v4.widget.CompoundButtonCompat}
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Nullable
@Override
public ColorStateList getSupportButtonTintList() {
@@ -112,7 +112,7 @@
* This should be accessed from {@link android.support.v4.widget.CompoundButtonCompat}
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public void setSupportButtonTintMode(@Nullable PorterDuff.Mode tintMode) {
if (mCompoundButtonHelper != null) {
@@ -124,7 +124,7 @@
* This should be accessed from {@link android.support.v4.widget.CompoundButtonCompat}
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Nullable
@Override
public PorterDuff.Mode getSupportButtonTintMode() {
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatSpinner.java b/v7/appcompat/src/android/support/v7/widget/AppCompatSpinner.java
index beb4b73..9f27f78 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatSpinner.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatSpinner.java
@@ -16,6 +16,8 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
@@ -48,8 +50,6 @@
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* A {@link Spinner} which supports compatible features on older versions of the platform,
@@ -475,7 +475,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public void setSupportBackgroundTintList(@Nullable ColorStateList tint) {
if (mBackgroundTintHelper != null) {
@@ -489,7 +489,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
@Nullable
public ColorStateList getSupportBackgroundTintList() {
@@ -504,7 +504,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public void setSupportBackgroundTintMode(@Nullable PorterDuff.Mode tintMode) {
if (mBackgroundTintHelper != null) {
@@ -518,7 +518,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
@Nullable
public PorterDuff.Mode getSupportBackgroundTintMode() {
diff --git a/v7/appcompat/src/android/support/v7/widget/AppCompatTextView.java b/v7/appcompat/src/android/support/v7/widget/AppCompatTextView.java
index 276d5c4..66fd929 100644
--- a/v7/appcompat/src/android/support/v7/widget/AppCompatTextView.java
+++ b/v7/appcompat/src/android/support/v7/widget/AppCompatTextView.java
@@ -16,6 +16,8 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
@@ -28,8 +30,6 @@
import android.util.AttributeSet;
import android.widget.TextView;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* A {@link TextView} which supports compatible features on older version of the platform,
* including:
@@ -91,7 +91,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public void setSupportBackgroundTintList(@Nullable ColorStateList tint) {
if (mBackgroundTintHelper != null) {
@@ -105,7 +105,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
@Nullable
public ColorStateList getSupportBackgroundTintList() {
@@ -119,7 +119,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public void setSupportBackgroundTintMode(@Nullable PorterDuff.Mode tintMode) {
if (mBackgroundTintHelper != null) {
@@ -133,7 +133,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
@Nullable
public PorterDuff.Mode getSupportBackgroundTintMode() {
diff --git a/v7/appcompat/src/android/support/v7/widget/ButtonBarLayout.java b/v7/appcompat/src/android/support/v7/widget/ButtonBarLayout.java
index 6c97ee1..048f2b6 100644
--- a/v7/appcompat/src/android/support/v7/widget/ButtonBarLayout.java
+++ b/v7/appcompat/src/android/support/v7/widget/ButtonBarLayout.java
@@ -15,6 +15,8 @@
*/
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Build;
@@ -27,15 +29,13 @@
import android.view.View;
import android.widget.LinearLayout;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* An extension of LinearLayout that automatically switches to vertical
* orientation when it can't fit its child views horizontally.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class ButtonBarLayout extends LinearLayout {
/** Minimum screen height required for button stacking. */
private static final int ALLOW_STACKING_MIN_HEIGHT_DP = 320;
diff --git a/v7/appcompat/src/android/support/v7/widget/ContentFrameLayout.java b/v7/appcompat/src/android/support/v7/widget/ContentFrameLayout.java
index f656370..1100280 100644
--- a/v7/appcompat/src/android/support/v7/widget/ContentFrameLayout.java
+++ b/v7/appcompat/src/android/support/v7/widget/ContentFrameLayout.java
@@ -16,6 +16,11 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+import static android.view.View.MeasureSpec.AT_MOST;
+import static android.view.View.MeasureSpec.EXACTLY;
+import static android.view.View.MeasureSpec.getMode;
+
import android.content.Context;
import android.graphics.Rect;
import android.support.annotation.RestrictTo;
@@ -25,11 +30,6 @@
import android.util.TypedValue;
import android.widget.FrameLayout;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-import static android.view.View.MeasureSpec.AT_MOST;
-import static android.view.View.MeasureSpec.EXACTLY;
-import static android.view.View.MeasureSpec.getMode;
-
/**
* @hide
*/
@@ -67,7 +67,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void dispatchFitSystemWindows(Rect insets) {
fitSystemWindows(insets);
}
@@ -82,7 +82,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void setDecorPadding(int left, int top, int right, int bottom) {
mDecorPadding.set(left, top, right, bottom);
if (ViewCompat.isLaidOut(this)) {
diff --git a/v7/appcompat/src/android/support/v7/widget/DecorContentParent.java b/v7/appcompat/src/android/support/v7/widget/DecorContentParent.java
index ca83469..bc36f97 100644
--- a/v7/appcompat/src/android/support/v7/widget/DecorContentParent.java
+++ b/v7/appcompat/src/android/support/v7/widget/DecorContentParent.java
@@ -17,6 +17,8 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.graphics.drawable.Drawable;
import android.os.Parcelable;
import android.support.annotation.RestrictTo;
@@ -25,15 +27,13 @@
import android.view.Menu;
import android.view.Window;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Implemented by the top-level decor layout for a window. DecorContentParent offers
* entry points for a number of title/window decor features.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public interface DecorContentParent {
void setWindowCallback(Window.Callback cb);
void setWindowTitle(CharSequence title);
diff --git a/v7/appcompat/src/android/support/v7/widget/DecorToolbar.java b/v7/appcompat/src/android/support/v7/widget/DecorToolbar.java
index fb9081c..d9fe0c3 100644
--- a/v7/appcompat/src/android/support/v7/widget/DecorToolbar.java
+++ b/v7/appcompat/src/android/support/v7/widget/DecorToolbar.java
@@ -17,6 +17,8 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Parcelable;
@@ -32,8 +34,6 @@
import android.widget.AdapterView;
import android.widget.SpinnerAdapter;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Common interface for a toolbar that sits as part of the window decor.
* Layouts that control window decor use this as a point of interaction with different
@@ -41,7 +41,7 @@
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public interface DecorToolbar {
ViewGroup getViewGroup();
Context getContext();
diff --git a/v7/appcompat/src/android/support/v7/widget/DialogTitle.java b/v7/appcompat/src/android/support/v7/widget/DialogTitle.java
index bc81ca4..313d748 100644
--- a/v7/appcompat/src/android/support/v7/widget/DialogTitle.java
+++ b/v7/appcompat/src/android/support/v7/widget/DialogTitle.java
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2015 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,6 +16,8 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.TypedArray;
import android.support.annotation.RestrictTo;
@@ -25,15 +27,13 @@
import android.util.TypedValue;
import android.widget.TextView;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Used by dialogs to change the font size and number of lines to try to fit
* the text to the available space.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class DialogTitle extends TextView {
public DialogTitle(Context context, AttributeSet attrs, int defStyleAttr) {
diff --git a/v7/appcompat/src/android/support/v7/widget/DrawableUtils.java b/v7/appcompat/src/android/support/v7/widget/DrawableUtils.java
index 51383e9..d73b88b 100644
--- a/v7/appcompat/src/android/support/v7/widget/DrawableUtils.java
+++ b/v7/appcompat/src/android/support/v7/widget/DrawableUtils.java
@@ -16,6 +16,8 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
@@ -24,7 +26,6 @@
import android.graphics.drawable.InsetDrawable;
import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.ScaleDrawable;
-import android.graphics.drawable.StateListDrawable;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.annotation.RestrictTo;
@@ -34,10 +35,8 @@
import java.lang.reflect.Field;
import java.lang.reflect.Method;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/** @hide */
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class DrawableUtils {
private static final String TAG = "DrawableUtils";
diff --git a/v7/appcompat/src/android/support/v7/widget/FitWindowsFrameLayout.java b/v7/appcompat/src/android/support/v7/widget/FitWindowsFrameLayout.java
index 1ec3c3e..d9ae921 100644
--- a/v7/appcompat/src/android/support/v7/widget/FitWindowsFrameLayout.java
+++ b/v7/appcompat/src/android/support/v7/widget/FitWindowsFrameLayout.java
@@ -16,18 +16,18 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.graphics.Rect;
import android.support.annotation.RestrictTo;
import android.util.AttributeSet;
import android.widget.FrameLayout;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class FitWindowsFrameLayout extends FrameLayout implements FitWindowsViewGroup {
private OnFitSystemWindowsListener mListener;
diff --git a/v7/appcompat/src/android/support/v7/widget/FitWindowsLinearLayout.java b/v7/appcompat/src/android/support/v7/widget/FitWindowsLinearLayout.java
index 359849b..163a211 100644
--- a/v7/appcompat/src/android/support/v7/widget/FitWindowsLinearLayout.java
+++ b/v7/appcompat/src/android/support/v7/widget/FitWindowsLinearLayout.java
@@ -16,18 +16,18 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.graphics.Rect;
import android.support.annotation.RestrictTo;
import android.util.AttributeSet;
import android.widget.LinearLayout;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class FitWindowsLinearLayout extends LinearLayout implements FitWindowsViewGroup {
private OnFitSystemWindowsListener mListener;
diff --git a/v7/appcompat/src/android/support/v7/widget/FitWindowsViewGroup.java b/v7/appcompat/src/android/support/v7/widget/FitWindowsViewGroup.java
index 16a07c8..ffec343 100644
--- a/v7/appcompat/src/android/support/v7/widget/FitWindowsViewGroup.java
+++ b/v7/appcompat/src/android/support/v7/widget/FitWindowsViewGroup.java
@@ -16,15 +16,15 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.graphics.Rect;
import android.support.annotation.RestrictTo;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public interface FitWindowsViewGroup {
interface OnFitSystemWindowsListener {
diff --git a/v7/appcompat/src/android/support/v7/widget/ForwardingListener.java b/v7/appcompat/src/android/support/v7/widget/ForwardingListener.java
index 91c0fd7..80fbbd4 100644
--- a/v7/appcompat/src/android/support/v7/widget/ForwardingListener.java
+++ b/v7/appcompat/src/android/support/v7/widget/ForwardingListener.java
@@ -16,7 +16,7 @@
package android.support.v7.widget;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import android.annotation.TargetApi;
import android.os.Build;
@@ -38,7 +38,7 @@
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public abstract class ForwardingListener implements View.OnTouchListener {
/** Scaled touch slop, used for detecting movement outside bounds. */
diff --git a/v7/appcompat/src/android/support/v7/widget/LinearLayoutCompat.java b/v7/appcompat/src/android/support/v7/widget/LinearLayoutCompat.java
index ce6f140..10633f6 100644
--- a/v7/appcompat/src/android/support/v7/widget/LinearLayoutCompat.java
+++ b/v7/appcompat/src/android/support/v7/widget/LinearLayoutCompat.java
@@ -16,6 +16,8 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
@@ -36,8 +38,6 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* A Layout that arranges its children in a single column or a single row. The direction of
@@ -56,7 +56,7 @@
*/
public class LinearLayoutCompat extends ViewGroup {
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@IntDef({HORIZONTAL, VERTICAL})
@Retention(RetentionPolicy.SOURCE)
public @interface OrientationMode {}
@@ -65,7 +65,7 @@
public static final int VERTICAL = 1;
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@IntDef(flag = true,
value = {
SHOW_DIVIDER_NONE,
@@ -273,7 +273,7 @@
*
* @hide Used internally by framework.
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public int getDividerWidth() {
return mDividerWidth;
}
diff --git a/v7/appcompat/src/android/support/v7/widget/ListPopupWindow.java b/v7/appcompat/src/android/support/v7/widget/ListPopupWindow.java
index 0fe68d6..11edc08 100644
--- a/v7/appcompat/src/android/support/v7/widget/ListPopupWindow.java
+++ b/v7/appcompat/src/android/support/v7/widget/ListPopupWindow.java
@@ -16,6 +16,8 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.TypedArray;
import android.database.DataSetObserver;
@@ -28,7 +30,6 @@
import android.support.annotation.Nullable;
import android.support.annotation.RestrictTo;
import android.support.annotation.StyleRes;
-import android.support.v4.os.BuildCompat;
import android.support.v4.view.ViewCompat;
import android.support.v4.widget.PopupWindowCompat;
import android.support.v7.appcompat.R;
@@ -54,8 +55,6 @@
import java.lang.reflect.Method;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Static library support version of the framework's {@link android.widget.ListPopupWindow}.
* Used to write apps that run on platforms prior to Android L. When running
@@ -349,7 +348,7 @@
*
* @hide Used only by AutoCompleteTextView to handle some internal special cases.
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void setForceIgnoreOutsideTouch(boolean forceIgnoreOutsideTouch) {
mForceIgnoreOutsideTouch = forceIgnoreOutsideTouch;
}
@@ -365,7 +364,7 @@
*
* @hide Only used by AutoCompleteTextView under special conditions.
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void setDropDownAlwaysVisible(boolean dropDownAlwaysVisible) {
mDropDownAlwaysVisible = dropDownAlwaysVisible;
}
@@ -375,7 +374,7 @@
*
* @hide Only used by AutoCompleteTextView under special conditions.
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public boolean isDropDownAlwaysVisible() {
return mDropDownAlwaysVisible;
}
@@ -510,7 +509,7 @@
* @param bounds anchor-relative bounds
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void setEpicenterBounds(Rect bounds) {
mEpicenterBounds = bounds;
}
diff --git a/v7/appcompat/src/android/support/v7/widget/ListViewCompat.java b/v7/appcompat/src/android/support/v7/widget/ListViewCompat.java
index fab68d1..0baefe0 100644
--- a/v7/appcompat/src/android/support/v7/widget/ListViewCompat.java
+++ b/v7/appcompat/src/android/support/v7/widget/ListViewCompat.java
@@ -16,6 +16,8 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Rect;
@@ -33,15 +35,13 @@
import java.lang.reflect.Field;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* This class contains a number of useful things for ListView. Mainly used by
* {@link android.support.v7.widget.ListPopupWindow}.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class ListViewCompat extends ListView {
public static final int INVALID_POSITION = -1;
diff --git a/v7/appcompat/src/android/support/v7/widget/MenuItemHoverListener.java b/v7/appcompat/src/android/support/v7/widget/MenuItemHoverListener.java
index 02b71a8..70f844d 100644
--- a/v7/appcompat/src/android/support/v7/widget/MenuItemHoverListener.java
+++ b/v7/appcompat/src/android/support/v7/widget/MenuItemHoverListener.java
@@ -16,20 +16,20 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.support.annotation.NonNull;
import android.support.annotation.RestrictTo;
import android.support.v7.view.menu.MenuBuilder;
import android.view.MenuItem;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* An interface notified when a menu item is hovered. Useful for cases when hover should trigger
* some behavior at a higher level, like managing the opening and closing of submenus.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public interface MenuItemHoverListener {
/**
* Called when hover exits a menu item.
diff --git a/v7/appcompat/src/android/support/v7/widget/MenuPopupWindow.java b/v7/appcompat/src/android/support/v7/widget/MenuPopupWindow.java
index e877c19..cc6628a 100644
--- a/v7/appcompat/src/android/support/v7/widget/MenuPopupWindow.java
+++ b/v7/appcompat/src/android/support/v7/widget/MenuPopupWindow.java
@@ -16,6 +16,8 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
@@ -23,7 +25,6 @@
import android.support.annotation.NonNull;
import android.support.annotation.RestrictTo;
import android.support.v4.view.ViewCompat;
-import android.support.v4.widget.PopupWindowCompat;
import android.support.v7.view.menu.ListMenuItemView;
import android.support.v7.view.menu.MenuAdapter;
import android.support.v7.view.menu.MenuBuilder;
@@ -33,16 +34,12 @@
import android.view.KeyEvent;
import android.view.MenuItem;
import android.view.MotionEvent;
-import android.view.View;
import android.widget.HeaderViewListAdapter;
import android.widget.ListAdapter;
import android.widget.PopupWindow;
-import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* A MenuPopupWindow represents the popup window for menu.
*
@@ -51,7 +48,7 @@
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class MenuPopupWindow extends ListPopupWindow implements MenuItemHoverListener {
private static final String TAG = "MenuPopupWindow";
@@ -128,7 +125,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public static class MenuDropDownListView extends DropDownListView {
final int mAdvanceKey;
final int mRetreatKey;
diff --git a/v7/appcompat/src/android/support/v7/widget/ScrollingTabContainerView.java b/v7/appcompat/src/android/support/v7/widget/ScrollingTabContainerView.java
index 7069965..ea536d2 100644
--- a/v7/appcompat/src/android/support/v7/widget/ScrollingTabContainerView.java
+++ b/v7/appcompat/src/android/support/v7/widget/ScrollingTabContainerView.java
@@ -15,6 +15,8 @@
*/
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.drawable.Drawable;
@@ -46,15 +48,13 @@
import android.widget.TextView;
import android.widget.Toast;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* This widget implements the dynamic action bar tab behavior that can change across different
* configurations or circumstances.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class ScrollingTabContainerView extends HorizontalScrollView
implements AdapterView.OnItemSelectedListener {
diff --git a/v7/appcompat/src/android/support/v7/widget/SearchView.java b/v7/appcompat/src/android/support/v7/widget/SearchView.java
index 79df8f4..40793df 100644
--- a/v7/appcompat/src/android/support/v7/widget/SearchView.java
+++ b/v7/appcompat/src/android/support/v7/widget/SearchView.java
@@ -16,7 +16,7 @@
package android.support.v7.widget;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import static android.support.v7.widget.SuggestionsAdapter.getColumnString;
import android.annotation.TargetApi;
@@ -461,7 +461,7 @@
* @param appSearchData bundle provided by the app when launching the search dialog
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void setAppSearchData(Bundle appSearchData) {
mAppSearchData = appSearchData;
}
@@ -512,7 +512,7 @@
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public boolean requestFocus(int direction, Rect previouslyFocusedRect) {
// Don't accept focus if in the middle of clearing focus
@@ -532,7 +532,7 @@
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public void clearFocus() {
mClearingFocus = true;
@@ -1871,7 +1871,7 @@
* Local subclass for AutoCompleteTextView.
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public static class SearchAutoComplete extends AppCompatAutoCompleteTextView {
private int mThreshold;
diff --git a/v7/appcompat/src/android/support/v7/widget/TintContextWrapper.java b/v7/appcompat/src/android/support/v7/widget/TintContextWrapper.java
index 8202d45..1454e59 100644
--- a/v7/appcompat/src/android/support/v7/widget/TintContextWrapper.java
+++ b/v7/appcompat/src/android/support/v7/widget/TintContextWrapper.java
@@ -16,6 +16,8 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.AssetManager;
@@ -27,15 +29,13 @@
import java.lang.ref.WeakReference;
import java.util.ArrayList;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* A {@link android.content.ContextWrapper} which returns a tint-aware
* {@link android.content.res.Resources} instance from {@link #getResources()}.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class TintContextWrapper extends ContextWrapper {
private static final Object CACHE_LOCK = new Object();
diff --git a/v7/appcompat/src/android/support/v7/widget/TintTypedArray.java b/v7/appcompat/src/android/support/v7/widget/TintTypedArray.java
index 5725b37..ca72d27 100644
--- a/v7/appcompat/src/android/support/v7/widget/TintTypedArray.java
+++ b/v7/appcompat/src/android/support/v7/widget/TintTypedArray.java
@@ -16,6 +16,8 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
@@ -27,8 +29,6 @@
import android.util.AttributeSet;
import android.util.TypedValue;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* A class that wraps a {@link android.content.res.TypedArray} and provides the same public API
* surface. The purpose of this class is so that we can intercept the {@link #getDrawable(int)}
@@ -36,7 +36,7 @@
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class TintTypedArray {
private final Context mContext;
diff --git a/v7/appcompat/src/android/support/v7/widget/Toolbar.java b/v7/appcompat/src/android/support/v7/widget/Toolbar.java
index 01b28a8..8687292 100644
--- a/v7/appcompat/src/android/support/v7/widget/Toolbar.java
+++ b/v7/appcompat/src/android/support/v7/widget/Toolbar.java
@@ -16,6 +16,8 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Build;
@@ -65,8 +67,6 @@
import java.util.ArrayList;
import java.util.List;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* A standard toolbar for use within application content.
*
@@ -503,7 +503,7 @@
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public boolean canShowOverflowMenu() {
return getVisibility() == VISIBLE && mMenuView != null && mMenuView.isOverflowReserved();
}
@@ -519,7 +519,7 @@
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public boolean isOverflowMenuShowPending() {
return mMenuView != null && mMenuView.isOverflowMenuShowPending();
}
@@ -543,7 +543,7 @@
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void setMenu(MenuBuilder menu, ActionMenuPresenter outerPresenter) {
if (menu == null && mMenuView == null) {
return;
@@ -589,7 +589,7 @@
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public boolean isTitleTruncated() {
if (mTitleTextView == null) {
return false;
@@ -2109,7 +2109,7 @@
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public DecorToolbar getWrapper() {
if (mWrapper == null) {
mWrapper = new ToolbarWidgetWrapper(this, true);
@@ -2148,7 +2148,7 @@
* it could be considered "empty" (no visible elements with nonzero measured size)
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void setCollapsible(boolean collapsible) {
mCollapsible = collapsible;
requestLayout();
@@ -2158,7 +2158,7 @@
* Must be called before the menu is accessed
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void setMenuCallbacks(MenuPresenter.Callback pcb, MenuBuilder.Callback mcb) {
mActionMenuPresenterCallback = pcb;
mMenuBuilderCallback = mcb;
diff --git a/v7/appcompat/src/android/support/v7/widget/ToolbarWidgetWrapper.java b/v7/appcompat/src/android/support/v7/widget/ToolbarWidgetWrapper.java
index eee9cf0..491ed90 100644
--- a/v7/appcompat/src/android/support/v7/widget/ToolbarWidgetWrapper.java
+++ b/v7/appcompat/src/android/support/v7/widget/ToolbarWidgetWrapper.java
@@ -17,6 +17,8 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.app.ActionBar;
import android.content.Context;
import android.graphics.drawable.Drawable;
@@ -44,8 +46,6 @@
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Internal class used to interact with the Toolbar widget without
* exposing interface methods to the public API.
@@ -57,7 +57,7 @@
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class ToolbarWidgetWrapper implements DecorToolbar {
private static final String TAG = "ToolbarWidgetWrapper";
diff --git a/v7/appcompat/src/android/support/v7/widget/VectorEnabledTintResources.java b/v7/appcompat/src/android/support/v7/widget/VectorEnabledTintResources.java
index 89423ce..e184e85 100644
--- a/v7/appcompat/src/android/support/v7/widget/VectorEnabledTintResources.java
+++ b/v7/appcompat/src/android/support/v7/widget/VectorEnabledTintResources.java
@@ -16,6 +16,8 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
@@ -26,15 +28,13 @@
import java.lang.ref.WeakReference;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* This class allows us to intercept calls so that we can tint resources (if applicable), and
* inflate vector resources from within drawable containers pre-L.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class VectorEnabledTintResources extends Resources {
public static boolean shouldBeUsed() {
diff --git a/v7/appcompat/src/android/support/v7/widget/ViewStubCompat.java b/v7/appcompat/src/android/support/v7/widget/ViewStubCompat.java
index eb9194b..6319eac 100644
--- a/v7/appcompat/src/android/support/v7/widget/ViewStubCompat.java
+++ b/v7/appcompat/src/android/support/v7/widget/ViewStubCompat.java
@@ -16,6 +16,8 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
@@ -29,15 +31,13 @@
import java.lang.ref.WeakReference;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Backport of {@link android.view.ViewStub} so that we can set the
* {@link android.view.LayoutInflater} on devices before Jelly Bean.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public final class ViewStubCompat extends View {
private int mLayoutResource = 0;
private int mInflatedId;
diff --git a/v7/appcompat/src/android/support/v7/widget/ViewUtils.java b/v7/appcompat/src/android/support/v7/widget/ViewUtils.java
index 72799ec..2a158c5 100644
--- a/v7/appcompat/src/android/support/v7/widget/ViewUtils.java
+++ b/v7/appcompat/src/android/support/v7/widget/ViewUtils.java
@@ -16,6 +16,8 @@
package android.support.v7.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.graphics.Rect;
import android.os.Build;
import android.support.annotation.RestrictTo;
@@ -26,12 +28,10 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class ViewUtils {
private static final String TAG = "ViewUtils";
diff --git a/v7/appcompat/tests/res/layout/appcompat_button_activity.xml b/v7/appcompat/tests/res/layout/appcompat_button_activity.xml
index 7708d0c..1b3656a 100644
--- a/v7/appcompat/tests/res/layout/appcompat_button_activity.xml
+++ b/v7/appcompat/tests/res/layout/appcompat_button_activity.xml
@@ -83,6 +83,12 @@
android:text="@string/sample_text2"
style="@style/Widget.AppCompat.Button.Colored"/>
+ <android.support.v7.widget.AppCompatButton
+ android:id="@+id/button_untinted"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/sample_text2"/>
+
</LinearLayout>
</ScrollView>
diff --git a/v7/appcompat/tests/src/android/support/v7/testutils/AppCompatTintableViewActions.java b/v7/appcompat/tests/src/android/support/v7/testutils/AppCompatTintableViewActions.java
index f92031e..de36207 100644
--- a/v7/appcompat/tests/src/android/support/v7/testutils/AppCompatTintableViewActions.java
+++ b/v7/appcompat/tests/src/android/support/v7/testutils/AppCompatTintableViewActions.java
@@ -35,41 +35,13 @@
public class AppCompatTintableViewActions {
/**
- * Sets enabled state on a <code>View</code> that implements the
- * <code>TintableBackgroundView</code> interface.
+ * Sets the passed color state list as the background layer on a {@link View}.
*/
- public static ViewAction setEnabled(final boolean enabled) {
+ public static ViewAction setBackgroundTintList(final ColorStateList tint) {
return new ViewAction() {
@Override
public Matcher<View> getConstraints() {
- return allOf(isDisplayed(), TestUtilsMatchers.isTintableBackgroundView());
- }
-
- @Override
- public String getDescription() {
- return "set enabled";
- }
-
- @Override
- public void perform(UiController uiController, View view) {
- uiController.loopMainThreadUntilIdle();
-
- view.setEnabled(enabled);
-
- uiController.loopMainThreadUntilIdle();
- }
- };
- }
-
- /**
- * Sets the passed color state list as the background layer on a {@link View} that
- * implements the {@link TintableBackgroundView} interface.
- */
- public static ViewAction setBackgroundTintList(final ColorStateList colorStateList) {
- return new ViewAction() {
- @Override
- public Matcher<View> getConstraints() {
- return allOf(isDisplayed(), TestUtilsMatchers.isTintableBackgroundView());
+ return isDisplayed();
}
@Override
@@ -81,8 +53,7 @@
public void perform(UiController uiController, View view) {
uiController.loopMainThreadUntilIdle();
- TintableBackgroundView tintableBackgroundView = (TintableBackgroundView) view;
- tintableBackgroundView.setSupportBackgroundTintList(colorStateList);
+ ViewCompat.setBackgroundTintList(view, tint);
uiController.loopMainThreadUntilIdle();
}
@@ -90,14 +61,13 @@
}
/**
- * Sets the passed mode as the background tint mode on a <code>View</code> that
- * implements the <code>TintableBackgroundView</code> interface.
+ * Sets the passed mode as the background tint mode on a <code>View</code>.
*/
- public static ViewAction setBackgroundTintMode(final PorterDuff.Mode tintMode) {
+ public static ViewAction setBackgroundTintMode(final PorterDuff.Mode mode) {
return new ViewAction() {
@Override
public Matcher<View> getConstraints() {
- return allOf(isDisplayed(), TestUtilsMatchers.isTintableBackgroundView());
+ return isDisplayed();
}
@Override
@@ -109,8 +79,7 @@
public void perform(UiController uiController, View view) {
uiController.loopMainThreadUntilIdle();
- TintableBackgroundView tintableBackgroundView = (TintableBackgroundView) view;
- tintableBackgroundView.setSupportBackgroundTintMode(tintMode);
+ ViewCompat.setBackgroundTintMode(view, mode);
uiController.loopMainThreadUntilIdle();
}
diff --git a/v7/appcompat/tests/src/android/support/v7/widget/AppCompatBaseViewTest.java b/v7/appcompat/tests/src/android/support/v7/widget/AppCompatBaseViewTest.java
index dca0f2a..bacb0e3 100644
--- a/v7/appcompat/tests/src/android/support/v7/widget/AppCompatBaseViewTest.java
+++ b/v7/appcompat/tests/src/android/support/v7/widget/AppCompatBaseViewTest.java
@@ -21,9 +21,9 @@
import static android.support.v7.testutils.AppCompatTintableViewActions.setBackgroundResource;
import static android.support.v7.testutils.AppCompatTintableViewActions.setBackgroundTintList;
import static android.support.v7.testutils.AppCompatTintableViewActions.setBackgroundTintMode;
-import static android.support.v7.testutils.AppCompatTintableViewActions.setEnabled;
import static android.support.v7.testutils.TestUtilsActions.setBackgroundTintListViewCompat;
import static android.support.v7.testutils.TestUtilsActions.setBackgroundTintModeViewCompat;
+import static android.support.v7.testutils.TestUtilsActions.setEnabled;
import static android.support.v7.testutils.TestUtilsMatchers.isBackground;
import static org.junit.Assert.assertNull;
@@ -219,8 +219,7 @@
// switched to the matching entry in newly set color state list.
final ColorStateList sandColor = ResourcesCompat.getColorStateList(
mResources, R.color.color_state_list_sand, null);
- onView(withId(viewId)).perform(
- setBackgroundTintList(sandColor));
+ onView(withId(viewId)).perform(setBackgroundTintList(sandColor));
verifyBackgroundIsColoredAs("New sand tinting in enabled state", view,
sandDefault, 0);
diff --git a/v7/appcompat/tests/src/android/support/v7/widget/AppCompatButtonTest.java b/v7/appcompat/tests/src/android/support/v7/widget/AppCompatButtonTest.java
index 2e5a952..bfc2bc1 100644
--- a/v7/appcompat/tests/src/android/support/v7/widget/AppCompatButtonTest.java
+++ b/v7/appcompat/tests/src/android/support/v7/widget/AppCompatButtonTest.java
@@ -83,12 +83,13 @@
assertEquals("Button is not in all caps", text, button.getLayout().getText());
}
- /**
- * Currently only runs on API 22+ due to http://b.android.com/221469
- */
@Test
- @SdkSuppress(minSdkVersion = 22)
public void testBackgroundTintListOnColoredButton() {
testUntintedBackgroundTintingViewCompatAcrossStateChange(R.id.button_colored_untinted);
}
+
+ @Test
+ public void testBackgroundTintListOnButton() {
+ testUntintedBackgroundTintingViewCompatAcrossStateChange(R.id.button_untinted);
+ }
}
diff --git a/v7/cardview/build.gradle b/v7/cardview/build.gradle
index 12f9e39..b88aad7 100644
--- a/v7/cardview/build.gradle
+++ b/v7/cardview/build.gradle
@@ -22,20 +22,12 @@
'src'
]
main.res.srcDir 'res'
-
- androidTest.setRoot('tests')
- androidTest.java.srcDir 'tests/java'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
-
- lintOptions {
- // TODO: fix errors and reenable.
- abortOnError false
- }
}
android.libraryVariants.all { variant ->
diff --git a/v7/gridlayout/build.gradle b/v7/gridlayout/build.gradle
index a2c3d36..542d5a7 100644
--- a/v7/gridlayout/build.gradle
+++ b/v7/gridlayout/build.gradle
@@ -42,11 +42,6 @@
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
-
- lintOptions {
- // TODO: fix errors and reenable.
- abortOnError false
- }
}
diff --git a/v7/mediarouter/build.gradle b/v7/mediarouter/build.gradle
index 61a5985..6b63089 100644
--- a/v7/mediarouter/build.gradle
+++ b/v7/mediarouter/build.gradle
@@ -29,11 +29,6 @@
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
-
- lintOptions {
- // TODO: fix errors and reenable.
- abortOnError false
- }
}
android.libraryVariants.all { variant ->
diff --git a/v7/mediarouter/src/android/support/v7/media/MediaRouteDescriptor.java b/v7/mediarouter/src/android/support/v7/media/MediaRouteDescriptor.java
index 068db47..0a4d0d4 100644
--- a/v7/mediarouter/src/android/support/v7/media/MediaRouteDescriptor.java
+++ b/v7/mediarouter/src/android/support/v7/media/MediaRouteDescriptor.java
@@ -15,6 +15,8 @@
*/
package android.support.v7.media;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.IntentFilter;
import android.content.IntentSender;
import android.net.Uri;
@@ -28,8 +30,6 @@
import java.util.Collections;
import java.util.List;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Describes the properties of a route.
* <p>
@@ -90,7 +90,7 @@
* </p>
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public List<String> getGroupMemberIds() {
return mBundle.getStringArrayList(KEY_GROUP_MEMBER_IDS);
}
@@ -278,7 +278,7 @@
* Gets the minimum client version required for this route.
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public int getMinClientVersion() {
return mBundle.getInt(KEY_MIN_CLIENT_VERSION,
MediaRouteProviderProtocol.CLIENT_VERSION_START);
@@ -288,7 +288,7 @@
* Gets the maximum client version required for this route.
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public int getMaxClientVersion() {
return mBundle.getInt(KEY_MAX_CLIENT_VERSION, Integer.MAX_VALUE);
}
@@ -411,7 +411,7 @@
* </p>
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public Builder addGroupMemberId(String groupMemberId) {
if (TextUtils.isEmpty(groupMemberId)) {
throw new IllegalArgumentException("groupMemberId must not be empty");
@@ -434,7 +434,7 @@
* </p>
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public Builder addGroupMemberIds(Collection<String> groupMemberIds) {
if (groupMemberIds == null) {
throw new IllegalArgumentException("groupMemberIds must not be null");
@@ -663,7 +663,7 @@
* A router whose version is lower than this will not be able to connect to this route.
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public Builder setMinClientVersion(int minVersion) {
mBundle.putInt(KEY_MIN_CLIENT_VERSION, minVersion);
return this;
@@ -674,7 +674,7 @@
* A router whose version is higher than this will not be able to connect to this route.
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public Builder setMaxClientVersion(int maxVersion) {
mBundle.putInt(KEY_MAX_CLIENT_VERSION, maxVersion);
return this;
diff --git a/v7/mediarouter/src/android/support/v7/media/MediaRouteProvider.java b/v7/mediarouter/src/android/support/v7/media/MediaRouteProvider.java
index e514782..eee05cc 100644
--- a/v7/mediarouter/src/android/support/v7/media/MediaRouteProvider.java
+++ b/v7/mediarouter/src/android/support/v7/media/MediaRouteProvider.java
@@ -16,6 +16,8 @@
package android.support.v7.media;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -26,8 +28,6 @@
import android.support.annotation.RestrictTo;
import android.support.v7.media.MediaRouter.ControlRequestCallback;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Media route providers are used to publish additional media routes for
* use within an application. Media route providers may also be declared
@@ -274,7 +274,7 @@
* cannot be controlled using the route controller interface.
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Nullable
public RouteController onCreateRouteController(@NonNull String routeId,
@NonNull String routeGroupId) {
diff --git a/v7/mediarouter/src/android/support/v7/media/MediaRouteProviderProtocol.java b/v7/mediarouter/src/android/support/v7/media/MediaRouteProviderProtocol.java
index 4bc03a8..3c44b6b 100644
--- a/v7/mediarouter/src/android/support/v7/media/MediaRouteProviderProtocol.java
+++ b/v7/mediarouter/src/android/support/v7/media/MediaRouteProviderProtocol.java
@@ -119,7 +119,7 @@
public static final int CLIENT_MSG_SET_DISCOVERY_REQUEST = 10;
public static final String CLIENT_DATA_ROUTE_ID = "routeId";
- public static final String CLIENT_DATA_ROUTE_GROUP_ID = "routeGroupId";
+ public static final String CLIENT_DATA_ROUTE_LIBRARY_GROUP = "routeGroupId";
public static final String CLIENT_DATA_VOLUME = "volume";
public static final String CLIENT_DATA_UNSELECT_REASON = "unselectReason";
diff --git a/v7/mediarouter/src/android/support/v7/media/MediaRouteProviderService.java b/v7/mediarouter/src/android/support/v7/media/MediaRouteProviderService.java
index dc49e81..9ddde89 100644
--- a/v7/mediarouter/src/android/support/v7/media/MediaRouteProviderService.java
+++ b/v7/mediarouter/src/android/support/v7/media/MediaRouteProviderService.java
@@ -16,6 +16,35 @@
package android.support.v7.media;
+import static android.support.v7.media.MediaRouteProviderProtocol.CLIENT_DATA_ROUTE_ID;
+import static android.support.v7.media.MediaRouteProviderProtocol.CLIENT_DATA_ROUTE_LIBRARY_GROUP;
+import static android.support.v7.media.MediaRouteProviderProtocol.CLIENT_DATA_UNSELECT_REASON;
+import static android.support.v7.media.MediaRouteProviderProtocol.CLIENT_DATA_VOLUME;
+import static android.support.v7.media.MediaRouteProviderProtocol
+ .CLIENT_MSG_CREATE_ROUTE_CONTROLLER;
+import static android.support.v7.media.MediaRouteProviderProtocol.CLIENT_MSG_REGISTER;
+import static android.support.v7.media.MediaRouteProviderProtocol
+ .CLIENT_MSG_RELEASE_ROUTE_CONTROLLER;
+import static android.support.v7.media.MediaRouteProviderProtocol.CLIENT_MSG_ROUTE_CONTROL_REQUEST;
+import static android.support.v7.media.MediaRouteProviderProtocol.CLIENT_MSG_SELECT_ROUTE;
+import static android.support.v7.media.MediaRouteProviderProtocol.CLIENT_MSG_SET_DISCOVERY_REQUEST;
+import static android.support.v7.media.MediaRouteProviderProtocol.CLIENT_MSG_SET_ROUTE_VOLUME;
+import static android.support.v7.media.MediaRouteProviderProtocol.CLIENT_MSG_UNREGISTER;
+import static android.support.v7.media.MediaRouteProviderProtocol.CLIENT_MSG_UNSELECT_ROUTE;
+import static android.support.v7.media.MediaRouteProviderProtocol.CLIENT_MSG_UPDATE_ROUTE_VOLUME;
+import static android.support.v7.media.MediaRouteProviderProtocol.CLIENT_VERSION_1;
+import static android.support.v7.media.MediaRouteProviderProtocol.SERVICE_DATA_ERROR;
+import static android.support.v7.media.MediaRouteProviderProtocol
+ .SERVICE_MSG_CONTROL_REQUEST_FAILED;
+import static android.support.v7.media.MediaRouteProviderProtocol
+ .SERVICE_MSG_CONTROL_REQUEST_SUCCEEDED;
+import static android.support.v7.media.MediaRouteProviderProtocol.SERVICE_MSG_DESCRIPTOR_CHANGED;
+import static android.support.v7.media.MediaRouteProviderProtocol.SERVICE_MSG_GENERIC_FAILURE;
+import static android.support.v7.media.MediaRouteProviderProtocol.SERVICE_MSG_GENERIC_SUCCESS;
+import static android.support.v7.media.MediaRouteProviderProtocol.SERVICE_MSG_REGISTERED;
+import static android.support.v7.media.MediaRouteProviderProtocol.SERVICE_VERSION_CURRENT;
+import static android.support.v7.media.MediaRouteProviderProtocol.isValidRemoteMessenger;
+
import android.app.Service;
import android.content.Intent;
import android.os.Bundle;
@@ -33,8 +62,6 @@
import java.util.ArrayList;
import java.util.List;
-import static android.support.v7.media.MediaRouteProviderProtocol.*;
-
/**
* Base class for media route provider services.
* <p>
@@ -663,7 +690,7 @@
case CLIENT_MSG_CREATE_ROUTE_CONTROLLER: {
String routeId = data.getString(CLIENT_DATA_ROUTE_ID);
- String routeGroupId = data.getString(CLIENT_DATA_ROUTE_GROUP_ID);
+ String routeGroupId = data.getString(CLIENT_DATA_ROUTE_LIBRARY_GROUP);
if (routeId != null) {
return service.onCreateRouteController(
messenger, requestId, arg, routeId, routeGroupId);
diff --git a/v7/mediarouter/src/android/support/v7/media/MediaRouter.java b/v7/mediarouter/src/android/support/v7/media/MediaRouter.java
index daf73d0..8e451b3 100644
--- a/v7/mediarouter/src/android/support/v7/media/MediaRouter.java
+++ b/v7/mediarouter/src/android/support/v7/media/MediaRouter.java
@@ -16,7 +16,7 @@
package android.support.v7.media;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import android.app.ActivityManager;
import android.content.ComponentName;
@@ -875,7 +875,7 @@
* @see #getDeviceType
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public static final int DEVICE_TYPE_UNKNOWN = 0;
/**
@@ -901,7 +901,7 @@
* @see #getDeviceType
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public static final int DEVICE_TYPE_BLUETOOTH = 3;
@IntDef({PLAYBACK_VOLUME_FIXED,PLAYBACK_VOLUME_VARIABLE})
@@ -931,7 +931,7 @@
* with the route.
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public static final int PRESENTATION_DISPLAY_ID_NONE = -1;
static final int CHANGE_GENERAL = 1 << 0;
@@ -1282,7 +1282,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public boolean isDefaultOrBluetooth() {
if (isDefault() || mDeviceType == DEVICE_TYPE_BLUETOOTH) {
return true;
@@ -1413,7 +1413,7 @@
* Gets the route's presentation display id, or -1 if none.
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public int getPresentationDisplayId() {
return mPresentationDisplayId;
}
@@ -1558,7 +1558,7 @@
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public MediaRouteProvider getProviderInstance() {
return mProvider.getProviderInstance();
}
@@ -1568,7 +1568,7 @@
* Information about a route that consists of multiple other routes in a group.
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public static class RouteGroup extends RouteInfo {
private List<RouteInfo> mRoutes = new ArrayList<>();
diff --git a/v7/mediarouter/src/android/support/v7/media/RegisteredMediaRouteProvider.java b/v7/mediarouter/src/android/support/v7/media/RegisteredMediaRouteProvider.java
index 7942eed..ca2d486 100644
--- a/v7/mediarouter/src/android/support/v7/media/RegisteredMediaRouteProvider.java
+++ b/v7/mediarouter/src/android/support/v7/media/RegisteredMediaRouteProvider.java
@@ -16,6 +16,35 @@
package android.support.v7.media;
+import static android.support.v7.media.MediaRouteProviderProtocol.CLIENT_DATA_ROUTE_ID;
+import static android.support.v7.media.MediaRouteProviderProtocol.CLIENT_DATA_ROUTE_LIBRARY_GROUP;
+import static android.support.v7.media.MediaRouteProviderProtocol.CLIENT_DATA_UNSELECT_REASON;
+import static android.support.v7.media.MediaRouteProviderProtocol.CLIENT_DATA_VOLUME;
+import static android.support.v7.media.MediaRouteProviderProtocol
+ .CLIENT_MSG_CREATE_ROUTE_CONTROLLER;
+import static android.support.v7.media.MediaRouteProviderProtocol.CLIENT_MSG_REGISTER;
+import static android.support.v7.media.MediaRouteProviderProtocol
+ .CLIENT_MSG_RELEASE_ROUTE_CONTROLLER;
+import static android.support.v7.media.MediaRouteProviderProtocol.CLIENT_MSG_ROUTE_CONTROL_REQUEST;
+import static android.support.v7.media.MediaRouteProviderProtocol.CLIENT_MSG_SELECT_ROUTE;
+import static android.support.v7.media.MediaRouteProviderProtocol.CLIENT_MSG_SET_DISCOVERY_REQUEST;
+import static android.support.v7.media.MediaRouteProviderProtocol.CLIENT_MSG_SET_ROUTE_VOLUME;
+import static android.support.v7.media.MediaRouteProviderProtocol.CLIENT_MSG_UNREGISTER;
+import static android.support.v7.media.MediaRouteProviderProtocol.CLIENT_MSG_UNSELECT_ROUTE;
+import static android.support.v7.media.MediaRouteProviderProtocol.CLIENT_MSG_UPDATE_ROUTE_VOLUME;
+import static android.support.v7.media.MediaRouteProviderProtocol.CLIENT_VERSION_CURRENT;
+import static android.support.v7.media.MediaRouteProviderProtocol.SERVICE_DATA_ERROR;
+import static android.support.v7.media.MediaRouteProviderProtocol
+ .SERVICE_MSG_CONTROL_REQUEST_FAILED;
+import static android.support.v7.media.MediaRouteProviderProtocol
+ .SERVICE_MSG_CONTROL_REQUEST_SUCCEEDED;
+import static android.support.v7.media.MediaRouteProviderProtocol.SERVICE_MSG_DESCRIPTOR_CHANGED;
+import static android.support.v7.media.MediaRouteProviderProtocol.SERVICE_MSG_GENERIC_FAILURE;
+import static android.support.v7.media.MediaRouteProviderProtocol.SERVICE_MSG_GENERIC_SUCCESS;
+import static android.support.v7.media.MediaRouteProviderProtocol.SERVICE_MSG_REGISTERED;
+import static android.support.v7.media.MediaRouteProviderProtocol.SERVICE_VERSION_1;
+import static android.support.v7.media.MediaRouteProviderProtocol.isValidRemoteMessenger;
+
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -24,10 +53,10 @@
import android.os.DeadObjectException;
import android.os.Handler;
import android.os.IBinder;
-import android.os.RemoteException;
import android.os.IBinder.DeathRecipient;
import android.os.Message;
import android.os.Messenger;
+import android.os.RemoteException;
import android.support.annotation.NonNull;
import android.support.v7.media.MediaRouter.ControlRequestCallback;
import android.util.Log;
@@ -37,8 +66,6 @@
import java.util.ArrayList;
import java.util.List;
-import static android.support.v7.media.MediaRouteProviderProtocol.*;
-
/**
* Maintains a connection to a particular media route provider service.
*/
@@ -537,7 +564,7 @@
int controllerId = mNextControllerId++;
Bundle data = new Bundle();
data.putString(CLIENT_DATA_ROUTE_ID, routeId);
- data.putString(CLIENT_DATA_ROUTE_GROUP_ID, routeGroupId);
+ data.putString(CLIENT_DATA_ROUTE_LIBRARY_GROUP, routeGroupId);
sendRequest(CLIENT_MSG_CREATE_ROUTE_CONTROLLER,
mNextRequestId++, controllerId, null, data);
return controllerId;
diff --git a/v7/palette/build.gradle b/v7/palette/build.gradle
index 01ce70c..2494370 100644
--- a/v7/palette/build.gradle
+++ b/v7/palette/build.gradle
@@ -13,18 +13,13 @@
}
android {
- compileSdkVersion 9
+ compileSdkVersion project.ext.currentSdk
defaultConfig {
minSdkVersion 9
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
- lintOptions {
- // TODO: fix errors and reenable.
- abortOnError false
- }
-
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
diff --git a/v7/preference/build.gradle b/v7/preference/build.gradle
index 55fe020..a63cc9e 100644
--- a/v7/preference/build.gradle
+++ b/v7/preference/build.gradle
@@ -63,8 +63,8 @@
}
lintOptions {
- // TODO: fix errors and reenable.
- abortOnError false
+ // Remove this once all NewApi breakages have been fixed.
+ disable "NewApi"
}
buildTypes.all {
diff --git a/v7/preference/constants/android/support/v7/preference/AndroidResources.java b/v7/preference/constants/android/support/v7/preference/AndroidResources.java
index aeddb15..d08a887 100644
--- a/v7/preference/constants/android/support/v7/preference/AndroidResources.java
+++ b/v7/preference/constants/android/support/v7/preference/AndroidResources.java
@@ -16,14 +16,14 @@
package android.support.v7.preference;
-import android.support.annotation.RestrictTo;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import android.support.annotation.RestrictTo;
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class AndroidResources {
public static final int ANDROID_R_ICON_FRAME = android.R.id.icon_frame;
diff --git a/v7/preference/src/android/support/v7/internal/package-info.java b/v7/preference/src/android/support/v7/internal/package-info.java
index c146ca5..b5fabd6 100644
--- a/v7/preference/src/android/support/v7/internal/package-info.java
+++ b/v7/preference/src/android/support/v7/internal/package-info.java
@@ -1,9 +1,9 @@
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
package android.support.v7.internal;
-import android.support.annotation.RestrictTo;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
\ No newline at end of file
+import android.support.annotation.RestrictTo;
\ No newline at end of file
diff --git a/v7/preference/src/android/support/v7/internal/widget/PreferenceImageView.java b/v7/preference/src/android/support/v7/internal/widget/PreferenceImageView.java
index a02872f..e2a133c 100644
--- a/v7/preference/src/android/support/v7/internal/widget/PreferenceImageView.java
+++ b/v7/preference/src/android/support/v7/internal/widget/PreferenceImageView.java
@@ -16,6 +16,8 @@
package android.support.v7.internal.widget;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.TypedArray;
import android.support.annotation.RestrictTo;
@@ -23,13 +25,11 @@
import android.util.AttributeSet;
import android.widget.ImageView;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Extension of ImageView that correctly applies maxWidth and maxHeight.
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class PreferenceImageView extends ImageView {
private int mMaxWidth = Integer.MAX_VALUE;
diff --git a/v7/preference/src/android/support/v7/preference/CheckBoxPreference.java b/v7/preference/src/android/support/v7/preference/CheckBoxPreference.java
index 72143a4..086f22d 100644
--- a/v7/preference/src/android/support/v7/preference/CheckBoxPreference.java
+++ b/v7/preference/src/android/support/v7/preference/CheckBoxPreference.java
@@ -16,6 +16,8 @@
package android.support.v7.preference;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.TypedArray;
import android.support.annotation.RestrictTo;
@@ -26,8 +28,6 @@
import android.widget.Checkable;
import android.widget.CompoundButton;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* A {@link Preference} that provides checkbox widget
* functionality.
@@ -99,7 +99,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
protected void performClick(View view) {
super.performClick(view);
diff --git a/v7/preference/src/android/support/v7/preference/DropDownPreference.java b/v7/preference/src/android/support/v7/preference/DropDownPreference.java
index ec6339e..89c9d2e 100644
--- a/v7/preference/src/android/support/v7/preference/DropDownPreference.java
+++ b/v7/preference/src/android/support/v7/preference/DropDownPreference.java
@@ -16,6 +16,8 @@
package android.support.v7.preference;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.RestrictTo;
@@ -26,8 +28,6 @@
import android.widget.ArrayAdapter;
import android.widget.Spinner;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* A version of {@link ListPreference} that presents the options in a
* drop down menu rather than a dialog.
@@ -102,7 +102,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public int findSpinnerIndexOfValue(String value) {
CharSequence[] entryValues = getEntryValues();
if (value != null && entryValues != null) {
diff --git a/v7/preference/src/android/support/v7/preference/EditTextPreferenceDialogFragmentCompat.java b/v7/preference/src/android/support/v7/preference/EditTextPreferenceDialogFragmentCompat.java
index cb18ba9..a6cc81f 100644
--- a/v7/preference/src/android/support/v7/preference/EditTextPreferenceDialogFragmentCompat.java
+++ b/v7/preference/src/android/support/v7/preference/EditTextPreferenceDialogFragmentCompat.java
@@ -16,14 +16,14 @@
package android.support.v7.preference;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.RestrictTo;
import android.view.View;
import android.widget.EditText;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
public class EditTextPreferenceDialogFragmentCompat extends PreferenceDialogFragmentCompat {
private static final String SAVE_STATE_TEXT = "EditTextPreferenceDialogFragment.text";
@@ -76,7 +76,7 @@
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
protected boolean needInputMethod() {
// We want the input method to show, if possible, when dialog is displayed
diff --git a/v7/preference/src/android/support/v7/preference/Preference.java b/v7/preference/src/android/support/v7/preference/Preference.java
index 7d2bd3f..deb3b12 100644
--- a/v7/preference/src/android/support/v7/preference/Preference.java
+++ b/v7/preference/src/android/support/v7/preference/Preference.java
@@ -16,6 +16,8 @@
package android.support.v7.preference;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
@@ -42,8 +44,6 @@
import java.util.ArrayList;
import java.util.List;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Represents the basic Preference UI building
* block displayed by a {@link PreferenceFragmentCompat} in the form of a
@@ -960,7 +960,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected void performClick(View view) {
performClick();
}
@@ -970,7 +970,7 @@
*
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public void performClick() {
if (!isEnabled()) {
@@ -1111,7 +1111,7 @@
* Called from {@link PreferenceGroup} to pass in an ID for reuse
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected void onAttachedToHierarchy(PreferenceManager preferenceManager, long id) {
mId = id;
mHasId = true;
diff --git a/v7/preference/src/android/support/v7/preference/PreferenceDialogFragmentCompat.java b/v7/preference/src/android/support/v7/preference/PreferenceDialogFragmentCompat.java
index 3989385..b61bae5 100644
--- a/v7/preference/src/android/support/v7/preference/PreferenceDialogFragmentCompat.java
+++ b/v7/preference/src/android/support/v7/preference/PreferenceDialogFragmentCompat.java
@@ -16,6 +16,8 @@
package android.support.v7.preference;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
@@ -37,8 +39,6 @@
import android.view.WindowManager;
import android.widget.TextView;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Abstract base class which presents a dialog associated with a
* {@link android.support.v7.preference.DialogPreference}. Since the preference object may
@@ -194,7 +194,7 @@
* the soft input method brought up automatically.
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected boolean needInputMethod() {
return false;
}
diff --git a/v7/preference/src/android/support/v7/preference/PreferenceFragmentCompat.java b/v7/preference/src/android/support/v7/preference/PreferenceFragmentCompat.java
index 751d9f7..7d42155 100644
--- a/v7/preference/src/android/support/v7/preference/PreferenceFragmentCompat.java
+++ b/v7/preference/src/android/support/v7/preference/PreferenceFragmentCompat.java
@@ -16,6 +16,8 @@
package android.support.v7.preference;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
@@ -39,8 +41,6 @@
import android.view.View;
import android.view.ViewGroup;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Shows a hierarchy of {@link Preference} objects as
* lists. These preferences will
@@ -545,12 +545,12 @@
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected void onBindPreferences() {
}
/** @hide */
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected void onUnbindPreferences() {
}
@@ -652,7 +652,7 @@
* @return Fragment to possibly use as a callback
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public Fragment getCallbackFragment() {
return null;
}
diff --git a/v7/preference/src/android/support/v7/preference/PreferenceGroup.java b/v7/preference/src/android/support/v7/preference/PreferenceGroup.java
index 0fc77ce..da7f8dc 100644
--- a/v7/preference/src/android/support/v7/preference/PreferenceGroup.java
+++ b/v7/preference/src/android/support/v7/preference/PreferenceGroup.java
@@ -16,6 +16,8 @@
package android.support.v7.preference;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Bundle;
@@ -30,8 +32,6 @@
import java.util.Collections;
import java.util.List;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* A container for multiple
* {@link Preference} objects. It is a base class for Preference objects that are
@@ -322,7 +322,7 @@
* Returns true if we're between {@link #onAttached()} and {@link #onPrepareForRemoval()}
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public boolean isAttached() {
return mAttachedToHierarchy;
}
diff --git a/v7/preference/src/android/support/v7/preference/PreferenceGroupAdapter.java b/v7/preference/src/android/support/v7/preference/PreferenceGroupAdapter.java
index c8af738..feef983 100644
--- a/v7/preference/src/android/support/v7/preference/PreferenceGroupAdapter.java
+++ b/v7/preference/src/android/support/v7/preference/PreferenceGroupAdapter.java
@@ -16,6 +16,8 @@
package android.support.v7.preference;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Handler;
@@ -31,15 +33,13 @@
import java.util.ArrayList;
import java.util.List;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* An adapter that connects a RecyclerView to the {@link Preference} objects contained in the
* associated {@link PreferenceGroup}.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class PreferenceGroupAdapter extends RecyclerView.Adapter<PreferenceViewHolder>
implements Preference.OnPreferenceChangeInternalListener,
PreferenceGroup.PreferencePositionCallback {
diff --git a/v7/preference/src/android/support/v7/preference/PreferenceManager.java b/v7/preference/src/android/support/v7/preference/PreferenceManager.java
index 7af430f..0da1a9b 100644
--- a/v7/preference/src/android/support/v7/preference/PreferenceManager.java
+++ b/v7/preference/src/android/support/v7/preference/PreferenceManager.java
@@ -16,6 +16,8 @@
package android.support.v7.preference;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.drawable.Drawable;
@@ -25,8 +27,6 @@
import android.support.v4.os.BuildCompat;
import android.text.TextUtils;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Used to help create {@link Preference} hierarchies
* from activities or XML.
@@ -101,7 +101,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public PreferenceManager(Context context) {
mContext = context;
@@ -120,7 +120,7 @@
* root).
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public PreferenceScreen inflateFromResource(Context context, int resId,
PreferenceScreen rootPreferences) {
// Block commits
diff --git a/v7/preference/src/android/support/v7/preference/PreferenceRecyclerViewAccessibilityDelegate.java b/v7/preference/src/android/support/v7/preference/PreferenceRecyclerViewAccessibilityDelegate.java
index d2a2454..e42bcd8 100644
--- a/v7/preference/src/android/support/v7/preference/PreferenceRecyclerViewAccessibilityDelegate.java
+++ b/v7/preference/src/android/support/v7/preference/PreferenceRecyclerViewAccessibilityDelegate.java
@@ -16,6 +16,8 @@
package android.support.v7.preference;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.os.Bundle;
import android.support.annotation.RestrictTo;
import android.support.v4.view.AccessibilityDelegateCompat;
@@ -23,16 +25,13 @@
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerViewAccessibilityDelegate;
import android.view.View;
-import android.view.accessibility.AccessibilityEvent;
-
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
/**
* The AccessibilityDelegate used by the RecyclerView that displays Views for Preferences.
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class PreferenceRecyclerViewAccessibilityDelegate
extends RecyclerViewAccessibilityDelegate {
final RecyclerView mRecyclerView;
diff --git a/v7/preference/src/android/support/v7/preference/PreferenceScreen.java b/v7/preference/src/android/support/v7/preference/PreferenceScreen.java
index 8434354..e29264a 100644
--- a/v7/preference/src/android/support/v7/preference/PreferenceScreen.java
+++ b/v7/preference/src/android/support/v7/preference/PreferenceScreen.java
@@ -16,13 +16,13 @@
package android.support.v7.preference;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.support.annotation.RestrictTo;
import android.support.v4.content.res.TypedArrayUtils;
import android.util.AttributeSet;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Represents a top-level {@link Preference} that
* is the root of a Preference hierarchy. A {@link PreferenceFragmentCompat}
@@ -84,7 +84,7 @@
* Do NOT use this constructor, use {@link PreferenceManager#createPreferenceScreen(Context)}.
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public PreferenceScreen(Context context, AttributeSet attrs) {
super(context, attrs, TypedArrayUtils.getAttr(context, R.attr.preferenceScreenStyle,
android.R.attr.preferenceScreenStyle));
diff --git a/v7/preference/src/android/support/v7/preference/SwitchPreferenceCompat.java b/v7/preference/src/android/support/v7/preference/SwitchPreferenceCompat.java
index 1784f9f..6b7b93f 100644
--- a/v7/preference/src/android/support/v7/preference/SwitchPreferenceCompat.java
+++ b/v7/preference/src/android/support/v7/preference/SwitchPreferenceCompat.java
@@ -16,6 +16,8 @@
package android.support.v7.preference;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.TypedArray;
import android.support.annotation.RestrictTo;
@@ -27,8 +29,6 @@
import android.widget.Checkable;
import android.widget.CompoundButton;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* A {@link Preference} that provides a two-state toggleable option.
* <p>
@@ -201,7 +201,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
protected void performClick(View view) {
super.performClick(view);
diff --git a/v7/preference/src/android/support/v7/preference/TwoStatePreference.java b/v7/preference/src/android/support/v7/preference/TwoStatePreference.java
index 19071f5..537c88a 100644
--- a/v7/preference/src/android/support/v7/preference/TwoStatePreference.java
+++ b/v7/preference/src/android/support/v7/preference/TwoStatePreference.java
@@ -16,6 +16,8 @@
package android.support.v7.preference;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Parcel;
@@ -26,8 +28,6 @@
import android.view.View;
import android.widget.TextView;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Common base class for preferences that have two selectable states, persist a
* boolean value in SharedPreferences, and may have dependent preferences that are
@@ -203,7 +203,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
protected void syncSummaryView(View view) {
if (!(view instanceof TextView)) {
return;
diff --git a/v7/preference/src/android/support/v7/preference/UnPressableLinearLayout.java b/v7/preference/src/android/support/v7/preference/UnPressableLinearLayout.java
index d8c0970..1524d31 100644
--- a/v7/preference/src/android/support/v7/preference/UnPressableLinearLayout.java
+++ b/v7/preference/src/android/support/v7/preference/UnPressableLinearLayout.java
@@ -16,7 +16,7 @@
package android.support.v7.preference;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import android.content.Context;
import android.support.annotation.RestrictTo;
@@ -29,7 +29,7 @@
* or long-clickable.
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public class UnPressableLinearLayout extends LinearLayout {
public UnPressableLinearLayout(Context context) {
this(context, null);
diff --git a/v7/preference/src/android/support/v7/preference/internal/AbstractMultiSelectListPreference.java b/v7/preference/src/android/support/v7/preference/internal/AbstractMultiSelectListPreference.java
index 6fcd77c..64d02ef 100644
--- a/v7/preference/src/android/support/v7/preference/internal/AbstractMultiSelectListPreference.java
+++ b/v7/preference/src/android/support/v7/preference/internal/AbstractMultiSelectListPreference.java
@@ -16,6 +16,8 @@
package android.support.v7.preference.internal;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
+
import android.content.Context;
import android.support.annotation.RestrictTo;
import android.support.v7.preference.DialogPreference;
@@ -23,8 +25,6 @@
import java.util.Set;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
-
/**
* Stub superclass for {@link android.support.v14.preference.MultiSelectListPreference} so that we
* can reference it from
@@ -32,7 +32,7 @@
*
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
public abstract class AbstractMultiSelectListPreference extends DialogPreference {
public AbstractMultiSelectListPreference(Context context, AttributeSet attrs, int defStyleAttr,
int defStyleRes) {
diff --git a/v7/preference/src/android/support/v7/preference/internal/package-info.java b/v7/preference/src/android/support/v7/preference/internal/package-info.java
index 6561bf1..b110d3a 100644
--- a/v7/preference/src/android/support/v7/preference/internal/package-info.java
+++ b/v7/preference/src/android/support/v7/preference/internal/package-info.java
@@ -1,9 +1,9 @@
/**
* @hide
*/
-@RestrictTo(GROUP_ID)
+@RestrictTo(LIBRARY_GROUP)
package android.support.v7.preference.internal;
-import android.support.annotation.RestrictTo;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
\ No newline at end of file
+import android.support.annotation.RestrictTo;
\ No newline at end of file
diff --git a/v7/recyclerview/build.gradle b/v7/recyclerview/build.gradle
index 793fb95..11a098e 100644
--- a/v7/recyclerview/build.gradle
+++ b/v7/recyclerview/build.gradle
@@ -23,7 +23,7 @@
}
android {
- compileSdkVersion 23
+ compileSdkVersion project.ext.currentSdk
defaultConfig {
minSdkVersion 9
@@ -47,11 +47,6 @@
targetCompatibility JavaVersion.VERSION_1_7
}
- lintOptions {
- // TODO: fix errors and reenable.
- abortOnError false
- }
-
packagingOptions {
exclude 'LICENSE.txt'
}
diff --git a/v7/recyclerview/src/android/support/v7/widget/DividerItemDecoration.java b/v7/recyclerview/src/android/support/v7/widget/DividerItemDecoration.java
index 6229b20..b3b7cd1 100644
--- a/v7/recyclerview/src/android/support/v7/widget/DividerItemDecoration.java
+++ b/v7/recyclerview/src/android/support/v7/widget/DividerItemDecoration.java
@@ -17,6 +17,7 @@
package android.support.v7.widget;
+import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
@@ -105,6 +106,7 @@
}
}
+ @SuppressLint("NewApi")
private void drawVertical(Canvas canvas, RecyclerView parent) {
canvas.save();
final int left;
@@ -131,6 +133,7 @@
canvas.restore();
}
+ @SuppressLint("NewApi")
private void drawHorizontal(Canvas canvas, RecyclerView parent) {
canvas.save();
final int top;
diff --git a/v7/recyclerview/src/android/support/v7/widget/LinearLayoutManager.java b/v7/recyclerview/src/android/support/v7/widget/LinearLayoutManager.java
index ceabf01..c078e95 100644
--- a/v7/recyclerview/src/android/support/v7/widget/LinearLayoutManager.java
+++ b/v7/recyclerview/src/android/support/v7/widget/LinearLayoutManager.java
@@ -16,7 +16,7 @@
package android.support.v7.widget;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import static android.support.v7.widget.RecyclerView.NO_POSITION;
import android.content.Context;
@@ -1965,7 +1965,7 @@
/**
* @hide This method should be called by ItemTouchHelper only.
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
@Override
public void prepareForDrop(View view, View target, int x, int y) {
assertNotInLayoutOrScroll("Cannot drop a view during a scroll or layout calculation");
@@ -2184,7 +2184,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public static class SavedState implements Parcelable {
int mAnchorPosition;
diff --git a/v7/recyclerview/src/android/support/v7/widget/RecyclerView.java b/v7/recyclerview/src/android/support/v7/widget/RecyclerView.java
index 4a9fab0..56404e7 100644
--- a/v7/recyclerview/src/android/support/v7/widget/RecyclerView.java
+++ b/v7/recyclerview/src/android/support/v7/widget/RecyclerView.java
@@ -17,7 +17,7 @@
package android.support.v7.widget;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import android.content.Context;
import android.content.res.TypedArray;
@@ -462,7 +462,8 @@
* until the end of the layout because a11y service may make sync calls back to the RV while
* the View's state is undefined.
*/
- private final List<ViewHolder> mPendingAccessibilityImportanceChange = new ArrayList();
+ @VisibleForTesting
+ final List<ViewHolder> mPendingAccessibilityImportanceChange = new ArrayList();
private Runnable mItemAnimatorRunner = new Runnable() {
@Override
@@ -901,6 +902,7 @@
*
* @attr name android:clipToPadding
*/
+ @Override
public boolean getClipToPadding() {
return mClipToPadding;
}
@@ -2428,7 +2430,7 @@
// NOTE: we only do this query once, statically, because it's very expensive (> 1ms)
Display display = ViewCompat.getDisplay(this);
float refreshRate = 60.0f;
- if (display != null) {
+ if (!isInEditMode() && display != null) {
float displayRefreshRate = display.getRefreshRate();
if (displayRefreshRate >= 30.0f) {
refreshRate = displayRefreshRate;
@@ -9955,7 +9957,8 @@
private int mWasImportantForAccessibilityBeforeHidden =
ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO;
// set if we defer the accessibility state change of the view holder
- private int mPendingAccessibilityState = PENDING_ACCESSIBILITY_STATE_NOT_SET;
+ @VisibleForTesting
+ int mPendingAccessibilityState = PENDING_ACCESSIBILITY_STATE_NOT_SET;
/**
* Is set when VH is bound from the adapter and cleaned right before it is sent to
@@ -10350,7 +10353,7 @@
for (int i = mPendingAccessibilityImportanceChange.size() - 1; i >= 0; i --) {
ViewHolder viewHolder = mPendingAccessibilityImportanceChange.get(i);
if (viewHolder.itemView.getParent() != this || viewHolder.shouldIgnore()) {
- return;
+ continue;
}
int state = viewHolder.mPendingAccessibilityState;
if (state != ViewHolder.PENDING_ACCESSIBILITY_STATE_NOT_SET) {
@@ -11059,7 +11062,7 @@
* This is public so that the CREATOR can be access on cold launch.
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public static class SavedState extends AbsSavedState {
Parcelable mLayoutState;
diff --git a/v7/recyclerview/src/android/support/v7/widget/StaggeredGridLayoutManager.java b/v7/recyclerview/src/android/support/v7/widget/StaggeredGridLayoutManager.java
index 62a7f09..99f6621 100644
--- a/v7/recyclerview/src/android/support/v7/widget/StaggeredGridLayoutManager.java
+++ b/v7/recyclerview/src/android/support/v7/widget/StaggeredGridLayoutManager.java
@@ -16,7 +16,7 @@
package android.support.v7.widget;
-import static android.support.annotation.RestrictTo.Scope.GROUP_ID;
+import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import static android.support.v7.widget.LayoutState.ITEM_DIRECTION_HEAD;
import static android.support.v7.widget.LayoutState.ITEM_DIRECTION_TAIL;
import static android.support.v7.widget.LayoutState.LAYOUT_END;
@@ -2996,7 +2996,7 @@
/**
* @hide
*/
- @RestrictTo(GROUP_ID)
+ @RestrictTo(LIBRARY_GROUP)
public static class SavedState implements Parcelable {
int mAnchorPosition;
diff --git a/v7/recyclerview/tests/src/android/support/v7/widget/RecyclerViewAccessibilityLifecycleTest.java b/v7/recyclerview/tests/src/android/support/v7/widget/RecyclerViewAccessibilityLifecycleTest.java
index 22adefd..e48818a 100644
--- a/v7/recyclerview/tests/src/android/support/v7/widget/RecyclerViewAccessibilityLifecycleTest.java
+++ b/v7/recyclerview/tests/src/android/support/v7/widget/RecyclerViewAccessibilityLifecycleTest.java
@@ -18,16 +18,26 @@
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.mockito.Matchers.anyInt;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import android.annotation.TargetApi;
+import android.content.Context;
import android.os.Build;
import android.support.test.filters.MediumTest;
import android.support.test.filters.SdkSuppress;
import android.support.test.runner.AndroidJUnit4;
import android.support.v4.view.ViewCompat;
+import android.view.View;
import android.view.ViewGroup;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.Mockito;
import java.util.ArrayList;
import java.util.Arrays;
@@ -91,6 +101,39 @@
assertThat(calledA11DuringLayout.get(), is(false));
}
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.JELLY_BEAN)
+ @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
+ @Test
+ public void processAllViewHolders() {
+ RecyclerView rv = new RecyclerView(getActivity());
+ rv.setLayoutManager(new LinearLayoutManager(getActivity()));
+ View itemView1 = spy(new View(getActivity()));
+ View itemView2 = spy(new View(getActivity()));
+ View itemView3 = spy(new View(getActivity()));
+
+ rv.addView(itemView1);
+ // do not add 2
+ rv.addView(itemView3);
+
+ RecyclerView.ViewHolder vh1 = new RecyclerView.ViewHolder(itemView1) {};
+ vh1.mPendingAccessibilityState = View.IMPORTANT_FOR_ACCESSIBILITY_YES;
+ RecyclerView.ViewHolder vh2 = new RecyclerView.ViewHolder(itemView2) {};
+ vh2.mPendingAccessibilityState = View.IMPORTANT_FOR_ACCESSIBILITY_YES;
+ RecyclerView.ViewHolder vh3 = new RecyclerView.ViewHolder(itemView3) {};
+ vh3.mPendingAccessibilityState = View.IMPORTANT_FOR_ACCESSIBILITY_AUTO;
+
+ rv.mPendingAccessibilityImportanceChange.add(vh1);
+ rv.mPendingAccessibilityImportanceChange.add(vh2);
+ rv.mPendingAccessibilityImportanceChange.add(vh3);
+ rv.dispatchPendingImportantForAccessibilityChanges();
+
+ verify(itemView1).setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
+ //noinspection WrongConstant
+ verify(itemView2, never()).setImportantForAccessibility(anyInt());
+ verify(itemView3).setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_AUTO);
+ assertThat(rv.mPendingAccessibilityImportanceChange.size(), is(0));
+ }
+
public class LayoutAllLayoutManager extends TestLayoutManager {
private final boolean mAllowNullLayoutLatch;