Skip to content

Commit

Permalink
update logo, implement hasil activity checked items
Browse files Browse the repository at this point in the history
  • Loading branch information
anprimordi committed Nov 23, 2019
1 parent 63a640b commit abbdeaf
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 55 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.makaryostudio.lovebird.feature.diagnosis

import android.os.Bundle
import android.widget.EditText
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.CheckBox
import android.widget.Toast
import androidx.recyclerview.widget.RecyclerView
import com.makaryostudio.lovebird.R
import com.makaryostudio.lovebird.feature.hasil.HasilActivity
Expand Down Expand Up @@ -76,6 +77,11 @@ class DiagnosisAdapter internal constructor(private val context: Context) :
gejala.isChecked = false
mCheckedGejala.remove(gejala)
inputGejala.remove(gejala.kodeGejala)

if (mCheckedGejala.isEmpty()) {
Toast.makeText(context,"Pilih gejala yang dialami", Toast.LENGTH_SHORT).show()

}
}

intent.putParcelableArrayListExtra("checked",mCheckedGejala)
Expand Down Expand Up @@ -378,15 +384,15 @@ class DiagnosisAdapter internal constructor(private val context: Context) :
}
}

println("Diagnosa Penyakit : $penyakit")
println("Diagnosis Penyakit : $penyakit")
println("Persentase CBR : $persentaseCBR")


intent.putExtra("penyakit", penyakit)
intent.putExtra("solusi", solusi)
intent.putExtra("pencegahan", pencegahan)
intent.putExtra("persentaseCBR", persentaseCBR.toString())


context.startActivity(intent)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,25 @@ class HasilActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_hasil)

bindView()

textHasilDiagnosis = findViewById(R.id.text_hasil_diagnosis)
textSolusi = findViewById(R.id.text_solusi)
textPencegahan = findViewById(R.id.title_pencegahan)
textPencegahan = findViewById(R.id.text_pencegahan)

val checked = intent.getParcelableExtra<Gejala>("checked")
val checked = intent.getParcelableArrayListExtra<Gejala>("checked")
val penyakitBurung = intent.getStringExtra("penyakit")
val solusi = intent.getStringExtra("solusi")
val pencegahan = intent.getStringExtra("pencegahan")

val mListData: ArrayList<Gejala> = arrayListOf(checked)
val mListData: List<Gejala> = checked

adapter.loadListData(mListData)

textHasilDiagnosis.text = penyakitBurung!!.toString()
textSolusi.text = solusi
textPencegahan.text = pencegahan

bindView()
}

private fun bindView() {
Expand Down
Binary file modified app/src/main/res/drawable/app_logo_upper.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions app/src/main/res/drawable/ic_app_logo_upper.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<bitmap
android:src="@drawable/app_logo_upper" />
</item>
</layer-list>
51 changes: 27 additions & 24 deletions app/src/main/res/layout/activity_diagnosis.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
tools:context=".feature.diagnosis.DiagnosisActivity">

<androidx.constraintlayout.widget.ConstraintLayout
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/guideline_horizontal_top"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@color/colorPrimary"
android:layout_height="0dp" >
app:layout_constraintBottom_toTopOf="@id/guideline_horizontal_25"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<ImageView
android:id="@+id/image_diagnosis_logo"
Expand All @@ -22,25 +22,21 @@
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:contentDescription="@string/diagnosis_logo_img_description"
android:src="@drawable/app_logo_upper"
android:src="@drawable/ic_app_logo_upper"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

<TextView
android:id="@+id/title_pilih_gejala"
android:layout_width="wrap_content"
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline_horizontal_15"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/diagnosis_pilih_gejala_text"
android:layout_marginTop="64dp"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textColor="@color/primary_text"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="@id/card_form" />
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.15" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline_horizontal_top"
android:id="@+id/guideline_horizontal_25"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
Expand All @@ -57,26 +53,32 @@
android:id="@+id/card_form"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="16dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:background="@android:color/white"
app:cardCornerRadius="32dp"
app:cardElevation="4dp"
app:layout_constraintBottom_toTopOf="@id/guideline_horizontal_bottom"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/title_pilih_gejala">
app:layout_constraintTop_toBottomOf="@id/guideline_horizontal_15">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="8dp">

<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline_vertical"
android:layout_width="1dp"
<TextView
android:id="@+id/title_pilih_gejala"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.5" />
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:text="@string/diagnosis_pilih_gejala_text"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="@color/primary_text"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<ScrollView
android:layout_width="match_parent"
Expand All @@ -86,13 +88,14 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
app:layout_constraintTop_toBottomOf="@id/title_pilih_gejala">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_gejala"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:listitem="@layout/item_gejala" />

</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
Expand Down
47 changes: 30 additions & 17 deletions app/src/main/res/layout/activity_hasil.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@color/colorPrimary"
app:layout_constraintBottom_toTopOf="@id/guideline_horizontal_top"
app:layout_constraintBottom_toTopOf="@id/guideline_horizontal_25"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
Expand All @@ -22,55 +22,67 @@
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:contentDescription="@string/diagnosis_logo_img_description"
android:src="@drawable/app_logo_upper"
android:src="@drawable/ic_app_logo_upper"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

<TextView
android:id="@+id/title_hasil"
android:layout_width="wrap_content"

<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline_horizontal_15"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="64dp"
android:text="@string/hasil_diagnosis_text"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textColor="@color/primary_text"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.15" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline_horizontal_top"
android:id="@+id/guideline_horizontal_25"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.25" />

<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="0dp"
android:layout_marginBottom="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/title_hasil">
app:layout_constraintTop_toBottomOf="@id/guideline_horizontal_15">

<com.google.android.material.card.MaterialCardView
android:id="@+id/card_form"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:background="@android:color/white"
app:cardCornerRadius="32dp"
app:cardElevation="4dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/guideline_horizontal_top">
app:layout_constraintTop_toBottomOf="@id/guideline_horizontal_25">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="8dp">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:text="@string/hasil_diagnosis_text"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="@color/colorAccent"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/title_gejala_dialami"
android:layout_width="0dp"
Expand Down Expand Up @@ -169,6 +181,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/title_pencegahan"
tools:text="@tools:sample/lorem/random" />

</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
</ScrollView>
Expand Down
14 changes: 7 additions & 7 deletions app/src/main/res/layout/activity_splash_screen.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@color/colorPrimary"
app:layout_constraintBottom_toTopOf="@id/guideline_horizontal_top"
app:layout_constraintBottom_toTopOf="@id/guideline_horizontal_25"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline_horizontal_top"
android:id="@+id/guideline_horizontal_25"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
Expand Down Expand Up @@ -48,11 +48,11 @@
app:layout_constraintTop_toBottomOf="@id/image_splashscreen_logo" />

<TextView
android:text="@string/app_copyright"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:text="@string/app_copyright"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

0 comments on commit abbdeaf

Please sign in to comment.