commit f299dfb3a018db7b66ccbe0ca937d19cb427c431
Author: Diassdp <149257568+Diassdp@users.noreply.github.com>
Date: Sun Jan 19 11:52:27 2025 +0700
First Commit:
Version 1.0 [Non Optimized Version]
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..aa724b7
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,15 @@
+*.iml
+.gradle
+/local.properties
+/.idea/caches
+/.idea/libraries
+/.idea/modules.xml
+/.idea/workspace.xml
+/.idea/navEditor.xml
+/.idea/assetWizardSettings.xml
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 0000000..605fe1a
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+Health Journal
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..b589d56
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml
new file mode 100644
index 0000000..b268ef3
--- /dev/null
+++ b/.idea/deploymentTargetSelector.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/discord.xml b/.idea/discord.xml
new file mode 100644
index 0000000..30bab2a
--- /dev/null
+++ b/.idea/discord.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 0000000..0897082
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
new file mode 100644
index 0000000..fdf8d99
--- /dev/null
+++ b/.idea/kotlinc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/migrations.xml b/.idea/migrations.xml
new file mode 100644
index 0000000..f8051a6
--- /dev/null
+++ b/.idea/migrations.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..8978d23
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
new file mode 100644
index 0000000..5fe3eb4
--- /dev/null
+++ b/app/build.gradle.kts
@@ -0,0 +1,76 @@
+plugins {
+ alias(libs.plugins.android.application)
+ alias(libs.plugins.jetbrains.kotlin.android)
+ id("com.google.gms.google-services")
+}
+
+android {
+ namespace = "com.healthjournal"
+ compileSdk = 34
+
+ defaultConfig {
+ applicationId = "com.healthjournal"
+ minSdk = 24
+ targetSdk = 34
+ versionCode = 1
+ versionName = "1.0"
+
+ testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
+ }
+
+ buildTypes {
+ release {
+ isMinifyEnabled = false
+ proguardFiles(
+ getDefaultProguardFile("proguard-android-optimize.txt"),
+ "proguard-rules.pro"
+ )
+ }
+ }
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
+ }
+ kotlinOptions {
+ jvmTarget = "1.8"
+ }
+ buildFeatures {
+ viewBinding = true
+ }
+}
+
+dependencies {
+ // Core libraries
+ implementation(libs.androidx.core.ktx) // Kotlin extensions for core Android functionality
+ implementation(libs.androidx.appcompat) // AppCompat library for backward compatibility
+ implementation(libs.material) // Material Design components
+ implementation(libs.androidx.activity) // Activity library for managing the activity lifecycle
+ implementation(libs.androidx.constraintlayout) // ConstraintLayout for flexible layouts
+ implementation ("androidx.lifecycle:lifecycle-livedata-ktx:2.5.1")
+ implementation("androidx.navigation:navigation-fragment-ktx:2.7.7")
+ implementation("androidx.navigation:navigation-ui-ktx:2.7.7")
+
+
+ // Firebase libraries
+ implementation(libs.firebase.database)
+ implementation(libs.firebase.auth)
+ testImplementation(libs.junit)
+ androidTestImplementation(libs.androidx.junit)
+ androidTestImplementation(libs.androidx.espresso.core)
+ implementation(platform("com.google.firebase:firebase-bom:33.1.2"))
+ implementation("com.google.firebase:firebase-analytics")
+
+ // Splash screen
+ implementation("androidx.core:core-splashscreen:1.0.0") // For splash screen support
+
+ // DataStore preferences
+ implementation("androidx.datastore:datastore-preferences:1.0.0") // For storing key-value pairs
+
+ // Coroutines
+ implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2") // Coroutines for asynchronous programming
+ implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2") // Coroutines for Android
+
+ // Circular image views
+ implementation("de.hdodenhof:circleimageview:3.1.0") // For circular image views
+ implementation ("com.google.android.material:material:1.7.0")
+}
\ No newline at end of file
diff --git a/app/google-services.json b/app/google-services.json
new file mode 100644
index 0000000..5b7bbb2
--- /dev/null
+++ b/app/google-services.json
@@ -0,0 +1,29 @@
+{
+ "project_info": {
+ "project_number": "739932964546",
+ "project_id": "healthjournal-3fcd9",
+ "storage_bucket": "healthjournal-3fcd9.appspot.com"
+ },
+ "client": [
+ {
+ "client_info": {
+ "mobilesdk_app_id": "1:739932964546:android:21b91b8876bf7e7eaf9d5b",
+ "android_client_info": {
+ "package_name": "com.healthjournal"
+ }
+ },
+ "oauth_client": [],
+ "api_key": [
+ {
+ "current_key": "AIzaSyAhq4eRgReA4iBhAoa79hOLJdbxXFsCMyI"
+ }
+ ],
+ "services": {
+ "appinvite_service": {
+ "other_platform_oauth_client": []
+ }
+ }
+ }
+ ],
+ "configuration_version": "1"
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
\ No newline at end of file
diff --git a/app/src/androidTest/java/com/healthjournal/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/healthjournal/ExampleInstrumentedTest.kt
new file mode 100644
index 0000000..c62a06e
--- /dev/null
+++ b/app/src/androidTest/java/com/healthjournal/ExampleInstrumentedTest.kt
@@ -0,0 +1,24 @@
+package com.healthjournal
+
+import androidx.test.platform.app.InstrumentationRegistry
+import androidx.test.ext.junit.runners.AndroidJUnit4
+
+import org.junit.Test
+import org.junit.runner.RunWith
+
+import org.junit.Assert.*
+
+/**
+ * Instrumented test, which will execute on an Android device.
+ *
+ * See [testing documentation](http://d.android.com/tools/testing).
+ */
+@RunWith(AndroidJUnit4::class)
+class ExampleInstrumentedTest {
+ @Test
+ fun useAppContext() {
+ // Context of the app under test.
+ val appContext = InstrumentationRegistry.getInstrumentation().targetContext
+ assertEquals("com.healthjournal", appContext.packageName)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..7be2c74
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/healthjournal/algorithm/Algorithm.kt b/app/src/main/java/com/healthjournal/algorithm/Algorithm.kt
new file mode 100644
index 0000000..2c71ab9
--- /dev/null
+++ b/app/src/main/java/com/healthjournal/algorithm/Algorithm.kt
@@ -0,0 +1,111 @@
+package com.healthjournal.algorithm
+
+import com.healthjournal.data.HealthData
+
+class AlgoritmaKesehatan {
+ fun recommendationOfTheDay(healthData: HealthData): HashMap {
+ val bloodSugarAnalysis = getBloodSugarAnalysis(healthData)
+ val bloodPressureAnalysis = getBloodPressureAnalysis(healthData)
+ val BMIAnalysis = getBMIAnalysis(healthData)
+ val tasks = getTaskBasedData(healthData)
+
+ return hashMapOf(
+ "bloodSugarAnalysis" to bloodSugarAnalysis,
+ "bloodPressureAnalysis" to bloodPressureAnalysis,
+ "BMIAnalysis" to BMIAnalysis,
+ "tasks" to tasks
+ )
+ }
+
+ fun getBloodSugarAnalysis(healthData: HealthData): String {
+ return when (healthData.gender) {
+ "Female", "Other" -> when {
+ healthData.bloodSugar < 70 -> "Gula darah rendah, konsumsi makanan manis seperti buah atau madu."
+ healthData.bloodSugar in 70.0..140.0 -> "Gula darah normal, pertahankan pola makan sehat."
+ healthData.bloodSugar > 140 -> "Gula darah tinggi, kurangi makanan manis dan lakukan olahraga teratur."
+ else -> "Data gula darah tidak valid."
+ }
+ "Male" -> when {
+ healthData.bloodSugar < 70 -> "Gula darah rendah, segera konsumsi makanan berkarbohidrat."
+ healthData.bloodSugar in 70.0..130.0 -> "Gula darah normal, jaga pola makan seimbang."
+ healthData.bloodSugar > 130 -> "Gula darah tinggi, batasi konsumsi gula dan periksa kesehatan secara berkala."
+ else -> "Data gula darah tidak valid."
+ }
+ else -> "Data gula darah tidak valid."
+ }
+ }
+
+ fun getBloodPressureAnalysis(healthData: HealthData): String {
+ return when (healthData.gender) {
+ "Female", "Other" -> when {
+ healthData.systolicBP < 90 || healthData.diastolicBP < 60 -> "Tekanan darah rendah, tingkatkan asupan cairan dan garam."
+ healthData.systolicBP in 90..120 && healthData.diastolicBP in 60..80 -> "Tekanan darah normal, pertahankan gaya hidup sehat."
+ healthData.systolicBP > 120 || healthData.diastolicBP > 80 -> "Tekanan darah tinggi, kurangi garam dan tingkatkan aktivitas fisik."
+ else -> "Data tekanan darah tidak valid."
+ }
+ "Male" -> when {
+ healthData.systolicBP < 100 || healthData.diastolicBP < 60 -> "Tekanan darah rendah, perbanyak cairan dan istirahat."
+ healthData.systolicBP in 100..130 && healthData.diastolicBP in 60..85 -> "Tekanan darah normal, pertahankan pola makan sehat."
+ healthData.systolicBP > 130 || healthData.diastolicBP > 85 -> "Tekanan darah tinggi, konsultasikan dengan dokter untuk pemeriksaan lebih lanjut."
+ else -> "Data tekanan darah tidak valid."
+ }
+ else -> "Data tekanan darah tidak valid."
+ }
+ }
+
+ fun getBMIAnalysis(healthData: HealthData): String {
+ return when (healthData.gender) {
+ "Female", "Other" -> when {
+ healthData.BMI < 18.5 -> "BMI rendah, tingkatkan asupan kalori dengan makanan bernutrisi."
+ healthData.BMI in 18.5..24.9 -> "BMI normal, pertahankan pola makan seimbang."
+ healthData.BMI > 24.9 -> "BMI tinggi, lakukan olahraga teratur dan perbaiki pola makan."
+ else -> "Data BMI tidak valid."
+ }
+ "Male" -> when {
+ healthData.BMI < 20 -> "BMI rendah, tambahkan asupan protein dan makanan bergizi."
+ healthData.BMI in 20.0..25.0 -> "BMI normal, teruskan pola hidup sehat."
+ healthData.BMI > 25 -> "BMI tinggi, perbanyak aktivitas fisik dan atur pola makan rendah lemak."
+ else -> "Data BMI tidak valid."
+ }
+ else -> "Data BMI tidak valid."
+ }
+ }
+
+ fun getTaskBasedData(healthData: HealthData): List