Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand All @@ -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);
}
}
7 changes: 7 additions & 0 deletions controller/app/src/main/res/drawable/k2go_card_amber.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- ADFA-4910: amber-outlined card (Maps landing v3 "Rebuild the full maps"). -->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/k2go_surface" />
<stroke android:width="1.5dp" android:color="@color/k2go_amber" />
<corners android:radius="18dp" />
</shape>
7 changes: 7 additions & 0 deletions controller/app/src/main/res/drawable/k2go_card_teal.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- ADFA-4910: teal-outlined card (Maps landing v3 "Full-Quality Regions"). -->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/k2go_surface" />
<stroke android:width="1.5dp" android:color="@color/k2go_teal" />
<corners android:radius="18dp" />
</shape>
7 changes: 7 additions & 0 deletions controller/app/src/main/res/drawable/k2go_pill_amber.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- ADFA-4910: amber-outlined pill (Maps landing v3 Rebuild tags). -->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@android:color/transparent" />
<stroke android:width="1dp" android:color="@color/k2go_amber" />
<corners android:radius="11dp" />
</shape>
7 changes: 7 additions & 0 deletions controller/app/src/main/res/drawable/k2go_pill_leaf.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- ADFA-4910: leaf-outlined pill ("Included" badge on the Maps landing v3 basic-maps card). -->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@android:color/transparent" />
<stroke android:width="1dp" android:color="@color/k2go_leaf" />
<corners android:radius="11dp" />
</shape>
7 changes: 7 additions & 0 deletions controller/app/src/main/res/drawable/k2go_pill_teal.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- ADFA-4910: teal-outlined pill (Maps landing v3 FQR tags). -->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@android:color/transparent" />
<stroke android:width="1dp" android:color="@color/k2go_teal" />
<corners android:radius="11dp" />
</shape>
Loading
Loading