add ~PagerAdapter ~ScrollView

This commit is contained in:
houzh 2022-04-01 14:16:44 +00:00
parent 61b8af9476
commit ac140b601a
4 changed files with 20 additions and 3 deletions

View File

@ -59,6 +59,16 @@ bool Adapter::isEmpty()const{
}
///////////////////////////////////////////////////////////////////////////////////////////////
PagerAdapter::PagerAdapter(){
mViewPagerObserver = nullptr;
}
PagerAdapter::~PagerAdapter(){
}
int PagerAdapter::getCount(){
return 0;
}
void PagerAdapter::startUpdate(ViewGroup* container){
}

View File

@ -134,7 +134,9 @@ public:
static constexpr int POSITION_UNCHANGED =-1;
static constexpr int POSITION_NONE = -2;
public:
virtual int getCount(){return 0;}
PagerAdapter();
virtual ~PagerAdapter();
virtual int getCount();
virtual void startUpdate(ViewGroup* container);
virtual void*instantiateItem(ViewGroup* container, int position);
virtual void destroyItem(ViewGroup* container, int position, void* object);

View File

@ -16,6 +16,10 @@ ScrollView::ScrollView(Context*ctx,const AttributeSet&atts)
initScrollView();
}
ScrollView::~ScrollView(){
delete mScroller;
}
float ScrollView::getTopFadingEdgeStrength() {
if (getChildCount() == 0) {
return 0.0f;
@ -53,8 +57,8 @@ void ScrollView::initScrollView() {
setFocusable(true);
setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
setWillNotDraw(false);
mFillViewport=false;
mVelocityTracker =nullptr;
mFillViewport = false;
mVelocityTracker = nullptr;
mEdgeGlowTop = mEdgeGlowBottom =nullptr;
ViewConfiguration& configuration = ViewConfiguration::get(mContext);
mTouchSlop = configuration.getScaledTouchSlop();

View File

@ -74,6 +74,7 @@ protected:
public:
ScrollView(int w,int h);
ScrollView(Context*ctx,const AttributeSet&atts);
~ScrollView()override;
int getMaxScrollAmount();
View& addView(View* child)override;
View& addView(View* child, int index)override;