Google andoid stúdió panda AI
1. A projekt inicializálása (Az AI prompt)
A kezdeti lépéshez az alábbi angol nyelvű promptot másold be a "Create with AI" ablakba (a modell angolul teljesít a legjobban).
Ez létrehozza a UI vázat, a témákat és az alap architektúrát:
"Build a Budapest hiking guide app with Material 3 design and dynamic dark/light mode support. Include a list-detail view showing the top 3 hiking trails near Budapest. Add a screen with a Google Maps SDK placeholder for route tracking and marking locations. Prepare the project architecture to use Room Database for local data storage."
2. A fejlesztés logikai szakaszai
A legenerált alapváz után a fejlesztést modulárisan kell folytatnod. Az alábbi sorrendet kövesd:
Térkép integráció: Google Maps SDK for Android beállítása és API kulcs megadása a térképes nézethez.
Adatbázis (Room): Entitások (táblák) létrehozása a helyszíneknek, és egy külön tábla a GPS koordinátáknak (TrackPoints).
Háttérfolyamatok (GPS): Foreground Service létrehozása a folyamatos helyzetmeghatározáshoz (Location Services), amely menti az utat.
Adat exportálása: Egy dedikált osztály megírása, ami a Room adatbázisból kiolvasott koordinátákat KML vagy GeoJSON formátumú szövegfájlba konvertálja és a fájlrendszerbe menti.
AI által készített Project Plan
Build a Budapest hiking guide app named 'BP_tura' with Material 3 design and dynamic dark/light mode support. Include a list-detail view showing the top 3 hiking trails near Budapest. Add a screen with a Google Maps SDK placeholder for route tracking and marking locations. Prepare the project architecture to use Room Database for local data storage. The app should have a vibrant, energetic color scheme, strong Material design aesthetic, full edge-to-edge display, and an adaptive app icon matching its core function.
Project Brief
Project Brief: BP_tura - Budapest Hiking Guide
BP_tura is a vibrant and energetic Android application designed to guide hikers through the scenic trails surrounding Budapest. Built with a strong Material 3 aesthetic, the app provides a seamless user experience for discovering trails and tracking hiking progress.
Features
• Curated Trail Directory: A Material 3 list-detail interface showcasing the top 3 hiking trails near Budapest with rich descriptions and images.
• Interactive Route Tracking: A dedicated map screen featuring a Google Maps SDK placeholder for route visualization and marking custom locations.
• Offline Data Persistence: A robust architecture powered by Room Database to ensure trail information is accessible even without an internet connection.
High-Level Technical Stack
• Language: Kotlin
• UI Framework: Jetpack Compose (Material 3)
• Concurrency: Kotlin Coroutines
• Navigation: Jetpack Navigation Compose
• Persistence: Room Database (via KSP)
• Image Loading: Coil
• Location Services: Google Play Services Location (for route tracking)
Implementation Steps
Task_1_Architecture_Theme: Configure the core project architecture including Room Database (Entity, DAO, Database) for local trail data and set up a vibrant Material 3 theme with full edge-to-edge support and dynamic color compatibility.
• Status: IN_PROGRESS
• Updates: Starting Task 1: Architecture and Theme. Planned steps:
1. Define Room Entity (Trail) and DAO.
2. Set up Room Database.
3. Configure vibrant Material 3 theme in Color.kt and Theme.kt.
4. Enable edge-to-edge in MainActivity.
Acceptance Criteria:
◦ Room database is correctly initialized
◦ Material 3 theme with vibrant color scheme is implemented
◦ Edge-to-edge display is enabled in MainActivity
• StartTime: 2026-03-08 17:31:55 CET
Task_2_App_Screens: Implement the Trail List, Trail Detail, and Map screens using Jetpack Compose and Navigation. Integrate the Room data layer and implement a Google Maps placeholder on the tracking screen along with location permission handling.
• Status: PENDING
• Acceptance Criteria:
◦ List screen displays 3 hiking trails
◦ Detail screen shows trail specifics
◦ Map screen contains a placeholder for Google Maps
◦ Navigation between screens works correctly
◦ Location permissions are requested/handled
Task_3_Assets_Branding: Create an adaptive app icon matching the hiking theme and refine the UI aesthetics to ensure a vibrant and energetic Material 3 look across all components.
• Status: PENDING
• Acceptance Criteria:
◦ Adaptive app icon is generated and applied
◦ UI follows Material 3 guidelines with high-energy colors
Task_4_Run_Verify: Perform a final run of the application to verify stability, feature completeness, and adherence to the project brief. Instruct critic_agent to verify application stability (no crashes), confirm alignment with user requirements, and report critical UI issues.
• Status: PENDING
• Acceptance Criteria:
◦ Project builds successfully
◦ App does not crash
◦ All existing tests pass
◦ Material 3 design and vibrant theme are verified
◦ List, Detail, and Map screens are functional
A Google Maps API kikerülésére a legjobb nyílt forráskódú alternatíva Androidon az Osmdroid könyvtár. Ez az OpenStreetMap (OSM) adatait használja, és teljesen ingyenes.
A beépített Gemini asszisztensnek az alábbi angol nyelvű promptot addtam meg:
"Replace the map placeholder in the BP_tura project with an OpenStreetMap implementation using the osmdroid-android library. Add the necessary osmdroid dependencies to the app-level
build.gradle.kts. Create a Jetpack Compose screen that uses theAndroidViewwrapper to display the osmdroidMapView. Center the map on Budapest (Lat: 47.4979, Lng: 19.0402) and set a default zoom level of 12.0. Configure the map to handle standard gestures (zoom, pan) and ensure its lifecycle is managed correctly within Compose."
A nyomvonalak (Polyline) kirajzolásához az Osmdroid térképen az adatbázisból lekérdezett koordinátákat kell felhasználni.
A Jetpack Compose AndroidView komponensének update blokkjában kell frissíteni a térkép rétegeit (overlays).
Az Android Studio beépített Gemini asszisztensének az alábbi angol nyelvű promptot addtam meg:
"Update the existing Osmdroid
MapViewimplementation in the BP_tura project to draw a hiking route. Accept aList<TrackPointEntity>from the Room database as a state parameter. Inside theAndroidViewupdate block, convert these track points into OsmdroidGeoPointobjects. Create anorg.osmdroid.views.overlay.Polyline, set its color to an energetic Material 3 color (e.g., Deep Orange), and add it to the map's overlays. Ensure previous polylines are cleared frommapView.overlaysbefore adding the new one to prevent duplication on state changes."
Az Osmdroid térkép memóriaszivárgásának elkerüléséhez a Jetpack Compose felületen az alábbi promptot addtam ki az asszisztensnek:
"Enhance the Osmdroid MapView inside the Compose AndroidView. Implement a DisposableEffect with a LifecycleEventObserver to manage the map's lifecycle. Trigger mapView.onResume() on Lifecycle.Event.ON_RESUME and mapView.onPause() on Lifecycle.Event.ON_PAUSE. Include an onDispose block that calls mapView.onDetach() to release map resources safely."
A GeoJSON formátum legenerálásához és mentéséhez ezt az angol nyelvű promptot használtam:
"Write a Kotlin utility class for the BP_tura app to convert a
List<TrackPointEntity>into a valid GeoJSON string. Use aFeatureCollectionwith aLineStringfor the coordinates. Implement a function to save this string as a.geojsonfile to the device's Downloads directory using the AndroidMediaStoreAPI."
A KML formátumhoz és a dokumentumválasztó (SAF) integrálásához ezt a promptot addtam ki:
"Create a Kotlin function to format a
List<TrackPointEntity>into a standard KML XML string. Include<kml>,<Document>,<Placemark>, and<LineString>tags. Implement file saving using the Android Storage Access Framework viaActivityResultContracts.CreateDocumentwith the MIME typeapplication/vnd.google-earth.kml+xml."
Az Android Studio beépített asszisztensének az alábbi angol nyelvű promptot addtam meg:
"Create a Jetpack Compose UI component with two Material 3 Buttons in a Row for the BP_tura app. One button should trigger 'Export GeoJSON' and the other 'Export KML'. Implement
rememberLauncherForActivityResultwithActivityResultContracts.CreateDocumentfor both actions. Set the correct MIME types ('application/geo+json' and 'application/vnd.google-earth.kml+xml'). When the system returns a valid URI, pass it to a ViewModel function to handle the actual file writing."
Az Android háttérben futó helymeghatározásához (Foreground Service) a FusedLocationProviderClient használata a standard.
Android 14 (API 34) felett szigorú szabályok vonatkoznak a szolgáltatás típusának deklarálására és az értesítések kezelésére.
Az Android Studio beépített Gemini asszisztensének az alábbi angol nyelvű promptot addtam meg:
"Create a Kotlin Service class for the BP_tura app that runs as a Foreground Service to track GPS location. Use FusedLocationProviderClient to request high-accuracy location updates every 5 seconds. Implement a persistent Notification with a NotificationChannel, required for foreground services. Configure the service type as location in the AndroidManifest.xml. Show how to inject the Room HikeDao and insert a new TrackPointEntity record on each location callback using a CoroutineScope."

.png)
Megjegyzések
Megjegyzés küldése