[android] pending progress for progress bars

This commit is contained in:
Arsentiy Milchakov 2018-04-17 15:05:04 +03:00 committed by Aleksandr Zatsepin
parent f9f9ee72e9
commit cd03906c50
2 changed files with 10 additions and 6 deletions

View file

@ -345,16 +345,11 @@ public class UpdaterDialogFragment extends BaseMwmDialogFragment
getString(R.string.whats_new_auto_update_button_later));
mFinishBtn.setOnClickListener(mFinishClickListener);
mProgressBar.setOnClickListener(mCancelClickListener);
mProgressBar.post(() -> mProgressBar.setPending(true));
if (mAutoUpdate)
{
int progress = MapManager.nativeGetOverallProgress(mOutdatedMaps);
setProgress(progress, mTotalSizeBytes * progress / 100, mTotalSizeBytes);
setCommonStatus(mProcessedMapId, mCommonStatusResId);
}
else
{
mTitle.setText(getString(R.string.whats_new_auto_update_title));
}
}
private boolean isAllUpdated()
@ -372,6 +367,9 @@ public class UpdaterDialogFragment extends BaseMwmDialogFragment
void setProgress(int progress, long localSize, long remoteSize)
{
if (mProgressBar.isPending())
mProgressBar.setPending(false);
mProgressBar.setProgress(progress);
mRelativeStatus.setText(getRelativeStatusFormatted(progress, localSize, remoteSize));
}

View file

@ -69,6 +69,7 @@ public class WheelProgressView extends ImageView
typedArray.recycle();
mPendingDrawable = (AnimationDrawable) getResources().getDrawable(ThemeUtils.getResource(getContext(), R.attr.wheelPendingAnimation));
Graphics.tint(mPendingDrawable, progressColor);
mBgPaint = new Paint();
mBgPaint.setColor(secondaryColor);
@ -156,4 +157,9 @@ public class WheelProgressView extends ImageView
invalidate();
}
public boolean isPending()
{
return mIsPending;
}
}