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){ void PagerAdapter::startUpdate(ViewGroup* container){
} }

View File

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

View File

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

View File

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