Skip to content

SanyamBK/Journey-Tracker

Repository files navigation

The First Android App (Journey Tracker)

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.

Features

  • 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.

Implementation

The project has two versions of the app:

  1. 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.
  2. Jetpack Compose Version:

    • Uses Jetpack Compose for the UI.
    • State management is handled using mutableStateOf and remember.
    • LazyColumn is used to display the list of stops.
    • The progress bar is implemented using LinearProgressIndicator.

Project Structure

  • 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).

Data Format (stops.txt)

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)

Example:

New York,yes,0
Philadelphia,no,150
Washington DC,no,200

Setup Instructions

  1. Clone the Repository:

    git clone https://github.com/SanyamBK/MC-Assignment-1.git
    cd MC-Assignment-1
  2. Switch Branches:

    • For the XML + Kotlin version:
      git checkout main
    • For the Jetpack Compose version:
      git checkout compose
  3. Open the Project:

    • Open the project in Android Studio.
  4. Run the App:

    • Connect an Android device or start an emulator.
    • Click the "Run" button in Android Studio to build and run the app.

APK Installation

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.
  • 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.

How to Install the APK on an Android Device:

  1. Download the respective APK file (gmaps_pro.apk or myjourney.apk).
  2. Transfer the file to your Android device if downloaded on a computer.
  3. Open the file using a file manager.
  4. If prompted, enable "Install from unknown sources" in your device settings.
  5. Tap "Install" and wait for the installation to complete.
  6. Open the app and start tracking your journey!

Grading Rubric

The project adheres to the following grading criteria:

  1. Textbox and Lazy List (10 marks): Implemented using RecyclerView in XML and LazyColumn in Compose.
  2. Buttons and Unit Conversion (10 marks): A button toggles between kilometers and miles, and another button moves to the next stop.
  3. User Interface (10 marks): The UI is clean and functional, with a progress bar and proper spacing.
  4. Compose Version (10 marks): The Compose version is fully functional and uses modern Jetpack Compose components.
  5. Readme and Packaging (10 marks): This README.md file explains the project, and the app is properly packaged.
  6. Running App (10 marks): The app runs smoothly on both Android devices and emulators.

Screenshots

XML + Kotlin Version

XML Version Screenshot

Jetpack Compose Version

Compose Version Screenshot

About

Repository for Mobile Computing Assignment 1

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages