java.lang.Object
↳androidx.core.view.accessibility.AccessibilityRecordCompat
Gradle dependencies
compile group: 'androidx.core', name: 'core', version: '1.15.0-alpha02'
- groupId: androidx.core
- artifactId: core
- version: 1.15.0-alpha02
Artifact androidx.core:core:1.15.0-alpha02 it located at Google repository (https://maven.google.com/)
Androidx artifact mapping:
androidx.core:core com.android.support:support-compat
Androidx class mapping:
androidx.core.view.accessibility.AccessibilityRecordCompat android.support.v4.view.accessibility.AccessibilityRecordCompat
Overview
Helper for accessing .
Summary
Methods |
---|
public boolean | equals(java.lang.Object obj)
|
public int | getAddedCount()
Gets the number of added characters. |
public java.lang.CharSequence | getBeforeText()
Sets the text before a change. |
public java.lang.CharSequence | getClassName()
Gets the class name of the source. |
public java.lang.CharSequence | getContentDescription()
Gets the description of the source. |
public int | getCurrentItemIndex()
Gets the index of the source in the list of items the can be visited. |
public int | getFromIndex()
Gets the index of the first character of the changed sequence,
or the beginning of a text selection or the index of the first
visible item when scrolling. |
public java.lang.Object | getImpl()
|
public int | getItemCount()
Gets the number of items that can be visited. |
public int | getMaxScrollX()
Gets the max scroll offset of the source left edge in pixels. |
public static int | getMaxScrollX(AccessibilityRecord record)
Gets the max scroll offset of the source left edge in pixels. |
public int | getMaxScrollY()
Gets the max scroll offset of the source top edge in pixels. |
public static int | getMaxScrollY(AccessibilityRecord record)
Gets the max scroll offset of the source top edge in pixels. |
public Parcelable | getParcelableData()
Gets the Parcelable data. |
public int | getRemovedCount()
Gets the number of removed characters. |
public int | getScrollX()
Gets the scroll offset of the source left edge in pixels. |
public int | getScrollY()
Gets the scroll offset of the source top edge in pixels. |
public AccessibilityNodeInfoCompat | getSource()
Gets the AccessibilityNodeInfo of
the event source. |
public java.util.List<java.lang.CharSequence> | getText()
Gets the text of the event. |
public int | getToIndex()
Gets the index of text selection end or the index of the last
visible item when scrolling. |
public int | getWindowId()
Gets the id of the window from which the event comes from. |
public int | hashCode()
|
public boolean | isChecked()
Gets if the source is checked. |
public boolean | isEnabled()
Gets if the source is enabled. |
public boolean | isFullScreen()
Gets if the source is taking the entire screen. |
public boolean | isPassword()
Gets if the source is a password field. |
public boolean | isScrollable()
Gets if the source is scrollable. |
public static AccessibilityRecordCompat | obtain()
Returns a cached instance if such is available or a new one is
instantiated. |
public static AccessibilityRecordCompat | obtain(AccessibilityRecordCompat record)
Returns a cached instance if such is available or a new one is
instantiated. |
public void | recycle()
Return an instance back to be reused. |
public void | setAddedCount(int addedCount)
Sets the number of added characters. |
public void | setBeforeText(java.lang.CharSequence beforeText)
Sets the text before a change. |
public void | setChecked(boolean isChecked)
Sets if the source is checked. |
public void | setClassName(java.lang.CharSequence className)
Sets the class name of the source. |
public void | setContentDescription(java.lang.CharSequence contentDescription)
Sets the description of the source. |
public void | setCurrentItemIndex(int currentItemIndex)
Sets the index of the source in the list of items that can be visited. |
public void | setEnabled(boolean isEnabled)
Sets if the source is enabled. |
public void | setFromIndex(int fromIndex)
Sets the index of the first character of the changed sequence
or the beginning of a text selection or the index of the first
visible item when scrolling. |
public void | setFullScreen(boolean isFullScreen)
Sets if the source is taking the entire screen. |
public void | setItemCount(int itemCount)
Sets the number of items that can be visited. |
public static void | setMaxScrollX(AccessibilityRecord record, int maxScrollX)
Sets the max scroll offset of the source left edge in pixels. |
public void | setMaxScrollX(int maxScrollX)
Sets the max scroll offset of the source left edge in pixels. |
public static void | setMaxScrollY(AccessibilityRecord record, int maxScrollY)
Sets the max scroll offset of the source top edge in pixels. |
public void | setMaxScrollY(int maxScrollY)
Sets the max scroll offset of the source top edge in pixels. |
public void | setParcelableData(Parcelable parcelableData)
Sets the Parcelable data of the event. |
public void | setPassword(boolean isPassword)
Sets if the source is a password field. |
public void | setRemovedCount(int removedCount)
Sets the number of removed characters. |
public void | setScrollable(boolean scrollable)
Sets if the source is scrollable. |
public void | setScrollX(int scrollX)
Sets the scroll offset of the source left edge in pixels. |
public void | setScrollY(int scrollY)
Sets the scroll offset of the source top edge in pixels. |
public static void | setSource(AccessibilityRecord record, View root, int virtualDescendantId)
Sets the source to be a virtual descendant of the given root . |
public void | setSource(View source)
Sets the event source. |
public void | setSource(View root, int virtualDescendantId)
Sets the source to be a virtual descendant of the given root . |
public void | setToIndex(int toIndex)
Sets the index of text selection end or the index of the last
visible item when scrolling. |
from java.lang.Object | clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructors
public
AccessibilityRecordCompat(java.lang.Object record)
Deprecated: This is not type safe. If you want to modify an
's properties defined in
use
AccessibilityEventCompat.asRecord(AccessibilityEvent). This method will be removed
in a subsequent release of the support library.
Methods
public java.lang.Object
getImpl()
Deprecated: This method will be removed in a subsequent release of
the support library.
Returns:
The wrapped implementation.
Deprecated: Use directly.
Returns a cached instance if such is available or a new one is
instantiated. The instance is initialized with data from the
given record.
Returns:
An instance.
Deprecated: Use directly.
Returns a cached instance if such is available or a new one is
instantiated.
Returns:
An instance.
public void
setSource(View source)
Deprecated: Use directly.
Sets the event source.
Parameters:
source: The source.
public void
setSource(View root, int virtualDescendantId)
Deprecated: Use AccessibilityRecordCompat.setSource(AccessibilityRecord, View, int) instead.
Sets the source to be a virtual descendant of the given root
.
If virtualDescendantId
equals to View
the root
is set as the source.
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.
Parameters:
root: The root of the virtual subtree.
virtualDescendantId: The id of the virtual descendant.
public static void
setSource(AccessibilityRecord record, View root, int virtualDescendantId)
Deprecated: Call directly.
Sets the source to be a virtual descendant of the given root
.
If virtualDescendantId
equals to View
the root
is set as the source.
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.
Parameters:
record: The instance to use.
root: The root of the virtual subtree.
virtualDescendantId: The id of the virtual descendant.
Deprecated: Use directly.
Gets the AccessibilityNodeInfo
of
the event source.
Note: It is a client responsibility to recycle the
received info by calling
AccessibilityNodeInfo#recycle()
to avoid creating of multiple instances.
Returns:
The info of the source.
Deprecated: Use directly.
Gets the id of the window from which the event comes from.
Returns:
The window id.
public boolean
isChecked()
Deprecated: Use directly.
Gets if the source is checked.
Returns:
True if the view is checked, false otherwise.
public void
setChecked(boolean isChecked)
Deprecated: Use directly.
Sets if the source is checked.
Parameters:
isChecked: True if the view is checked, false otherwise.
public boolean
isEnabled()
Deprecated: Use directly.
Gets if the source is enabled.
Returns:
True if the view is enabled, false otherwise.
public void
setEnabled(boolean isEnabled)
Deprecated: Use directly.
Sets if the source is enabled.
Parameters:
isEnabled: True if the view is enabled, false otherwise.
public boolean
isPassword()
Deprecated: Use directly.
Gets if the source is a password field.
Returns:
True if the view is a password field, false otherwise.
public void
setPassword(boolean isPassword)
Deprecated: Use directly.
Sets if the source is a password field.
Parameters:
isPassword: True if the view is a password field, false otherwise.
public boolean
isFullScreen()
Deprecated: Use directly.
Gets if the source is taking the entire screen.
Returns:
True if the source is full screen, false otherwise.
public void
setFullScreen(boolean isFullScreen)
Deprecated: Use directly.
Sets if the source is taking the entire screen.
Parameters:
isFullScreen: True if the source is full screen, false otherwise.
public boolean
isScrollable()
Deprecated: Use directly.
Gets if the source is scrollable.
Returns:
True if the source is scrollable, false otherwise.
public void
setScrollable(boolean scrollable)
Deprecated: Use directly.
Sets if the source is scrollable.
Parameters:
scrollable: True if the source is scrollable, false otherwise.
public int
getItemCount()
Deprecated: Use directly.
Gets the number of items that can be visited.
Returns:
The number of items.
public void
setItemCount(int itemCount)
Deprecated: Use directly.
Sets the number of items that can be visited.
Parameters:
itemCount: The number of items.
public int
getCurrentItemIndex()
Deprecated: Use directly.
Gets the index of the source in the list of items the can be visited.
Returns:
The current item index.
public void
setCurrentItemIndex(int currentItemIndex)
Deprecated: Use directly.
Sets the index of the source in the list of items that can be visited.
Parameters:
currentItemIndex: The current item index.
public int
getFromIndex()
Deprecated: Use directly.
Gets the index of the first character of the changed sequence,
or the beginning of a text selection or the index of the first
visible item when scrolling.
Returns:
The index of the first character or selection
start or the first visible item.
public void
setFromIndex(int fromIndex)
Deprecated: Use directly.
Sets the index of the first character of the changed sequence
or the beginning of a text selection or the index of the first
visible item when scrolling.
Parameters:
fromIndex: The index of the first character or selection
start or the first visible item.
Deprecated: Use directly.
Gets the index of text selection end or the index of the last
visible item when scrolling.
Returns:
The index of selection end or last item index.
public void
setToIndex(int toIndex)
Deprecated: Use directly.
Sets the index of text selection end or the index of the last
visible item when scrolling.
Parameters:
toIndex: The index of selection end or last item index.
Deprecated: Use directly.
Gets the scroll offset of the source left edge in pixels.
Returns:
The scroll.
public void
setScrollX(int scrollX)
Deprecated: Use directly.
Sets the scroll offset of the source left edge in pixels.
Parameters:
scrollX: The scroll.
Deprecated: Use directly.
Gets the scroll offset of the source top edge in pixels.
Returns:
The scroll.
public void
setScrollY(int scrollY)
Deprecated: Use directly.
Sets the scroll offset of the source top edge in pixels.
Parameters:
scrollY: The scroll.
public int
getMaxScrollX()
Deprecated: Use AccessibilityRecordCompat.getMaxScrollX(AccessibilityRecord) instead.
Gets the max scroll offset of the source left edge in pixels.
Returns:
The max scroll.
public static int
getMaxScrollX(AccessibilityRecord record)
Deprecated: Call directly.
Gets the max scroll offset of the source left edge in pixels.
Parameters:
record: The instance to use.
Returns:
The max scroll.
public void
setMaxScrollX(int maxScrollX)
Deprecated: Use AccessibilityRecordCompat.setMaxScrollX(AccessibilityRecord, int) instead.
Sets the max scroll offset of the source left edge in pixels.
Parameters:
maxScrollX: The max scroll.
public static void
setMaxScrollX(AccessibilityRecord record, int maxScrollX)
Deprecated: Call directly.
Sets the max scroll offset of the source left edge in pixels.
Parameters:
record: The instance to use.
maxScrollX: The max scroll.
public int
getMaxScrollY()
Deprecated: Use AccessibilityRecordCompat.getMaxScrollY(AccessibilityRecord) instead.
Gets the max scroll offset of the source top edge in pixels.
Returns:
The max scroll.
public static int
getMaxScrollY(AccessibilityRecord record)
Deprecated: Call directly.
Gets the max scroll offset of the source top edge in pixels.
Parameters:
record: The instance to use.
Returns:
The max scroll.
public void
setMaxScrollY(int maxScrollY)
Deprecated: Use AccessibilityRecordCompat.setMaxScrollY(AccessibilityRecord, int) instead.
Sets the max scroll offset of the source top edge in pixels.
Parameters:
maxScrollY: The max scroll.
public static void
setMaxScrollY(AccessibilityRecord record, int maxScrollY)
Deprecated: Call directly.
Sets the max scroll offset of the source top edge in pixels.
Parameters:
record: The instance to use.
maxScrollY: The max scroll.
public int
getAddedCount()
Deprecated: Use directly.
Gets the number of added characters.
Returns:
The number of added characters.
public void
setAddedCount(int addedCount)
Deprecated: Use directly.
Sets the number of added characters.
Parameters:
addedCount: The number of added characters.
public int
getRemovedCount()
Deprecated: Use directly.
Gets the number of removed characters.
Returns:
The number of removed characters.
public void
setRemovedCount(int removedCount)
Deprecated: Use directly.
Sets the number of removed characters.
Parameters:
removedCount: The number of removed characters.
public java.lang.CharSequence
getClassName()
Deprecated: Use directly.
Gets the class name of the source.
Returns:
The class name.
public void
setClassName(java.lang.CharSequence className)
Deprecated: Use directly.
Sets the class name of the source.
Parameters:
className: The lass name.
public java.util.List<java.lang.CharSequence>
getText()
Deprecated: Use directly.
Gets the text of the event. The index in the list represents the priority
of the text. Specifically, the lower the index the higher the priority.
Returns:
The text.
public java.lang.CharSequence
getBeforeText()
Deprecated: Use directly.
Sets the text before a change.
Returns:
The text before the change.
public void
setBeforeText(java.lang.CharSequence beforeText)
Deprecated: Use directly.
Sets the text before a change.
Parameters:
beforeText: The text before the change.
public java.lang.CharSequence
getContentDescription()
Deprecated: Use directly.
Gets the description of the source.
Returns:
The description.
public void
setContentDescription(java.lang.CharSequence contentDescription)
Deprecated: Use directly.
Sets the description of the source.
Parameters:
contentDescription: The description.
public Parcelable
getParcelableData()
Deprecated: Use directly.
Gets the Parcelable
data.
Returns:
The parcelable data.
public void
setParcelableData(Parcelable parcelableData)
Deprecated: Use directly.
Sets the Parcelable
data of the event.
Parameters:
parcelableData: The parcelable data.
Deprecated: Use directly.
Return an instance back to be reused.
Note: You must not touch the object after calling this
function.
Deprecated: Use directly.
public boolean
equals(java.lang.Object obj)
Deprecated: Use directly.
Source
/*
* 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 androidx.core.view.accessibility;
import android.annotation.SuppressLint;
import android.os.Parcelable;
import android.view.View;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.accessibility.AccessibilityRecord;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.util.List;
/**
* Helper for accessing {@link AccessibilityRecord}.
*/
public class AccessibilityRecordCompat {
private final AccessibilityRecord mRecord;
/**
* @deprecated This is not type safe. If you want to modify an
* {@link AccessibilityEvent}'s properties defined in
* {@link AccessibilityRecord} use
* {@link AccessibilityEventCompat#asRecord(AccessibilityEvent)}. This method will be removed
* in a subsequent release of the support library.
*/
@Deprecated
public AccessibilityRecordCompat(Object record) {
mRecord = (AccessibilityRecord) record;
}
/**
* @return The wrapped implementation.
*
* @deprecated This method will be removed in a subsequent release of
* the support library.
*/
@Deprecated
public Object getImpl() {
return mRecord;
}
/**
* Returns a cached instance if such is available or a new one is
* instantiated. The instance is initialized with data from the
* given record.
*
* @return An instance.
*
* @deprecated Use {@link AccessibilityRecord#obtain(AccessibilityRecord)} directly.
*/
@SuppressWarnings("deprecation")
@Deprecated
public static AccessibilityRecordCompat obtain(AccessibilityRecordCompat record) {
return new AccessibilityRecordCompat(AccessibilityRecord.obtain(record.mRecord));
}
/**
* Returns a cached instance if such is available or a new one is
* instantiated.
*
* @return An instance.
*
* @deprecated Use {@link AccessibilityRecord#obtain()} directly.
*/
@SuppressWarnings("deprecation")
@Deprecated
public static AccessibilityRecordCompat obtain() {
return new AccessibilityRecordCompat(AccessibilityRecord.obtain());
}
/**
* Sets the event source.
*
* @param source The source.
*
* @throws IllegalStateException If called from an AccessibilityService.
*
* @deprecated Use {@link AccessibilityRecord#setSource(View)} directly.
*/
@SuppressLint("KotlinPropertyAccess")
@Deprecated
public void setSource(View source) {
mRecord.setSource(source);
}
/**
* 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 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) {
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.
* @deprecated Call {@link AccessibilityRecord#setSource()} directly.
*/
@Deprecated
@androidx.annotation.ReplaceWith(expression = "record.setSource(root, virtualDescendantId)")
public static void setSource(@NonNull AccessibilityRecord record, @Nullable View root,
int virtualDescendantId) {
record.setSource(root, virtualDescendantId);
}
/**
* Gets the {@link AccessibilityNodeInfo} of
* the event source.
* <p>
* <strong>Note:</strong> It is a client responsibility to recycle the
* received info by calling
* {@link AccessibilityNodeInfo#recycle()
* AccessibilityNodeInfo#recycle()} to avoid creating of multiple instances.
*</p>
*
* @return The info of the source.
*
* @deprecated Use {@link AccessibilityRecord#getSource()} directly.
*/
@SuppressLint("KotlinPropertyAccess")
@Deprecated
public AccessibilityNodeInfoCompat getSource() {
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 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 mRecord.isChecked();
}
/**
* Sets if the source is checked.
*
* @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) {
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 mRecord.isEnabled();
}
/**
* Sets if the source is enabled.
*
* @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) {
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 mRecord.isPassword();
}
/**
* Sets if the source is a password field.
*
* @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) {
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 mRecord.isFullScreen();
}
/**
* Sets if the source is taking the entire screen.
*
* @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) {
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 mRecord.isScrollable();
}
/**
* Sets if the source is scrollable.
*
* @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) {
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 mRecord.getItemCount();
}
/**
* Sets the number of items that can be visited.
*
* @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) {
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 mRecord.getCurrentItemIndex();
}
/**
* Sets the index of the source in the list of items that can be visited.
*
* @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) {
mRecord.setCurrentItemIndex(currentItemIndex);
}
/**
* Gets the index of the first character of the changed sequence,
* or the beginning of a text selection or the index of the first
* visible item when scrolling.
*
* @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 mRecord.getFromIndex();
}
/**
* Sets the index of the first character of the changed sequence
* or the beginning of a text selection or the index of the first
* visible item when scrolling.
*
* @param fromIndex The index of the first character or selection
* 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) {
mRecord.setFromIndex(fromIndex);
}
/**
* Gets the index of text selection end or the index of the last
* 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 mRecord.getToIndex();
}
/**
* Sets the index of text selection end or the index of the last
* 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) {
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 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) {
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 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) {
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 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.
* @deprecated Call {@link AccessibilityRecord#getMaxScrollX()} directly.
*/
@Deprecated
@androidx.annotation.ReplaceWith(expression = "record.getMaxScrollX()")
public static int getMaxScrollX(@NonNull AccessibilityRecord record) {
return record.getMaxScrollX();
}
/**
* 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) {
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.
* @deprecated Call {@link AccessibilityRecord#setMaxScrollX()} directly.
*/
@Deprecated
@androidx.annotation.ReplaceWith(expression = "record.setMaxScrollX(maxScrollX)")
public static void setMaxScrollX(@NonNull AccessibilityRecord record, int maxScrollX) {
record.setMaxScrollX(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 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.
* @deprecated Call {@link AccessibilityRecord#getMaxScrollY()} directly.
*/
@Deprecated
@androidx.annotation.ReplaceWith(expression = "record.getMaxScrollY()")
public static int getMaxScrollY(@NonNull AccessibilityRecord record) {
return record.getMaxScrollY();
}
/**
* 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) {
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.
* @deprecated Call {@link AccessibilityRecord#setMaxScrollY()} directly.
*/
@Deprecated
@androidx.annotation.ReplaceWith(expression = "record.setMaxScrollY(maxScrollY)")
public static void setMaxScrollY(@NonNull AccessibilityRecord record, int maxScrollY) {
record.setMaxScrollY(maxScrollY);
}
/**
* Gets the number of added characters.
*
* @return The number of added characters.
*
* @deprecated Use {@link AccessibilityRecord#getAddedCount()} directly.
*/
@Deprecated
public int getAddedCount() {
return mRecord.getAddedCount();
}
/**
* Sets the number of added characters.
*
* @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) {
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 mRecord.getRemovedCount();
}
/**
* Sets the number of removed characters.
*
* @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) {
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 mRecord.getClassName();
}
/**
* Sets the class name of the source.
*
* @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) {
mRecord.setClassName(className);
}
/**
* Gets the text of the event. The index in the list represents the priority
* 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 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 mRecord.getBeforeText();
}
/**
* Sets the text before a change.
*
* @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) {
mRecord.setBeforeText(beforeText);
}
/**
* Gets the description of the source.
*
* @return The description.
*
* @deprecated Use {@link AccessibilityRecord#getContentDescription()} directly.
*/
@Deprecated
public CharSequence getContentDescription() {
return mRecord.getContentDescription();
}
/**
* Sets the description of the source.
*
* @param contentDescription The description.
*
* @throws IllegalStateException If called from an AccessibilityService.
*
* @deprecated Use {@link AccessibilityRecord#setContentDescription(CharSequence)} directly.
*/
@Deprecated
public void setContentDescription(CharSequence contentDescription) {
mRecord.setContentDescription(contentDescription);
}
/**
* Gets the {@link Parcelable} data.
*
* @return The parcelable data.
*
* @deprecated Use {@link AccessibilityRecord#getParcelableData()} directly.
*/
@Deprecated
public Parcelable getParcelableData() {
return mRecord.getParcelableData();
}
/**
* Sets the {@link Parcelable} data of the event.
*
* @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) {
mRecord.setParcelableData(parcelableData);
}
/**
* Return an instance back to be reused.
* <p>
* <strong>Note:</strong> You must not touch the object after calling this
* function.
* </p>
*
* @throws IllegalStateException If the record is already recycled.
*
* @deprecated Use {@link AccessibilityRecord#recycle()} directly.
*/
@Deprecated
public void recycle() {
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) {
return true;
}
if (!(obj instanceof AccessibilityRecordCompat)) {
return false;
}
AccessibilityRecordCompat other = (AccessibilityRecordCompat) obj;
if (mRecord == null) {
return other.mRecord == null;
}
return mRecord.equals(other.mRecord);
}
}