add AbsSeekBar::~AbsSeekBar

This commit is contained in:
houzh 2023-12-07 11:26:47 +08:00
parent b2a7c3f0d5
commit 124b28111e
3 changed files with 22 additions and 3 deletions

View File

@ -97,13 +97,26 @@ static void startAnimationController(void *userData, const XML_Char *xname, cons
LayoutAnimationController* AnimationUtils::loadLayoutAnimation(Context* context,const std::string&resid){
LACDATA data;
XML_Parser parser = XML_ParserCreate(nullptr);
char buf[256];
int rdlen = 0;
data.context = context;
data.controller = nullptr;
std::unique_ptr<std::istream> stream = context->getInputStream(resid,&data.package);
if(stream==nullptr)return nullptr;
XML_Parser parser = XML_ParserCreate(nullptr);
XML_SetElementHandler(parser, startAnimationController, nullptr);
XML_SetUserData(parser,&data);
std::unique_ptr<std::istream> stream = context->getInputStream(resid,&data.package);
do {
stream->read(buf,sizeof(buf));
rdlen = stream->gcount();
if (XML_Parse(parser, buf,rdlen,!rdlen) == XML_STATUS_ERROR) {
const char*es=XML_ErrorString(XML_GetErrorCode(parser));
LOGE("%s at %s:line %ld",es, resid.c_str(),XML_GetCurrentLineNumber(parser));
XML_ParserFree(parser);
return nullptr;
}
} while(rdlen);
XML_ParserFree(parser);
return data.controller;
}

View File

@ -49,6 +49,11 @@ void AbsSeekBar::initSeekBar(){
setFocusable(true);
}
AbsSeekBar::~AbsSeekBar(){
delete mThumb;
delete mTickMark;
}
void AbsSeekBar::setMin(int min) {
ProgressBar::setMin(min);
int range = getMax() - getMin();

View File

@ -56,6 +56,7 @@ protected:
public:
AbsSeekBar(int w,int h);
AbsSeekBar(Context*ctx,const AttributeSet&attrs);
~AbsSeekBar();
void setKeyProgressIncrement(int increment);
int getKeyProgressIncrement()const;
void setThumbOffset(int thumbOffset);