diff --git a/src/gui/animation/valueanimator.cc b/src/gui/animation/valueanimator.cc index d5d3548a..59c49587 100755 --- a/src/gui/animation/valueanimator.cc +++ b/src/gui/animation/valueanimator.cc @@ -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; diff --git a/src/gui/widgetEx/recyclerview/recyclerview.cc b/src/gui/widgetEx/recyclerview/recyclerview.cc index 4d65474c..b108b499 100755 --- a/src/gui/widgetEx/recyclerview/recyclerview.cc +++ b/src/gui/widgetEx/recyclerview/recyclerview.cc @@ -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(); } diff --git a/src/gui/widgetEx/recyclerview/recyclerview.h b/src/gui/widgetEx/recyclerview/recyclerview.h index 09005137..c9fed698 100755 --- a/src/gui/widgetEx/recyclerview/recyclerview.h +++ b/src/gui/widgetEx/recyclerview/recyclerview.h @@ -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); diff --git a/src/gui/widgetEx/viewpager2.cc b/src/gui/widgetEx/viewpager2.cc index 5f81e67a..5cf43736 100755 --- a/src/gui/widgetEx/viewpager2.cc +++ b/src/gui/widgetEx/viewpager2.cc @@ -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()) { @@ -412,9 +393,9 @@ void ViewPager2::setCurrentItemInternal(int item, bool smoothScroll) { if (std::abs(item - previousItem) > 3) { mRecyclerView->scrollToPosition(item > previousItem ? item - 3 : item + 3); // TODO(b/114361680): call smoothScrollToPosition synchronously (blocked by b/114019007) - Runnable run([this,item](){ - mRecyclerView->smoothScrollToPosition(item); - }); + Runnable run([this,item](){ + mRecyclerView->smoothScrollToPosition(item); + }); mRecyclerView->post(run);//new SmoothScrollToPosition(item, mRecyclerView)); } else { mRecyclerView->smoothScrollToPosition(item); diff --git a/src/gui/widgetEx/viewpager2.h b/src/gui/widgetEx/viewpager2.h index 9eac1e33..763a30f7 100755 --- a/src/gui/widgetEx/viewpager2.h +++ b/src/gui/widgetEx/viewpager2.h @@ -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);