Cleanup AccessibilityEventCompat and AccessibilityRecordCompat after minSdk 14 bump.
Bug: 32794064
Test: ./gradlew assemble
Change-Id: I5431e454e017deb7bf3f5a0779e5375416487e4f
diff --git a/api/current.txt b/api/current.txt
index 8d12577..83d059c 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -8116,13 +8116,13 @@
package android.support.v4.view.accessibility {
public final class AccessibilityEventCompat {
- method public static void appendRecord(android.view.accessibility.AccessibilityEvent, android.support.v4.view.accessibility.AccessibilityRecordCompat);
- method public static android.support.v4.view.accessibility.AccessibilityRecordCompat asRecord(android.view.accessibility.AccessibilityEvent);
+ method public static deprecated void appendRecord(android.view.accessibility.AccessibilityEvent, android.support.v4.view.accessibility.AccessibilityRecordCompat);
+ method public static deprecated android.support.v4.view.accessibility.AccessibilityRecordCompat asRecord(android.view.accessibility.AccessibilityEvent);
method public int getAction(android.view.accessibility.AccessibilityEvent);
method public static int getContentChangeTypes(android.view.accessibility.AccessibilityEvent);
method public int getMovementGranularity(android.view.accessibility.AccessibilityEvent);
- method public static android.support.v4.view.accessibility.AccessibilityRecordCompat getRecord(android.view.accessibility.AccessibilityEvent, int);
- method public static int getRecordCount(android.view.accessibility.AccessibilityEvent);
+ method public static deprecated android.support.v4.view.accessibility.AccessibilityRecordCompat getRecord(android.view.accessibility.AccessibilityEvent, int);
+ method public static deprecated int getRecordCount(android.view.accessibility.AccessibilityEvent);
method public void setAction(android.view.accessibility.AccessibilityEvent, int);
method public static void setContentChangeTypes(android.view.accessibility.AccessibilityEvent, int);
method public void setMovementGranularity(android.view.accessibility.AccessibilityEvent, int);
@@ -8135,20 +8135,20 @@
field public static final int TYPE_ASSIST_READING_CONTEXT = 16777216; // 0x1000000
field public static final int TYPE_GESTURE_DETECTION_END = 524288; // 0x80000
field public static final int TYPE_GESTURE_DETECTION_START = 262144; // 0x40000
- field public static final int TYPE_TOUCH_EXPLORATION_GESTURE_END = 1024; // 0x400
- field public static final int TYPE_TOUCH_EXPLORATION_GESTURE_START = 512; // 0x200
+ field public static final deprecated int TYPE_TOUCH_EXPLORATION_GESTURE_END = 1024; // 0x400
+ field public static final deprecated int TYPE_TOUCH_EXPLORATION_GESTURE_START = 512; // 0x200
field public static final int TYPE_TOUCH_INTERACTION_END = 2097152; // 0x200000
field public static final int TYPE_TOUCH_INTERACTION_START = 1048576; // 0x100000
field public static final int TYPE_VIEW_ACCESSIBILITY_FOCUSED = 32768; // 0x8000
field public static final int TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED = 65536; // 0x10000
field public static final int TYPE_VIEW_CONTEXT_CLICKED = 8388608; // 0x800000
- field public static final int TYPE_VIEW_HOVER_ENTER = 128; // 0x80
- field public static final int TYPE_VIEW_HOVER_EXIT = 256; // 0x100
- field public static final int TYPE_VIEW_SCROLLED = 4096; // 0x1000
- field public static final int TYPE_VIEW_TEXT_SELECTION_CHANGED = 8192; // 0x2000
+ field public static final deprecated int TYPE_VIEW_HOVER_ENTER = 128; // 0x80
+ field public static final deprecated int TYPE_VIEW_HOVER_EXIT = 256; // 0x100
+ field public static final deprecated int TYPE_VIEW_SCROLLED = 4096; // 0x1000
+ field public static final deprecated int TYPE_VIEW_TEXT_SELECTION_CHANGED = 8192; // 0x2000
field public static final int TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY = 131072; // 0x20000
field public static final int TYPE_WINDOWS_CHANGED = 4194304; // 0x400000
- field public static final int TYPE_WINDOW_CONTENT_CHANGED = 2048; // 0x800
+ field public static final deprecated int TYPE_WINDOW_CONTENT_CHANGED = 2048; // 0x800
}
public final class AccessibilityManagerCompat {
@@ -8419,53 +8419,58 @@
public class AccessibilityRecordCompat {
ctor public deprecated AccessibilityRecordCompat(java.lang.Object);
- method public int getAddedCount();
- method public java.lang.CharSequence getBeforeText();
- method public java.lang.CharSequence getClassName();
- method public java.lang.CharSequence getContentDescription();
- method public int getCurrentItemIndex();
- method public int getFromIndex();
+ method public deprecated int getAddedCount();
+ method public deprecated java.lang.CharSequence getBeforeText();
+ method public deprecated java.lang.CharSequence getClassName();
+ method public deprecated java.lang.CharSequence getContentDescription();
+ method public deprecated int getCurrentItemIndex();
+ method public deprecated int getFromIndex();
method public deprecated java.lang.Object getImpl();
- method public int getItemCount();
- method public int getMaxScrollX();
- method public int getMaxScrollY();
- method public android.os.Parcelable getParcelableData();
- method public int getRemovedCount();
- method public int getScrollX();
- method public int getScrollY();
- method public android.support.v4.view.accessibility.AccessibilityNodeInfoCompat getSource();
- method public java.util.List<java.lang.CharSequence> getText();
- method public int getToIndex();
- method public int getWindowId();
- method public boolean isChecked();
- method public boolean isEnabled();
- method public boolean isFullScreen();
- method public boolean isPassword();
- method public boolean isScrollable();
- method public static android.support.v4.view.accessibility.AccessibilityRecordCompat obtain(android.support.v4.view.accessibility.AccessibilityRecordCompat);
- method public static android.support.v4.view.accessibility.AccessibilityRecordCompat obtain();
- method public void recycle();
- method public void setAddedCount(int);
- method public void setBeforeText(java.lang.CharSequence);
- method public void setChecked(boolean);
- method public void setClassName(java.lang.CharSequence);
- method public void setContentDescription(java.lang.CharSequence);
- method public void setCurrentItemIndex(int);
- method public void setEnabled(boolean);
- method public void setFromIndex(int);
- method public void setFullScreen(boolean);
- method public void setItemCount(int);
- method public void setMaxScrollX(int);
- method public void setMaxScrollY(int);
- method public void setParcelableData(android.os.Parcelable);
- method public void setPassword(boolean);
- method public void setRemovedCount(int);
- method public void setScrollX(int);
- method public void setScrollY(int);
- method public void setScrollable(boolean);
- method public void setSource(android.view.View);
- method public void setSource(android.view.View, int);
- method public void setToIndex(int);
+ method public deprecated int getItemCount();
+ method public deprecated int getMaxScrollX();
+ method public static int getMaxScrollX(android.view.accessibility.AccessibilityRecord);
+ method public deprecated int getMaxScrollY();
+ method public static int getMaxScrollY(android.view.accessibility.AccessibilityRecord);
+ method public deprecated android.os.Parcelable getParcelableData();
+ method public deprecated int getRemovedCount();
+ method public deprecated int getScrollX();
+ method public deprecated int getScrollY();
+ method public deprecated android.support.v4.view.accessibility.AccessibilityNodeInfoCompat getSource();
+ method public deprecated java.util.List<java.lang.CharSequence> getText();
+ method public deprecated int getToIndex();
+ method public deprecated int getWindowId();
+ method public deprecated boolean isChecked();
+ method public deprecated boolean isEnabled();
+ method public deprecated boolean isFullScreen();
+ method public deprecated boolean isPassword();
+ method public deprecated boolean isScrollable();
+ method public static deprecated android.support.v4.view.accessibility.AccessibilityRecordCompat obtain(android.support.v4.view.accessibility.AccessibilityRecordCompat);
+ method public static deprecated android.support.v4.view.accessibility.AccessibilityRecordCompat obtain();
+ method public deprecated void recycle();
+ method public deprecated void setAddedCount(int);
+ method public deprecated void setBeforeText(java.lang.CharSequence);
+ method public deprecated void setChecked(boolean);
+ method public deprecated void setClassName(java.lang.CharSequence);
+ method public deprecated void setContentDescription(java.lang.CharSequence);
+ method public deprecated void setCurrentItemIndex(int);
+ method public deprecated void setEnabled(boolean);
+ method public deprecated void setFromIndex(int);
+ method public deprecated void setFullScreen(boolean);
+ method public deprecated void setItemCount(int);
+ method public deprecated void setMaxScrollX(int);
+ method public static void setMaxScrollX(android.view.accessibility.AccessibilityRecord, int);
+ method public deprecated void setMaxScrollY(int);
+ method public static void setMaxScrollY(android.view.accessibility.AccessibilityRecord, int);
+ method public deprecated void setParcelableData(android.os.Parcelable);
+ method public deprecated void setPassword(boolean);
+ method public deprecated void setRemovedCount(int);
+ method public deprecated void setScrollX(int);
+ method public deprecated void setScrollY(int);
+ method public deprecated void setScrollable(boolean);
+ method public deprecated void setSource(android.view.View);
+ method public deprecated void setSource(android.view.View, int);
+ method public static void setSource(android.view.accessibility.AccessibilityRecord, android.view.View, int);
+ method public deprecated void setToIndex(int);
}
public class AccessibilityWindowInfoCompat {
diff --git a/compat/Android.mk b/compat/Android.mk
index f3f7ef3..95b241e 100644
--- a/compat/Android.mk
+++ b/compat/Android.mk
@@ -28,7 +28,6 @@
LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/java
LOCAL_SRC_FILES := \
$(call all-java-files-under,ics) \
- $(call all-java-files-under,ics-mr1) \
$(call all-java-files-under,jellybean) \
$(call all-java-files-under,jellybean-mr1) \
$(call all-java-files-under,jellybean-mr2) \
diff --git a/compat/build.gradle b/compat/build.gradle
index dbaac46..ddee41d 100644
--- a/compat/build.gradle
+++ b/compat/build.gradle
@@ -23,7 +23,6 @@
sourceSets {
main.java.srcDirs = [
'ics',
- 'ics-mr1',
'jellybean',
'jellybean-mr1',
'jellybean-mr2',
diff --git a/compat/ics-mr1/android/support/v4/view/accessibility/AccessibilityRecordCompatIcsMr1.java b/compat/ics-mr1/android/support/v4/view/accessibility/AccessibilityRecordCompatIcsMr1.java
deleted file mode 100644
index 103eadc..0000000
--- a/compat/ics-mr1/android/support/v4/view/accessibility/AccessibilityRecordCompatIcsMr1.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2011 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.view.accessibility;
-
-import android.support.annotation.RequiresApi;
-import android.view.accessibility.AccessibilityRecord;
-
-/**
- * ICS MR1 specific AccessibilityRecord API implementation.
- */
-
-@RequiresApi(15)
-class AccessibilityRecordCompatIcsMr1 {
-
- public static int getMaxScrollX(Object record) {
- return ((AccessibilityRecord) record).getMaxScrollX();
- }
-
- public static int getMaxScrollY(Object record) {
- return ((AccessibilityRecord) record).getMaxScrollY();
- }
- public static void setMaxScrollX(Object record, int maxScrollX) {
- ((AccessibilityRecord) record).setMaxScrollX(maxScrollX);
- }
-
- public static void setMaxScrollY(Object record, int maxScrollY) {
- ((AccessibilityRecord) record).setMaxScrollY(maxScrollY);
- }
-}
diff --git a/compat/ics/android/support/v4/view/accessibility/AccessibilityEventCompatIcs.java b/compat/ics/android/support/v4/view/accessibility/AccessibilityEventCompatIcs.java
deleted file mode 100644
index b2cb068..0000000
--- a/compat/ics/android/support/v4/view/accessibility/AccessibilityEventCompatIcs.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2011 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.view.accessibility;
-
-import android.support.annotation.RequiresApi;
-import android.view.accessibility.AccessibilityEvent;
-import android.view.accessibility.AccessibilityRecord;
-
-/**
- * ICS specific AccessibilityEvent API implementation.
- */
-
-@RequiresApi(14)
-class AccessibilityEventCompatIcs {
-
- public static int getRecordCount(AccessibilityEvent event) {
- return event.getRecordCount();
- }
-
- public static void appendRecord(AccessibilityEvent event, Object record) {
- event.appendRecord((AccessibilityRecord) record);
- }
-
- public static Object getRecord(AccessibilityEvent event, int index) {
- return event.getRecord(index);
- }
-
- public static void setScrollable(AccessibilityEvent event, boolean scrollable) {
- event.setScrollable(scrollable);
- }
-}
diff --git a/compat/ics/android/support/v4/view/accessibility/AccessibilityRecordCompatIcs.java b/compat/ics/android/support/v4/view/accessibility/AccessibilityRecordCompatIcs.java
deleted file mode 100644
index 9225ff7..0000000
--- a/compat/ics/android/support/v4/view/accessibility/AccessibilityRecordCompatIcs.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Copyright (C) 2011 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.view.accessibility;
-
-import android.os.Parcelable;
-import android.support.annotation.RequiresApi;
-import android.view.View;
-import android.view.accessibility.AccessibilityRecord;
-
-import java.util.List;
-
-/**
- * ICS specific AccessibilityRecord API implementation.
- */
-
-@RequiresApi(14)
-class AccessibilityRecordCompatIcs {
-
- public static Object obtain() {
- return AccessibilityRecord.obtain();
- }
-
- public static Object obtain(Object record) {
- return AccessibilityRecord.obtain((AccessibilityRecord) record);
- }
-
- public static int getAddedCount(Object record) {
- return ((AccessibilityRecord) record).getAddedCount();
- }
-
- public static CharSequence getBeforeText(Object record) {
- return ((AccessibilityRecord) record).getBeforeText();
- }
-
- public static CharSequence getClassName(Object record) {
- return ((AccessibilityRecord) record).getClassName();
- }
-
- public static CharSequence getContentDescription(Object record) {
- return ((AccessibilityRecord) record).getContentDescription();
- }
-
- public static int getCurrentItemIndex(Object record) {
- return ((AccessibilityRecord) record).getCurrentItemIndex();
- }
-
- public static int getFromIndex(Object record) {
- return ((AccessibilityRecord) record).getFromIndex();
- }
-
- public static int getItemCount(Object record) {
- return ((AccessibilityRecord) record).getItemCount();
- }
-
- public static Parcelable getParcelableData(Object record) {
- return ((AccessibilityRecord) record).getParcelableData();
- }
-
- public static int getRemovedCount(Object record) {
- return ((AccessibilityRecord) record).getRemovedCount();
- }
-
- public static int getScrollX(Object record) {
- return ((AccessibilityRecord) record).getScrollX();
- }
-
- public static int getScrollY(Object record) {
- return ((AccessibilityRecord) record).getScrollY();
- }
-
- public static Object getSource(Object record) {
- return ((AccessibilityRecord) record).getSource();
- }
-
- public static List<CharSequence> getText(Object record) {
- return ((AccessibilityRecord) record).getText();
- }
-
- public static int getToIndex(Object record) {
- return ((AccessibilityRecord) record).getToIndex();
- }
-
- public static int getWindowId(Object record) {
- return ((AccessibilityRecord) record).getWindowId();
- }
-
- public static boolean isChecked(Object record) {
- return ((AccessibilityRecord) record).isChecked();
- }
-
- public static boolean isEnabled(Object record) {
- return ((AccessibilityRecord) record).isEnabled();
- }
-
- public static boolean isFullScreen(Object record) {
- return ((AccessibilityRecord) record).isFullScreen();
- }
-
- public static boolean isPassword(Object record) {
- return ((AccessibilityRecord) record).isPassword();
- }
-
- public static boolean isScrollable(Object record) {
- return ((AccessibilityRecord) record).isScrollable();
- }
-
- public static void recycle(Object record) {
- ((AccessibilityRecord) record).recycle();
- }
-
- public static void setAddedCount(Object record, int addedCount) {
- ((AccessibilityRecord) record).setAddedCount(addedCount);
- }
-
- public static void setBeforeText(Object record, CharSequence beforeText) {
- ((AccessibilityRecord) record).setBeforeText(beforeText);
- }
-
- public static void setChecked(Object record, boolean isChecked) {
- ((AccessibilityRecord) record).setChecked(isChecked);
- }
-
- public static void setClassName(Object record, CharSequence className) {
- ((AccessibilityRecord) record).setClassName(className);
- }
-
- public static void setContentDescription(Object record, CharSequence contentDescription) {
- ((AccessibilityRecord) record).setContentDescription(contentDescription);
- }
-
- public static void setCurrentItemIndex(Object record, int currentItemIndex) {
- ((AccessibilityRecord) record).setCurrentItemIndex(currentItemIndex);
- }
-
- public static void setEnabled(Object record, boolean isEnabled) {
- ((AccessibilityRecord) record).setEnabled(isEnabled);
- }
-
- public static void setFromIndex(Object record, int fromIndex) {
- ((AccessibilityRecord) record).setFromIndex(fromIndex);
- }
-
- public static void setFullScreen(Object record, boolean isFullScreen) {
- ((AccessibilityRecord) record).setFullScreen(isFullScreen);
- }
-
- public static void setItemCount(Object record, int itemCount) {
- ((AccessibilityRecord) record).setItemCount(itemCount);
- }
-
- public static void setParcelableData(Object record, Parcelable parcelableData) {
- ((AccessibilityRecord) record).setParcelableData(parcelableData);
- }
-
- public static void setPassword(Object record, boolean isPassword) {
- ((AccessibilityRecord) record).setPassword(isPassword);
- }
-
- public static void setRemovedCount(Object record, int removedCount) {
- ((AccessibilityRecord) record).setRemovedCount(removedCount);
- }
-
- public static void setScrollX(Object record, int scrollX) {
- ((AccessibilityRecord) record).setScrollX(scrollX);
- }
-
- public static void setScrollY(Object record, int scrollY) {
- ((AccessibilityRecord) record).setScrollY(scrollY);
- }
-
- public static void setScrollable(Object record, boolean scrollable) {
- ((AccessibilityRecord) record).setScrollable(scrollable);
- }
-
- public static void setSource(Object record, View source) {
- ((AccessibilityRecord) record).setSource(source);
- }
-
- public static void setToIndex(Object record, int toIndex) {
- ((AccessibilityRecord) record).setToIndex(toIndex);
- }
-}
diff --git a/compat/java/android/support/v4/view/accessibility/AccessibilityEventCompat.java b/compat/java/android/support/v4/view/accessibility/AccessibilityEventCompat.java
index c06104b..61eff1c 100644
--- a/compat/java/android/support/v4/view/accessibility/AccessibilityEventCompat.java
+++ b/compat/java/android/support/v4/view/accessibility/AccessibilityEventCompat.java
@@ -19,175 +19,137 @@
import android.os.Build;
import android.support.annotation.RequiresApi;
import android.view.accessibility.AccessibilityEvent;
+import android.view.accessibility.AccessibilityRecord;
/**
- * Helper for accessing features in {@link AccessibilityEvent}
- * introduced after API level 4 in a backwards compatible fashion.
+ * Helper for accessing features in {@link AccessibilityEvent} in a backwards compatible fashion.
*/
public final class AccessibilityEventCompat {
- static interface AccessibilityEventVersionImpl {
- int getRecordCount(AccessibilityEvent event);
- void appendRecord(AccessibilityEvent event, Object record);
- Object getRecord(AccessibilityEvent event, int index);
- void setContentChangeTypes(AccessibilityEvent event, int types);
- int getContentChangeTypes(AccessibilityEvent event);
- public void setMovementGranularity(AccessibilityEvent event, int granularity);
- public int getMovementGranularity(AccessibilityEvent event);
- public void setAction(AccessibilityEvent event, int action);
- public int getAction(AccessibilityEvent event);
- }
-
- static class AccessibilityEventStubImpl implements AccessibilityEventVersionImpl {
-
- @Override
- public void appendRecord(AccessibilityEvent event, Object record) {
-
- }
-
- @Override
- public Object getRecord(AccessibilityEvent event, int index) {
- return null;
- }
-
- @Override
+ static class AccessibilityEventCompatBaseImpl {
public void setContentChangeTypes(AccessibilityEvent event, int types) {
-
}
- @Override
- public int getRecordCount(AccessibilityEvent event) {
- return 0;
- }
-
- @Override
public int getContentChangeTypes(AccessibilityEvent event) {
return 0;
}
- @Override
public void setMovementGranularity(AccessibilityEvent event, int granularity) {
}
- @Override
public int getMovementGranularity(AccessibilityEvent event) {
return 0;
}
- @Override
public void setAction(AccessibilityEvent event, int action) {
}
- @Override
public int getAction(AccessibilityEvent event) {
return 0;
}
}
- @RequiresApi(14)
- static class AccessibilityEventIcsImpl extends AccessibilityEventStubImpl {
-
- @Override
- public void appendRecord(AccessibilityEvent event, Object record) {
- AccessibilityEventCompatIcs.appendRecord(event, record);
- }
-
- @Override
- public Object getRecord(AccessibilityEvent event, int index) {
- return AccessibilityEventCompatIcs.getRecord(event, index);
- }
-
- @Override
- public int getRecordCount(AccessibilityEvent event) {
- return AccessibilityEventCompatIcs.getRecordCount(event);
- }
- }
-
@RequiresApi(16)
- static class AccessibilityEventJellyBeanImpl extends AccessibilityEventIcsImpl {
+ static class AccessibilityEventCompatApi16Impl extends AccessibilityEventCompatBaseImpl {
@Override
public void setMovementGranularity(AccessibilityEvent event, int granularity) {
- AccessibilityEventCompatJellyBean.setMovementGranularity(event, granularity);
+ event.setMovementGranularity(granularity);
}
@Override
public int getMovementGranularity(AccessibilityEvent event) {
- return AccessibilityEventCompatJellyBean.getMovementGranularity(event);
+ return event.getMovementGranularity();
}
@Override
public void setAction(AccessibilityEvent event, int action) {
- AccessibilityEventCompatJellyBean.setAction(event, action);
+ event.setAction(action);
}
@Override
public int getAction(AccessibilityEvent event) {
- return AccessibilityEventCompatJellyBean.getAction(event);
+ return event.getAction();
}
}
@RequiresApi(19)
- static class AccessibilityEventKitKatImpl extends AccessibilityEventJellyBeanImpl {
+ static class AccessibilityEventCompatApi19Impl extends AccessibilityEventCompatApi16Impl {
@Override
public void setContentChangeTypes(AccessibilityEvent event, int types) {
- AccessibilityEventCompatKitKat.setContentChangeTypes(event, types);
+ event.setContentChangeTypes(types);
}
@Override
public int getContentChangeTypes(AccessibilityEvent event) {
- return AccessibilityEventCompatKitKat.getContentChangeTypes(event);
+ return event.getContentChangeTypes();
}
}
- private final static AccessibilityEventVersionImpl IMPL;
+ private static final AccessibilityEventCompatBaseImpl IMPL;
static {
if (Build.VERSION.SDK_INT >= 19) { // KitKat
- IMPL = new AccessibilityEventKitKatImpl();
+ IMPL = new AccessibilityEventCompatApi19Impl();
} else if (Build.VERSION.SDK_INT >= 16) { // Jellybean
- IMPL = new AccessibilityEventJellyBeanImpl();
- } else if (Build.VERSION.SDK_INT >= 14) { // ICS
- IMPL = new AccessibilityEventIcsImpl();
+ IMPL = new AccessibilityEventCompatApi16Impl();
} else {
- IMPL = new AccessibilityEventStubImpl();
+ IMPL = new AccessibilityEventCompatBaseImpl();
}
}
/**
* Represents the event of a hover enter over a {@link android.view.View}.
+ * @deprecated Use {@link AccessibilityEvent#TYPE_VIEW_HOVER_ENTER} directly.
*/
- public static final int TYPE_VIEW_HOVER_ENTER = 0x00000080;
+ @Deprecated
+ public static final int TYPE_VIEW_HOVER_ENTER = AccessibilityEvent.TYPE_VIEW_HOVER_ENTER;
/**
* Represents the event of a hover exit over a {@link android.view.View}.
+ * @deprecated Use {@link AccessibilityEvent#TYPE_VIEW_HOVER_EXIT} directly.
*/
- public static final int TYPE_VIEW_HOVER_EXIT = 0x00000100;
+ @Deprecated
+ public static final int TYPE_VIEW_HOVER_EXIT = AccessibilityEvent.TYPE_VIEW_HOVER_EXIT;
/**
* Represents the event of starting a touch exploration gesture.
+ * @deprecated Use {@link AccessibilityEvent#TYPE_TOUCH_EXPLORATION_GESTURE_START} directly.
*/
- public static final int TYPE_TOUCH_EXPLORATION_GESTURE_START = 0x00000200;
+ @Deprecated
+ public static final int TYPE_TOUCH_EXPLORATION_GESTURE_START =
+ AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_START;
/**
* Represents the event of ending a touch exploration gesture.
+ * @deprecated Use {@link AccessibilityEvent#TYPE_TOUCH_EXPLORATION_GESTURE_END} directly.
*/
- public static final int TYPE_TOUCH_EXPLORATION_GESTURE_END = 0x00000400;
+ @Deprecated
+ public static final int TYPE_TOUCH_EXPLORATION_GESTURE_END =
+ AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_END;
/**
* Represents the event of changing the content of a window.
+ * @deprecated Use {@link AccessibilityEvent#TYPE_WINDOW_CONTENT_CHANGED} directly.
*/
- public static final int TYPE_WINDOW_CONTENT_CHANGED = 0x00000800;
+ @Deprecated
+ public static final int TYPE_WINDOW_CONTENT_CHANGED =
+ AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED;
/**
* Represents the event of scrolling a view.
+ * @deprecated Use {@link AccessibilityEvent#TYPE_VIEW_SCROLLED} directly.
*/
- public static final int TYPE_VIEW_SCROLLED = 0x00001000;
+ @Deprecated
+ public static final int TYPE_VIEW_SCROLLED = AccessibilityEvent.TYPE_VIEW_SCROLLED;
/**
* Represents the event of changing the selection in an {@link android.widget.EditText}.
+ * @deprecated Use {@link AccessibilityEvent#TYPE_VIEW_TEXT_SELECTION_CHANGED} directly.
*/
- public static final int TYPE_VIEW_TEXT_SELECTION_CHANGED = 0x00002000;
+ @Deprecated
+ public static final int TYPE_VIEW_TEXT_SELECTION_CHANGED =
+ AccessibilityEvent.TYPE_VIEW_TEXT_SELECTION_CHANGED;
/**
* Represents the event of an application making an announcement.
@@ -278,19 +240,22 @@
* @see AccessibilityEvent#TYPE_VIEW_TEXT_CHANGED
* @see AccessibilityEvent#TYPE_WINDOW_STATE_CHANGED
* @see AccessibilityEvent#TYPE_NOTIFICATION_STATE_CHANGED
- * @see #TYPE_VIEW_HOVER_ENTER
- * @see #TYPE_VIEW_HOVER_EXIT
- * @see #TYPE_TOUCH_EXPLORATION_GESTURE_START
- * @see #TYPE_TOUCH_EXPLORATION_GESTURE_END
- * @see #TYPE_WINDOW_CONTENT_CHANGED
- * @see #TYPE_VIEW_SCROLLED
- * @see #TYPE_VIEW_TEXT_SELECTION_CHANGED
+ * @see AccessibilityEvent#TYPE_VIEW_HOVER_ENTER
+ * @see AccessibilityEvent#TYPE_VIEW_HOVER_EXIT
+ * @see AccessibilityEvent#TYPE_TOUCH_EXPLORATION_GESTURE_START
+ * @see AccessibilityEvent#TYPE_TOUCH_EXPLORATION_GESTURE_END
+ * @see AccessibilityEvent#TYPE_WINDOW_CONTENT_CHANGED
+ * @see AccessibilityEvent#TYPE_VIEW_SCROLLED
+ * @see AccessibilityEvent#TYPE_VIEW_TEXT_SELECTION_CHANGED
* @see #TYPE_ANNOUNCEMENT
* @see #TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY
* @see #TYPE_GESTURE_DETECTION_START
* @see #TYPE_GESTURE_DETECTION_END
* @see #TYPE_TOUCH_INTERACTION_START
* @see #TYPE_TOUCH_INTERACTION_END
+ * @see #TYPE_WINDOWS_CHANGED
+ * @see #TYPE_VIEW_CONTEXT_CLICKED
+ * @see #TYPE_ASSIST_READING_CONTEXT
*/
public static final int TYPES_ALL_MASK = 0xFFFFFFFF;
@@ -305,9 +270,12 @@
* Gets the number of records contained in the event.
*
* @return The number of records.
+ *
+ * @deprecated Use {@link AccessibilityEvent#getRecordCount()} directly.
*/
+ @Deprecated
public static int getRecordCount(AccessibilityEvent event) {
- return IMPL.getRecordCount(event);
+ return event.getRecordCount();
}
/**
@@ -317,9 +285,12 @@
* @param record The record to append.
*
* @throws IllegalStateException If called from an AccessibilityService.
+ *
+ * @deprecated Use {@link AccessibilityEvent#appendRecord(AccessibilityRecord)} directly.
*/
+ @Deprecated
public static void appendRecord(AccessibilityEvent event, AccessibilityRecordCompat record) {
- IMPL.appendRecord(event, record.getImpl());
+ event.appendRecord((AccessibilityRecord) record.getImpl());
}
/**
@@ -327,9 +298,12 @@
*
* @param index The index.
* @return The record at the specified index.
+ *
+ * @deprecated Use {@link AccessibilityEvent#getRecord(int)} directly.
*/
+ @Deprecated
public static AccessibilityRecordCompat getRecord(AccessibilityEvent event, int index) {
- return new AccessibilityRecordCompat(IMPL.getRecord(event, index));
+ return new AccessibilityRecordCompat(event.getRecord(index));
}
/**
@@ -344,7 +318,10 @@
*
* @param event The from which to create a record.
* @return An {@link AccessibilityRecordCompat}.
+ *
+ * @deprecated Use the {@link AccessibilityEvent} directly as {@link AccessibilityRecord}.
*/
+ @Deprecated
public static AccessibilityRecordCompat asRecord(AccessibilityEvent event) {
return new AccessibilityRecordCompat(event);
}
diff --git a/compat/java/android/support/v4/view/accessibility/AccessibilityRecordCompat.java b/compat/java/android/support/v4/view/accessibility/AccessibilityRecordCompat.java
index 695be96..ca29ef3 100644
--- a/compat/java/android/support/v4/view/accessibility/AccessibilityRecordCompat.java
+++ b/compat/java/android/support/v4/view/accessibility/AccessibilityRecordCompat.java
@@ -18,555 +18,82 @@
import android.os.Build;
import android.os.Parcelable;
+import android.support.annotation.NonNull;
import android.support.annotation.RequiresApi;
import android.view.View;
import android.view.accessibility.AccessibilityEvent;
+import android.view.accessibility.AccessibilityRecord;
-import java.util.Collections;
import java.util.List;
/**
- * Helper for accessing {@link android.view.accessibility.AccessibilityRecord}
- * introduced after API level 4 in a backwards compatible fashion.
+ * Helper for accessing {@link AccessibilityRecord} in a backwards compatible fashion.
*/
public class AccessibilityRecordCompat {
- static interface AccessibilityRecordImpl {
- public Object obtain();
- public Object obtain(Object record);
- public void setSource(Object record, View source);
- public void setSource(Object record, View root, int virtualDescendantId);
- public AccessibilityNodeInfoCompat getSource(Object record);
- public int getWindowId(Object record);
- public boolean isChecked(Object record);
- public void setChecked(Object record, boolean isChecked);
- public boolean isEnabled(Object record);
- public void setEnabled(Object record, boolean isEnabled);
- public boolean isPassword(Object record);
- public void setPassword(Object record, boolean isPassword);
- public boolean isFullScreen(Object record);
- public void setFullScreen(Object record, boolean isFullScreen);
- public boolean isScrollable(Object record);
- public void setScrollable(Object record, boolean scrollable);
- public int getItemCount(Object record);
- public void setItemCount(Object record, int itemCount);
- public int getCurrentItemIndex(Object record);
- public void setCurrentItemIndex(Object record, int currentItemIndex);
- public int getFromIndex(Object record);
- public void setFromIndex(Object record, int fromIndex);
- public int getToIndex(Object record);
- public void setToIndex(Object record, int toIndex);
- public int getScrollX(Object record);
- public void setScrollX(Object record, int scrollX);
- public int getScrollY(Object record);
- public void setScrollY(Object record, int scrollY);
- public int getMaxScrollX(Object record);
- public void setMaxScrollX(Object record, int maxScrollX);
- public int getMaxScrollY(Object record);
- public void setMaxScrollY(Object record, int maxScrollY);
- public int getAddedCount(Object record);
- public void setAddedCount(Object record, int addedCount);
- public int getRemovedCount(Object record);
- public void setRemovedCount(Object record, int removedCount);
- public CharSequence getClassName(Object record);
- public void setClassName(Object record, CharSequence className);
- public List<CharSequence> getText(Object record);
- public CharSequence getBeforeText(Object record);
- public void setBeforeText(Object record, CharSequence beforeText);
- public CharSequence getContentDescription(Object record);
- public void setContentDescription(Object record, CharSequence contentDescription);
- public Parcelable getParcelableData(Object record);
- public void setParcelableData(Object record, Parcelable parcelableData);
- public void recycle(Object record);
- }
-
- static class AccessibilityRecordStubImpl implements AccessibilityRecordImpl {
- @Override
- public Object obtain() {
- return null;
- }
-
- @Override
- public Object obtain(Object record) {
- return null;
- }
-
- @Override
- public int getAddedCount(Object record) {
+ static class AccessibilityRecordCompatBaseImpl {
+ public int getMaxScrollX(AccessibilityRecord record) {
return 0;
}
- @Override
- public CharSequence getBeforeText(Object record) {
- return null;
- }
-
- @Override
- public CharSequence getClassName(Object record) {
- return null;
- }
-
- @Override
- public CharSequence getContentDescription(Object record) {
- return null;
- }
-
- @Override
- public int getCurrentItemIndex(Object record) {
+ public int getMaxScrollY(AccessibilityRecord record) {
return 0;
}
- @Override
- public int getFromIndex(Object record) {
- return 0;
+ public void setMaxScrollX(AccessibilityRecord record, int maxScrollX) {
}
- @Override
- public int getItemCount(Object record) {
- return 0;
+ public void setMaxScrollY(AccessibilityRecord record, int maxScrollY) {
}
- @Override
- public int getMaxScrollX(Object record) {
- return 0;
- }
-
- @Override
- public int getMaxScrollY(Object record) {
- return 0;
- }
-
- @Override
- public Parcelable getParcelableData(Object record) {
- return null;
- }
-
- @Override
- public int getRemovedCount(Object record) {
- return 0;
- }
-
- @Override
- public int getScrollX(Object record) {
- return 0;
- }
-
- @Override
- public int getScrollY(Object record) {
- return 0;
- }
-
- @Override
- public AccessibilityNodeInfoCompat getSource(Object record) {
- return null;
- }
-
- @Override
- public List<CharSequence> getText(Object record) {
- return Collections.emptyList();
- }
-
- @Override
- public int getToIndex(Object record) {
- return 0;
- }
-
- @Override
- public int getWindowId(Object record) {
- return 0;
- }
-
- @Override
- public boolean isChecked(Object record) {
- return false;
- }
-
- @Override
- public boolean isEnabled(Object record) {
- return false;
- }
-
- @Override
- public boolean isFullScreen(Object record) {
- return false;
- }
-
- @Override
- public boolean isPassword(Object record) {
- return false;
- }
-
- @Override
- public boolean isScrollable(Object record) {
- return false;
- }
-
- @Override
- public void recycle(Object record) {
-
- }
-
- @Override
- public void setAddedCount(Object record, int addedCount) {
-
- }
-
- @Override
- public void setBeforeText(Object record, CharSequence beforeText) {
-
- }
-
- @Override
- public void setChecked(Object record, boolean isChecked) {
-
- }
-
- @Override
- public void setClassName(Object record, CharSequence className) {
-
- }
-
- @Override
- public void setContentDescription(Object record, CharSequence contentDescription) {
-
- }
-
- @Override
- public void setCurrentItemIndex(Object record, int currentItemIndex) {
-
- }
-
- @Override
- public void setEnabled(Object record, boolean isEnabled) {
-
- }
-
- @Override
- public void setFromIndex(Object record, int fromIndex) {
-
- }
-
- @Override
- public void setFullScreen(Object record, boolean isFullScreen) {
-
- }
-
- @Override
- public void setItemCount(Object record, int itemCount) {
-
- }
-
- @Override
- public void setMaxScrollX(Object record, int maxScrollX) {
-
- }
-
- @Override
- public void setMaxScrollY(Object record, int maxScrollY) {
-
- }
-
- @Override
- public void setParcelableData(Object record, Parcelable parcelableData) {
-
- }
-
- @Override
- public void setPassword(Object record, boolean isPassword) {
-
- }
-
- @Override
- public void setRemovedCount(Object record, int removedCount) {
-
- }
-
- @Override
- public void setScrollX(Object record, int scrollX) {
-
- }
-
- @Override
- public void setScrollY(Object record, int scrollY) {
-
- }
-
- @Override
- public void setScrollable(Object record, boolean scrollable) {
-
- }
-
- @Override
- public void setSource(Object record, View source) {
-
- }
-
- @Override
- public void setSource(Object record, View root, int virtualDescendantId) {
-
- }
-
- @Override
- public void setToIndex(Object record, int toIndex) {
-
- }
- }
-
- @RequiresApi(14)
- static class AccessibilityRecordIcsImpl extends AccessibilityRecordStubImpl {
- @Override
- public Object obtain() {
- return AccessibilityRecordCompatIcs.obtain();
- }
-
- @Override
- public Object obtain(Object record) {
- return AccessibilityRecordCompatIcs.obtain(record);
- }
-
- @Override
- public int getAddedCount(Object record) {
- return AccessibilityRecordCompatIcs.getAddedCount(record);
- }
-
- @Override
- public CharSequence getBeforeText(Object record) {
- return AccessibilityRecordCompatIcs.getBeforeText(record);
- }
-
- @Override
- public CharSequence getClassName(Object record) {
- return AccessibilityRecordCompatIcs.getClassName(record);
- }
-
- @Override
- public CharSequence getContentDescription(Object record) {
- return AccessibilityRecordCompatIcs.getContentDescription(record);
- }
-
- @Override
- public int getCurrentItemIndex(Object record) {
- return AccessibilityRecordCompatIcs.getCurrentItemIndex(record);
- }
-
- @Override
- public int getFromIndex(Object record) {
- return AccessibilityRecordCompatIcs.getFromIndex(record);
- }
-
- @Override
- public int getItemCount(Object record) {
- return AccessibilityRecordCompatIcs.getItemCount(record);
- }
-
- @Override
- public Parcelable getParcelableData(Object record) {
- return AccessibilityRecordCompatIcs.getParcelableData(record);
- }
-
- @Override
- public int getRemovedCount(Object record) {
- return AccessibilityRecordCompatIcs.getRemovedCount(record);
- }
-
- @Override
- public int getScrollX(Object record) {
- return AccessibilityRecordCompatIcs.getScrollX(record);
- }
-
- @Override
- public int getScrollY(Object record) {
- return AccessibilityRecordCompatIcs.getScrollY(record);
- }
-
- @Override
- public AccessibilityNodeInfoCompat getSource(Object record) {
- return AccessibilityNodeInfoCompat.wrapNonNullInstance(
- AccessibilityRecordCompatIcs.getSource(record));
- }
-
- @Override
- public List<CharSequence> getText(Object record) {
- return AccessibilityRecordCompatIcs.getText(record);
- }
-
- @Override
- public int getToIndex(Object record) {
- return AccessibilityRecordCompatIcs.getToIndex(record);
- }
-
- @Override
- public int getWindowId(Object record) {
- return AccessibilityRecordCompatIcs.getWindowId(record);
- }
-
- @Override
- public boolean isChecked(Object record) {
- return AccessibilityRecordCompatIcs.isChecked(record);
- }
-
- @Override
- public boolean isEnabled(Object record) {
- return AccessibilityRecordCompatIcs.isEnabled(record);
- }
-
- @Override
- public boolean isFullScreen(Object record) {
- return AccessibilityRecordCompatIcs.isFullScreen(record);
- }
-
- @Override
- public boolean isPassword(Object record) {
- return AccessibilityRecordCompatIcs.isPassword(record);
- }
-
- @Override
- public boolean isScrollable(Object record) {
- return AccessibilityRecordCompatIcs.isScrollable(record);
- }
-
- @Override
- public void recycle(Object record) {
- AccessibilityRecordCompatIcs.recycle(record);
- }
-
- @Override
- public void setAddedCount(Object record, int addedCount) {
- AccessibilityRecordCompatIcs.setAddedCount(record, addedCount);
- }
-
- @Override
- public void setBeforeText(Object record, CharSequence beforeText) {
- AccessibilityRecordCompatIcs.setBeforeText(record, beforeText);
- }
-
- @Override
- public void setChecked(Object record, boolean isChecked) {
- AccessibilityRecordCompatIcs.setChecked(record, isChecked);
- }
-
- @Override
- public void setClassName(Object record, CharSequence className) {
- AccessibilityRecordCompatIcs.setClassName(record, className);
- }
-
- @Override
- public void setContentDescription(Object record, CharSequence contentDescription) {
- AccessibilityRecordCompatIcs.setContentDescription(record, contentDescription);
- }
-
- @Override
- public void setCurrentItemIndex(Object record, int currentItemIndex) {
- AccessibilityRecordCompatIcs.setCurrentItemIndex(record, currentItemIndex);
- }
-
- @Override
- public void setEnabled(Object record, boolean isEnabled) {
- AccessibilityRecordCompatIcs.setEnabled(record, isEnabled);
- }
-
- @Override
- public void setFromIndex(Object record, int fromIndex) {
- AccessibilityRecordCompatIcs.setFromIndex(record, fromIndex);
- }
-
- @Override
- public void setFullScreen(Object record, boolean isFullScreen) {
- AccessibilityRecordCompatIcs.setFullScreen(record, isFullScreen);
- }
-
- @Override
- public void setItemCount(Object record, int itemCount) {
- AccessibilityRecordCompatIcs.setItemCount(record, itemCount);
- }
-
- @Override
- public void setParcelableData(Object record, Parcelable parcelableData) {
- AccessibilityRecordCompatIcs.setParcelableData(record, parcelableData);
- }
-
- @Override
- public void setPassword(Object record, boolean isPassword) {
- AccessibilityRecordCompatIcs.setPassword(record, isPassword);
- }
-
- @Override
- public void setRemovedCount(Object record, int removedCount) {
- AccessibilityRecordCompatIcs.setRemovedCount(record, removedCount);
- }
-
- @Override
- public void setScrollX(Object record, int scrollX) {
- AccessibilityRecordCompatIcs.setScrollX(record, scrollX);
- }
-
- @Override
- public void setScrollY(Object record, int scrollY) {
- AccessibilityRecordCompatIcs.setScrollY(record, scrollY);
- }
-
- @Override
- public void setScrollable(Object record, boolean scrollable) {
- AccessibilityRecordCompatIcs.setScrollable(record, scrollable);
- }
-
- @Override
- public void setSource(Object record, View source) {
- AccessibilityRecordCompatIcs.setSource(record, source);
- }
-
- @Override
- public void setToIndex(Object record, int toIndex) {
- AccessibilityRecordCompatIcs.setToIndex(record, toIndex);
+ public void setSource(AccessibilityRecord record, View root, int virtualDescendantId) {
}
}
@RequiresApi(15)
- static class AccessibilityRecordIcsMr1Impl extends AccessibilityRecordIcsImpl {
+ static class AccessibilityRecordCompatApi15Impl extends AccessibilityRecordCompatBaseImpl {
@Override
- public int getMaxScrollX(Object record) {
- return AccessibilityRecordCompatIcsMr1.getMaxScrollX(record);
+ public int getMaxScrollX(AccessibilityRecord record) {
+ return record.getMaxScrollX();
}
@Override
- public int getMaxScrollY(Object record) {
- return AccessibilityRecordCompatIcsMr1.getMaxScrollY(record);
+ public int getMaxScrollY(AccessibilityRecord record) {
+ return record.getMaxScrollY();
}
@Override
- public void setMaxScrollX(Object record, int maxScrollX) {
- AccessibilityRecordCompatIcsMr1.setMaxScrollX(record, maxScrollX);
+ public void setMaxScrollX(AccessibilityRecord record, int maxScrollX) {
+ record.setMaxScrollX(maxScrollX);
}
@Override
- public void setMaxScrollY(Object record, int maxScrollY) {
- AccessibilityRecordCompatIcsMr1.setMaxScrollY(record, maxScrollY);
+ public void setMaxScrollY(AccessibilityRecord record, int maxScrollY) {
+ record.setMaxScrollY(maxScrollY);
}
}
@RequiresApi(16)
- static class AccessibilityRecordJellyBeanImpl extends AccessibilityRecordIcsMr1Impl {
+ static class AccessibilityRecordCompatApi16Impl extends AccessibilityRecordCompatApi15Impl {
@Override
- public void setSource(Object record, View root, int virtualDescendantId) {
- AccessibilityRecordCompatJellyBean.setSource(record, root, virtualDescendantId);
+ public void setSource(AccessibilityRecord record, View root, int virtualDescendantId) {
+ record.setSource(root, virtualDescendantId);
}
}
static {
if (Build.VERSION.SDK_INT >= 16) { // JellyBean
- IMPL = new AccessibilityRecordJellyBeanImpl();
+ IMPL = new AccessibilityRecordCompatApi16Impl();
} else if (Build.VERSION.SDK_INT >= 15) { // ICS MR1
- IMPL = new AccessibilityRecordIcsMr1Impl();
- } else if (Build.VERSION.SDK_INT >= 14) { // ICS
- IMPL = new AccessibilityRecordIcsImpl();
+ IMPL = new AccessibilityRecordCompatApi15Impl();
} else {
- IMPL = new AccessibilityRecordStubImpl();
+ IMPL = new AccessibilityRecordCompatBaseImpl();
}
}
- private static final AccessibilityRecordImpl IMPL;
+ private static final AccessibilityRecordCompatBaseImpl IMPL;
- private final Object mRecord;
+ private final AccessibilityRecord mRecord;
/**
* @deprecated This is not type safe. If you want to modify an
@@ -577,7 +104,7 @@
*/
@Deprecated
public AccessibilityRecordCompat(Object record) {
- mRecord = record;
+ mRecord = (AccessibilityRecord) record;
}
/**
@@ -597,9 +124,12 @@
* given record.
*
* @return An instance.
+ *
+ * @deprecated Use {@link AccessibilityRecord#obtain(AccessibilityRecord)} directly.
*/
+ @Deprecated
public static AccessibilityRecordCompat obtain(AccessibilityRecordCompat record) {
- return new AccessibilityRecordCompat(IMPL.obtain(record.mRecord));
+ return new AccessibilityRecordCompat(AccessibilityRecord.obtain(record.mRecord));
}
/**
@@ -607,9 +137,12 @@
* instantiated.
*
* @return An instance.
+ *
+ * @deprecated Use {@link AccessibilityRecord#obtain()} directly.
*/
+ @Deprecated
public static AccessibilityRecordCompat obtain() {
- return new AccessibilityRecordCompat(IMPL.obtain());
+ return new AccessibilityRecordCompat(AccessibilityRecord.obtain());
}
/**
@@ -618,9 +151,12 @@
* @param source The source.
*
* @throws IllegalStateException If called from an AccessibilityService.
+ *
+ * @deprecated Use {@link AccessibilityRecord#setSource(View)} directly.
*/
+ @Deprecated
public void setSource(View source) {
- IMPL.setSource(mRecord, source);
+ mRecord.setSource(source);
}
/**
@@ -636,9 +172,32 @@
*
* @param root The root of the virtual subtree.
* @param virtualDescendantId The id of the virtual descendant.
+ *
+ * @deprecated Use {@link #setSource(AccessibilityRecord, View, int)} instead.
*/
+ @Deprecated
public void setSource(View root, int virtualDescendantId) {
- IMPL.setSource(mRecord, root, virtualDescendantId);
+ AccessibilityRecordCompat.setSource(mRecord, root, virtualDescendantId);
+ }
+
+ /**
+ * Sets the source to be a virtual descendant of the given <code>root</code>.
+ * If <code>virtualDescendantId</code> equals to {@link View#NO_ID} the root
+ * is set as the source.
+ * <p>
+ * A virtual descendant is an imaginary View that is reported as a part of the view
+ * hierarchy for accessibility purposes. This enables custom views that draw complex
+ * content to report them selves as a tree of virtual views, thus conveying their
+ * logical structure.
+ * </p>
+ *
+ * @param record The {@link AccessibilityRecord} instance to use.
+ * @param root The root of the virtual subtree.
+ * @param virtualDescendantId The id of the virtual descendant.
+ */
+ public static void setSource(@NonNull AccessibilityRecord record, View root,
+ int virtualDescendantId) {
+ IMPL.setSource(record, root, virtualDescendantId);
}
/**
@@ -652,27 +211,36 @@
*</p>
*
* @return The info of the source.
+ *
+ * @deprecated Use {@link AccessibilityRecord#getSource()} directly.
*/
+ @Deprecated
public AccessibilityNodeInfoCompat getSource() {
- return IMPL.getSource(mRecord);
+ return AccessibilityNodeInfoCompat.wrapNonNullInstance(mRecord.getSource());
}
/**
* Gets the id of the window from which the event comes from.
*
* @return The window id.
+ *
+ * @deprecated Use {@link AccessibilityRecord#getWindowId()} directly.
*/
+ @Deprecated
public int getWindowId() {
- return IMPL.getWindowId(mRecord);
+ return mRecord.getWindowId();
}
/**
* Gets if the source is checked.
*
* @return True if the view is checked, false otherwise.
+ *
+ * @deprecated Use {@link AccessibilityRecord#isChecked()} directly.
*/
+ @Deprecated
public boolean isChecked() {
- return IMPL.isChecked(mRecord);
+ return mRecord.isChecked();
}
/**
@@ -681,18 +249,24 @@
* @param isChecked True if the view is checked, false otherwise.
*
* @throws IllegalStateException If called from an AccessibilityService.
+ *
+ * @deprecated Use {@link AccessibilityRecord#setChecked(boolean)} directly.
*/
+ @Deprecated
public void setChecked(boolean isChecked) {
- IMPL.setChecked(mRecord, isChecked);
+ mRecord.setChecked(isChecked);
}
/**
* Gets if the source is enabled.
*
* @return True if the view is enabled, false otherwise.
+ *
+ * @deprecated Use {@link AccessibilityRecord#isEnabled()} directly.
*/
+ @Deprecated
public boolean isEnabled() {
- return IMPL.isEnabled(mRecord);
+ return mRecord.isEnabled();
}
/**
@@ -701,18 +275,24 @@
* @param isEnabled True if the view is enabled, false otherwise.
*
* @throws IllegalStateException If called from an AccessibilityService.
+ *
+ * @deprecated Use {@link AccessibilityRecord#isEnabled()} directly.
*/
+ @Deprecated
public void setEnabled(boolean isEnabled) {
- IMPL.setEnabled(mRecord, isEnabled);
+ mRecord.setEnabled(isEnabled);
}
/**
* Gets if the source is a password field.
*
* @return True if the view is a password field, false otherwise.
+ *
+ * @deprecated Use {@link AccessibilityRecord#isPassword()} directly.
*/
+ @Deprecated
public boolean isPassword() {
- return IMPL.isPassword(mRecord);
+ return mRecord.isPassword();
}
/**
@@ -721,18 +301,24 @@
* @param isPassword True if the view is a password field, false otherwise.
*
* @throws IllegalStateException If called from an AccessibilityService.
+ *
+ * @deprecated Use {@link AccessibilityRecord#setPassword(boolean)} directly.
*/
+ @Deprecated
public void setPassword(boolean isPassword) {
- IMPL.setPassword(mRecord, isPassword);
+ mRecord.setPassword(isPassword);
}
/**
* Gets if the source is taking the entire screen.
*
* @return True if the source is full screen, false otherwise.
+ *
+ * @deprecated Use {@link AccessibilityRecord#isFullScreen()} directly.
*/
+ @Deprecated
public boolean isFullScreen() {
- return IMPL.isFullScreen(mRecord);
+ return mRecord.isFullScreen();
}
/**
@@ -741,18 +327,24 @@
* @param isFullScreen True if the source is full screen, false otherwise.
*
* @throws IllegalStateException If called from an AccessibilityService.
+ *
+ * @deprecated Use {@link AccessibilityRecord#setFullScreen(boolean)} directly.
*/
+ @Deprecated
public void setFullScreen(boolean isFullScreen) {
- IMPL.setFullScreen(mRecord, isFullScreen);
+ mRecord.setFullScreen(isFullScreen);
}
/**
* Gets if the source is scrollable.
*
* @return True if the source is scrollable, false otherwise.
+ *
+ * @deprecated Use {@link AccessibilityRecord#isScrollable()} directly.
*/
+ @Deprecated
public boolean isScrollable() {
- return IMPL.isScrollable(mRecord);
+ return mRecord.isScrollable();
}
/**
@@ -761,18 +353,24 @@
* @param scrollable True if the source is scrollable, false otherwise.
*
* @throws IllegalStateException If called from an AccessibilityService.
+ *
+ * @deprecated Use {@link AccessibilityRecord#setScrollable(boolean)} directly.
*/
+ @Deprecated
public void setScrollable(boolean scrollable) {
- IMPL.setScrollable(mRecord, scrollable);
+ mRecord.setScrollable(scrollable);
}
/**
* Gets the number of items that can be visited.
*
* @return The number of items.
+ *
+ * @deprecated Use {@link AccessibilityRecord#getItemCount()} directly.
*/
+ @Deprecated
public int getItemCount() {
- return IMPL.getItemCount(mRecord);
+ return mRecord.getItemCount();
}
/**
@@ -781,18 +379,24 @@
* @param itemCount The number of items.
*
* @throws IllegalStateException If called from an AccessibilityService.
+ *
+ * @deprecated Use {@link AccessibilityRecord#setItemCount(int)} directly.
*/
+ @Deprecated
public void setItemCount(int itemCount) {
- IMPL.setItemCount(mRecord, itemCount);
+ mRecord.setItemCount(itemCount);
}
/**
* Gets the index of the source in the list of items the can be visited.
*
* @return The current item index.
+ *
+ * @deprecated Use {@link AccessibilityRecord#getCurrentItemIndex()} directly.
*/
+ @Deprecated
public int getCurrentItemIndex() {
- return IMPL.getCurrentItemIndex(mRecord);
+ return mRecord.getCurrentItemIndex();
}
/**
@@ -801,9 +405,12 @@
* @param currentItemIndex The current item index.
*
* @throws IllegalStateException If called from an AccessibilityService.
+ *
+ * @deprecated Use {@link AccessibilityRecord#setCurrentItemIndex(int)} directly.
*/
+ @Deprecated
public void setCurrentItemIndex(int currentItemIndex) {
- IMPL.setCurrentItemIndex(mRecord, currentItemIndex);
+ mRecord.setCurrentItemIndex(currentItemIndex);
}
/**
@@ -813,9 +420,12 @@
*
* @return The index of the first character or selection
* start or the first visible item.
+ *
+ * @deprecated Use {@link AccessibilityRecord#getFromIndex()} directly.
*/
+ @Deprecated
public int getFromIndex() {
- return IMPL.getFromIndex(mRecord);
+ return mRecord.getFromIndex();
}
/**
@@ -827,9 +437,12 @@
* start or the first visible item.
*
* @throws IllegalStateException If called from an AccessibilityService.
+ *
+ * @deprecated Use {@link AccessibilityRecord#setFromIndex(int)} directly.
*/
+ @Deprecated
public void setFromIndex(int fromIndex) {
- IMPL.setFromIndex(mRecord, fromIndex);
+ mRecord.setFromIndex(fromIndex);
}
/**
@@ -837,9 +450,12 @@
* visible item when scrolling.
*
* @return The index of selection end or last item index.
+ *
+ * @deprecated Use {@link AccessibilityRecord#getToIndex()} directly.
*/
+ @Deprecated
public int getToIndex() {
- return IMPL.getToIndex(mRecord);
+ return mRecord.getToIndex();
}
/**
@@ -847,89 +463,160 @@
* visible item when scrolling.
*
* @param toIndex The index of selection end or last item index.
+ *
+ * @deprecated Use {@link AccessibilityRecord#setToIndex(int)} directly.
*/
+ @Deprecated
public void setToIndex(int toIndex) {
- IMPL.setToIndex(mRecord, toIndex);
+ mRecord.setToIndex(toIndex);
}
/**
* Gets the scroll offset of the source left edge in pixels.
*
* @return The scroll.
+ *
+ * @deprecated Use {@link AccessibilityRecord#getScrollX()} directly.
*/
+ @Deprecated
public int getScrollX() {
- return IMPL.getScrollX(mRecord);
+ return mRecord.getScrollX();
}
/**
* Sets the scroll offset of the source left edge in pixels.
*
* @param scrollX The scroll.
+ *
+ * @deprecated Use {@link AccessibilityRecord#setScrollX(int)} directly.
*/
+ @Deprecated
public void setScrollX(int scrollX) {
- IMPL.setScrollX(mRecord, scrollX);
+ mRecord.setScrollX(scrollX);
}
/**
* Gets the scroll offset of the source top edge in pixels.
*
* @return The scroll.
+ *
+ * @deprecated Use {@link AccessibilityRecord#getScrollY()} directly.
*/
+ @Deprecated
public int getScrollY() {
- return IMPL.getScrollY(mRecord);
+ return mRecord.getScrollY();
}
/**
* Sets the scroll offset of the source top edge in pixels.
*
* @param scrollY The scroll.
+ *
+ * @deprecated Use {@link AccessibilityRecord#setScrollY(int)} directly.
*/
+ @Deprecated
public void setScrollY(int scrollY) {
- IMPL.setScrollY(mRecord, scrollY);
+ mRecord.setScrollY(scrollY);
}
/**
* Gets the max scroll offset of the source left edge in pixels.
*
* @return The max scroll.
+ *
+ * @deprecated Use {@link #getMaxScrollX(AccessibilityRecord)} instead.
*/
+ @Deprecated
public int getMaxScrollX() {
- return IMPL.getMaxScrollX(mRecord);
+ return AccessibilityRecordCompat.getMaxScrollX(mRecord);
}
+
+ /**
+ * Gets the max scroll offset of the source left edge in pixels.
+ *
+ * @param record The {@link AccessibilityRecord} instance to use.
+ * @return The max scroll.
+ */
+ public static int getMaxScrollX(AccessibilityRecord record) {
+ return IMPL.getMaxScrollX(record);
+ }
+
/**
* Sets the max scroll offset of the source left edge in pixels.
*
* @param maxScrollX The max scroll.
+ *
+ * @deprecated Use {@link #setMaxScrollX(AccessibilityRecord, int)} instead.
*/
+ @Deprecated
public void setMaxScrollX(int maxScrollX) {
- IMPL.setMaxScrollX(mRecord, maxScrollX);
+ AccessibilityRecordCompat.setMaxScrollX(mRecord, maxScrollX);
+ }
+
+ /**
+ * Sets the max scroll offset of the source left edge in pixels.
+ *
+ * @param record The {@link AccessibilityRecord} instance to use.
+ * @param maxScrollX The max scroll.
+ */
+ public static void setMaxScrollX(AccessibilityRecord record, int maxScrollX) {
+ IMPL.setMaxScrollX(record, maxScrollX);
}
/**
* Gets the max scroll offset of the source top edge in pixels.
*
* @return The max scroll.
+ *
+ * @deprecated Use {@link #getMaxScrollY(AccessibilityRecord)} instead.
*/
+ @Deprecated
public int getMaxScrollY() {
- return IMPL.getMaxScrollY(mRecord);
+ return AccessibilityRecordCompat.getMaxScrollY(mRecord);
+ }
+
+ /**
+ * Gets the max scroll offset of the source top edge in pixels.
+ *
+ * @param record The {@link AccessibilityRecord} instance to use.
+ * @return The max scroll.
+ */
+ public static int getMaxScrollY(AccessibilityRecord record) {
+ return IMPL.getMaxScrollY(record);
}
/**
* Sets the max scroll offset of the source top edge in pixels.
*
* @param maxScrollY The max scroll.
+ *
+ * @deprecated Use {@link #setMaxScrollY(AccessibilityRecord, int)} instead.
*/
+ @Deprecated
public void setMaxScrollY(int maxScrollY) {
- IMPL.setMaxScrollY(mRecord, maxScrollY);
+ AccessibilityRecordCompat.setMaxScrollY(mRecord, maxScrollY);
+ }
+
+ /**
+ * Sets the max scroll offset of the source top edge in pixels.
+ *
+ * @param record The {@link AccessibilityRecord} instance to use.
+ * @param maxScrollY The max scroll.
+ */
+ public static void setMaxScrollY(AccessibilityRecord record, int maxScrollY) {
+ IMPL.setMaxScrollY(record, maxScrollY);
}
/**
* Gets the number of added characters.
*
* @return The number of added characters.
+ *
+ * @deprecated Use {@link AccessibilityRecord#getAddedCount()} directly.
*/
+ @Deprecated
public int getAddedCount() {
- return IMPL.getAddedCount(mRecord);
+ return mRecord.getAddedCount();
}
/**
@@ -938,18 +625,24 @@
* @param addedCount The number of added characters.
*
* @throws IllegalStateException If called from an AccessibilityService.
+ *
+ * @deprecated Use {@link AccessibilityRecord#setAddedCount(int)} directly.
*/
+ @Deprecated
public void setAddedCount(int addedCount) {
- IMPL.setAddedCount(mRecord, addedCount);
+ mRecord.setAddedCount(addedCount);
}
/**
* Gets the number of removed characters.
*
* @return The number of removed characters.
+ *
+ * @deprecated Use {@link AccessibilityRecord#getRemovedCount()} directly.
*/
+ @Deprecated
public int getRemovedCount() {
- return IMPL.getRemovedCount(mRecord);
+ return mRecord.getRemovedCount();
}
/**
@@ -958,18 +651,24 @@
* @param removedCount The number of removed characters.
*
* @throws IllegalStateException If called from an AccessibilityService.
+ *
+ * @deprecated Use {@link AccessibilityRecord#setRemovedCount(int)} directly.
*/
+ @Deprecated
public void setRemovedCount(int removedCount) {
- IMPL.setRemovedCount(mRecord, removedCount);
+ mRecord.setRemovedCount(removedCount);
}
/**
* Gets the class name of the source.
*
* @return The class name.
+ *
+ * @deprecated Use {@link AccessibilityRecord#getClassName()} directly.
*/
+ @Deprecated
public CharSequence getClassName() {
- return IMPL.getClassName(mRecord);
+ return mRecord.getClassName();
}
/**
@@ -978,9 +677,12 @@
* @param className The lass name.
*
* @throws IllegalStateException If called from an AccessibilityService.
+ *
+ * @deprecated Use {@link AccessibilityRecord#setClassName(CharSequence)} directly.
*/
+ @Deprecated
public void setClassName(CharSequence className) {
- IMPL.setClassName(mRecord, className);
+ mRecord.setClassName(className);
}
/**
@@ -988,18 +690,24 @@
* of the text. Specifically, the lower the index the higher the priority.
*
* @return The text.
+ *
+ * @deprecated Use {@link AccessibilityRecord#getText()} directly.
*/
+ @Deprecated
public List<CharSequence> getText() {
- return IMPL.getText(mRecord);
+ return mRecord.getText();
}
/**
* Sets the text before a change.
*
* @return The text before the change.
+ *
+ * @deprecated Use {@link AccessibilityRecord#getBeforeText()} directly.
*/
+ @Deprecated
public CharSequence getBeforeText() {
- return IMPL.getBeforeText(mRecord);
+ return mRecord.getBeforeText();
}
/**
@@ -1008,18 +716,24 @@
* @param beforeText The text before the change.
*
* @throws IllegalStateException If called from an AccessibilityService.
+ *
+ * @deprecated Use {@link AccessibilityRecord#setBeforeText(CharSequence)} directly.
*/
+ @Deprecated
public void setBeforeText(CharSequence beforeText) {
- IMPL.setBeforeText(mRecord, beforeText);
+ mRecord.setBeforeText(beforeText);
}
/**
* Gets the description of the source.
*
* @return The description.
+ *
+ * @deprecated Use {@link AccessibilityRecord#getContentDescription()} directly.
*/
+ @Deprecated
public CharSequence getContentDescription() {
- return IMPL.getContentDescription(mRecord);
+ return mRecord.getContentDescription();
}
/**
@@ -1028,18 +742,24 @@
* @param contentDescription The description.
*
* @throws IllegalStateException If called from an AccessibilityService.
+ *
+ * @deprecated Use {@link AccessibilityRecord#setContentDescription(CharSequence)} directly.
*/
+ @Deprecated
public void setContentDescription(CharSequence contentDescription) {
- IMPL.setContentDescription(mRecord, contentDescription);
+ mRecord.setContentDescription(contentDescription);
}
/**
* Gets the {@link Parcelable} data.
*
* @return The parcelable data.
+ *
+ * @deprecated Use {@link AccessibilityRecord#getParcelableData()} directly.
*/
+ @Deprecated
public Parcelable getParcelableData() {
- return IMPL.getParcelableData(mRecord);
+ return mRecord.getParcelableData();
}
/**
@@ -1048,9 +768,12 @@
* @param parcelableData The parcelable data.
*
* @throws IllegalStateException If called from an AccessibilityService.
+ *
+ * @deprecated Use {@link AccessibilityRecord#setParcelableData(Parcelable)} directly.
*/
+ @Deprecated
public void setParcelableData(Parcelable parcelableData) {
- IMPL.setParcelableData(mRecord, parcelableData);
+ mRecord.setParcelableData(parcelableData);
}
/**
@@ -1061,17 +784,27 @@
* </p>
*
* @throws IllegalStateException If the record is already recycled.
+ *
+ * @deprecated Use {@link AccessibilityRecord#recycle()} directly.
*/
+ @Deprecated
public void recycle() {
- IMPL.recycle(mRecord);
+ mRecord.recycle();
}
+ /**
+ * @deprecated Use {@link AccessibilityRecord#hashCode()} directly.
+ */
+ @Deprecated
@Override
public int hashCode() {
return (mRecord == null) ? 0 : mRecord.hashCode();
}
-
+ /**
+ * @deprecated Use {@link AccessibilityRecord} directly.
+ */
+ @Deprecated
@Override
public boolean equals(Object obj) {
if (this == obj) {
diff --git a/compat/jellybean/android/support/v4/view/accessibility/AccessibilityEventCompatJellyBean.java b/compat/jellybean/android/support/v4/view/accessibility/AccessibilityEventCompatJellyBean.java
deleted file mode 100644
index 673c2d2..0000000
--- a/compat/jellybean/android/support/v4/view/accessibility/AccessibilityEventCompatJellyBean.java
+++ /dev/null
@@ -1,39 +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.v4.view.accessibility;
-
-import android.support.annotation.RequiresApi;
-import android.view.accessibility.AccessibilityEvent;
-
-@RequiresApi(16)
-class AccessibilityEventCompatJellyBean {
- public static void setMovementGranularity(AccessibilityEvent event, int granularity) {
- event.setMovementGranularity(granularity);
- }
-
- public static int getMovementGranularity(AccessibilityEvent event) {
- return event.getMovementGranularity();
- }
-
- public static void setAction(AccessibilityEvent event, int action) {
- event.setAction(action);
- }
-
- public static int getAction(AccessibilityEvent event) {
- return event.getAction();
- }
-}
diff --git a/compat/jellybean/android/support/v4/view/accessibility/AccessibilityRecordCompatJellyBean.java b/compat/jellybean/android/support/v4/view/accessibility/AccessibilityRecordCompatJellyBean.java
deleted file mode 100644
index 3beddc6..0000000
--- a/compat/jellybean/android/support/v4/view/accessibility/AccessibilityRecordCompatJellyBean.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.support.v4.view.accessibility;
-
-import android.support.annotation.RequiresApi;
-import android.view.View;
-import android.view.accessibility.AccessibilityRecord;
-
-/**
- * JellyBean specific AccessibilityRecord API implementation.
- */
-
-@RequiresApi(16)
-class AccessibilityRecordCompatJellyBean {
-
- public static void setSource(Object record, View root, int virtualDescendantId) {
- ((AccessibilityRecord) record).setSource(root, virtualDescendantId);
- }
-}
diff --git a/compat/kitkat/android/support/v4/view/accessibility/AccessibilityEventCompatKitKat.java b/compat/kitkat/android/support/v4/view/accessibility/AccessibilityEventCompatKitKat.java
deleted file mode 100644
index dbabe2f..0000000
--- a/compat/kitkat/android/support/v4/view/accessibility/AccessibilityEventCompatKitKat.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.support.v4.view.accessibility;
-
-import android.support.annotation.RequiresApi;
-import android.view.accessibility.AccessibilityEvent;
-
-@RequiresApi(19)
-class AccessibilityEventCompatKitKat {
- public static void setContentChangeTypes(AccessibilityEvent event, int changeTypes) {
- event.setContentChangeTypes(changeTypes);
- }
-
- public static int getContentChangeTypes(AccessibilityEvent event) {
- return event.getContentChangeTypes();
- }
-}
diff --git a/core-ui/java/android/support/v4/view/ViewPager.java b/core-ui/java/android/support/v4/view/ViewPager.java
index bec05fe..d43233f 100644
--- a/core-ui/java/android/support/v4/view/ViewPager.java
+++ b/core-ui/java/android/support/v4/view/ViewPager.java
@@ -34,7 +34,6 @@
import android.support.v4.content.ContextCompat;
import android.support.v4.view.accessibility.AccessibilityEventCompat;
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
-import android.support.v4.view.accessibility.AccessibilityRecordCompat;
import android.util.AttributeSet;
import android.util.Log;
import android.view.FocusFinder;
@@ -3025,14 +3024,11 @@
public void onInitializeAccessibilityEvent(View host, AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(host, event);
event.setClassName(ViewPager.class.getName());
- final AccessibilityRecordCompat recordCompat =
- AccessibilityEventCompat.asRecord(event);
- recordCompat.setScrollable(canScroll());
- if (event.getEventType() == AccessibilityEventCompat.TYPE_VIEW_SCROLLED
- && mAdapter != null) {
- recordCompat.setItemCount(mAdapter.getCount());
- recordCompat.setFromIndex(mCurItem);
- recordCompat.setToIndex(mCurItem);
+ event.setScrollable(canScroll());
+ if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_SCROLLED && mAdapter != null) {
+ event.setItemCount(mAdapter.getCount());
+ event.setFromIndex(mCurItem);
+ event.setToIndex(mCurItem);
}
}
diff --git a/core-ui/java/android/support/v4/widget/ExploreByTouchHelper.java b/core-ui/java/android/support/v4/widget/ExploreByTouchHelper.java
index 1640100..840effb 100644
--- a/core-ui/java/android/support/v4/widget/ExploreByTouchHelper.java
+++ b/core-ui/java/android/support/v4/widget/ExploreByTouchHelper.java
@@ -38,6 +38,7 @@
import android.view.ViewParent;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
+import android.view.accessibility.AccessibilityRecord;
import java.util.ArrayList;
import java.util.List;
@@ -617,9 +618,9 @@
// Stay consistent with framework behavior by sending ENTER/EXIT pairs
// in reverse order. This is accurate as of API 18.
- sendEventForVirtualView(virtualViewId, AccessibilityEventCompat.TYPE_VIEW_HOVER_ENTER);
+ sendEventForVirtualView(virtualViewId, AccessibilityEvent.TYPE_VIEW_HOVER_ENTER);
sendEventForVirtualView(
- previousVirtualViewId, AccessibilityEventCompat.TYPE_VIEW_HOVER_EXIT);
+ previousVirtualViewId, AccessibilityEvent.TYPE_VIEW_HOVER_EXIT);
}
/**
@@ -674,16 +675,15 @@
*/
private AccessibilityEvent createEventForChild(int virtualViewId, int eventType) {
final AccessibilityEvent event = AccessibilityEvent.obtain(eventType);
- final AccessibilityRecordCompat record = AccessibilityEventCompat.asRecord(event);
final AccessibilityNodeInfoCompat node = obtainAccessibilityNodeInfo(virtualViewId);
// Allow the client to override these properties,
- record.getText().add(node.getText());
- record.setContentDescription(node.getContentDescription());
- record.setScrollable(node.isScrollable());
- record.setPassword(node.isPassword());
- record.setEnabled(node.isEnabled());
- record.setChecked(node.isChecked());
+ event.getText().add(node.getText());
+ event.setContentDescription(node.getContentDescription());
+ event.setScrollable(node.isScrollable());
+ event.setPassword(node.isPassword());
+ event.setEnabled(node.isEnabled());
+ event.setChecked(node.isChecked());
// Allow the client to populate the event.
onPopulateEventForVirtualView(virtualViewId, event);
@@ -695,8 +695,8 @@
}
// Don't allow the client to override these properties.
- record.setClassName(node.getClassName());
- record.setSource(mHost, virtualViewId);
+ event.setClassName(node.getClassName());
+ AccessibilityRecordCompat.setSource(event, mHost, virtualViewId);
event.setPackageName(mHost.getContext().getPackageName());
return event;
@@ -1102,7 +1102,7 @@
* <li>package name, set to the package of the host view's
* {@link Context}, see {@link AccessibilityEvent#setPackageName}
* <li>event source, set to the host view and virtual view identifier,
- * see {@link AccessibilityRecordCompat#setSource(View, int)}
+ * see {@link AccessibilityRecordCompat#setSource(AccessibilityRecord, View, int)}
* </ul>
*
* @param virtualViewId The virtual view id for the item for which to
diff --git a/core-ui/java/android/support/v4/widget/NestedScrollView.java b/core-ui/java/android/support/v4/widget/NestedScrollView.java
index d65a528..5e65526 100644
--- a/core-ui/java/android/support/v4/widget/NestedScrollView.java
+++ b/core-ui/java/android/support/v4/widget/NestedScrollView.java
@@ -35,7 +35,6 @@
import android.support.v4.view.NestedScrollingParentHelper;
import android.support.v4.view.ScrollingView;
import android.support.v4.view.ViewCompat;
-import android.support.v4.view.accessibility.AccessibilityEventCompat;
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
import android.support.v4.view.accessibility.AccessibilityRecordCompat;
import android.util.AttributeSet;
@@ -1945,13 +1944,12 @@
super.onInitializeAccessibilityEvent(host, event);
final NestedScrollView nsvHost = (NestedScrollView) host;
event.setClassName(ScrollView.class.getName());
- final AccessibilityRecordCompat record = AccessibilityEventCompat.asRecord(event);
final boolean scrollable = nsvHost.getScrollRange() > 0;
- record.setScrollable(scrollable);
- record.setScrollX(nsvHost.getScrollX());
- record.setScrollY(nsvHost.getScrollY());
- record.setMaxScrollX(nsvHost.getScrollX());
- record.setMaxScrollY(nsvHost.getScrollRange());
+ event.setScrollable(scrollable);
+ event.setScrollX(nsvHost.getScrollX());
+ event.setScrollY(nsvHost.getScrollY());
+ AccessibilityRecordCompat.setMaxScrollX(event, nsvHost.getScrollX());
+ AccessibilityRecordCompat.setMaxScrollY(event, nsvHost.getScrollRange());
}
}
}
diff --git a/v7/recyclerview/src/android/support/v7/widget/LinearLayoutManager.java b/v7/recyclerview/src/android/support/v7/widget/LinearLayoutManager.java
index b4419cc..e65dcde 100644
--- a/v7/recyclerview/src/android/support/v7/widget/LinearLayoutManager.java
+++ b/v7/recyclerview/src/android/support/v7/widget/LinearLayoutManager.java
@@ -27,8 +27,6 @@
import android.support.annotation.RestrictTo;
import android.support.v4.os.TraceCompat;
import android.support.v4.view.ViewCompat;
-import android.support.v4.view.accessibility.AccessibilityEventCompat;
-import android.support.v4.view.accessibility.AccessibilityRecordCompat;
import android.support.v7.widget.RecyclerView.LayoutParams;
import android.support.v7.widget.helper.ItemTouchHelper;
import android.util.AttributeSet;
@@ -238,10 +236,8 @@
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(event);
if (getChildCount() > 0) {
- final AccessibilityRecordCompat record = AccessibilityEventCompat
- .asRecord(event);
- record.setFromIndex(findFirstVisibleItemPosition());
- record.setToIndex(findLastVisibleItemPosition());
+ event.setFromIndex(findFirstVisibleItemPosition());
+ event.setToIndex(findLastVisibleItemPosition());
}
}
diff --git a/v7/recyclerview/src/android/support/v7/widget/RecyclerView.java b/v7/recyclerview/src/android/support/v7/widget/RecyclerView.java
index 511af9d..b8caca5 100644
--- a/v7/recyclerview/src/android/support/v7/widget/RecyclerView.java
+++ b/v7/recyclerview/src/android/support/v7/widget/RecyclerView.java
@@ -51,7 +51,6 @@
import android.support.v4.view.ViewCompat;
import android.support.v4.view.accessibility.AccessibilityEventCompat;
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
-import android.support.v4.view.accessibility.AccessibilityRecordCompat;
import android.support.v4.widget.EdgeEffectCompat;
import android.support.v7.recyclerview.R;
import android.support.v7.widget.RecyclerView.ItemAnimator.ItemHolderInfo;
@@ -9689,18 +9688,16 @@
*/
public void onInitializeAccessibilityEvent(Recycler recycler, State state,
AccessibilityEvent event) {
- final AccessibilityRecordCompat record = AccessibilityEventCompat
- .asRecord(event);
- if (mRecyclerView == null || record == null) {
+ if (mRecyclerView == null || event == null) {
return;
}
- record.setScrollable(mRecyclerView.canScrollVertically(1)
+ event.setScrollable(mRecyclerView.canScrollVertically(1)
|| mRecyclerView.canScrollVertically(-1)
|| mRecyclerView.canScrollHorizontally(-1)
|| mRecyclerView.canScrollHorizontally(1));
if (mRecyclerView.mAdapter != null) {
- record.setItemCount(mRecyclerView.mAdapter.getItemCount());
+ event.setItemCount(mRecyclerView.mAdapter.getItemCount());
}
}
diff --git a/v7/recyclerview/src/android/support/v7/widget/StaggeredGridLayoutManager.java b/v7/recyclerview/src/android/support/v7/widget/StaggeredGridLayoutManager.java
index 6ab5c82..679f483 100644
--- a/v7/recyclerview/src/android/support/v7/widget/StaggeredGridLayoutManager.java
+++ b/v7/recyclerview/src/android/support/v7/widget/StaggeredGridLayoutManager.java
@@ -32,9 +32,7 @@
import android.support.annotation.Nullable;
import android.support.annotation.RestrictTo;
import android.support.v4.view.ViewCompat;
-import android.support.v4.view.accessibility.AccessibilityEventCompat;
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
-import android.support.v4.view.accessibility.AccessibilityRecordCompat;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
@@ -1266,8 +1264,6 @@
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(event);
if (getChildCount() > 0) {
- final AccessibilityRecordCompat record = AccessibilityEventCompat
- .asRecord(event);
final View start = findFirstVisibleItemClosestToStart(false);
final View end = findFirstVisibleItemClosestToEnd(false);
if (start == null || end == null) {
@@ -1276,11 +1272,11 @@
final int startPos = getPosition(start);
final int endPos = getPosition(end);
if (startPos < endPos) {
- record.setFromIndex(startPos);
- record.setToIndex(endPos);
+ event.setFromIndex(startPos);
+ event.setToIndex(endPos);
} else {
- record.setFromIndex(endPos);
- record.setToIndex(startPos);
+ event.setFromIndex(endPos);
+ event.setToIndex(startPos);
}
}
}
diff --git a/v7/recyclerview/tests/src/android/support/v7/widget/LinearLayoutManagerTest.java b/v7/recyclerview/tests/src/android/support/v7/widget/LinearLayoutManagerTest.java
index 2da67af..e228ddf 100644
--- a/v7/recyclerview/tests/src/android/support/v7/widget/LinearLayoutManagerTest.java
+++ b/v7/recyclerview/tests/src/android/support/v7/widget/LinearLayoutManagerTest.java
@@ -33,8 +33,6 @@
import android.graphics.drawable.StateListDrawable;
import android.support.test.filters.LargeTest;
import android.support.v4.view.AccessibilityDelegateCompat;
-import android.support.v4.view.accessibility.AccessibilityEventCompat;
-import android.support.v4.view.accessibility.AccessibilityRecordCompat;
import android.util.Log;
import android.util.StateSet;
import android.view.View;
@@ -943,13 +941,11 @@
delegateCompat.onInitializeAccessibilityEvent(mRecyclerView, event);
}
});
- final AccessibilityRecordCompat record = AccessibilityEventCompat
- .asRecord(event);
assertEquals("result should have first position",
- record.getFromIndex(),
+ event.getFromIndex(),
mLayoutManager.findFirstVisibleItemPosition());
assertEquals("result should have last position",
- record.getToIndex(),
+ event.getToIndex(),
mLayoutManager.findLastVisibleItemPosition());
}
}
diff --git a/v7/recyclerview/tests/src/android/support/v7/widget/RecyclerViewAccessibilityTest.java b/v7/recyclerview/tests/src/android/support/v7/widget/RecyclerViewAccessibilityTest.java
index 2a6ca93..4e9656a 100644
--- a/v7/recyclerview/tests/src/android/support/v7/widget/RecyclerViewAccessibilityTest.java
+++ b/v7/recyclerview/tests/src/android/support/v7/widget/RecyclerViewAccessibilityTest.java
@@ -24,9 +24,7 @@
import android.os.Build;
import android.support.test.filters.MediumTest;
import android.support.v4.view.AccessibilityDelegateCompat;
-import android.support.v4.view.accessibility.AccessibilityEventCompat;
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
-import android.support.v4.view.accessibility.AccessibilityRecordCompat;
import android.view.View;
import android.view.accessibility.AccessibilityEvent;
@@ -172,11 +170,9 @@
delegateCompat.onInitializeAccessibilityEvent(recyclerView, event);
}
});
- final AccessibilityRecordCompat record = AccessibilityEventCompat
- .asRecord(event);
- assertEquals(record.isScrollable(), mVerticalScrollAfter || mHorizontalScrollAfter ||
- mVerticalScrollBefore || mHorizontalScrollBefore);
- assertEquals(record.getItemCount(), adapter.getItemCount());
+ assertEquals(event.isScrollable(), mVerticalScrollAfter || mHorizontalScrollAfter
+ || mVerticalScrollBefore || mHorizontalScrollBefore);
+ assertEquals(event.getItemCount(), adapter.getItemCount());
getInstrumentation().waitForIdleSync();
if (SUPPORTS_COLLECTION_INFO) {
diff --git a/v7/recyclerview/tests/src/android/support/v7/widget/StaggeredGridLayoutManagerTest.java b/v7/recyclerview/tests/src/android/support/v7/widget/StaggeredGridLayoutManagerTest.java
index 89db393..13e781e 100644
--- a/v7/recyclerview/tests/src/android/support/v7/widget/StaggeredGridLayoutManagerTest.java
+++ b/v7/recyclerview/tests/src/android/support/v7/widget/StaggeredGridLayoutManagerTest.java
@@ -39,8 +39,6 @@
import android.os.Parcelable;
import android.support.test.filters.LargeTest;
import android.support.v4.view.AccessibilityDelegateCompat;
-import android.support.v4.view.accessibility.AccessibilityEventCompat;
-import android.support.v4.view.accessibility.AccessibilityRecordCompat;
import android.text.TextUtils;
import android.util.Log;
import android.util.StateSet;
@@ -1256,8 +1254,6 @@
delegateCompat.onInitializeAccessibilityEvent(mRecyclerView, event);
}
});
- final AccessibilityRecordCompat record = AccessibilityEventCompat
- .asRecord(event);
final int start = mRecyclerView
.getChildLayoutPosition(
mLayoutManager.findFirstVisibleItemClosestToStart(false));
@@ -1265,9 +1261,9 @@
.getChildLayoutPosition(
mLayoutManager.findFirstVisibleItemClosestToEnd(false));
assertEquals("first item position should match",
- Math.min(start, end), record.getFromIndex());
+ Math.min(start, end), event.getFromIndex());
assertEquals("last item position should match",
- Math.max(start, end), record.getToIndex());
+ Math.max(start, end), event.getToIndex());
}
}