diff --git a/.idea/misc.xml b/.idea/misc.xml index 138e459..c6d0a87 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,7 +3,9 @@ diff --git a/app/build.gradle b/app/build.gradle index 91a886e..a860946 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,7 +11,7 @@ android { minSdk 23 targetSdk 32 versionCode 1 - versionName "1.0" + versionName "1.1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/java/com/haritaci/altyapiasistani/MainActivity.kt b/app/src/main/java/com/haritaci/altyapiasistani/MainActivity.kt index a964d2f..8bed61d 100644 --- a/app/src/main/java/com/haritaci/altyapiasistani/MainActivity.kt +++ b/app/src/main/java/com/haritaci/altyapiasistani/MainActivity.kt @@ -1,8 +1,9 @@ package com.haritaci.altyapiasistani -import androidx.appcompat.app.AppCompatActivity import android.os.Bundle +import androidx.appcompat.app.AppCompatActivity import com.haritaci.altyapiasistani.databinding.ActivityMainBinding +import kotlin.math.round class MainActivity : AppCompatActivity() { lateinit var binding: ActivityMainBinding @@ -17,16 +18,18 @@ class MainActivity : AppCompatActivity() { binding.hesapButton.setOnClickListener{ if (binding.CihazKotu.text.isNotEmpty()&&binding.baca1Kotu.text.isNotEmpty()&&binding.baca2Kotu.text.isNotEmpty()&&binding.bacaMesafe.text.isNotEmpty()&&binding.cursor.text.isNotEmpty()&&binding.boruCapi.text.isNotEmpty()) { - var Aletkotu = binding.CihazKotu.text.toString().toDouble() - var baca1 = binding.baca1Kotu.text.toString().toDouble() - var baca2 = binding.baca2Kotu.text.toString().toDouble() - var bacamesafe = binding.bacaMesafe.text.toString().toDouble() - var nerdesin =binding.cursor.text.toString().toDouble() - var borucap = binding.boruCapi.text.toString().toDouble() - var bUstu:Double = (((Aletkotu - (baca1 - (((baca1 - baca2)/bacamesafe)*nerdesin))) - borucap)).toDouble() - var bAlti:Double = (Aletkotu - (baca1 - (((baca1 - baca2)/bacamesafe)*nerdesin))).toDouble() - bAlti = Math.floor(bAlti * 100) / 100; - bUstu = Math.floor(bUstu * 100) / 100; + binding.uyari.text = null + val aletkotu = binding.CihazKotu.text.toString().toDouble() + val baca1 = binding.baca1Kotu.text.toString().toDouble() + val baca2 = binding.baca2Kotu.text.toString().toDouble() + val bacamesafe = binding.bacaMesafe.text.toString().toDouble() + val nerdesin =binding.cursor.text.toString().toDouble() + val borucap = binding.boruCapi.text.toString().toDouble() + var bUstu:Double = (((aletkotu - (baca1 - (((baca1 - baca2)/bacamesafe)*nerdesin))) - borucap)) + var bAlti:Double = (aletkotu - (baca1 - (((baca1 - baca2)/bacamesafe)*nerdesin))) + bAlti = round(bAlti * 100) / 100 + bUstu = round(bUstu * 100) / 100 + binding.kaziUst.text = bAlti.toString() binding.boruUst.text = bUstu.toString() @@ -34,8 +37,9 @@ class MainActivity : AppCompatActivity() { } - else binding.uyari.text = "HATA!" - binding.uyari.setTextColor(getColor(R.color.red)) + else + "HATA!".also { binding.uyari.text = it } + binding.uyari.setTextColor(getColor(R.color.red)) } } } \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index cc93a97..98b1761 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -8,6 +8,7 @@ tools:context=".MainActivity"> + + @@ -63,7 +71,7 @@ android:layout_width="100dp" android:layout_height="match_parent" android:paddingTop="15dp" - android:text="1. Baca Kotu" + android:text="1. Nokta kotu" android:textAlignment="center" /> @@ -90,7 +98,7 @@ android:layout_width="100dp" android:layout_height="match_parent" android:paddingTop="15dp" - android:text="2. Baca Kotu" + android:text="2. Nokta kotu" android:textAlignment="center" /> @@ -116,7 +124,7 @@ android:layout_width="100dp" android:layout_height="match_parent" android:paddingTop="2dp" - android:text="Bacalar Arası Mesafe" + android:text="Noktalar Arası Mesafe" android:textAlignment="center" /> + +