[android] Start LinearProgressBars at 1% to show initial dot

see https://m3.material.io/components/progress-indicators/guidelines#817a3dbd-9dd5-471f-a7d0-50eae6270ee0

Signed-off-by: Harry Bond <me@hbond.xyz>
This commit is contained in:
Harry Bond
2025-08-23 13:57:46 +01:00
committed by Konstantin Pastbin
parent 06b6c3f794
commit e367fa6792
3 changed files with 10 additions and 6 deletions

View File

@@ -116,10 +116,10 @@ public class DownloadResourcesLegacyActivity extends BaseMwmFragmentActivity
private final app.organicmaps.sdk.DownloadResourcesLegacyActivity.Listener mResourcesDownloadListener =
new app.organicmaps.sdk.DownloadResourcesLegacyActivity.Listener() {
@Override
public void onProgress(final int percent)
public void onProgress(final int bytesDownloaded)
{
if (!isFinishing())
mProgress.setProgressCompat(percent, true);
mProgress.setProgressCompat(bytesDownloaded, true);
}
@Override
@@ -250,7 +250,8 @@ public class DownloadResourcesLegacyActivity extends BaseMwmFragmentActivity
setDownloadMessage(bytes);
mProgress.setMax(bytes);
mProgress.setProgressCompat(0, true);
// Start progress at 1% according to M3 guidelines
mProgress.setProgressCompat(bytes/100, true);
}
else
finishFilesDownload(bytes);
@@ -368,7 +369,8 @@ public class DownloadResourcesLegacyActivity extends BaseMwmFragmentActivity
String fileSizeString = StringUtils.getFileSizeString(this, item.totalSize);
mTvMessage.setText(getString(R.string.downloading_country_can_proceed, item.name, fileSizeString));
mProgress.setMax((int) item.totalSize);
mProgress.setProgressCompat(0, true);
// Start progress at 1% according to M3 guidelines
mProgress.setProgressCompat((int) (item.totalSize/100), true);
mCountryDownloadListenerSlot = MapManager.nativeSubscribe(mCountryDownloadListener);
MapManager.startDownload(mCurrentCountry);

View File

@@ -17,7 +17,7 @@ public class DownloadResourcesLegacyActivity
{
// Called by JNI.
@Keep
void onProgress(int percent);
void onProgress(int bytesDownloaded);
// Called by JNI.
@Keep

View File

@@ -231,7 +231,9 @@ public class NavMenu
updateTime(info.totalTimeInSeconds);
mDistanceValue.setText(info.distToTarget.mDistanceStr);
mDistanceUnits.setText(info.distToTarget.getUnitsStr(mActivity.getApplicationContext()));
mRouteProgress.setProgressCompat((int) info.completionPercent, true);
// Start progress at 1% according to M3 guidelines
final int completionPercent = (info.completionPercent < 1) ? 1 : (int) info.completionPercent;
mRouteProgress.setProgressCompat(completionPercent, true);
}
public interface NavMenuListener