fix: [ui] adjust overall user interface layout

This commit is contained in:
Wisnu Andika
2025-04-11 14:02:38 +07:00
parent e24753f7a2
commit 59f534fb35
12 changed files with 36 additions and 96 deletions

View File

@ -45,10 +45,20 @@ class HistoryDiagnoseAdapter : ListAdapter<HistoryDiagnose, HistoryDiagnoseAdapt
titleResultDiagnosis.text = historyDiagnose.name
val date = historyDiagnose.date.replace("-", " ")
dateResultDiagnosis.text = date
binding.confidenceResultDiagnosis.text = "Confidence: ${confidenceConverter(historyDiagnose.confidence)}"
}
}
}
fun confidenceConverter(confidence: String): String {
val confidenceValue = confidence.toDouble() * 100
return if (confidenceValue % 1 == 0.0) {
confidenceValue.toInt().toString() + "%"
} else {
String.format("%.1f", confidenceValue) + "%"
}
}
interface OnItemClickCallback {
fun onItemClicked(data: HistoryDiagnose)
}

View File

@ -302,9 +302,19 @@ class HomeFragment : Fragment(R.layout.fragment_home) {
binding.titleResultDiagnosis.text = historyDiagnose.name
val date = historyDiagnose.date.replace("-", " ")
binding.dateResultDiagnosis.text = date
binding.confidenceResultDiagnosis.text = "Confidence: ${confidenceConverter(historyDiagnose.confidence)}"
binding.cdHomeScreenAnalyze.visibility = View.VISIBLE
}
fun confidenceConverter(confidence: String): String {
val confidenceValue = confidence.toDouble() * 100
return if (confidenceValue % 1 == 0.0) {
confidenceValue.toInt().toString() + "%"
} else {
String.format("%.1f", confidenceValue) + "%"
}
}
override fun onDestroyView() {
super.onDestroyView()
_binding = null

View File

@ -58,11 +58,11 @@ class DiseaseDetailActivity : AppCompatActivity() {
private fun setUpUi(diseaseDetail: DiseaseDiagnose?) {
if(diseaseDetail?.diseaseName == "Brown Spots") {
Glide.with(this)
.load(R.drawable.dgs_wereng_img)
.load(R.drawable.palm_brown_spots_example_img)
.into(binding.imageDisease)
} else {
Glide.with(this)
.load(R.drawable.upn_logo)
.load(R.drawable.palm_healthy_example_img)
.into(binding.imageDisease)
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 651 KiB

View File

@ -5,89 +5,9 @@
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".ui.diagnose.DiagnoseDetailActivity">
<!-- <LinearLayout-->
<!-- android:id="@+id/ll_ds"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginHorizontal="30dp"-->
<!-- android:orientation="vertical"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent">-->
<!-- <ImageView-->
<!-- android:id="@+id/dgs_back"-->
<!-- android:layout_width="32dp"-->
<!-- android:layout_height="32dp"-->
<!-- android:layout_marginTop="35dp"-->
<!-- android:layout_marginBottom="15dp"-->
<!-- android:src="@drawable/ds_back_arrow_img" />-->
<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:orientation="horizontal">-->
<!-- <TextView-->
<!-- android:id="@+id/tv_title"-->
<!-- style="@style/ActivityDiagnoseDiseaseName"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- tools:text="Algal Leaf" />-->
<!-- <TextView-->
<!-- android:id="@+id/tv_confidence"-->
<!-- style="@style/ActivityDiagnoseDiseaseName"-->
<!-- android:layout_marginStart="10dp"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="80%" />-->
<!-- </LinearLayout>-->
<!-- <com.google.android.material.card.MaterialCardView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content">-->
<!-- <ImageView-->
<!-- android:id="@+id/iv_img_tea"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="200dp"-->
<!-- android:scaleType="fitXY"-->
<!-- tools:src="@drawable/dgs_wereng_img" />-->
<!-- </com.google.android.material.card.MaterialCardView>-->
<!-- <com.google.android.material.tabs.TabLayout-->
<!-- android:id="@+id/tab_layout"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginVertical="8dp"-->
<!-- app:tabSelectedTextColor="@color/primaryGreen"-->
<!-- app:tabIndicatorColor="@color/primaryGreen"-->
<!-- android:background="@color/grayBackground"-->
<!-- app:layout_constraintTop_toBottomOf="@+id/img">-->
<!-- <com.google.android.material.tabs.TabItem-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content" />-->
<!-- <com.google.android.material.tabs.TabItem-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content" />-->
<!-- </com.google.android.material.tabs.TabLayout>-->
<!-- <androidx.viewpager2.widget.ViewPager2-->
<!-- android:id="@+id/view_pager"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- app:layout_constraintHorizontal_bias="0.0"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toBottomOf="@id/tab_layout"-->
<!-- app:layout_constraintVertical_bias="1.0" />-->
<!-- </LinearLayout>-->
<ImageView
android:id="@+id/dgs_back"
android:layout_width="32dp"
@ -116,7 +36,7 @@
android:layout_width="match_parent"
android:layout_height="200dp"
android:scaleType="fitXY"
tools:src="@drawable/dgs_wereng_img" />
tools:src="@drawable/palm_brown_spots_example_img" />
</com.google.android.material.card.MaterialCardView>
<androidx.constraintlayout.widget.ConstraintLayout
@ -174,7 +94,6 @@
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_component"
android:layout_marginHorizontal="@dimen/margin_screen"
android:background="@color/white"
app:layout_constraintTop_toBottomOf="@+id/tv_confidence_desc"
@ -193,12 +112,13 @@
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="200dp"
android:layout_marginHorizontal="@dimen/margin_screen"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tab_layout"
app:layout_constraintVertical_bias="1.0" />
<Button
@ -209,7 +129,7 @@
android:fontFamily="@font/poppins_medium"
android:gravity="center"
android:layout_marginHorizontal="@dimen/margin_screen"
android:layout_marginBottom="@dimen/margin_screen"
android:layout_marginBottom="10dp"
android:paddingVertical="14dp"
android:text="Informasi Selengkapnya"
android:textColor="@color/white"

View File

@ -32,11 +32,12 @@
android:layout_width="match_parent"
android:layout_height="185dp"
android:layout_gravity="center"
android:scaleType="centerCrop"
android:layout_marginHorizontal="@dimen/margin_screen"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:src="@drawable/dgs_wereng_img"/>
android:src="@drawable/palm_brown_spots_example_img"/>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/dd_cont_title"

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -13,4 +13,4 @@
android:layout_height="wrap_content"
android:text="Penyakit Algal Leaf disebabkan oleh alga hijau Cephaleuros virescens yang menyerang daun teh, menyebabkan bintik-bintik hijau kusam atau oranye pada daun." />
</FrameLayout>
</ScrollView>

View File

@ -334,7 +334,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:visibility="gone"
app:cardCornerRadius="0dp"
app:strokeColor="@color/greenGeneral"
app:strokeWidth="1dp"
@ -366,7 +365,7 @@
android:layout_width="75dp"
android:layout_height="75dp"
android:scaleType="fitXY"
android:src="@drawable/hs_wereng_img" />
android:src="@drawable/palm_brown_spots_example_img" />
</com.google.android.material.card.MaterialCardView>
<TextView

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -13,4 +13,4 @@
android:layout_height="wrap_content"
android:text="Pangkas dan buang daun yang terinfeksi, pastikan tanaman mendapatkan sirkulasi udara yang baik, dan gunakan fungisida berbasis tembaga jika diperlukan." />
</FrameLayout>
</ScrollView>

View File

@ -32,7 +32,7 @@
android:layout_width="75dp"
android:layout_height="75dp"
android:scaleType="fitXY"
android:src="@drawable/hs_wereng_img" />
android:src="@drawable/palm_brown_spots_example_img" />
</com.google.android.material.card.MaterialCardView>
<TextView
@ -52,7 +52,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/date_result_diagnosis"
android:text="Algal Leaf"
android:text="Brown Spots"
android:textColor="@color/greenGeneral"
android:textSize="20sp"
android:textStyle="bold"