├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.webp │ │ │ │ └── ic_launcher_round.webp │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.webp │ │ │ │ └── ic_launcher_round.webp │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.webp │ │ │ │ └── ic_launcher_round.webp │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.webp │ │ │ │ └── ic_launcher_round.webp │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.webp │ │ │ │ └── ic_launcher_round.webp │ │ │ ├── drawable │ │ │ │ ├── bg_task.xml │ │ │ │ ├── bg_button.xml │ │ │ │ ├── bg_edit.xml │ │ │ │ ├── bg_botton_sheet.xml │ │ │ │ ├── ic_add.xml │ │ │ │ ├── bg_bottom_shet.xml │ │ │ │ ├── ic_menu.xml │ │ │ │ ├── ic_send.xml │ │ │ │ ├── ic_next.xml │ │ │ │ ├── ic_back.xml │ │ │ │ ├── bg_degrade_buttom.xml │ │ │ │ ├── ic_logout.xml │ │ │ │ ├── container_header.xml │ │ │ │ ├── ic_refresh.xml │ │ │ │ ├── ic_search.xml │ │ │ │ ├── ic_auto_graph.xml │ │ │ │ ├── ic_calculate.xml │ │ │ │ ├── container_resultado_ui.xml │ │ │ │ ├── ic_logoemdiabetes.xml │ │ │ │ └── ic_launcher_background.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── menu │ │ │ │ └── menu_main.xml │ │ │ ├── xml │ │ │ │ ├── backup_rules.xml │ │ │ │ └── data_extraction_rules.xml │ │ │ ├── layout │ │ │ │ ├── fragment_splash.xml │ │ │ │ ├── fragment_base.xml │ │ │ │ ├── activity_main.xml │ │ │ │ ├── fragment_diet.xml │ │ │ │ ├── fragment_medication.xml │ │ │ │ ├── bottom_sheet.xml │ │ │ │ ├── fragment_home.xml │ │ │ │ ├── fragment_glycemia.xml │ │ │ │ ├── fragment_recover_account.xml │ │ │ │ ├── fragment_login.xml │ │ │ │ ├── fragment_register.xml │ │ │ │ ├── item_adapter.xml │ │ │ │ ├── fragment_form_medication.xml │ │ │ │ ├── fragment_form_diet.xml │ │ │ │ ├── fragment_calc_insulina.xml │ │ │ │ └── fragment_form_glycemia.xml │ │ │ ├── values-night │ │ │ │ └── themes.xml │ │ │ ├── values │ │ │ │ ├── colors.xml │ │ │ │ ├── themes.xml │ │ │ │ └── strings.xml │ │ │ ├── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ │ └── navigation │ │ │ │ └── main_graph.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── digo │ │ │ │ └── emdiabetes │ │ │ │ ├── model │ │ │ │ ├── Diet.kt │ │ │ │ ├── Medication.kt │ │ │ │ ├── Glycemia.kt │ │ │ │ └── CalcularInsulina.kt │ │ │ │ ├── helper │ │ │ │ ├── BaseFragment.kt │ │ │ │ ├── FirebaseHelper.kt │ │ │ │ └── Extensions.kt │ │ │ │ └── ui │ │ │ │ ├── MainActivity.kt │ │ │ │ ├── adapter │ │ │ │ ├── ViewPagerAdapter.kt │ │ │ │ ├── DietAdapter.kt │ │ │ │ ├── MedicationAdapter.kt │ │ │ │ └── GlycemiaAdapter.kt │ │ │ │ ├── SplashFragment.kt │ │ │ │ ├── HomeFragment.kt │ │ │ │ ├── auth │ │ │ │ ├── RecoverAccountFragment.kt │ │ │ │ ├── RegisterFragment.kt │ │ │ │ └── LoginFragment.kt │ │ │ │ ├── form │ │ │ │ ├── FormDietFragment.kt │ │ │ │ ├── FormMedicationFragment.kt │ │ │ │ └── FormGlycemiaFragment.kt │ │ │ │ ├── CalcInsulinaFragment.kt │ │ │ │ ├── DietFragment.kt │ │ │ │ ├── MedicationFragment.kt │ │ │ │ └── GlycemiaFragment.kt │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── digo │ │ │ └── emdiabetes │ │ │ └── ExampleUnitTest.kt │ └── androidTest │ │ └── java │ │ └── com │ │ └── digo │ │ └── emdiabetes │ │ └── ExampleInstrumentedTest.kt ├── proguard-rules.pro ├── google-services.json └── build.gradle ├── .idea ├── .gitignore ├── compiler.xml ├── vcs.xml ├── deploymentTargetDropDown.xml ├── gradle.xml └── misc.xml ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── settings.gradle ├── LICENSE ├── gradle.properties ├── gradlew.bat ├── README.md └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rodrigo-Sarmento/EmDiabetes/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rodrigo-Sarmento/EmDiabetes/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rodrigo-Sarmento/EmDiabetes/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rodrigo-Sarmento/EmDiabetes/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rodrigo-Sarmento/EmDiabetes/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rodrigo-Sarmento/EmDiabetes/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rodrigo-Sarmento/EmDiabetes/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rodrigo-Sarmento/EmDiabetes/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rodrigo-Sarmento/EmDiabetes/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rodrigo-Sarmento/EmDiabetes/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rodrigo-Sarmento/EmDiabetes/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_task.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_button.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_edit.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Sep 01 15:20:23 BRT 2022 2 | distributionBase=GRADLE_USER_HOME 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | local.properties 16 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_botton_sheet.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_add.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_bottom_shet.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_menu.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_send.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_next.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_back.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | gradlePluginPortal() 4 | google() 5 | mavenCentral() 6 | } 7 | } 8 | dependencyResolutionManagement { 9 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) 10 | repositories { 11 | google() 12 | mavenCentral() 13 | maven { url 'https://jitpack.io' } 14 | } 15 | } 16 | rootProject.name = "EmDiabetes" 17 | include ':app' 18 | -------------------------------------------------------------------------------- /app/src/test/java/com/digo/emdiabetes/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.digo.emdiabetes 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } -------------------------------------------------------------------------------- /app/src/main/java/com/digo/emdiabetes/model/Diet.kt: -------------------------------------------------------------------------------- 1 | package com.digo.emdiabetes.model 2 | 3 | import android.os.Parcelable 4 | import com.digo.emdiabetes.helper.FirebaseHelper 5 | import kotlinx.parcelize.Parcelize 6 | 7 | @Parcelize 8 | data class Diet( 9 | var id: String = "", 10 | var refeicao: String = "", 11 | var alimento: String = "", 12 | ) : Parcelable { 13 | init { 14 | this.id = FirebaseHelper.getDatabase().push().key ?: "" 15 | } 16 | } -------------------------------------------------------------------------------- /app/src/main/java/com/digo/emdiabetes/model/Medication.kt: -------------------------------------------------------------------------------- 1 | package com.digo.emdiabetes.model 2 | 3 | import android.os.Parcelable 4 | import com.digo.emdiabetes.helper.FirebaseHelper 5 | import kotlinx.parcelize.Parcelize 6 | 7 | @Parcelize 8 | data class Medication( 9 | var id: String = "", 10 | var nome: String = "", 11 | var dosagem: String = "" 12 | ) : Parcelable { 13 | init { 14 | this.id = FirebaseHelper.getDatabase().push().key ?: "" 15 | } 16 | } -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 8 | 9 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_degrade_buttom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_logout.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/container_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_refresh.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/xml/backup_rules.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | -------------------------------------------------------------------------------- /app/src/main/java/com/digo/emdiabetes/model/Glycemia.kt: -------------------------------------------------------------------------------- 1 | package com.digo.emdiabetes.model 2 | 3 | import android.os.Parcelable 4 | import com.digo.emdiabetes.helper.FirebaseHelper 5 | import kotlinx.parcelize.Parcelize 6 | 7 | @Parcelize 8 | data class Glycemia( 9 | var id: String = "", 10 | var glicemia: String = "", 11 | var descricao: String = "", 12 | var dia: Int = 0, 13 | var mes: Int = 0, 14 | var ano: Int = 0 15 | ) : Parcelable { 16 | init { 17 | this.id = FirebaseHelper.getDatabase().push().key ?: "" 18 | } 19 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_search.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_splash.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_base.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/java/com/digo/emdiabetes/helper/BaseFragment.kt: -------------------------------------------------------------------------------- 1 | package com.digo.emdiabetes.helper 2 | 3 | import android.content.Context 4 | import android.view.inputmethod.InputMethodManager 5 | import androidx.fragment.app.Fragment 6 | 7 | open class BaseFragment : Fragment() { 8 | 9 | fun hideKeyboard() { 10 | val view = activity?.currentFocus 11 | if (view != null) { 12 | val imm = activity?.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager 13 | imm.hideSoftInputFromWindow(view.windowToken, 0) 14 | } 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_auto_graph.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/deploymentTargetDropDown.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_calculate.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/xml/data_extraction_rules.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 12 | 13 | 19 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/container_resultado_ui.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | 14 | 15 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/digo/emdiabetes/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.digo.emdiabetes 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("com.digo.emdiabetes", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /app/src/main/java/com/digo/emdiabetes/ui/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.digo.emdiabetes.ui 2 | 3 | import androidx.appcompat.app.AppCompatActivity 4 | import android.os.Bundle 5 | import androidx.navigation.fragment.NavHostFragment 6 | import com.digo.emdiabetes.R 7 | import com.digo.emdiabetes.databinding.ActivityMainBinding 8 | import com.digo.emdiabetes.helper.initToolbar 9 | 10 | class MainActivity : AppCompatActivity() { 11 | 12 | private lateinit var binding: ActivityMainBinding 13 | 14 | override fun onCreate(savedInstanceState: Bundle?) { 15 | super.onCreate(savedInstanceState) 16 | binding = ActivityMainBinding.inflate(layoutInflater) 17 | setContentView(binding.root) 18 | 19 | supportFragmentManager.findFragmentById(R.id.nav_host_fragment) as NavHostFragment 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /app/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /app/src/main/java/com/digo/emdiabetes/ui/adapter/ViewPagerAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.digo.emdiabetes.ui.adapter 2 | 3 | import androidx.fragment.app.Fragment 4 | import androidx.fragment.app.FragmentActivity 5 | import androidx.viewpager2.adapter.FragmentStateAdapter 6 | 7 | class ViewPagerAdapter(fragmentActivity: FragmentActivity) : 8 | FragmentStateAdapter(fragmentActivity) { 9 | 10 | private val fragmentList: MutableList = ArrayList() 11 | 12 | private val titleList: MutableList = ArrayList() 13 | 14 | fun getTitle(position: Int): Int { 15 | return titleList[position] 16 | } 17 | 18 | fun addFragment(fragment: Fragment, title: Int) { 19 | fragmentList.add(fragment) 20 | titleList.add(title) 21 | } 22 | 23 | override fun createFragment(position: Int): Fragment { 24 | return fragmentList[position] 25 | } 26 | 27 | override fun getItemCount(): Int { 28 | return fragmentList.size 29 | } 30 | } -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | #FF000000 9 | #FFFFFFFF 10 | 11 | #7b0000 12 | 13 | #EA8383 14 | #91EC83 15 | #92E8F4 16 | #F4E98C 17 | 18 | #FF4C3B 19 | #03B6FC 20 | #04D5C1 21 | 22 | #FF7803 23 | #03B6FC 24 | #04D5C1 25 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 20 | 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Rodrigo Sarmento 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /app/google-services.json: -------------------------------------------------------------------------------- 1 | { 2 | "project_info": { 3 | "project_number": "561028915091", 4 | "project_id": "emdiabetes-177a0", 5 | "storage_bucket": "emdiabetes-177a0.appspot.com" 6 | }, 7 | "client": [ 8 | { 9 | "client_info": { 10 | "mobilesdk_app_id": "1:561028915091:android:e46d77206d532820e6d266", 11 | "android_client_info": { 12 | "package_name": "com.digo.emdiabetes" 13 | } 14 | }, 15 | "oauth_client": [ 16 | { 17 | "client_id": "561028915091-ipfuid2il3ngeuvn3j2evcjm8ufti7eb.apps.googleusercontent.com", 18 | "client_type": 3 19 | } 20 | ], 21 | "api_key": [ 22 | { 23 | "current_key": "AIzaSyBotf-UdThoP0UB8CWXg40pLsvnRH7YyAA" 24 | } 25 | ], 26 | "services": { 27 | "appinvite_service": { 28 | "other_platform_oauth_client": [ 29 | { 30 | "client_id": "561028915091-ipfuid2il3ngeuvn3j2evcjm8ufti7eb.apps.googleusercontent.com", 31 | "client_type": 3 32 | } 33 | ] 34 | } 35 | } 36 | } 37 | ], 38 | "configuration_version": "1" 39 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 18 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app"s APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Kotlin code style for this project: "official" or "obsolete": 19 | kotlin.code.style=official 20 | # Enables namespacing of each library's R class so that its R class includes only the 21 | # resources declared in the library itself and none from the library's dependencies, 22 | # thereby reducing the size of the R class for that library 23 | android.nonTransitiveRClass=true -------------------------------------------------------------------------------- /app/src/main/java/com/digo/emdiabetes/helper/FirebaseHelper.kt: -------------------------------------------------------------------------------- 1 | package com.digo.emdiabetes.helper 2 | 3 | import com.digo.emdiabetes.R 4 | import com.google.firebase.auth.FirebaseAuth 5 | import com.google.firebase.database.FirebaseDatabase 6 | 7 | class FirebaseHelper { 8 | 9 | companion object { 10 | 11 | fun getDatabase() = FirebaseDatabase.getInstance().reference 12 | 13 | private fun getAuth() = FirebaseAuth.getInstance() 14 | 15 | fun getIdUser() = getAuth().uid 16 | 17 | fun isAutenticated() = getAuth().currentUser != null 18 | 19 | fun validError(error: String): Int { 20 | return when { 21 | error.contains("There is no user record corresponding to this identifier") -> { 22 | R.string.account_not_registered_register_fragment 23 | } 24 | error.contains("The email address is badly formatted") -> { 25 | R.string.invalid_email_register_fragment 26 | } 27 | error.contains("The password is invalid or the user does not have a password") -> { 28 | R.string.invalid_password_register_fragment 29 | } 30 | error.contains("The email address is already in use by another account") -> { 31 | R.string.email_in_use_register_fragment 32 | } 33 | error.contains("Password should be at least 6 characters") -> { 34 | R.string.strong_password_register_fragment 35 | } 36 | else -> { 37 | R.string.error_generic 38 | } 39 | } 40 | } 41 | 42 | } 43 | 44 | } -------------------------------------------------------------------------------- /app/src/main/java/com/digo/emdiabetes/helper/Extensions.kt: -------------------------------------------------------------------------------- 1 | package com.digo.emdiabetes.helper 2 | 3 | import android.graphics.Color 4 | import androidx.appcompat.app.AppCompatActivity 5 | import androidx.appcompat.widget.Toolbar 6 | import androidx.fragment.app.Fragment 7 | import com.digo.emdiabetes.R 8 | import com.digo.emdiabetes.databinding.BottomSheetBinding 9 | import com.google.android.material.bottomsheet.BottomSheetDialog 10 | 11 | fun Fragment.initToolbar(toolbar: Toolbar) { 12 | (activity as AppCompatActivity).setSupportActionBar(toolbar) 13 | (activity as AppCompatActivity).title = "" 14 | (activity as AppCompatActivity).supportActionBar?.setDisplayHomeAsUpEnabled(true) 15 | toolbar.setNavigationOnClickListener { activity?.onBackPressed() } 16 | toolbar.setTitleTextColor(Color.parseColor("#FFFFFF")) 17 | } 18 | 19 | fun Fragment.showBottomSheet( 20 | titleDialog: Int? = null, 21 | titleButton: Int? = null, 22 | message: Int, 23 | onClick: () -> Unit = {} 24 | ) { 25 | val bottomSheetDialog = BottomSheetDialog(requireContext(), R.style.BottomSheetDialog) 26 | val bottomSheetBinding: BottomSheetBinding = 27 | BottomSheetBinding.inflate(layoutInflater, null, false) 28 | 29 | bottomSheetBinding.textTitle.text = getString(titleDialog ?: R.string.text_title_bottom_sheet) 30 | bottomSheetBinding.textMessage.text = getText(message) 31 | bottomSheetBinding.btnClick.text = getString(titleButton ?: R.string.text_button_bottom_sheet) 32 | bottomSheetBinding.btnClick.setOnClickListener { 33 | onClick() 34 | bottomSheetDialog.dismiss() 35 | } 36 | 37 | bottomSheetDialog.setContentView(bottomSheetBinding.root) 38 | bottomSheetDialog.show() 39 | } -------------------------------------------------------------------------------- /app/src/main/java/com/digo/emdiabetes/ui/SplashFragment.kt: -------------------------------------------------------------------------------- 1 | package com.digo.emdiabetes.ui 2 | 3 | import android.os.Bundle 4 | import android.os.Handler 5 | import android.os.Looper 6 | import androidx.fragment.app.Fragment 7 | import android.view.LayoutInflater 8 | import android.view.View 9 | import android.view.ViewGroup 10 | import androidx.navigation.fragment.findNavController 11 | import com.digo.emdiabetes.R 12 | import com.digo.emdiabetes.databinding.FragmentSplashBinding 13 | import com.google.firebase.auth.FirebaseAuth 14 | import com.google.firebase.auth.ktx.auth 15 | import com.google.firebase.ktx.Firebase 16 | 17 | class SplashFragment : Fragment() { 18 | 19 | private var _binding: FragmentSplashBinding? = null 20 | private val binding get() = _binding!! 21 | 22 | private lateinit var auth: FirebaseAuth 23 | 24 | override fun onCreateView( 25 | inflater: LayoutInflater, container: ViewGroup?, 26 | savedInstanceState: Bundle? 27 | ): View { 28 | _binding = FragmentSplashBinding.inflate(inflater, container, false) 29 | return binding.root 30 | } 31 | 32 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 33 | super.onViewCreated(view, savedInstanceState) 34 | 35 | Handler(Looper.getMainLooper()).postDelayed(this::checkAuth, 3000) 36 | 37 | } 38 | 39 | private fun checkAuth() { 40 | auth = Firebase.auth 41 | if (auth.currentUser == null) { 42 | findNavController().navigate(R.id.action_splashFragment_to_authentication) 43 | } else { 44 | findNavController().navigate(R.id.action_splashFragment_to_homeFragment) 45 | } 46 | } 47 | 48 | override fun onDestroyView() { 49 | super.onDestroyView() 50 | _binding = null 51 | } 52 | 53 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/digo/emdiabetes/model/CalcularInsulina.kt: -------------------------------------------------------------------------------- 1 | package com.digo.emdiabetes.model 2 | 3 | class CalcularInsulina { 4 | 5 | private var resultado = 0.0 6 | private var resultadoTotal = 0.0 7 | 8 | fun calcular(peso:Double, carboidrato:Double){ 9 | if (peso>=45 && peso<49){ 10 | resultado = carboidrato / 16 11 | resultadoTotal = resultado 12 | }else if (peso>=49 && peso<58){ 13 | resultado = carboidrato / 15 14 | resultadoTotal = resultado 15 | }else if (peso>=58 && peso<63){ 16 | resultado = carboidrato / 14 17 | resultadoTotal = resultado 18 | }else if (peso>=63 && peso<67){ 19 | resultado = carboidrato / 13 20 | resultadoTotal = resultado 21 | }else if (peso>=67 && peso<76){ 22 | resultado = carboidrato / 12 23 | resultadoTotal = resultado 24 | }else if (peso>=76 && peso<81){ 25 | resultado = carboidrato / 11 26 | resultadoTotal = resultado 27 | }else if (peso>=81 && peso<85){ 28 | resultado = carboidrato / 10 29 | resultadoTotal = resultado 30 | }else if (peso>=85 && peso<90){ 31 | resultado = carboidrato / 9 32 | resultadoTotal = resultado 33 | }else if (peso>=90 && peso<99){ 34 | resultado = carboidrato / 8 35 | resultadoTotal = resultado 36 | }else if (peso>=99 && peso<108){ 37 | resultado = carboidrato / 7 38 | resultadoTotal = resultado 39 | }else if (peso>=108){ 40 | resultado = carboidrato / 6 41 | resultadoTotal = resultado 42 | }else if (peso<45){ 43 | resultado = carboidrato / 17 44 | resultadoTotal = resultado 45 | } 46 | } 47 | 48 | fun resultado():Double{ 49 | return resultadoTotal 50 | } 51 | } -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | id 'org.jetbrains.kotlin.android' 4 | id 'com.google.gms.google-services' 5 | id 'kotlin-parcelize' 6 | id 'androidx.navigation.safeargs.kotlin' 7 | } 8 | 9 | android { 10 | compileSdk 32 11 | 12 | defaultConfig { 13 | applicationId "com.digo.emdiabetes" 14 | minSdk 21 15 | targetSdk 32 16 | versionCode 1 17 | versionName "1.0" 18 | 19 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 20 | } 21 | 22 | buildTypes { 23 | release { 24 | minifyEnabled false 25 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 26 | } 27 | } 28 | compileOptions { 29 | sourceCompatibility JavaVersion.VERSION_1_8 30 | targetCompatibility JavaVersion.VERSION_1_8 31 | } 32 | kotlinOptions { 33 | jvmTarget = '1.8' 34 | } 35 | 36 | viewBinding { 37 | enabled true 38 | } 39 | } 40 | 41 | dependencies { 42 | //firebase 43 | implementation platform('com.google.firebase:firebase-bom:30.3.2') 44 | implementation 'com.google.firebase:firebase-analytics-ktx' 45 | implementation 'com.google.firebase:firebase-auth-ktx' 46 | implementation 'com.google.firebase:firebase-database-ktx' 47 | 48 | implementation 'androidx.core:core-ktx:1.7.0' 49 | implementation 'androidx.appcompat:appcompat:1.5.0' 50 | implementation 'com.google.android.material:material:1.6.1' 51 | implementation 'androidx.constraintlayout:constraintlayout:2.1.4' 52 | 53 | testImplementation 'junit:junit:4.13.2' 54 | androidTestImplementation 'androidx.test.ext:junit:1.1.3' 55 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' 56 | 57 | //navigation 58 | implementation 'androidx.navigation:navigation-fragment-ktx:2.5.2' 59 | implementation 'androidx.navigation:navigation-ui-ktx:2.5.2' 60 | 61 | implementation 'com.github.Ferfalk:SimpleSearchView:0.2.0' 62 | } -------------------------------------------------------------------------------- /app/src/main/java/com/digo/emdiabetes/ui/adapter/DietAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.digo.emdiabetes.ui.adapter 2 | 3 | import android.content.Context 4 | import android.view.LayoutInflater 5 | import android.view.ViewGroup 6 | import androidx.core.content.ContextCompat 7 | import androidx.recyclerview.widget.RecyclerView 8 | import com.digo.emdiabetes.R 9 | import com.digo.emdiabetes.databinding.ItemAdapterBinding 10 | import com.digo.emdiabetes.model.Diet 11 | 12 | class DietAdapter( 13 | private val context: Context, 14 | private val dietList: List, 15 | val contactSelected: (Diet, Int) -> Unit 16 | ) : RecyclerView.Adapter() { 17 | 18 | companion object { 19 | val SELECT_BACK: Int = 1 20 | val SELECT_REMOVE: Int = 2 21 | val SELECT_EDIT: Int = 3 22 | val SELECT_DETAILS: Int = 4 23 | val SELECT_NEXT: Int = 5 24 | } 25 | 26 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder { 27 | return MyViewHolder( 28 | ItemAdapterBinding.inflate( 29 | LayoutInflater.from(parent.context), 30 | parent, 31 | false 32 | ) 33 | ) 34 | } 35 | 36 | override fun onBindViewHolder(holder: MyViewHolder, position: Int) { 37 | val diet= dietList[position] 38 | 39 | val colorCard = ContextCompat.getColor(context, R.color.color_4) 40 | 41 | holder.binding.textDescription.text = "Refeição: "+diet.refeicao +"\nAlimento(s): "+ diet.alimento 42 | 43 | holder.binding.btnDelete.setOnClickListener { contactSelected(diet, SELECT_REMOVE) } 44 | holder.binding.btnEdit.setOnClickListener { contactSelected(diet, SELECT_EDIT) } 45 | holder.binding.btnDetails.setOnClickListener { contactSelected(diet, SELECT_DETAILS) } 46 | 47 | holder.binding.cardview.setCardBackgroundColor(colorCard) 48 | } 49 | 50 | override fun getItemCount() = dietList.size 51 | 52 | inner class MyViewHolder(val binding: ItemAdapterBinding) : 53 | RecyclerView.ViewHolder(binding.root) 54 | 55 | } -------------------------------------------------------------------------------- /app/src/main/java/com/digo/emdiabetes/ui/adapter/MedicationAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.digo.emdiabetes.ui.adapter 2 | 3 | import android.content.Context 4 | import android.view.LayoutInflater 5 | import android.view.ViewGroup 6 | import androidx.core.content.ContextCompat 7 | import androidx.recyclerview.widget.RecyclerView 8 | import com.digo.emdiabetes.R 9 | import com.digo.emdiabetes.databinding.ItemAdapterBinding 10 | import com.digo.emdiabetes.model.Medication 11 | 12 | class MedicationAdapter( 13 | private val context: Context, 14 | private val medicationList: List, 15 | val medicationSelected: (Medication, Int) -> Unit 16 | ) : RecyclerView.Adapter() { 17 | 18 | companion object { 19 | val SELECT_BACK: Int = 1 20 | val SELECT_REMOVE: Int = 2 21 | val SELECT_EDIT: Int = 3 22 | val SELECT_DETAILS: Int = 4 23 | val SELECT_NEXT: Int = 5 24 | } 25 | 26 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder { 27 | return MyViewHolder( 28 | ItemAdapterBinding.inflate( 29 | LayoutInflater.from(parent.context), 30 | parent, 31 | false 32 | ) 33 | ) 34 | } 35 | 36 | override fun onBindViewHolder(holder: MyViewHolder, position: Int) { 37 | val medication = medicationList[position] 38 | 39 | val colorCard = ContextCompat.getColor(context, R.color.color_3) 40 | 41 | holder.binding.textDescription.text = "Nome: "+medication.nome + "\nDosagem: "+medication.dosagem 42 | 43 | holder.binding.btnDelete.setOnClickListener { medicationSelected(medication, SELECT_REMOVE) } 44 | holder.binding.btnEdit.setOnClickListener { medicationSelected(medication, SELECT_EDIT) } 45 | holder.binding.btnDetails.setOnClickListener { medicationSelected(medication, SELECT_DETAILS) } 46 | 47 | holder.binding.cardview.setCardBackgroundColor(colorCard) 48 | } 49 | 50 | override fun getItemCount() = medicationList.size 51 | 52 | inner class MyViewHolder(val binding: ItemAdapterBinding) : 53 | RecyclerView.ViewHolder(binding.root) 54 | 55 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_logoemdiabetes.xml: -------------------------------------------------------------------------------- 1 | 3 | 5 | 7 | 9 | 11 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_diet.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 17 | 18 | 28 | 29 | 34 | 35 | 43 | 44 | 45 | 46 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_medication.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 17 | 18 | 28 | 29 | 34 | 35 | 43 | 44 | 45 | 46 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /app/src/main/res/layout/bottom_sheet.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 21 | 22 | 31 | 32 | 43 | 44 |