Skip to content
kishorramaniPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

XR Note App

A cutting-edge Android XR (Extended Reality) note-taking application that allows users to create and manage floating notes in both traditional 2D and immersive 3D spatial environments.

๐Ÿ“ฑ Overview

XR Note App is an innovative note-taking application built for Android XR devices. It seamlessly transitions between 2D Home Space mode (traditional Android UI) and Full Space mode (immersive 3D XR environment), allowing users to place and interact with notes in a spatial context.

โœจ Features

Core Functionality

  • Dual-Mode Operation

    • ๐Ÿ  Home Space Mode: Traditional 2D interface for standard Android devices
    • ๐ŸŽฏ Full Space Mode: Immersive 3D XR environment with spatial notes
  • Note Management

    • Create, read, and delete notes
    • Persistent storage using Room Database
    • Real-time synchronization between 2D and 3D views
  • XR Capabilities

    • Movable and resizable spatial panels
    • 3D note positioning in virtual space
    • Head tracking support
    • XR anchor import support

Technical Features

  • Clean Architecture with separation of concerns
  • Dependency Injection using Koin
  • Reactive UI with Jetpack Compose
  • Room Database for local persistence
  • AndroidX XR Compose integration

๐Ÿ—๏ธ Architecture

The project follows Clean Architecture principles with clear separation between layers:

app/
โ”œโ”€โ”€ data/
โ”‚   โ”œโ”€โ”€ local/          # Room Database, DAOs
โ”‚   โ”œโ”€โ”€ model/          # Data entities
โ”‚   โ””โ”€โ”€ repository/     # Repository implementations
โ”œโ”€โ”€ domain/
โ”‚   โ”œโ”€โ”€ model/          # Domain models
โ”‚   โ”œโ”€โ”€ repository/     # Repository interfaces
โ”‚   โ””โ”€โ”€ usecase/        # Business logic
โ”œโ”€โ”€ presentation/
โ”‚   โ”œโ”€โ”€ components/     # Reusable UI components
โ”‚   โ”œโ”€โ”€ viewmodel/      # ViewModels
โ”‚   โ””โ”€โ”€ xrscene/        # XR-specific scene components
โ””โ”€โ”€ di/                 # Dependency injection modules

Layers

  1. Data Layer

    • NoteEntity: Room database entity
    • NoteDao: Database access object
    • AppDatabase: Room database configuration
    • NoteRepositoryImpl: Repository implementation
  2. Domain Layer

    • Note: Domain model
    • NoteRepository: Repository interface
    • Use cases: AddNoteUseCase, DeleteNoteUseCase, GetAllNotesUseCase, UpdateNotePositionUseCase
  3. Presentation Layer

    • NotesViewModel: Manages UI state and business logic
    • NoteCard: 2D note component
    • NoteCard3D: 3D spatial note component

๐Ÿ› ๏ธ Tech Stack

Core Technologies

  • Language: Kotlin
  • UI Framework: Jetpack Compose
  • Build System: Gradle with Kotlin DSL
  • Min SDK: 34 (Android 14)
  • Target SDK: 36

Key Dependencies

Android XR

androidx.xr.compose:compose:1.0.0-alpha07
androidx.xr.runtime:runtime:1.0.0-alpha07
androidx.xr.scenecore:scenecore:1.0.0-alpha07

Jetpack Libraries

  • Compose BOM 2025.07.00
  • Lifecycle Runtime & ViewModel Compose 2.9.3+
  • Activity Compose 1.11.0
  • Room 2.8.3

Dependency Injection

  • Koin 4.1.1

3D Rendering

  • Filament Android 1.66.1

๐Ÿ“‹ Prerequisites

  • Android Studio Hedgehog or later
  • Android SDK 34 or higher
  • Android XR Emulator or compatible XR device
  • JDK 11

๐Ÿš€ Getting Started

1. Clone the Repository

git clone <repository-url>
cd XRNoteApp

2. Open in Android Studio

  1. Launch Android Studio
  2. Select "Open an Existing Project"
  3. Navigate to the cloned directory
  4. Wait for Gradle sync to complete

3. Configure the XR Environment

For XR Emulator:

  1. Download and install the Android XR Emulator from Android Studio
  2. Ensure OpenXR runtime is configured
  3. Grant necessary permissions when prompted

For Physical XR Device:

  1. Enable developer mode on your XR device
  2. Connect via ADB
  3. Deploy the application

4. Build and Run

# Build the project
./gradlew build

# Install on connected device/emulator
./gradlew installDebug

# Or use Android Studio's Run button

๐ŸŽฎ Usage

Home Space (2D Mode)

  1. Launch the App: Opens in traditional 2D mode
  2. Create Notes: Tap "Add Note" to create a new note
  3. View Notes: All notes appear in a scrollable list
  4. Delete Notes: Each note has a delete button
  5. Enter XR: Tap "Enter Full Space" to switch to 3D mode

Full Space (3D Mode)

  1. Enter Full Space: From Home Space, tap "Enter Full Space"
  2. Grant Permissions: Allow SCENE_UNDERSTANDING permission if prompted
  3. View Spatial Notes: Notes appear as floating 3D panels
  4. Interact with Notes:
    • Move panels by grabbing them
    • Resize panels using resize handles
    • Delete notes using the delete button on each panel
  5. Add Notes: Use the floating "Add Note" button in 3D space
  6. Exit XR: Tap "Back to 2D" to return to Home Space mode

๐Ÿ” Permissions

The app requires the following permissions:

<uses-permission android:name="android.permission.IMPORT_XR_ANCHOR" />
<uses-permission android:name="android.permission.SCENE_UNDERSTANDING" /> <!-- Runtime permission -->

Optional Features

<uses-feature android:name="android.hardware.xr.headtracking" android:required="false" />

๐Ÿ›๏ธ Project Structure

Activities

  • MainActivity: Entry point, handles 2D mode and permission requests
  • XrHostActivity: Isolated XR initialization and Full Space mode hosting
  • FloatingNotesApp: Application class for dependency injection setup

Key Components

NotesViewModel

Manages the state and logic for notes:

  • Fetches notes from repository
  • Handles note creation and deletion
  • Updates note positions in 3D space

Spatial Components

  • SpatialPanel: Container for 3D UI elements
  • Subspace: XR composition root
  • Orbiter: Positions UI elements in 3D space

๐Ÿงช Testing

# Run unit tests
./gradlew test

# Run instrumented tests
./gradlew connectedAndroidTest

๐Ÿ› Troubleshooting

XR Mode Not Working

Problem: "Enter Full Space" button doesn't work Solution:

  • Verify OpenXR runtime is installed: Check /system/etc/openxr/1/active_runtime.json
  • Grant SCENE_UNDERSTANDING permission
  • Restart the XR emulator/device

Permission Issues

Problem: Permission requests keep appearing Solution:

  • Manually grant permissions via Settings > Apps > XR Note App > Permissions
  • Clear app data and try again

Build Issues

Problem: Gradle sync fails Solution:

./gradlew clean
./gradlew build --refresh-dependencies

Database Issues

Problem: Notes not persisting Solution:

  • Clear app data
  • Uninstall and reinstall the app
  • Check Logcat for Room database errors

๐Ÿ“ Development Notes

XR Implementation Strategy

The app uses a defensive 2D-first approach:

  • MainActivity provides a stable 2D UI that always works
  • XrHostActivity handles XR initialization separately to prevent crashes
  • Graceful fallback when XR features are unavailable

State Management

  • Uses Kotlin Flows for reactive state updates
  • ViewModel survives configuration changes
  • Single source of truth in Room database

3D Positioning

Notes are positioned in 3D space using:

  • X and Y coordinates (horizontal and vertical positioning)
  • Z coordinate fixed at -800dp (depth from user)

๐Ÿค Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is open source and available under the MIT License.

๐Ÿ‘จโ€๐Ÿ’ป Author

Kishor Ramani

๐Ÿ™ Acknowledgments

  • Android XR Team for the XR Compose libraries
  • Jetpack Compose team for the modern UI toolkit
  • Koin team for the lightweight dependency injection framework

๐Ÿ“š Resources

๐Ÿ”ฎ Future Enhancements

  • Note editing functionality
  • Color customization for notes
  • Voice-to-text note creation
  • Collaborative notes in shared XR spaces
  • Note categories and tags
  • Export/Import functionality
  • Cloud synchronization
  • Gesture controls for XR interactions
  • Advanced 3D positioning with spatial anchors
  • Multi-user XR sessions

Built with โค๏ธ using Kotlin and Jetpack Compose for Android XR

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages