fix seekbar's seek operation

This commit is contained in:
houzh 2023-04-14 05:17:41 +00:00
parent ab0e29ef33
commit 1a4a06c634
3 changed files with 5 additions and 18 deletions

View File

@ -11,6 +11,7 @@ void TimeAnimator::start(){
mPreviousTime = -1;
ValueAnimator::start();
}
bool TimeAnimator::animateBasedOnTime(long currentTime){
if(mListener != nullptr){
long totalTime = currentTime - mStartTime;
@ -18,6 +19,7 @@ bool TimeAnimator::animateBasedOnTime(long currentTime){
mPreviousTime = currentTime;
mListener(*this,totalTime,detaTime);
}
return true;
}
void TimeAnimator::setCurrentPlayTime(long playTime){

View File

@ -355,8 +355,6 @@ int TouchDevice::putRawEvent(const struct timeval&tv,int type,int code,int value
case SYN_REPORT:
case SYN_MT_REPORT:
mMoveTime =(tv.tv_sec*1000000+tv.tv_usec);
LOGV("%s pos=%.f,%.f",MotionEvent::actionToString(mEvent.getAction()).c_str(),
mPointMAP.begin()->second.coord.getX(),mPointMAP.begin()->second.coord.getY() );
mEvent.initialize(getId(),getSource(),mEvent.getAction(),mEvent.getActionButton(),
0/*flags*/, 0/*edgeFlags*/, 0/*metaState*/, mEvent.getButtonState() ,
0/*xOffset*/,0/*yOffset*/ , 0/*xPrecision*/, 0/*yPrecision*/ ,
@ -364,6 +362,8 @@ int TouchDevice::putRawEvent(const struct timeval&tv,int type,int code,int value
for(auto p:mPointMAP){
mEvent.addSample(mMoveTime,p.second.prop,p.second.coord);
}
LOGV_IF(mEvent.getAction()==MotionEvent::ACTION_UP,"%s pos=%.f,%.f",MotionEvent::actionToString(mEvent.getAction()).c_str(),
mPointMAP.begin()->second.coord.getX(),mEvent.getX(),mEvent.getY());
if(listener)listener(mEvent);
if(mEvent.getAction()==MotionEvent::ACTION_UP)
mPointMAP.clear();

View File

@ -67,7 +67,6 @@ ProgressBar::ProgressBar(int width, int height):View(width,height){
indeterminatePos=0;
mHasAnimation=false;
mAttached=false;
mRefreshIsPosted=false;
mShouldStartAnimationDrawable=false;
setProgressDrawable(mContext->getDrawable("cdroid:drawable/progress_horizontal.xml"));
}
@ -353,21 +352,7 @@ void ProgressBar::refreshProgress(int id, int progress, bool fromUser,bool anima
rd.progress=progress;
rd.fromUser=fromUser;
rd.animate=animate;
//doRefreshProgress(id, progress, fromUser, true, animate);
//return ;
if(!mRefreshIsPosted){
if(mAttached&&!mRefreshIsPosted){
mRefreshProgressRunnable =[this](){
for(auto d:mDatas){
RefreshData&rd=d.second;
doRefreshProgress(d.first,rd.progress, rd.fromUser, true, rd.animate);
}
mRefreshIsPosted=false;
};
post(mRefreshProgressRunnable);
mRefreshIsPosted=true;
}
}
doRefreshProgress(id, progress, fromUser, true, animate);
}
bool ProgressBar::setProgressInternal(int value, bool fromUser,bool animate){