diff --git a/controller/app/src/main/java/org/iiab/controller/redesign/MapsLandingFragment.java b/controller/app/src/main/java/org/iiab/controller/redesign/MapsLandingFragment.java index 996f1881..a96d8437 100644 --- a/controller/app/src/main/java/org/iiab/controller/redesign/MapsLandingFragment.java +++ b/controller/app/src/main/java/org/iiab/controller/redesign/MapsLandingFragment.java @@ -3,15 +3,18 @@ * Name : MapsLandingFragment.java * Author : AppDevForAll * Copyright : Copyright (c) 2026 AppDevForAll - * Description : ADFA-4848 (slice 2). Maps entry in Get More — the install/update entry - * into the layers & quality chooser. No FQR fork: full-quality regions move - * into the maps WebView later (the map already draws + generates the code; - * we only wire its backend execution via the REST engine). Hosted in - * SetupLibraryActivity. + * Description : ADFA-4848 (slice 2) / ADFA-4910 (landing v3). Maps entry in Get More. + * Basic maps + "Rebuild the full maps" always show; the Full-Quality + * Regions card is dismissible (x) and its state is persisted, so + * returning users get the compact "Show" row. "Rebuild" opens the + * layers & quality chooser; "Continue" leaves with basic maps (back to + * the Get More hub). Hosted in SetupLibraryActivity. * ============================================================================ */ package org.iiab.controller.redesign; +import android.content.Context; +import android.content.SharedPreferences; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; @@ -21,11 +24,15 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; import org.iiab.controller.R; public class MapsLandingFragment extends Fragment { + // ADFA-4910: persisted so a returning user sees the compact Full-Quality Regions row. + private static final String PREF_FQR_DISMISSED = "maps_fqr_dismissed"; + @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle s) { @@ -35,11 +42,41 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c back.setText("‹ " + getString(R.string.k2go_gm_hub_title)); back.setOnClickListener(v -> requireActivity().getSupportFragmentManager().popBackStack()); - root.findViewById(R.id.k2go_maps_choose_btn).setOnClickListener(v -> { + final View fqrCard = root.findViewById(R.id.k2go_maps_fqr_card); + final View fqrCompact = root.findViewById(R.id.k2go_maps_fqr_compact_row); + applyFqrState(fqrCard, fqrCompact, prefs().getBoolean(PREF_FQR_DISMISSED, false)); + + root.findViewById(R.id.k2go_maps_fqr_dismiss).setOnClickListener(v -> { + prefs().edit().putBoolean(PREF_FQR_DISMISSED, true).apply(); + applyFqrState(fqrCard, fqrCompact, true); + }); + root.findViewById(R.id.k2go_maps_fqr_show).setOnClickListener(v -> { + prefs().edit().putBoolean(PREF_FQR_DISMISSED, false).apply(); + applyFqrState(fqrCard, fqrCompact, false); + }); + + // "Rebuild the full maps" -> the layers & quality chooser (the previous single action). + root.findViewById(R.id.k2go_maps_rebuild_card).setOnClickListener(v -> { if (getActivity() instanceof SetupLibraryActivity) { ((SetupLibraryActivity) getActivity()).openMapsChoose(); } }); + + // "Continue" -> leave with basic maps: pop the whole maps sub-flow, back to the Get More hub. + root.findViewById(R.id.k2go_maps_continue).setOnClickListener(v -> + requireActivity().getSupportFragmentManager() + .popBackStack("getmore_maps", FragmentManager.POP_BACK_STACK_INCLUSIVE)); + return root; } + + private void applyFqrState(View card, View compact, boolean dismissed) { + card.setVisibility(dismissed ? View.GONE : View.VISIBLE); + compact.setVisibility(dismissed ? View.VISIBLE : View.GONE); + } + + private SharedPreferences prefs() { + return requireContext().getSharedPreferences( + getString(R.string.pref_file_internal), Context.MODE_PRIVATE); + } } diff --git a/controller/app/src/main/res/drawable/k2go_card_amber.xml b/controller/app/src/main/res/drawable/k2go_card_amber.xml new file mode 100644 index 00000000..de975e90 --- /dev/null +++ b/controller/app/src/main/res/drawable/k2go_card_amber.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/controller/app/src/main/res/drawable/k2go_card_teal.xml b/controller/app/src/main/res/drawable/k2go_card_teal.xml new file mode 100644 index 00000000..26a91b86 --- /dev/null +++ b/controller/app/src/main/res/drawable/k2go_card_teal.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/controller/app/src/main/res/drawable/k2go_pill_amber.xml b/controller/app/src/main/res/drawable/k2go_pill_amber.xml new file mode 100644 index 00000000..e36ba029 --- /dev/null +++ b/controller/app/src/main/res/drawable/k2go_pill_amber.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/controller/app/src/main/res/drawable/k2go_pill_leaf.xml b/controller/app/src/main/res/drawable/k2go_pill_leaf.xml new file mode 100644 index 00000000..f6bfcd62 --- /dev/null +++ b/controller/app/src/main/res/drawable/k2go_pill_leaf.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/controller/app/src/main/res/drawable/k2go_pill_teal.xml b/controller/app/src/main/res/drawable/k2go_pill_teal.xml new file mode 100644 index 00000000..167edc30 --- /dev/null +++ b/controller/app/src/main/res/drawable/k2go_pill_teal.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/controller/app/src/main/res/layout/fragment_k2go_maps_landing.xml b/controller/app/src/main/res/layout/fragment_k2go_maps_landing.xml index 773e84b9..d29427b7 100644 --- a/controller/app/src/main/res/layout/fragment_k2go_maps_landing.xml +++ b/controller/app/src/main/res/layout/fragment_k2go_maps_landing.xml @@ -1,92 +1,426 @@ - - + + android:orientation="vertical"> - - - + android:layout_height="0dp" + android:layout_weight="1" + android:fillViewport="true"> - - + android:orientation="vertical" + android:paddingLeft="20dp" + android:paddingRight="20dp" + android:paddingTop="20dp" + android:paddingBottom="8dp"> - + android:padding="4dp" + android:textAppearance="?attr/textAppearanceBodyMedium" + android:textColor="@color/k2go_teal" /> - + - + + + + + android:layout_marginTop="4dp" + android:text="@string/k2go_maps_landing_sub" + android:textAppearance="?attr/textAppearanceBodyLarge" + android:textColor="@color/k2go_muted" /> + + + + + + + + + + + + + + + + + android:layout_marginTop="20dp" + android:text="@string/k2go_maps_sec_sharp" + android:textAppearance="?attr/textAppearanceBodySmall" + android:textStyle="bold" + android:letterSpacing="0.08" + android:textColor="@color/k2go_teal" /> -