remove ViewPager2::enforceChildFillListener

This commit is contained in:
侯歌 2024-06-13 09:01:00 +08:00
parent cf29328032
commit 23d14736c3
5 changed files with 10 additions and 30 deletions

View File

@ -202,8 +202,8 @@ void ValueAnimator::setCurrentFraction(float fraction) {
fraction = clampFraction(fraction);
mStartTimeCommitted = true; // do not allow start time to be compensated for jank
if (isPulsingInternal()) {
long seekTime = (long) (getScaledDuration() * fraction);
long currentTime =SystemClock::uptimeMillis();
const long seekTime = (long) (getScaledDuration() * fraction);
const long currentTime = SystemClock::uptimeMillis();
// Only modify the start time when the animation is running. Seek fraction will ensure
// non-running animations skip to the correct start time.
mStartTime = currentTime - seekTime;

View File

@ -5289,11 +5289,11 @@ int RecyclerView::LayoutManager::getPaddingEnd() {
return mRecyclerView ? mRecyclerView->getPaddingEnd() : 0;
}
bool RecyclerView::LayoutManager::isFocused() {
bool RecyclerView::LayoutManager::isFocused() const{
return mRecyclerView && mRecyclerView->isFocused();
}
bool RecyclerView::LayoutManager::hasFocus() {
bool RecyclerView::LayoutManager::hasFocus() const{
return mRecyclerView && mRecyclerView->hasFocus();
}

View File

@ -716,8 +716,8 @@ public:
int getPaddingBottom();
int getPaddingStart();
int getPaddingEnd();
bool isFocused();
bool hasFocus();
bool isFocused()const;
bool hasFocus()const;
View* getFocusedChild();
int getItemCount();
virtual void offsetChildrenHorizontal(int dx);

View File

@ -78,10 +78,7 @@ void ViewPager2::initialize(Context* context,const AttributeSet& attrs) {
FATAL("Pages must fill the whole ViewPager2 (use match_parent)");
}
};
ls.onChildViewDetachedFromWindow=[](View&){
// nothing
};
mRecyclerView->addOnChildAttachStateChangeListener(ls);//enforceChildFillListener());
mRecyclerView->addOnChildAttachStateChangeListener(ls);//enforceChildFillListener();
// Create ScrollEventAdapter before attaching PagerSnapHelper to RecyclerView, because the
// attach process calls PagerSnapHelperImpl.findSnapView, which uses the mScrollEventAdapter
@ -141,22 +138,6 @@ void ViewPager2::initialize(Context* context,const AttributeSet& attrs) {
}
RecyclerView::OnChildAttachStateChangeListener ViewPager2::enforceChildFillListener() {
return {};/*new RecyclerView::OnChildAttachStateChangeListener() {
public void onChildViewAttachedToWindow(View* view) {
RecyclerView::LayoutParams* layoutParams = (RecyclerView::LayoutParams*) view->getLayoutParams();
if (layoutParams->width != LayoutParams::MATCH_PARENT
|| layoutParams->height != LayoutParams::MATCH_PARENT) {
FATAL("Pages must fill the whole ViewPager2 (use match_parent)");
}
}
public void onChildViewDetachedFromWindow(View* view) {
// nothing
}
};*/
}
#if 0
CharSequence ViewPager2::getAccessibilityClassName() {
if (mAccessibilityProvider.handlesGetAccessibilityClassName()) {

View File

@ -67,7 +67,6 @@ protected:
private:
class RecyclerViewImpl;
void initialize(Context* context, const AttributeSet& attrs);
RecyclerView::OnChildAttachStateChangeListener enforceChildFillListener();
void setOrientation(Context* context,const AttributeSet& attrs);
void restorePendingState();
void unregisterCurrentItemDataSetTracker(RecyclerView::Adapter*adapter);