-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
96dc78d
commit b22e665
Showing
21 changed files
with
182 additions
and
318 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
6 changes: 2 additions & 4 deletions
6
app/src/androidTest/java/com/example/posyandu/ExampleInstrumentedTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,28 @@ | ||
package com.example.posyandu | ||
|
||
import androidx.appcompat.app.AppCompatActivity | ||
import android.os.Bundle | ||
import android.os.PersistableBundle | ||
import android.view.View | ||
import android.widget.Button | ||
import android.widget.EditText | ||
import android.widget.TextView | ||
|
||
class MainActivity : AppCompatActivity(), View.OnClickListener { | ||
private lateinit var editWidth: EditText | ||
private lateinit var editHeight: EditText | ||
private lateinit var editLength: EditText | ||
private lateinit var btnCalculate: Button | ||
private lateinit var tvResult: TextView | ||
import androidx.appcompat.app.AppCompatActivity | ||
|
||
companion object { | ||
private const val STATE_RESULT = "state_result" | ||
} | ||
class MainActivity : AppCompatActivity() { | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_main) | ||
editWidth = findViewById(R.id.edit_width) | ||
editHeight = findViewById(R.id.edit_height) | ||
editLength = findViewById(R.id.edit_length) | ||
btnCalculate = findViewById(R.id.btn_calculate) | ||
tvResult = findViewById(R.id.tv_result) | ||
btnCalculate.setOnClickListener(this) | ||
setContentView(R.layout.activity_login_bidan) | ||
|
||
if (savedInstanceState != null) { | ||
val result = savedInstanceState.getString(STATE_RESULT) | ||
tvResult.text = result | ||
} | ||
} | ||
|
||
// Your initialization code goes here | ||
|
||
override fun onSaveInstanceState(outState: Bundle) { | ||
super.onSaveInstanceState(outState) | ||
outState.putString(STATE_RESULT, tvResult.text.toString()) | ||
} | ||
// Example: Accessing a view from the layout | ||
// val myTextView = findViewById<TextView>(R.id.my_text_view) | ||
// myTextView.text = "Hello, Kotlin!" | ||
|
||
// Example: Setting up a click listener for a button | ||
// val myButton = findViewById<Button>(R.id.my_button) | ||
// myButton.setOnClickListener { | ||
// // Handle button click | ||
// } | ||
} | ||
|
||
override fun onClick(view: View?) { | ||
if (view?.id == R.id.btn_calculate) { | ||
val inputLength = editLength.text.toString().trim() | ||
val inputWidth = editWidth.text.toString().trim() | ||
val inputHeight = editHeight.text.toString().trim() | ||
var isEmptyFields = false | ||
|
||
if (inputLength.isEmpty()) { | ||
isEmptyFields = true | ||
editLength.error = "Panjang tidak boleh kosong" | ||
} | ||
|
||
if (inputWidth.isEmpty()) { | ||
isEmptyFields = true | ||
editWidth.error = "Lebar tidak boleh kosong" | ||
} | ||
|
||
if (inputHeight.isEmpty()) { | ||
isEmptyFields = true | ||
editHeight.error = "Tinggi tidak boleh kosong" | ||
} | ||
// Add other lifecycle methods and functions as needed | ||
|
||
if (!isEmptyFields) { | ||
val volume = inputLength.toDouble() * inputWidth.toDouble() * inputHeight.toDouble() | ||
tvResult.text = volume.toString() | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<!-- res/drawable/rounded_button_background.xml --> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:shape="rectangle"> | ||
<corners android:radius="12dp" /> <!-- Adjust the radius as needed for the desired roundness --> | ||
<solid android:color="#000000" /> <!-- Set the background color --> | ||
</shape> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions
6
app/src/main/res/drawable/rounded_text_input_layout_background.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<!-- res/drawable/rounded_text_input_layout_background.xml --> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<solid android:color="@android:color/white" /> | ||
<corners android:radius="14dp" /> <!-- Adjust the radius as needed for the desired roundness --> | ||
<stroke android:color="#CCCCCC" android:width="1dp" /> <!-- Border color and width --> | ||
</shape> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:paddingHorizontal="20dp" | ||
android:paddingVertical="14dp"> | ||
|
||
<TextView | ||
android:id="@+id/loginTitle" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:fontFamily="@font/inter_bold" | ||
android:text="Login Sebagai Bidan" | ||
android:textSize="20sp" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:layout_constraintLeft_toLeftOf="parent" | ||
app:layout_constraintRight_toRightOf="parent" | ||
android:layout_marginTop="14dp" | ||
/> | ||
|
||
<ImageView | ||
android:id="@+id/imageBidan" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
app:srcCompat="@drawable/ilustrasi_bidan" | ||
app:layout_constraintTop_toBottomOf="@+id/loginTitle" | ||
app:layout_constraintLeft_toLeftOf="parent" | ||
app:layout_constraintRight_toRightOf="parent" | ||
android:layout_marginVertical="32dp" | ||
/> | ||
|
||
<com.google.android.material.textfield.TextInputLayout | ||
android:id="@+id/usernameInput" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
app:layout_constraintTop_toBottomOf="@+id/imageBidan" | ||
app:layout_constraintRight_toRightOf="parent" | ||
app:layout_constraintLeft_toLeftOf="parent" | ||
android:layout_marginVertical="20dp" | ||
android:hint="Username" | ||
android:background="@drawable/rounded_text_input_layout_background"> | ||
<com.google.android.material.textfield.TextInputEditText | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"/> | ||
</com.google.android.material.textfield.TextInputLayout> | ||
|
||
<com.google.android.material.textfield.TextInputLayout | ||
android:id="@+id/passwordInput" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginVertical="20dp" | ||
android:background="@drawable/rounded_text_input_layout_background" | ||
android:hint="Password" | ||
app:hintTextAppearance="@font/inter_bold" | ||
app:layout_constraintLeft_toLeftOf="parent" | ||
app:layout_constraintRight_toRightOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/usernameInput" | ||
app:passwordToggleEnabled="true"> | ||
|
||
<com.google.android.material.textfield.TextInputEditText | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:inputType="textPassword"/> | ||
</com.google.android.material.textfield.TextInputLayout> | ||
|
||
<TextView | ||
android:id="@+id/hyperlinkLupaPassword" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="Lupa Password?" | ||
android:autoLink="web" | ||
android:linksClickable="true" | ||
app:layout_constraintTop_toBottomOf="@+id/passwordInput" | ||
app:layout_constraintEnd_toEndOf="@+id/passwordInput" | ||
android:paddingVertical="14dp" | ||
/> | ||
|
||
<Button | ||
android:id="@+id/loginButton" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:text="Login" | ||
app:layout_constraintTop_toBottomOf="@+id/hyperlinkLupaPassword" | ||
app:layout_constraintRight_toRightOf="parent" | ||
app:layout_constraintLeft_toLeftOf="parent" | ||
android:background="@drawable/button_background" | ||
android:fontFamily="@font/inter_bold" | ||
android:textSize="14dp"/> | ||
/> | ||
|
||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
Oops, something went wrong.