Google-Play-Expansion-File
Google-Play-Expansion-File copied to clipboard
Downloader indicator mismatch
I successfully implement the sample on my work project, but I noticed that the indicators not work as expected. The file and the downloading size overlaps the limit and the percent too. The code have a line that for my personal opinion is wrong.
progress.mOverallTotal = progress.mOverallTotal;
/**
* Sets the state of the various controls based on the progress info object
* sent from the downloader service.
*/
@Override
public void onDownloadProgress(DownloadProgressInfo progress) {
mAverageSpeed.setText(getString(R.string.kilobytes_per_second, Helpers.getSpeedString(progress.mCurrentSpeed)));
mTimeRemaining.setText(getString(R.string.time_remaining, Helpers.getTimeRemaining(progress.mTimeRemaining)));
progress.mOverallTotal = progress.mOverallTotal;
mPB.setMax((int) (progress.mOverallTotal >> 8));
mPB.setProgress((int) (progress.mOverallProgress >> 8));
mProgressPercent.setText(Long.toString(progress.mOverallProgress * 100 / progress.mOverallTotal) + "%");
mProgressFraction.setText(Helpers.getDownloadProgressString(progress.mOverallProgress, progress.mOverallTotal));
}
Any suggestions to fix this? @danikula Thanks in advance 😄
I had similar problem with notifies. In my case, the progress won't be 100% at all even though download finished. So, I just pushed my own notify with specific ID that this library is using. You can see the ID at this line. BTW, own notify can be overwritten by this library's notify even though pushed later than that. So I placed sleep thread 100ms before pushing own notify. Yes, sleeping thread is not excellent idea, but it works excellently and absolutely simple.