Skip to content

Satwik0706/MAD_LAB_CAMPUS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation



🏛️ Campus Explore

An interactive Android app to navigate your college campus — buildings, floors, rooms & canteen menus, all in one place.



📱 App Flow

Campus Explore Page
        │
        ▼
🗺️  3D Campus Map          ← Isometric / 3D view of all buildings
        │  (tap a building)
        ▼
🏛️  Building Details        ← 2D floor plan with floor tabs
        │  (tap a floor)
        ▼
📋  Floor Details           ← Offices · Classrooms · Canteen
        │  (tap canteen)
        ▼
🍽️  Canteen Menu            ← Food items with prices & categories

✨ Features

  • 🗺️ Interactive 3D/Isometric Campus Map — tap any building to explore
  • 🏛️ 2D Floor Plan Viewer — custom Canvas-based rendering with room tap support
  • 📋 Room-level Navigation — offices, classrooms, canteen all linked
  • 🍽️ Live Canteen Menu — food items, categories & pricing
  • 📦 JSON-driven Data — all campus data loaded from local assets
  • ViewModel + Repository pattern — clean MVVM architecture

🗂️ Project Structure

app/src/main/java/com/bms/college_explore/
│
├── ui/
│   ├── map/
│   │   ├── CampusMapFragment.kt        # 3D isometric map with building markers
│   │   ├── MapViewModel.kt             # State & data binding for map screen
│   │   └── BuildingMarkerAdapter.kt    # Renders building pins on the map
│   │
│   ├── floorplan/
│   │   ├── FloorPlanActivity.kt        # 2D floor plan viewer with floor tabs
│   │   ├── FloorPlanView.kt            # Custom Canvas view for room rendering
│   │   └── RoomClickListener.kt        # Interface for room tap events
│   │
│   ├── canteen/
│   │   ├── CanteenMenuFragment.kt      # Displays food items & prices
│   │   └── MenuAdapter.kt             # RecyclerView adapter for menu list
│   │
│   └── common/
│       └── BuildingData.kt             # Shared data class definitions
│
├── data/
│   ├── models/
│   │   ├── Building.kt                 # Building model (name, location, floors)
│   │   ├── Floor.kt                    # Floor model (number, rooms)
│   │   ├── Room.kt                     # Room model (id, name, type, bounds)
│   │   └── MenuItem.kt                 # Menu item (name, price, category)
│   │
│   └── repository/
│       └── CampusRepository.kt         # Loads campus JSON from assets/
│
└── utils/
    └── MapUtils.kt                     # Isometric coordinate helpers

🏗️ Architecture

           ┌─────────────────────────────┐
           │         UI Layer            │
           │  Fragment / Activity / View │
           └────────────┬────────────────┘
                        │ observes
           ┌────────────▼────────────────┐
           │       ViewModel Layer       │
           │       MapViewModel          │
           └────────────┬────────────────┘
                        │ requests
           ┌────────────▼────────────────┐
           │      Repository Layer       │
           │      CampusRepository       │
           └────────────┬────────────────┘
                        │ reads
           ┌────────────▼────────────────┐
           │       Data / Assets         │
           │     campus.json (assets/)   │
           └─────────────────────────────┘

Pattern: MVVM · Repository · LiveData / StateFlow


🧩 Key Components

🗺️ CampusMapFragment + MapViewModel

Renders an isometric projection of all campus buildings. Uses MapUtils.kt for coordinate conversion:

screenX = (col - row) × tileWidth  / 2
screenY = (col + row) × tileHeight / 2

🏛️ FloorPlanView (Custom Canvas)

A fully custom View that:

  • Draws room rectangles per floor from Floor data model
  • Hit-tests finger touch against RectF room bounds
  • Fires RoomClickListener on valid tap

📦 CampusRepository

Loads JSON from assets/campus.json on an IO coroutine:

withContext(Dispatchers.IO) {
    context.assets.open("campus.json").use { stream ->
        Gson().fromJson(stream.reader(), CampusData::class.java)
    }
}

🍽️ CanteenMenuFragment + MenuAdapter

Displays menu items grouped by category with prices. Backed by MenuItem.kt data model.


📐 Data Models

data class Building(
    val id: String,
    val name: String,
    val gridCol: Int,
    val gridRow: Int,
    val floors: List<Floor>
)

data class Floor(
    val number: Int,
    val label: String,
    val rooms: List<Room>
)

data class Room(
    val id: String,
    val name: String,
    val type: RoomType,   // OFFICE | CLASSROOM | CANTEEN | LAB | OTHER
    val bounds: RectF
)

data class MenuItem(
    val name: String,
    val price: Double,
    val category: String,
    val isAvailable: Boolean
)

🚀 Getting Started

Prerequisites

  • Android Studio Hedgehog or later
  • Min SDK 24 · Target SDK 34
  • Kotlin 1.9+

Installation

# 1. Clone the repository
git clone https://github.com/YOUR_USERNAME/campus-explore.git

# 2. Open in Android Studio
File → Open → select the cloned folder

# 3. Place your campus data
cp your_campus_data.json app/src/main/assets/campus.json

# 4. Build & Run
./gradlew assembleDebug

📦 Dependencies

// build.gradle.kts (app)
dependencies {
    // ViewModel & LiveData
    implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0")
    implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.7.0")

    // Coroutines
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")

    // JSON parsing
    implementation("com.google.code.gson:gson:2.10.1")

    // Navigation Component
    implementation("androidx.navigation:navigation-fragment-ktx:2.7.6")
    implementation("androidx.navigation:navigation-ui-ktx:2.7.6")

    // RecyclerView
    implementation("androidx.recyclerview:recyclerview:1.3.2")
}

🎓 About

Built for BMS College of Engineering to help students, staff, and visitors navigate the campus with ease.


Made with ❤️ for BMS College · Bengaluru

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages