A modern Android app built with Kotlin and Jetpack Compose for managing motorparts inventory using AI-powered voice commands.
Features β’ Setup β’ Documentation β’ Contributing
- Features
- Tech Stack
- Project Structure
- Setup Instructions
- App Screens
- Voice Commands
- Testing
- Documentation
- Security
- Roadmap
- Troubleshooting
- Contributing
- License
- π± Modern UI: Clean, dark-mode industrial aesthetic with Material Design 3
- π¦ Inventory Forms: Add and edit inventory items with a simple form UI
- π€ Voice Commands: Natural language inventory management powered by Gemini AI
- βοΈ Cloud Sync: Real-time inventory synchronization with Firebase Firestore
- π€ AI Assistant: Intelligent inventory insights and suggestions
- π Analytics Dashboard: Comprehensive inventory analytics with visualizations
- π Report Generation: Export PDF reports and CSV files
- π₯ CSV Import/Export: Bulk import and export inventory data
- π Smart Search: Quick part lookup and filtering
- β‘ Real-time Updates: Live inventory tracking and updates
- π§ͺ Comprehensive Testing: Unit tests for ViewModels, Repositories, and Utils
- Language: Kotlin 1.9.0+
- UI Framework: Jetpack Compose 1.5.0+
- Architecture: MVVM (Model-View-ViewModel)
- Database: Firebase Firestore
- AI: Google Gemini 1.5 Flash API
- Navigation: Jetpack Navigation Compose
- Async: Kotlin Coroutines & Flow
- Firebase: Firestore for real-time data synchronization
- Material 3: Modern Material Design components
- Accompanist: Compose utilities and animations
- Kotlin Coroutines: Asynchronous programming
- Kotlin Flow: Reactive streams
- AndroidX Lifecycle: Lifecycle-aware components
app/src/main/kotlin/com/vibeinventory/motorparts/
βββ MainActivity.kt # Main entry point
βββ ui/
β βββ theme/ # App theming
β β βββ Color.kt # Industrial color palette
β β βββ Theme.kt # Material 3 theme
β β βββ Type.kt # Typography system
β βββ navigation/ # Navigation setup
β β βββ NavigationItem.kt # Nav destinations
β β βββ MainNavigation.kt # Nav host & bottom bar
β βββ screens/ # Feature screens
β βββ inventory/ # Inventory management
β β βββ InventoryListScreen.kt # Inventory list UI
β βββ voice/ # Voice commands
β β βββ VoiceCommandScreen.kt # Voice command UI
β βββ analytics/ # Analytics dashboard
β β βββ AnalyticsScreen.kt # Analytics UI
β βββ settings/ # App settings
β βββ SettingsScreen.kt # Settings UI
βββ data/
β βββ model/ # Data models
β β βββ InventoryItem.kt # Inventory item model
β β βββ InventoryAnalytics.kt # Analytics data model
β βββ repository/ # Data layer
β βββ InventoryRepository.kt # Firestore operations
β βββ AnalyticsRepository.kt # Analytics operations
βββ ai/
β βββ GeminiAIService.kt # AI service integration
βββ speech/
β βββ SpeechRecognitionManager.kt # Voice recognition
βββ utils/ # Utilities
β βββ CsvExporter.kt # CSV export functionality
β βββ CsvImporter.kt # CSV import functionality
β βββ PdfReportGenerator.kt # PDF report generation
βββ viewmodel/ # ViewModels
βββ InventoryViewModel.kt # Inventory state management
βββ VoiceCommandViewModel.kt # Voice command state
βββ VoiceCommandViewModelFactory.kt # ViewModel factory
βββ AnalyticsViewModel.kt # Analytics state management
app/src/test/kotlin/.../ # Unit tests
βββ AllTestsSuite.kt # Test suite runner
βββ viewmodel/ # ViewModel tests
βββ data/repository/ # Repository tests
βββ ai/ # AI service tests
βββ utils/ # Utility tests
app/src/androidTest/kotlin/.../ # Android UI tests
βββ ui/ # UI component tests
- Background:
#0A0A0A(Industrial Black) - Surface:
#1E1E1E(Dark Gray) - Primary:
#FF6B35(Industrial Orange) - Secondary:
#FFA726(Industrial Amber) - Accent:
#42A5F5(Industrial Blue)
- Sans-serif font family
- Material 3 type scale
- Bold headers, medium body text
- Android Studio Hedgehog or newer
- JDK 17
- Android SDK 34
- Firebase account
- Google AI Studio account (for Gemini API)
-
Create Firebase Project:
- Go to Firebase Console
- Create a new project or use existing one
- Add Android app with package name:
com.vibeinventory.motorparts
-
Download Configuration:
- Download
google-services.json - Place it in
app/directory
- Download
-
Enable Firestore:
- In Firebase Console, go to Firestore Database
- Click "Create Database"
- Start in test mode (for development)
- Choose a location
-
Firestore Security Rules (for production):
rules_version = '2'; service cloud.firestore { match /databases/{database}/documents { match /inventory/{itemId} { allow read, write: if request.auth != null; } } }
-
Get API Key:
- Visit Google AI Studio
- Create a new API key
- Copy the key
-
Add to Project: Create
app/src/main/res/values/secrets.xml:<?xml version="1.0" encoding="utf-8"?> <resources> <string name="gemini_api_key">YOUR_API_KEY_HERE</string> </resources>
-
Initialize in Code:
val apiKey = getString(R.string.gemini_api_key) val aiService = GeminiAIService(apiKey)
-
Clone the Repository:
git clone https://github.com/triplex1/AI-Inventory-Agent-for-mobile.git cd AI-Inventory-Agent-for-mobile -
Configure API Keys:
- Create
app/src/main/res/values/secrets.xmlwith your Gemini API key (see Gemini AI Setup above) - Add
google-services.jsontoapp/directory (see Firebase Setup above)
- Create
-
Sync Gradle:
- Open project in Android Studio Hedgehog or newer
- Wait for Gradle sync to complete
- Resolve any dependency issues if prompted
-
Run the App:
- Connect an Android device via USB (with USB debugging enabled) or start an emulator
- Click Run
βΆοΈ button or pressShift+F10(Windows/Linux) /Ctrl+R(Mac) - Select your target device when prompted
-
Build APK (Optional):
./gradlew assembleDebug
APK will be generated at:
app/build/outputs/apk/debug/app-debug.apk
- View all inventory: Browse complete motorparts inventory
- Search & Filter: Quick part lookup by name, category, or part number
- Stock Indicators: Visual status for healthy, low, and out-of-stock items
- Add Items: Floating Action Button (FAB) opens the add inventory form
- Real-time Sync: Live updates from Firebase Firestore
- Edit Items: Tap an item to open the edit form and update details
- Create New Items: Enter name, part number, quantity, location, price, and category
- Edit Existing Items: Pre-filled form when opened from an existing item
- Basic Validation: Requires name and part number, with inline error feedback
- Firestore Integration: Uses
InventoryViewModelandInventoryRepositoryto persist changes - Simple Navigation: Back navigation returns to the inventory list after save or cancel
- Voice-to-Text: Real-time speech recognition
- Natural Language Processing: Understand conversational commands
- AI-Powered Responses: Intelligent command interpretation via Gemini AI
- Execute Operations: Search, query, and interact with inventory using voice
- Animated UI: Interactive microphone button with visual feedback
- Live Transcription: See your speech converted to text in real-time
- Summary Cards: Total items, total value, low stock count, out of stock alerts
- Stock Visualization: Bar charts showing inventory health distribution
- Category Breakdown: Statistics for each category (item count, total value, alerts)
- Top Value Items: List of most valuable inventory items
- Low Stock Alerts: Real-time monitoring with color-coded warnings
- Export Options: Generate PDF reports or export CSV data
- Account Management: User profile and preferences
- Notification Preferences: Configure alerts for low stock
- AI Configuration: Customize Gemini AI settings
- Voice Settings: Adjust speech recognition parameters
- Database Sync: Manage Firestore synchronization
- Backup & Restore: Import/export inventory data
- App Preferences: Theme, language, and display options
- "Show me all brake pads in stock"
- "How many spark plugs do we have?"
- "What items are low on stock?"
- "Find parts in location A-12"
- "Check oil filter inventory"
- "Search for brake components"
- "Add 10 oil filters to location B-05" (requires inventory form)
- "Update brake pad quantity to 20" (requires edit functionality)
- Speak clearly and pause between commands
- Use specific part names or categories for better accuracy
- Include quantities or locations in your queries
- The AI understands context from previous commands
{
"name": "Brake Pad Set",
"partNumber": "BP-2024-001",
"description": "High-performance ceramic brake pads",
"category": "brake",
"quantity": 15,
"minQuantity": 5,
"location": "A-12",
"price": 45.99,
"supplier": "Premium Parts Co.",
"barcode": "1234567890123",
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z",
"tags": ["brake", "ceramic", "performance"]
}- Natural Language Understanding: Parse voice commands into structured actions
- Inventory Insights: Generate smart recommendations
- Context-Aware Responses: AI knows current inventory state
- Intent Detection: Classify commands (search, add, update, delete, check stock)
- Smart Extraction: Parse item details from natural language
The project includes comprehensive test coverage for core components:
- ViewModels: Test coverage for
InventoryViewModel,VoiceCommandViewModel, andAnalyticsViewModel - Repositories: Test
InventoryRepositoryand data layer logic - AI Service: Test
GeminiAIServiceintegration and command processing - Utils: Test CSV import/export and PDF generation utilities
- Screen Tests: UI component testing for
InventoryListScreen
Run all unit tests:
./gradlew testRun Android tests:
./gradlew connectedAndroidTestRun specific test class:
./gradlew test --tests "com.vibeinventory.motorparts.viewmodel.InventoryViewModelTest"View test reports:
- Unit test reports:
app/build/reports/tests/test/index.html - Android test reports:
app/build/reports/androidTests/connected/index.html
app/src/test/kotlin/com/vibeinventory/motorparts/
βββ AllTestsSuite.kt # Test suite configuration
βββ viewmodel/
β βββ InventoryViewModelTest.kt
β βββ VoiceCommandViewModelTest.kt
β βββ AnalyticsViewModelTest.kt
βββ data/repository/
β βββ InventoryRepositoryTest.kt
βββ ai/
β βββ GeminiAIServiceTest.kt
βββ utils/
βββ CsvExporterTest.kt
βββ CsvImporterTest.kt
app/src/androidTest/kotlin/com/vibeinventory/motorparts/
βββ ui/
βββ InventoryListScreenTest.kt
- Never commit
google-services.jsonto version control - Keep
secrets.xmlin.gitignore - Use Firebase Authentication in production
- Implement proper Firestore security rules
- Secure API keys using Android Keystore
Additional documentation files are available in the repository:
- SETUP_GUIDE.md: Detailed setup and configuration guide
- VOICE_RECOGNITION_GUIDE.md: Voice command features and usage
- ANALYTICS_FEATURES.md: Analytics, reporting, and data export/import features
- inventory_template.csv: CSV template for bulk import
- Voice Recognition - Real Android Speech Recognizer integration
- AI Integration - Full Gemini AI command processing
- Live Transcription - Real-time voice-to-text display
- Permission Handling - Automatic microphone permission flow
- Inventory Forms - Add/edit form for inventory items
- Analytics Dashboard - Comprehensive inventory analytics with visualizations
- CSV Export/Import - Bulk data import and export functionality
- PDF Report Generation - Professional inventory reports
- Test Suite - Comprehensive unit and UI tests
- Low Stock Alerts - Automated monitoring and notifications
- Barcode Scanning - ML Kit integration for barcode scanning
- Offline Mode - Local caching and sync when connection restored
- User Authentication - Firebase Authentication integration
- Multi-warehouse Support - Manage multiple warehouse locations
- Push Notifications - FCM integration for low stock alerts
- Advanced Search - Enhanced filtering and search capabilities
- Inventory History - Track inventory changes over time
- Supplier Management - Manage supplier information and contacts
Issue: Build fails with JDK version errors
- Solution:
- Ensure JDK 17 is installed and configured
- Set
JAVA_HOMEenvironment variable - In Android Studio: File β Project Structure β SDK Location β JDK Location
Issue: Gradle sync fails
- Solution:
- Invalidate caches: File β Invalidate Caches / Restart
- Delete
.gradlefolder in project root - Sync project again: File β Sync Project with Gradle Files
Issue: Dependency resolution errors
- Solution:
- Clean project: Build β Clean Project
- Rebuild: Build β Rebuild Project
- Check internet connection for dependency downloads
Issue: App crashes on startup with Firebase errors
- Solution:
- Verify
google-services.jsonis inapp/directory (not in root) - Ensure package name in
google-services.jsonmatchescom.vibeinventory.motorparts - Rebuild project after adding
google-services.json
- Verify
Issue: Firestore connection timeout
- Solution:
- Check internet connectivity
- Verify Firebase project is active in Firebase Console
- Check Firestore database is created and accessible
- Review security rules in Firestore Console
Issue: Voice commands not processing
- Solution:
- Verify Gemini API key in
app/src/main/res/values/secrets.xml - Check API key is valid and has quota remaining
- Ensure internet connectivity
- Check Logcat for API error messages
- Verify Gemini API key in
Issue: Speech recognition not working
- Solution:
- Grant microphone permission when prompted
- Check device has microphone access enabled in Settings
- Ensure Google Speech Services are installed/updated on device
- Test with a different device or emulator
Issue: App crashes on specific screens
- Solution:
- Check Logcat for detailed error messages
- Verify all required dependencies are included
- Ensure minimum SDK version (API 24+) is met
- Clear app data: Settings β Apps β Vibe Inventory β Clear Data
Issue: CSV import/export fails
- Solution:
- Verify file permissions (Storage permission for Android 11+)
- Check CSV format matches template
- Ensure proper file encoding (UTF-8)
- Review error messages in Logcat
- Development: Use Android Studio's built-in emulator for testing voice features
- Testing: Run unit tests before making commits to ensure stability
- Firebase: Start with Firestore test mode, then implement proper security rules for production
- API Keys: Never commit sensitive files - use
.gitignoreforsecrets.xmlandgoogle-services.json - Performance: Use Android Profiler to monitor app performance during development
MIT License - Feel free to use this project for learning and commercial purposes.
We welcome contributions! Here's how you can help:
- Fork the repository and clone your fork
- Create a feature branch:
git checkout -b feature/your-feature-name - Make your changes following the existing code style
- Write tests for new functionality
- Commit your changes:
git commit -m "Add: Description of changes" - Push to your fork:
git push origin feature/your-feature-name - Open a Pull Request with a clear description
- Follow Kotlin coding conventions and Android best practices
- Write clear, descriptive commit messages
- Add tests for new features and bug fixes
- Update documentation for user-facing changes
- Ensure all tests pass before submitting PR
- Keep PRs focused and manageable in size
When reporting bugs or requesting features, please include:
- Android version and device information
- Steps to reproduce the issue
- Expected vs actual behavior
- Relevant logs or screenshots
- Use meaningful variable and function names
- Add comments for complex logic
- Follow MVVM architecture patterns
- Use Kotlin coroutines for asynchronous operations
- Prefer Jetpack Compose for UI components
Built with β€οΈ using Kotlin & Jetpack Compose
Made with dedication for efficient inventory management
β Star this repo if you find it helpful!