BMI_Calculator_Jetpack_Compose

This commit is contained in:
MohamadDiandraFerdiansyah 2025-01-10 01:08:01 +07:00
parent d4b46cdae3
commit d2b55efecb
13 changed files with 37 additions and 88 deletions

2
.idea/compiler.xml generated
View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="CompilerConfiguration"> <component name="CompilerConfiguration">
<bytecodeTargetLevel target="1.8" /> <bytecodeTargetLevel target="11" />
</component> </component>
</project> </project>

5
.idea/gradle.xml generated
View File

@ -4,16 +4,15 @@
<component name="GradleSettings"> <component name="GradleSettings">
<option name="linkedExternalProjectsSettings"> <option name="linkedExternalProjectsSettings">
<GradleProjectSettings> <GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="11" /> <option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
<option name="modules"> <option name="modules">
<set> <set>
<option value="$PROJECT_DIR$" /> <option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" /> <option value="$PROJECT_DIR$/app" />
</set> </set>
</option> </option>
<option name="resolveExternalAnnotations" value="false" />
</GradleProjectSettings> </GradleProjectSettings>
</option> </option>
</component> </component>

2
.idea/misc.xml generated
View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" /> <component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="corretto-11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 397 KiB

View File

@ -1,63 +1,18 @@
# BMI Calculator ( Using - Jetpack Compose ) # BMI Calculator ( Using - Jetpack Compose )
[Download App](https://drive.google.com/file/d/1OXT7n2-iT-DbYn90jI0qzz9MS6RDLmcr/view?usp=sharing) ## CARA MENGGUNAKAN APLIKASI BMI
* Buka aplikasi kalkulator BMI di perangkat Anda.
* Masukkan berat badan Anda di kolom yang disediakan (biasanya dalam kg).
* Masukkan tinggi badan Anda di kolom yang disediakan (biasanya dalam cm atau m).
* Klik tombol "Hitung" atau "Calculate."
* Aplikasi akan menampilkan nilai BMI Anda beserta interpretasi kategori berdasarkan nilai tersebut.
||| # FUNGSI BMI CALCULATOR
|:----------------------------------------:|:-----------------------------------------:| * Menentukan Status Berat Badan
| <img src="https://github.com/devicons/devicon/blob/master/icons/androidstudio/androidstudio-original.svg" alt="Android" width="50" height="50"/> </a> <a href="https://www.java.com" target="_blank"> | <img src="https://github.com/devicons/devicon/blob/master/icons/kotlin/kotlin-original.svg" alt="Android" width="50" height="50"/> </a> <a href="https://www.java.com" target="_blank"> | Berdasarkan nilai BMI, kalkulator memberikan kategori status berat badan
<p align="center"> Kurus: BMI kurang dari 18,5
<a href=""><img src="https://github.com/maityamit/BMI-Calculator-JetPack-Compose/blob/master/Demo/pr_amit.svg" width="50%" /></a> Normal: BMI antara 18,5 dan 24,9
</p> Berat Badan Berlebih: BMI antara 25 dan 29,9
Obesitas: BMI 30 ke atas
## 🤔 What is this App
✍️ Here is "BMI Calculator". You can view your BMI by inputting your height and weight with just one click.
## 💡 Features Used
1. JetPack Compose (Kotlin)
<h1 align=center> Project Admin 🤵 </h1>
<p align="center">
<a href="https://github.com/maityamit"><img src="https://avatars.githubusercontent.com/u/74618071?v=4" width="11%" /></a>
<p align="center">
<a target="_blank"href="https://www.linkedin.com/in/maityamit/"><img src="https://img.shields.io/badge/linkedin-%230077B5.svg?&style=for-the-badge&logo=linkedin&logoColor=white" /></a>&nbsp;&nbsp;&nbsp;&nbsp;
<a href="maityamit308@gmail.com"><img src="https://img.shields.io/badge/gmail-%23D14836.svg?&style=for-the-badge&logo=gmail&logoColor=white" /></a>&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://www.instagram.com/amit_maity_2003/"><img src="https://img.shields.io/badge/instagram-%23D14836.svg?&style=for-the-badge&logo=instagram&logoColor=pink" /></a>&nbsp;&nbsp;&nbsp;&nbsp;
</p>
<br>
## 📸 Screenshots
||||
|:----------------------------------------:|:-----------------------------------------:|:-----------------------------------------:|
| ![Imgur](Demo/1.png) | ![Imgur](Demo/2.png) | ![Imgur](Demo/3.png) |
<p align="center">
<a href=""><img src="https://github.com/maityamit/BMI-Calculator-JetPack-Compose/blob/master/Demo/previeww.gif" width="20%" /></a>
</p>
<h2 align="center">📝 Created by </h2>
<h3>Amit maity</h3>
<a href="https://linkedin.com/in/maityamit" target="blank"><img align="center" src="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/linked-in-alt.svg" alt="ansuman-behera-7b00b61b6" height="30" width="40" /></a>
<a href="https://instagram.com/amit_maity_2003" target="blank"><img align="center" src="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/instagram.svg" alt="_ansuman_behera_/" height="30" width="40" /></a>
<a href="https://twitter.com/AmitMai40525308" target="blank"><img align="center" src="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/twitter.svg" alt="_ansuman_behera_/" height="30" width="40" /></a>
<a href="https://github.com/maityamit" target="blank"><img align="center" src="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/github.svg" alt="_ansuman_behera_/" height="30" width="40" /></a>
<a href="https://leetcode.com/maityamit/" target="blank"><img align="center" src="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/leet-code.svg" alt="_ansuman_behera_/" height="30" width="40" /></a>
<a href="https://www.hackerrank.com/maity_amit_coll1" target="blank"><img align="center" src="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/hackerrank.svg" alt="_ansuman_behera_/" height="30" width="40" /></a>

View File

@ -19,12 +19,9 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
import com.example.bmicalculator.ui.theme.* import com.example.bmicalculator.ui.theme.*
@ -49,7 +46,7 @@ class MainActivity : ComponentActivity() {
Box( Box(
modifier = Modifier modifier = Modifier
.fillMaxSize() .fillMaxSize()
.background(DeepBlue)) .background(white))
{ {
Column { Column {
GreetingSection() GreetingSection()
@ -58,7 +55,7 @@ class MainActivity : ComponentActivity() {
text = "Weight", text = "Weight",
fontWeight = FontWeight.SemiBold, fontWeight = FontWeight.SemiBold,
fontSize = 25.sp, fontSize = 25.sp,
color = Color.White, color = Color.Black,
modifier = Modifier modifier = Modifier
.padding(start = 30.dp, bottom = 20.dp) .padding(start = 30.dp, bottom = 20.dp)
) )
@ -66,12 +63,12 @@ class MainActivity : ComponentActivity() {
TextField( TextField(
value = weight, value = weight,
label = { label = {
Text(text = "Weight", color = Color.White) Text(text = "Weight", color = Color.Black)
}, },
onValueChange = { onValueChange = {
weight = it weight = it
}, },
textStyle = TextStyle(color = Color.White, fontSize = 21.sp), textStyle = TextStyle(color = Color.Black, fontSize = 21.sp),
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Decimal), keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Decimal),
singleLine = true, singleLine = true,
modifier = Modifier modifier = Modifier
@ -90,7 +87,7 @@ class MainActivity : ComponentActivity() {
.padding(15.dp) .padding(15.dp)
) { ) {
Text(text = "Kg", color = Color.White) Text(text = "Kg", color = Color.Black)
} }
} }
@ -99,7 +96,7 @@ class MainActivity : ComponentActivity() {
text = "Height", text = "Height",
fontWeight = FontWeight.SemiBold, fontWeight = FontWeight.SemiBold,
fontSize = 25.sp, fontSize = 25.sp,
color = Color.White, color = Color.Black,
modifier = Modifier modifier = Modifier
.padding(start = 30.dp, bottom = 20.dp) .padding(start = 30.dp, bottom = 20.dp)
) )
@ -107,12 +104,12 @@ class MainActivity : ComponentActivity() {
TextField( TextField(
value = height, value = height,
label = { label = {
Text(text = "Height", color = Color.White) Text(text = "Height", color = Color.Black)
}, },
onValueChange = { onValueChange = {
height = it height = it
}, },
textStyle = TextStyle(color = Color.White, fontSize = 21.sp), textStyle = TextStyle(color = Color.Black, fontSize = 21.sp),
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Decimal), keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Decimal),
singleLine = true, singleLine = true,
modifier = Modifier modifier = Modifier
@ -131,7 +128,7 @@ class MainActivity : ComponentActivity() {
.padding(15.dp) .padding(15.dp)
) { ) {
Text(text = "Cm", color = Color.White) Text(text = "Cm", color = Color.Black)
} }
} }
@ -147,7 +144,7 @@ class MainActivity : ComponentActivity() {
.fillMaxWidth(0.6f) .fillMaxWidth(0.6f)
.height(60.dp) .height(60.dp)
.clip(RoundedCornerShape(30.dp)) .clip(RoundedCornerShape(30.dp))
.background(LightRed) .background(DarkerButtonBlue)
.padding(16.dp) .padding(16.dp)
.clickable { .clickable {
val one = weight.toDouble() val one = weight.toDouble()
@ -161,7 +158,7 @@ class MainActivity : ComponentActivity() {
Text( Text(
text = "Calculate" , text = "Calculate" ,
fontSize = 21.sp , fontSize = 21.sp ,
color = Color.White ,) color = Color.Black ,)
} }
Spacer(modifier = Modifier.height(40.dp)) Spacer(modifier = Modifier.height(40.dp))
Box( Box(
@ -171,7 +168,7 @@ class MainActivity : ComponentActivity() {
Text( Text(
text = ans_bmi , text = ans_bmi ,
fontSize = 22.sp , fontSize = 22.sp ,
color = Color.White ,) color = Color.Black ,)
} }
} }
@ -198,13 +195,13 @@ fun GreetingSection() {
Text( Text(
text = "BMI Calculator", text = "BMI Calculator",
style = MaterialTheme.typography.h4, style = MaterialTheme.typography.h4,
color = Color.White, color = Color.Black,
fontWeight = FontWeight.Bold fontWeight = FontWeight.Bold
) )
Text( Text(
text = "made by Amit Maity", text = "Mohamad Diandra Ferdiansyah",
style = MaterialTheme.typography.body1, style = MaterialTheme.typography.body1,
color = Color.White , color = Color.Black ,
) )
} }

View File

@ -3,12 +3,11 @@ package com.example.bmicalculator.ui.theme
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
val DeepBlue = Color(0xff06164c) val white = Color(0xFFFFFFFF)
val Purple200 = Color(0xFFBB86FC) val Purple200 = Color(0xFFBB86FC)
val Purple500 = Color(0xFF6200EE) val Purple500 = Color(0xFF6200EE)
val Purple700 = Color(0xFF3700B3) val Purple700 = Color(0xff9aa5c4)
val Teal200 = Color(0xFF03DAC5) val Teal200 = Color(0xFF03DAC5)
val ButtonBlue = Color(0xff505cf3) val ButtonBlue = Color(0xff505cf3)
val DarkerButtonBlue = Color(0xff566894) val DarkerButtonBlue = Color(0xff566894)
val LightRed = Color(0xfffc879a)
val AquaBlue = Color(0xff9aa5c4) val AquaBlue = Color(0xff9aa5c4)

View File

@ -1,6 +1,6 @@
plugins { plugins {
id 'com.android.application' version '7.2.1' apply false id 'com.android.application' version '7.4.2' apply false
id 'com.android.library' version '7.2.1' apply false id 'com.android.library' version '7.4.2' apply false
id 'org.jetbrains.kotlin.android' version '1.6.21' apply false id 'org.jetbrains.kotlin.android' version '1.6.21' apply false
} }

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists