mirror of
https://gitee.com/houstudio/Cdroid.git
synced 2024-11-30 03:08:12 +08:00
remove ViewPager2::enforceChildFillListener
This commit is contained in:
parent
cf29328032
commit
23d14736c3
@ -202,8 +202,8 @@ void ValueAnimator::setCurrentFraction(float fraction) {
|
|||||||
fraction = clampFraction(fraction);
|
fraction = clampFraction(fraction);
|
||||||
mStartTimeCommitted = true; // do not allow start time to be compensated for jank
|
mStartTimeCommitted = true; // do not allow start time to be compensated for jank
|
||||||
if (isPulsingInternal()) {
|
if (isPulsingInternal()) {
|
||||||
long seekTime = (long) (getScaledDuration() * fraction);
|
const long seekTime = (long) (getScaledDuration() * fraction);
|
||||||
long currentTime =SystemClock::uptimeMillis();
|
const long currentTime = SystemClock::uptimeMillis();
|
||||||
// Only modify the start time when the animation is running. Seek fraction will ensure
|
// Only modify the start time when the animation is running. Seek fraction will ensure
|
||||||
// non-running animations skip to the correct start time.
|
// non-running animations skip to the correct start time.
|
||||||
mStartTime = currentTime - seekTime;
|
mStartTime = currentTime - seekTime;
|
||||||
|
@ -5289,11 +5289,11 @@ int RecyclerView::LayoutManager::getPaddingEnd() {
|
|||||||
return mRecyclerView ? mRecyclerView->getPaddingEnd() : 0;
|
return mRecyclerView ? mRecyclerView->getPaddingEnd() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RecyclerView::LayoutManager::isFocused() {
|
bool RecyclerView::LayoutManager::isFocused() const{
|
||||||
return mRecyclerView && mRecyclerView->isFocused();
|
return mRecyclerView && mRecyclerView->isFocused();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RecyclerView::LayoutManager::hasFocus() {
|
bool RecyclerView::LayoutManager::hasFocus() const{
|
||||||
return mRecyclerView && mRecyclerView->hasFocus();
|
return mRecyclerView && mRecyclerView->hasFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -716,8 +716,8 @@ public:
|
|||||||
int getPaddingBottom();
|
int getPaddingBottom();
|
||||||
int getPaddingStart();
|
int getPaddingStart();
|
||||||
int getPaddingEnd();
|
int getPaddingEnd();
|
||||||
bool isFocused();
|
bool isFocused()const;
|
||||||
bool hasFocus();
|
bool hasFocus()const;
|
||||||
View* getFocusedChild();
|
View* getFocusedChild();
|
||||||
int getItemCount();
|
int getItemCount();
|
||||||
virtual void offsetChildrenHorizontal(int dx);
|
virtual void offsetChildrenHorizontal(int dx);
|
||||||
|
@ -78,10 +78,7 @@ void ViewPager2::initialize(Context* context,const AttributeSet& attrs) {
|
|||||||
FATAL("Pages must fill the whole ViewPager2 (use match_parent)");
|
FATAL("Pages must fill the whole ViewPager2 (use match_parent)");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ls.onChildViewDetachedFromWindow=[](View&){
|
mRecyclerView->addOnChildAttachStateChangeListener(ls);//enforceChildFillListener();
|
||||||
// nothing
|
|
||||||
};
|
|
||||||
mRecyclerView->addOnChildAttachStateChangeListener(ls);//enforceChildFillListener());
|
|
||||||
|
|
||||||
// Create ScrollEventAdapter before attaching PagerSnapHelper to RecyclerView, because the
|
// Create ScrollEventAdapter before attaching PagerSnapHelper to RecyclerView, because the
|
||||||
// attach process calls PagerSnapHelperImpl.findSnapView, which uses the mScrollEventAdapter
|
// 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
|
#if 0
|
||||||
CharSequence ViewPager2::getAccessibilityClassName() {
|
CharSequence ViewPager2::getAccessibilityClassName() {
|
||||||
if (mAccessibilityProvider.handlesGetAccessibilityClassName()) {
|
if (mAccessibilityProvider.handlesGetAccessibilityClassName()) {
|
||||||
@ -412,9 +393,9 @@ void ViewPager2::setCurrentItemInternal(int item, bool smoothScroll) {
|
|||||||
if (std::abs(item - previousItem) > 3) {
|
if (std::abs(item - previousItem) > 3) {
|
||||||
mRecyclerView->scrollToPosition(item > previousItem ? item - 3 : item + 3);
|
mRecyclerView->scrollToPosition(item > previousItem ? item - 3 : item + 3);
|
||||||
// TODO(b/114361680): call smoothScrollToPosition synchronously (blocked by b/114019007)
|
// TODO(b/114361680): call smoothScrollToPosition synchronously (blocked by b/114019007)
|
||||||
Runnable run([this,item](){
|
Runnable run([this,item](){
|
||||||
mRecyclerView->smoothScrollToPosition(item);
|
mRecyclerView->smoothScrollToPosition(item);
|
||||||
});
|
});
|
||||||
mRecyclerView->post(run);//new SmoothScrollToPosition(item, mRecyclerView));
|
mRecyclerView->post(run);//new SmoothScrollToPosition(item, mRecyclerView));
|
||||||
} else {
|
} else {
|
||||||
mRecyclerView->smoothScrollToPosition(item);
|
mRecyclerView->smoothScrollToPosition(item);
|
||||||
|
@ -67,7 +67,6 @@ protected:
|
|||||||
private:
|
private:
|
||||||
class RecyclerViewImpl;
|
class RecyclerViewImpl;
|
||||||
void initialize(Context* context, const AttributeSet& attrs);
|
void initialize(Context* context, const AttributeSet& attrs);
|
||||||
RecyclerView::OnChildAttachStateChangeListener enforceChildFillListener();
|
|
||||||
void setOrientation(Context* context,const AttributeSet& attrs);
|
void setOrientation(Context* context,const AttributeSet& attrs);
|
||||||
void restorePendingState();
|
void restorePendingState();
|
||||||
void unregisterCurrentItemDataSetTracker(RecyclerView::Adapter*adapter);
|
void unregisterCurrentItemDataSetTracker(RecyclerView::Adapter*adapter);
|
||||||
|
Loading…
Reference in New Issue
Block a user