mirror of
https://gitee.com/houstudio/Cdroid.git
synced 2024-12-04 05:10:06 +08:00
fix imageview and animatedimagedrawable
This commit is contained in:
parent
3614bb830b
commit
ccd3753d30
@ -42,6 +42,10 @@ AnimatedImageDrawable::AnimatedImageDrawable(cdroid::Context*ctx,const std::stri
|
||||
}
|
||||
|
||||
AnimatedImageDrawable::~AnimatedImageDrawable(){
|
||||
mStarting = false;
|
||||
if(mRunnable)
|
||||
unscheduleSelf(mRunnable);
|
||||
mRunnable = nullptr;
|
||||
if(mImageHandler){
|
||||
GFXDestroySurface(mImageHandler);
|
||||
mImageHandler = nullptr;
|
||||
@ -94,13 +98,14 @@ void AnimatedImageDrawable::draw(Canvas& canvas){
|
||||
const long nextDelay = mDecoder->getFrameDuration(mCurrentFrame);
|
||||
// a value <= 0 indicates that the drawable is stopped or that renderThread
|
||||
// will manage the animation
|
||||
LOGV("%p draw Frame %d/%d repeat=%d/%d nextDelay=%d",this,mCurrentFrame,
|
||||
mAnimatedImageState->mFrameCount,mRepeated,mRepeatCount,nextDelay);
|
||||
if(mStarting && ((mRepeated<mRepeatCount) || (mRepeatCount==REPEAT_INFINITE))){
|
||||
LOGV("%p draw Frame %d/%d started=%d repeat=%d/%d nextDelay=%d",this,mCurrentFrame,
|
||||
mAnimatedImageState->mFrameCount,mStarting,mRepeated,mRepeatCount,nextDelay);
|
||||
if(mStarting && ((mRepeated<mRepeatCount) || (mRepeatCount<0))){
|
||||
if (nextDelay > 0) {
|
||||
if (mRunnable == nullptr) {
|
||||
mRunnable = [this](){
|
||||
invalidateSelf();
|
||||
if(mStarting)
|
||||
invalidateSelf();
|
||||
mCurrentFrame=(mCurrentFrame+1)%mAnimatedImageState->mFrameCount;
|
||||
if(mCurrentFrame==mAnimatedImageState->mFrameCount-1){
|
||||
mRepeated++;
|
||||
@ -228,7 +233,6 @@ AnimatedImageDrawable::AnimatedImageState::AnimatedImageState(const AnimatedImag
|
||||
}
|
||||
|
||||
AnimatedImageDrawable::AnimatedImageState::~AnimatedImageState(){
|
||||
LOGD("AnimatedImageState~AnimatedImageState");
|
||||
delete mDecoder;
|
||||
}
|
||||
|
||||
|
@ -709,7 +709,7 @@ void ImageView::updateDrawable(Drawable*d){
|
||||
d->setState(getDrawableState());
|
||||
}
|
||||
if (!sameDrawable ) {
|
||||
const bool visible = getVisibility() == VISIBLE;
|
||||
const bool visible = isAttachedToWindow() && (getWindowVisibility() == VISIBLE) && isShown();
|
||||
d->setVisible(visible, true);
|
||||
}
|
||||
d->setLevel(mLevel);
|
||||
|
@ -3556,7 +3556,7 @@ void RecyclerView::RecycledViewPool::clear() {
|
||||
ScrapData* data = mScrap.valueAt(i);
|
||||
std::vector<ViewHolder*>& vhs = data->mScrapHeap;
|
||||
for(int j=0;j<vhs.size();j++)delete vhs.at(j);
|
||||
vhs.clear();
|
||||
vhs.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user