3030public 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 ) {
0 commit comments