/*
* Copyright 2018 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.recyclerview.widget;
import static androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP;
import static androidx.core.view.ViewCompat.TYPE_NON_TOUCH;
import static androidx.core.view.ViewCompat.TYPE_TOUCH;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.database.Observable;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.SystemClock;
import android.util.AttributeSet;
import android.util.Log;
import android.util.SparseArray;
import android.view.Display;
import android.view.FocusFinder;
import android.view.InputDevice;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.view.animation.Interpolator;
import android.widget.EdgeEffect;
import android.widget.LinearLayout;
import android.widget.OverScroller;
import androidx.annotation.CallSuper;
import androidx.annotation.IntDef;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.Px;
import androidx.annotation.RestrictTo;
import androidx.annotation.VisibleForTesting;
import androidx.core.os.TraceCompat;
import androidx.core.util.Preconditions;
import androidx.core.view.InputDeviceCompat;
import androidx.core.view.MotionEventCompat;
import androidx.core.view.NestedScrollingChild2;
import androidx.core.view.NestedScrollingChildHelper;
import androidx.core.view.ScrollingView;
import androidx.core.view.ViewCompat;
import androidx.core.view.ViewConfigurationCompat;
import androidx.core.view.accessibility.AccessibilityEventCompat;
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
import androidx.core.widget.EdgeEffectCompat;
import androidx.customview.view.AbsSavedState;
import androidx.recyclerview.R;
import androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo;
import androidx.viewpager.widget.ViewPager;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.ref.WeakReference;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* A flexible view for providing a limited window into a large data set.
*
* <h3>Glossary of terms:</h3>
*
* <ul>
* <li><em>Adapter:</em> A subclass of {@link Adapter} responsible for providing views
* that represent items in a data set.</li>
* <li><em>Position:</em> The position of a data item within an <em>Adapter</em>.</li>
* <li><em>Index:</em> The index of an attached child view as used in a call to
* {@link ViewGroup#getChildAt}. Contrast with <em>Position.</em></li>
* <li><em>Binding:</em> The process of preparing a child view to display data corresponding
* to a <em>position</em> within the adapter.</li>
* <li><em>Recycle (view):</em> A view previously used to display data for a specific adapter
* position may be placed in a cache for later reuse to display the same type of data again
* later. This can drastically improve performance by skipping initial layout inflation
* or construction.</li>
* <li><em>Scrap (view):</em> A child view that has entered into a temporarily detached
* state during layout. Scrap views may be reused without becoming fully detached
* from the parent RecyclerView, either unmodified if no rebinding is required or modified
* by the adapter if the view was considered <em>dirty</em>.</li>
* <li><em>Dirty (view):</em> A child view that must be rebound by the adapter before
* being displayed.</li>
* </ul>
*
* <h4>Positions in RecyclerView:</h4>
* <p>
* RecyclerView introduces an additional level of abstraction between the {@link Adapter} and
* {@link LayoutManager} to be able to detect data set changes in batches during a layout
* calculation. This saves LayoutManager from tracking adapter changes to calculate animations.
* It also helps with performance because all view bindings happen at the same time and unnecessary
* bindings are avoided.
* <p>
* For this reason, there are two types of <code>position</code> related methods in RecyclerView:
* <ul>
* <li>layout position: Position of an item in the latest layout calculation. This is the
* position from the LayoutManager's perspective.</li>
* <li>adapter position: Position of an item in the adapter. This is the position from
* the Adapter's perspective.</li>
* </ul>
* <p>
* These two positions are the same except the time between dispatching <code>adapter.notify*
* </code> events and calculating the updated layout.
* <p>
* Methods that return or receive <code>*LayoutPosition*</code> use position as of the latest
* layout calculation (e.g. {@link ViewHolder#getLayoutPosition()},
* {@link #findViewHolderForLayoutPosition(int)}). These positions include all changes until the
* last layout calculation. You can rely on these positions to be consistent with what user is
* currently seeing on the screen. For example, if you have a list of items on the screen and user
* asks for the 5<sup>th</sup> element, you should use these methods as they'll match what user
* is seeing.
* <p>
* The other set of position related methods are in the form of
* <code>*AdapterPosition*</code>. (e.g. {@link ViewHolder#getAdapterPosition()},
* {@link #findViewHolderForAdapterPosition(int)}) You should use these methods when you need to
* work with up-to-date adapter positions even if they may not have been reflected to layout yet.
* For example, if you want to access the item in the adapter on a ViewHolder click, you should use
* {@link ViewHolder#getAdapterPosition()}. Beware that these methods may not be able to calculate
* adapter positions if {@link Adapter#notifyDataSetChanged()} has been called and new layout has
* not yet been calculated. For this reasons, you should carefully handle {@link #NO_POSITION} or
* <code>null</code> results from these methods.
* <p>
* When writing a {@link LayoutManager} you almost always want to use layout positions whereas when
* writing an {@link Adapter}, you probably want to use adapter positions.
*
* @attr ref androidx.recyclerview.R.styleable#RecyclerView_layoutManager
*/
public class RecyclerView extends ViewGroup implements ScrollingView, NestedScrollingChild2 {
static final String TAG = "RecyclerView";
static final boolean DEBUG = false;
static final boolean VERBOSE_TRACING = false;
private static final int[] NESTED_SCROLLING_ATTRS =
{16843830 /* android.R.attr.nestedScrollingEnabled */};
private static final int[] CLIP_TO_PADDING_ATTR = {android.R.attr.clipToPadding};
/**
* On Kitkat and JB MR2, there is a bug which prevents
没有合适的资源?快使用搜索试试~ 我知道了~
android 9.0 源码下载(28)
共2000个文件
java:2000个
2星 需积分: 5 159 下载量 155 浏览量
2018-10-09
14:43:41
上传
评论 3
收藏 40.04MB ZIP 举报
温馨提示
android 9.0 源码下载(28)
资源推荐
资源详情
资源评论
收起资源包目录
android 9.0 源码下载(28) (2000个子文件)
RecyclerView.java 569KB
ExifInterface.java 269KB
GridWidgetTest.java 246KB
NotificationCompat.java 217KB
RecyclerViewLayoutTest.java 210KB
FragmentManager.java 161KB
GridLayoutManager.java 152KB
ViewCompat.java 135KB
CoordinatorLayout.java 133KB
TCKLocalDateTime.java 128KB
StaggeredGridLayoutManager.java 127KB
AccessibilityNodeInfoCompat.java 124KB
MediaRouter.java 122KB
ViewPager.java 121KB
Fragment.java 113KB
TCKZonedDateTime.java 111KB
TCKDuration.java 107KB
ItemTouchHelper.java 106KB
AppCompatDelegateImpl.java 105KB
LinearLayoutManager.java 102KB
TCKLocalTime.java 99KB
TCKInstant.java 97KB
DrawerLayout.java 96KB
MediaPlayer2Impl.java 95KB
Toolbar.java 92KB
MediaPlayer2Test.java 91KB
TCKLocalDate.java 86KB
SearchView.java 79KB
MediaPlayer2.java 77KB
NestedScrollView.java 77KB
TCKOffsetDateTime.java 77KB
RecyclerViewAnimationsTest.java 75KB
MediaControlView2.java 74KB
TCKDateTimeFormatters.java 73KB
MediaBrowserServiceCompat.java 72KB
Preference.java 71KB
VectorDrawableCompat.java 70KB
LinearLayoutCompat.java 70KB
BrowseFragment.java 70KB
BrowseSupportFragment.java 70KB
WorkManagerImplTest.java 67KB
GuidedActionsStylist.java 67KB
MediaSession2.java 65KB
GuidedStepSupportFragment.java 62KB
TCKDateTimeParseResolver.java 62KB
TCKYearMonth.java 62KB
GuidedStepFragment.java 62KB
MediaRouteControllerDialog.java 62KB
MediaController2Test_copied.java 62KB
VideoView2ImplBase.java 61KB
TCKOffsetTime.java 61KB
FragmentLifecycleTest.java 61KB
ViewDragHelper.java 61KB
MediaController2Test.java 61KB
StaggeredGridLayoutManagerTest.java 61KB
AlertDialogTest.java 60KB
TCKZoneRules.java 60KB
GridLayoutManagerTest.java 58KB
FragmentTransition.java 58KB
SortedListTest.java 58KB
LinearLayoutManagerTest.java 58KB
TCKJapaneseChronology.java 57KB
RowsSupportFragmentTest.java 57KB
RowsFragmentTest.java 56KB
MediaSession2ImplBase.java 56KB
VideoView2ImplBaseWithMp1.java 56KB
RecyclerViewCacheTest.java 54KB
AppCompatBaseAutoSizeTest.java 53KB
MediaControlIntent.java 53KB
BaseViewPagerTest.java 53KB
ActionBar.java 52KB
ListRowPresenterTest.java 52KB
ListPopupWindow.java 52KB
DetailsSupportFragmentTest.java 52KB
ExploreByTouchHelper.java 51KB
DetailsFragmentTest.java 51KB
TCKPeriod.java 50KB
MediaController2ImplBase.java 50KB
GridLayoutManager.java 49KB
SwitchCompat.java 48KB
TCKMinguoChronology.java 48KB
EmojiCompat.java 48KB
FragmentViewTests.java 47KB
FragmentTransitionTest.java 47KB
TCKThaiBuddhistChronology.java 47KB
BaseRecyclerViewInstrumentationTest.java 46KB
MenuBuilder.java 46KB
TCKYear.java 46KB
MediaSession2Test.java 45KB
BaseGridView.java 45KB
WindowDecorActionBar.java 44KB
SwipeRefreshLayout.java 44KB
PlaybackFragment.java 43KB
PlaybackSupportFragment.java 43KB
TCKDateTimeFormatter.java 43KB
BidiFormatter.java 43KB
AlertController.java 42KB
AlertDialog.java 42KB
MediaMetadata2.java 42KB
ExifInterfaceTest.java 42KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
- 勇敢地追2022-03-07啥呀都是,我想要init.cpp文件的源代码
- pearce2020-07-17可以用,谢谢
- jo_whc2019-07-30先好好学习一下
- 小黄鸡#2019-07-06都不知道是什么鬼代码。我还以为是framework里面的部分代码
- #天梦#2019-03-20只有java代码,没有底层C代码小哥在魔都2019-03-26可以具体说下吗?
小哥在魔都
- 粉丝: 2
- 资源: 13
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功