# ๐Ÿ‹๏ธ BMI Calculator [![Kotlin](https://img.shields.io/badge/Kotlin-1.9+-purple.svg)](https://kotlinlang.org) [![Compose](https://img.shields.io/badge/Jetpack%20Compose-2025.11-green.svg)](https://developer.android.com/jetpack/compose) [![Material3](https://img.shields.io/badge/Material%20Design%203-latest-blue.svg)](https://m3.material.io/) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg)](LICENSE) Modern Android aplikasi untuk menghitung Body Mass Index (BMI) dengan antarmuka yang clean dan intuitif menggunakan Jetpack Compose dan Material Design 3. ![BMI Calculator Screenshot](https://via.placeholder.com/800x400/2563EB/FFFFFF?text=BMI+Calculator+App) --- ## ๐Ÿ“‹ Daftar Isi - [Fitur](#-fitur) - [Screenshots](#-screenshots) - [Teknologi](#-teknologi) - [Arsitektur](#-arsitektur) - [Instalasi](#-instalasi) - [Cara Menggunakan](#-cara-menggunakan) - [Testing](#-testing) - [Struktur Project](#-struktur-project) - [Kategori BMI](#-kategori-bmi) - [Formula Perhitungan](#-formula-perhitungan) - [Kontribusi](#-kontribusi) - [Lisensi](#-lisensi) - [Kontak](#-kontak) --- ## โœจ Fitur ### ๐ŸŽฏ Core Features - โœ… **Perhitungan BMI Akurat** - Formula standar WHO untuk Metric dan Imperial - โœ… **Dual Unit System** - Support Metric (kg, cm) dan Imperial (lb, in) - โœ… **Kategori BMI** - Underweight, Normal, Overweight, Obese dengan color coding - โœ… **Healthy Weight Range** - Menampilkan rentang berat ideal berdasarkan tinggi - โœ… **Input Validation** - Validasi real-time untuk input yang valid - โœ… **Error Handling** - Error messages yang jelas dan helpful ### ๐ŸŽจ UI/UX Features - โœ… **Modern UI** - Jetpack Compose dengan Material Design 3 - โœ… **Smooth Animations** - Spring animations untuk hasil BMI - โœ… **Clean Design** - Minimalist interface dengan visual hierarchy yang jelas - โœ… **Material Icons** - Icon yang meaningful untuk setiap elemen - โœ… **Welcome Screen** - Onboarding screen dengan ilustrasi - โœ… **Responsive Layout** - Adaptive untuk berbagai ukuran layar - โœ… **Color-coded Results** - Visual feedback berdasarkan kategori BMI ### ๐Ÿ”ง Technical Features - โœ… **Jetpack Compose** - 100% Compose UI (no XML layouts) - โœ… **Material Design 3** - Latest design system - โœ… **Type Safety** - Kotlin with strong typing - โœ… **Unit Tested** - 93+ test cases dengan coverage >90% - โœ… **Edge-to-Edge** - Modern Android edge-to-edge support - โœ… **No Dependencies** - Pure Android SDK (no third-party libraries) --- ## ๐Ÿ“ฑ Screenshots ### Welcome Screen Welcome Screen ### Main Calculator BMI Calculator ### Result Display BMI Result --- ## ๐Ÿ›  Teknologi ### Core Technologies | Technology | Version | Purpose | |------------|---------|---------| | **Kotlin** | 1.9+ | Programming language | | **Jetpack Compose** | 2025.11 | Modern UI toolkit | | **Material Design 3** | Latest | Design system | | **Android SDK** | Min 24, Target 36 | Android platform | | **JUnit 4** | 4.13.2 | Unit testing | ### Key Libraries ```kotlin // Compose BOM implementation(platform("androidx.compose:compose-bom:2025.11.00")) // Compose Core implementation("androidx.compose.ui:ui") implementation("androidx.compose.material3:material3") implementation("androidx.compose.material:material-icons-extended") // Activity Compose implementation("androidx.activity:activity-compose:1.11.0") // Core implementation("androidx.core:core-ktx:1.17.0") implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.9.4") ``` ### Development Tools - **Gradle** 8.x - Build system - **Android Studio** Koala+ - IDE - **Git** - Version control --- ## ๐Ÿ— Arsitektur ### Project Structure ``` app/ โ”œโ”€โ”€ src/ โ”‚ โ”œโ”€โ”€ main/ โ”‚ โ”‚ โ”œโ”€โ”€ java/com/example/tiptime/ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ MainActivity.kt # Main entry point โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ WelcomeActivity.kt # Welcome screen โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ model/ โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ BmiData.kt # BMI data class โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ BmiCategory.kt # BMI categories enum โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ UnitSystem.kt # Metric/Imperial enum โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ ui/ โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ BmiCalculatorScreen.kt # Main calculator UI โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ theme/ โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ Color.kt # Color definitions โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ Theme.kt # App theme โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ Type.kt # Typography โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ utils/ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ BmiCalculator.kt # BMI calculation logic โ”‚ โ”‚ โ””โ”€โ”€ res/ โ”‚ โ”‚ โ”œโ”€โ”€ drawable/ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ image_bmi.png # Welcome illustration โ”‚ โ”‚ โ””โ”€โ”€ values/ โ”‚ โ”‚ โ””โ”€โ”€ strings.xml # String resources โ”‚ โ””โ”€โ”€ test/ โ”‚ โ””โ”€โ”€ java/com/example/tiptime/ โ”‚ โ”œโ”€โ”€ utils/ โ”‚ โ”‚ โ””โ”€โ”€ BmiCalculatorTest.kt # 43 unit tests โ”‚ โ””โ”€โ”€ model/ โ”‚ โ”œโ”€โ”€ BmiCategoryTest.kt # 30+ unit tests โ”‚ โ”œโ”€โ”€ BmiDataTest.kt # 10 unit tests โ”‚ โ””โ”€โ”€ UnitSystemTest.kt # 10 unit tests ``` ### Design Pattern - **MVVM-like Structure** - Separation of UI and business logic - **Single Activity** - Modern Android navigation - **Stateless Composables** - Unidirectional data flow - **Utility Classes** - Pure functions for calculations - **Material Design** - Following Material 3 guidelines --- ## ๐Ÿ’ฟ Instalasi ### Prerequisites - **Android Studio** Koala (2024.1.1) atau lebih baru - **JDK** 17 atau lebih baru - **Android SDK** API 24+ (Android 7.0) - **Git** untuk clone repository ### Clone & Build ```bash # 1. Clone repository git clone https://github.com/username/bmi-calculator.git cd bmi-calculator # 2. Open di Android Studio # File โ†’ Open โ†’ Pilih folder project # 3. Sync Gradle # Android Studio akan otomatis sync dependencies # 4. Build project ./gradlew build # Windows: gradlew.bat build # 5. Run aplikasi # Pilih device/emulator โ†’ Click Run (โ–ถ๏ธ) ``` ### Install APK ```bash # Build debug APK ./gradlew assembleDebug # APK tersedia di: # app/build/outputs/apk/debug/app-debug.apk # Install ke device ./gradlew installDebug ``` --- ## ๐Ÿ“– Cara Menggunakan ### Langkah Penggunaan 1. **Buka Aplikasi** - Lihat welcome screen - Tap "Get Started" 2. **Pilih Unit System** - **Metric**: kg & cm - **Imperial**: lb & in 3. **Input Data** - Masukkan **Weight** (berat badan) - Masukkan **Height** (tinggi badan) 4. **Hitung BMI** - Tap tombol **"Calculate BMI"** - Hasil akan muncul dengan animasi 5. **Lihat Hasil** - **BMI Value** - Nilai BMI Anda - **Category** - Underweight/Normal/Overweight/Obese - **Healthy Range** - Rentang berat ideal Anda - **BMI Categories** - Info kategori BMI ### Input Validation | System | Weight Range | Height Range | |----------|--------------|--------------| | Metric | 1-500 kg | 50-300 cm | | Imperial | 2-1100 lb | 20-120 in | --- ## ๐Ÿงช Testing ### Unit Tests Project ini memiliki **93+ unit tests** dengan coverage >90%. #### Jalankan Test ```bash # Command Line ./gradlew test # Windows gradlew.bat test # Lihat HTML Report # app/build/reports/tests/test/index.html ``` #### Test Coverage | File | Tests | Coverage | |------|-------|----------| | `BmiCalculatorTest.kt` | 43 | Perhitungan, validasi, boundary | | `BmiCategoryTest.kt` | 30+ | Kategori, warna, display | | `BmiDataTest.kt` | 10 | Data class, equality | | `UnitSystemTest.kt` | 10 | Enum values | #### Contoh Test Cases ```kotlin // Test perhitungan BMI @Test fun calculateBmi_metric_normal_returnsCorrectBmi() { // 70 kg, 175 cm -> BMI = 22.86 (Normal) val result = BmiCalculator.calculateBmi(70.0, 175.0, UnitSystem.METRIC) assertEquals(22.86, result.bmi, 0.01) assertEquals(BmiCategory.NORMAL, result.category) } // Test boundary values @Test fun fromBmi_exactNormalLowerBoundary_returnsNormal() { // BMI 18.5 (tepat batas bawah normal) assertEquals(BmiCategory.NORMAL, BmiCategory.fromBmi(18.5)) } ``` Untuk panduan lengkap, baca: **[TESTING_GUIDE.md](TESTING_GUIDE.md)** --- ## ๐Ÿ“Š Kategori BMI Berdasarkan standar **WHO (World Health Organization)**: | Kategori | BMI Range | Color | Status | |----------|-----------|-------|--------| | **Underweight** | < 18.5 | ๐Ÿ”ต Blue | Berat badan kurang | | **Normal** | 18.5 - 24.9 | ๐ŸŸข Green | Berat badan ideal | | **Overweight** | 25.0 - 29.9 | ๐ŸŸ  Orange | Kelebihan berat badan | | **Obese** | โ‰ฅ 30.0 | ๐Ÿ”ด Red | Obesitas | ### Visual Color Coding ```kotlin val UnderweightColor = Color(0xFF3B82F6) // Blue val NormalColor = Color(0xFF10B981) // Green val OverweightColor = Color(0xFFF59E0B) // Orange val ObeseColor = Color(0xFFEF4444) // Red ``` --- ## ๐Ÿ”ฌ Formula Perhitungan ### Metric System (kg, cm) ``` BMI = weight (kg) / (height (m))ยฒ ``` **Contoh:** - Weight: 70 kg - Height: 175 cm = 1.75 m - BMI = 70 / (1.75)ยฒ = 22.86 ### Imperial System (lb, in) ``` BMI = (weight (lb) / (height (in))ยฒ) ร— 703 ``` **Contoh:** - Weight: 150 lb - Height: 67 in - BMI = (150 / (67)ยฒ) ร— 703 = 23.49 ### Healthy Weight Range ```kotlin // Untuk BMI 18.5 - 24.9 minWeight = 18.5 ร— (height)ยฒ maxWeight = 24.9 ร— (height)ยฒ ``` --- ## ๐ŸŽจ Theme & Colors ### Color Palette ```kotlin // Primary Colors val PrimaryBlue = Color(0xFF2563EB) val PrimaryBlueDark = Color(0xFF1E40AF) val BackgroundLight = Color(0xFFF8FAFC) // Text Colors val TextPrimary = Color(0xFF1E293B) val TextSecondary = Color(0xFF64748B) // BMI Category Colors val UnderweightColor = Color(0xFF3B82F6) // Blue val NormalColor = Color(0xFF10B981) // Green val OverweightColor = Color(0xFFF59E0B) // Orange val ObeseColor = Color(0xFFEF4444) // Red ``` ### Material Icons - **FitnessCenter** - App header icon - **MonitorWeight** - Weight input icon - **Height** - Height input icon - **Calculate** - Calculate button icon --- ## ๐Ÿ”ง Configuration ### Build Configuration ```kotlin android { compileSdk = 36 defaultConfig { applicationId = "com.example.tiptime" minSdk = 24 targetSdk = 36 versionCode = 1 versionName = "1.0" } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } kotlinOptions { jvmTarget = "17" } } ``` ### Gradle Version - **Gradle**: 8.9 - **AGP**: 8.7.3 - **Kotlin**: 2.0.21 --- ## ๐Ÿค Kontribusi Kontribusi sangat diterima! Berikut cara berkontribusi: ### Steps 1. **Fork** repository ini 2. **Create** feature branch (`git checkout -b feature/AmazingFeature`) 3. **Commit** changes (`git commit -m 'Add some AmazingFeature'`) 4. **Push** to branch (`git push origin feature/AmazingFeature`) 5. **Open** Pull Request ### Guidelines - โœ… Ikuti Kotlin coding conventions - โœ… Tulis unit tests untuk fitur baru - โœ… Update dokumentasi jika perlu - โœ… Pastikan semua tests pass - โœ… Gunakan commit messages yang jelas ### Bug Reports Jika menemukan bug, silakan buat issue dengan detail: - Deskripsi bug - Steps to reproduce - Expected vs actual behavior - Screenshots (jika ada) - Device & Android version --- ## ๐Ÿ“ Changelog ### Version 1.0.0 (November 2025) **Initial Release** โœจ **Features:** - BMI calculation (Metric & Imperial) - Welcome screen dengan ilustrasi - Modern Material Design 3 UI - Input validation - Healthy weight range - Animated results - BMI categories info card ๐Ÿงช **Tests:** - 93+ unit tests - >90% code coverage - Boundary value testing - Edge case handling ๐ŸŽจ **UI/UX:** - Clean, modern interface - Color-coded categories - Material icons - Smooth animations - Responsive layout --- ## ๐Ÿ“„ Lisensi ``` Copyright (C) 2025 BMI Calculator Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ``` Project ini menggunakan **Apache License 2.0**. Lihat file [LICENSE](LICENSE) untuk detail lengkap. --- ## ๐Ÿ‘ฅ Authors **[NPM: ISI NPM ANDA]** **[Nama: ISI NAMA ANDA]** --- ## ๐Ÿ“ž Kontak - **Email**: your.email@example.com - **GitHub**: [@yourusername](https://github.com/yourusername) - **LinkedIn**: [Your Name](https://linkedin.com/in/yourprofile) --- ## ๐Ÿ™ Acknowledgments - **Android Team** - Jetpack Compose & Material Design 3 - **WHO** - BMI classification standards - **Material Design** - Design guidelines & icons - **Kotlin Team** - Amazing programming language - **Open Source Community** - Inspiration & support --- ## ๐Ÿ“š Resources ### Documentation - [Jetpack Compose](https://developer.android.com/jetpack/compose) - [Material Design 3](https://m3.material.io/) - [Kotlin Language](https://kotlinlang.org/docs/home.html) ### Related Projects - [Android Compose Samples](https://github.com/android/compose-samples) - [Material 3 Catalog](https://github.com/material-components/material-components-android) ### Learning Resources - [Android Basics with Compose](https://developer.android.com/courses/android-basics-compose/course) - [Kotlin Bootcamp](https://developer.android.com/courses/kotlin-bootcamp/overview) --- ## โญ Star History Jika project ini membantu Anda, berikan โญ di GitHub! [![Star History Chart](https://api.star-history.com/svg?repos=username/bmi-calculator&type=Date)](https://star-history.com/#username/bmi-calculator&Date) --- ## ๐Ÿš€ Future Enhancements Rencana pengembangan untuk versi mendatang: - [ ] Dark mode support - [ ] BMI history tracking - [ ] Export hasil ke PDF - [ ] Grafik BMI over time - [ ] Multi-language support (Indonesian, English) - [ ] Widget untuk home screen - [ ] Apple Health / Google Fit integration - [ ] BMI trends & analytics - [ ] Recommendations berdasarkan BMI - [ ] Share hasil ke social media ---
**Made with โค๏ธ using Jetpack Compose** [โฌ† Back to Top](#-bmi-calculator)