Skip to content

Commit 9c84b3a

Browse files
ADFA-4879: overlay header shows region size + keep the bar visible when minimized
- Header now reads: Downloading "name" · <size on disk> (from the estimate), with a middle-dot separator; percent + speed stay on the line below. - Minimizing (Hide) now keeps the title and the advancing progress bar visible and only hides the percent/cancel row, so you still see progress while collapsed.
1 parent 0eafced commit 9c84b3a

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

‎controller/app/src/main/java/org/iiab/controller/redesign/FqrController.java‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -226,14 +226,16 @@ private void showConsent(String name, String box, long transfer, long archive, l
226226
// Kick off the actual download only after consent; the box already re-validates.
227227
// (startDownload is invoked from the positive button above.)
228228
pendingBox = box;
229+
pendingArchive = archive;
229230
}
230231

231-
private String pendingBox; // box paired with the name at consent time
232+
private String pendingBox; // box paired with the name at consent time
233+
private long pendingArchive; // on-disk size (bytes) to show in the overlay header
232234

233235
private void startDownload(String name) {
234236
final String box = pendingBox;
235237
if (box == null) return;
236-
showOverlay(name);
238+
showOverlay(name, pendingArchive);
237239
client.download(name, box, new MapsRegionClient.DownloadListener() {
238240
@Override public void onProgress(int percent, long speed) { updateOverlay(percent, speed); }
239241
@Override public void onDone() {
@@ -253,7 +255,7 @@ private void startDownload(String name) {
253255
}
254256

255257
// ---- Floating progress overlay -----------------------------------------------------------
256-
private void showOverlay(String name) {
258+
private void showOverlay(String name, long sizeBytes) {
257259
hideOverlay();
258260
LinearLayout cardV = card(dp(16));
259261
cardV.setOrientation(LinearLayout.VERTICAL);
@@ -262,7 +264,8 @@ private void showOverlay(String name) {
262264
top.setOrientation(LinearLayout.HORIZONTAL);
263265
top.setGravity(Gravity.CENTER_VERTICAL);
264266
overlayTitle = new TextView(activity);
265-
overlayTitle.setText(String.format(Locale.US, "Downloading “%s”", name));
267+
final String size = sizeBytes > 0 ? " · " + human(sizeBytes) : ""; // "Downloading “x” · 2.1 GB"
268+
overlayTitle.setText(String.format(Locale.US, "Downloading “%s”%s", name, size));
266269
overlayTitle.setTextColor(Color.WHITE);
267270
overlayTitle.setTypeface(overlayTitle.getTypeface(), Typeface.BOLD);
268271
top.addView(overlayTitle, new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f));
@@ -313,10 +316,10 @@ private void toggleMinimize() {
313316
if (overlay == null) return;
314317
overlayMinimized = !overlayMinimized;
315318
LinearLayout cardV = (LinearLayout) overlay;
316-
// Keep the title row (index 0) always; hide bar (1) and controls row (2) when minimized.
317-
for (int i = 1; i < cardV.getChildCount(); i++) {
318-
cardV.getChildAt(i).setVisibility(overlayMinimized ? View.GONE : View.VISIBLE);
319-
}
319+
// Minimized = keep the title + the slim advancing bar; hide only the percent/cancel row,
320+
// so progress stays visible even when collapsed (the point of minimizing is minimal chrome).
321+
View controls = cardV.getChildAt(cardV.getChildCount() - 1);
322+
controls.setVisibility(overlayMinimized ? View.GONE : View.VISIBLE);
320323
if (overlayMin != null) overlayMin.setText(overlayMinimized ? "Show" : "Hide");
321324
}
322325

0 commit comments

Comments
 (0)