Skip to content

Commit 96868c4

Browse files
ADFA-4901: open the maps progress detail from the finishing-setup card
The maps stage row in the Finishing-setup index was not tappable (its richer detail was deferred). Make it open its own progress detail like the ZIM/Books rows, once the stage has started. Maps is a single proot runrole, so the detail is the queue-driven Preparing card (spinner + phase), reused in a new observe-only (fromIndex) mode that never (re)starts the install.
1 parent 6cb0237 commit 96868c4

2 files changed

Lines changed: 44 additions & 12 deletions

File tree

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

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
public class MapsPreparingFragment extends Fragment {
3131

3232
private static final String ARG_LEVELS = "levels";
33+
private static final String ARG_FROM_INDEX = "fromIndex";
3334

3435
public static MapsPreparingFragment newInstance(String[] levels) {
3536
MapsPreparingFragment f = new MapsPreparingFragment();
@@ -39,29 +40,48 @@ public static MapsPreparingFragment newInstance(String[] levels) {
3940
return f;
4041
}
4142

43+
/** ADFA-4901: open as the maps detail inside the Finishing-setup index — observe only, never
44+
* (re)start the install, and hide this fragment's own "Run in background" button (the index
45+
* host provides Back/Finish). Mirrors ZimPreparingFragment.newInstance(fromIndex). */
46+
public static MapsPreparingFragment newInstance(boolean fromIndex) {
47+
MapsPreparingFragment f = new MapsPreparingFragment();
48+
Bundle b = new Bundle();
49+
b.putBoolean(ARG_FROM_INDEX, fromIndex);
50+
f.setArguments(b);
51+
return f;
52+
}
53+
4254
private TextView status;
55+
private boolean fromIndex = false; // ADFA-4901: hosted by the Finishing-setup index (observe only)
4356
private boolean launched = false; // ADFA-4900: guard against re-launching maps on view recreation
4457

4558
@Nullable
4659
@Override
4760
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle s) {
4861
View root = inflater.inflate(R.layout.fragment_k2go_maps_preparing, container, false);
4962

63+
fromIndex = getArguments() != null && getArguments().getBoolean(ARG_FROM_INDEX, false);
64+
5065
status = root.findViewById(R.id.k2go_prep_status);
5166
status.setText(getString(R.string.k2go_maps_phase_prepared));
5267

53-
// Run in background -> back to the Get More hub (drops the whole Maps flow off the
54-
// back stack), the build keeps going in the foreground service.
55-
root.findViewById(R.id.k2go_prep_run_bg).setOnClickListener(v -> {
56-
if (getActivity() instanceof SetupLibraryActivity) {
57-
((SetupLibraryActivity) getActivity()).backToGetMoreHub();
58-
}
59-
});
68+
View runBg = root.findViewById(R.id.k2go_prep_run_bg);
69+
if (fromIndex) {
70+
runBg.setVisibility(View.GONE); // the index host provides Back/Finish; this card only observes
71+
} else {
72+
// Run in background -> back to the Get More hub (drops the whole Maps flow off the
73+
// back stack), the build keeps going in the foreground service.
74+
runBg.setOnClickListener(v -> {
75+
if (getActivity() instanceof SetupLibraryActivity) {
76+
((SetupLibraryActivity) getActivity()).backToGetMoreHub();
77+
}
78+
});
79+
}
6080

61-
// Start the real install only on first entry (not on a config-change recreation, and not
62-
// if a maps job is already running/done from this session).
81+
// Start the real install only on first entry (not on a config-change recreation, not when
82+
// hosted as the Finishing-setup detail, and not if a maps job is already running/done).
6383
String[] levels = getArguments() != null ? getArguments().getStringArray(ARG_LEVELS) : null;
64-
if (s == null && !launched
84+
if (s == null && !launched && !fromIndex
6585
&& getActivity() instanceof SetupLibraryActivity
6686
&& !ModuleQueueRepository.get().isRunning()
6787
&& ModuleQueueRepository.get().current().phase != ModuleQueueState.Phase.DONE) {

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,16 @@ private View mapsRow() {
371371
sub.setTextColor(ContextCompat.getColor(this, failed ? R.color.k2go_amber_text : R.color.k2go_muted));
372372
col.addView(sub);
373373
row.addView(col, new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.WRAP_CONTENT, 1f));
374+
375+
// ADFA-4901: like the ZIM/Books rows, maps opens its own progress detail once the stage has
376+
// started (running or done). Maps is a single proot runrole, so the detail is the queue-driven
377+
// Preparing card (spinner + phase), not a per-item checklist.
378+
ImageView chev = new ImageView(this);
379+
chev.setImageResource(R.drawable.ic_chevron_right);
380+
chev.setColorFilter(ContextCompat.getColor(this, R.color.k2go_muted));
381+
chev.setVisibility(started ? View.VISIBLE : View.INVISIBLE);
382+
row.addView(chev, new LinearLayout.LayoutParams(px(24), px(24)));
383+
if (started) row.setOnClickListener(v -> openDetail("maps"));
374384
return row;
375385
}
376386

@@ -421,8 +431,10 @@ private void goHome(boolean clearSessions) {
421431
// ---- detail: host the real per-module card ----
422432
private void openDetail(String key) {
423433
showingDetail = true;
424-
androidx.fragment.app.Fragment f = "zim".equals(key)
425-
? ZimPreparingFragment.newInstance(true) : BooksDownloadsFragment.newInstance(true);
434+
androidx.fragment.app.Fragment f;
435+
if ("zim".equals(key)) f = ZimPreparingFragment.newInstance(true);
436+
else if ("maps".equals(key)) f = MapsPreparingFragment.newInstance(true); // ADFA-4901: observe-only
437+
else f = BooksDownloadsFragment.newInstance(true);
426438
getSupportFragmentManager().beginTransaction().replace(R.id.k2go_sp_fraghost, f).commit();
427439
indexScroll.setVisibility(View.GONE);
428440
detailRoot.setVisibility(View.VISIBLE);

0 commit comments

Comments
 (0)