This is an Android application that helps users track their journey with multiple stops, including details such as distance, time, and visa requirements. The app supports both XML-based UI and Jetpack Compose implementations, as required by the assignment.
- Distance Tracking: Displays the distance covered and remaining in either kilometers or miles.
- Time Estimation: Displays the estimated time required to reach the next stop in hours and minutes.
- Progress Bar: Shows the progress of the journey using a horizontal progress bar.
- Next Stop Button: Allows the user to move to the next stop in the journey.
- Unit Conversion: Toggles between kilometers and miles using a button.
- Lazy List: Displays the next 3 stops in the journey using a lazy list (RecyclerView in XML and LazyColumn in Compose).
- Visa Requirements: Indicates whether a visa is required for each stop.
The project has two versions of the app:
-
XML + Kotlin Version:
- Uses traditional XML layouts for the UI.
- UI elements are referenced using
findViewById
in Kotlin. RecyclerView
is used to display the list of stops.- The progress bar is implemented using a
ProgressBar
widget.
-
Jetpack Compose Version:
- Uses Jetpack Compose for the UI.
- State management is handled using
mutableStateOf
andremember
. LazyColumn
is used to display the list of stops.- The progress bar is implemented using
LinearProgressIndicator
.
-
XML + Kotlin Version:
activity_main.xml
: Defines the main layout of the app.item_stop.xml
: Defines the layout for each stop item in the RecyclerView.MainActivity.kt
: Contains the logic for the XML-based version.StopAdapter.kt
: Adapter for the RecyclerView.
-
Jetpack Compose Version:
MainActivity.kt
: Contains the Compose UI and logic.- No XML files are used in this version.
-
Shared Resources:
stops.txt
: A raw resource file containing the list of stops with their details (name, visa requirement, and distance).
The journey stops are stored in a raw text file with each line formatted as:
Stop Name, Visa Required (yes/no), Distance from Previous Location (km)
New York,yes,0
Philadelphia,no,150
Washington DC,no,200
-
Clone the Repository:
git clone https://github.com/SanyamBK/MC-Assignment-1.git cd MC-Assignment-1
-
Switch Branches:
- For the XML + Kotlin version:
git checkout main
- For the Jetpack Compose version:
git checkout compose
- For the XML + Kotlin version:
-
Open the Project:
- Open the project in Android Studio.
-
Run the App:
- Connect an Android device or start an emulator.
- Click the "Run" button in Android Studio to build and run the app.
To install the app without compiling the source code, download and install the pre-built APK files:
-
XML + Kotlin Version (main):
- Navigate to the
apk/
directory of the main repository. - Download the
gmaps_pro.apk
file. - Transfer the APK to your Android device and install it manually.
- Navigate to the
-
Jetpack Compose Version (compose):
- Navigate to the
apk/
directory of the compose branch. - Download the
myjourney.apk
file. - Transfer the APK to your Android device and install it manually.
- Navigate to the
- Download the respective APK file (
gmaps_pro.apk
ormyjourney.apk
). - Transfer the file to your Android device if downloaded on a computer.
- Open the file using a file manager.
- If prompted, enable "Install from unknown sources" in your device settings.
- Tap "Install" and wait for the installation to complete.
- Open the app and start tracking your journey!
The project adheres to the following grading criteria:
- Textbox and Lazy List (10 marks): Implemented using
RecyclerView
in XML andLazyColumn
in Compose. - Buttons and Unit Conversion (10 marks): A button toggles between kilometers and miles, and another button moves to the next stop.
- User Interface (10 marks): The UI is clean and functional, with a progress bar and proper spacing.
- Compose Version (10 marks): The Compose version is fully functional and uses modern Jetpack Compose components.
- Readme and Packaging (10 marks): This
README.md
file explains the project, and the app is properly packaged. - Running App (10 marks): The app runs smoothly on both Android devices and emulators.