Skip to content

Commit

Permalink
update all layout
Browse files Browse the repository at this point in the history
  • Loading branch information
anprimordi committed Nov 23, 2019
1 parent ee8edc2 commit 8d97539
Show file tree
Hide file tree
Showing 16 changed files with 259 additions and 323 deletions.
8 changes: 5 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.makaryostudio.lovebird">

<application
android:allowBackup="true"
android:fullBackupContent="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
Expand All @@ -17,16 +19,16 @@
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
<activity
android:name=".feature.splashscreen.SplashScreenActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
<activity
android:name=".feature.home.HomeActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".feature.home.HomeActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package com.makaryostudio.lovebird.feature.diagnosis
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity

import android.os.Bundle
import android.widget.Button
import android.widget.EditText
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.makaryostudio.lovebird.R
import com.makaryostudio.lovebird.feature.hasil.HasilActivity
import com.makaryostudio.lovebird.repository.model.Gejala
import com.makaryostudio.lovebird.model.Gejala

class DiagnosisActivity : AppCompatActivity(), DiagnosisContract.View {

Expand All @@ -18,7 +16,6 @@ class DiagnosisActivity : AppCompatActivity(), DiagnosisContract.View {

private lateinit var rvGejala: RecyclerView
private lateinit var adapter: DiagnosisAdapter
private lateinit var textNamaBurung: EditText

private lateinit var btnDiagnosis: FloatingActionButton

Expand All @@ -38,19 +35,7 @@ class DiagnosisActivity : AppCompatActivity(), DiagnosisContract.View {

btnDiagnosis = findViewById(R.id.button_diagnosis)

//textNamaBurung = findViewById(R.id.edit_nama_burung) as EditText

// val penyakitBurung = intent.getStringExtra("penyakit")
// val cbr = intent.getStringExtra("persentaseCBR")

btnDiagnosis.setOnClickListener {
val intent = Intent(this, HasilActivity::class.java)
// intent.putExtra("namaBurung", textNamaBurung.text.toString())
// intent.putExtra("penyakit", penyakitBurung)
// intent.putExtra("persentaseCBR", cbr )
// startActivity(intent)
//print(textNamaBurung.text)
//print(textNamaBurung.text)
adapter.cbr()
finish()
}
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ package com.makaryostudio.lovebird.feature.diagnosis

import com.makaryostudio.lovebird.base.BasePresenter
import com.makaryostudio.lovebird.base.BaseView
import com.makaryostudio.lovebird.repository.model.Gejala
import com.makaryostudio.lovebird.model.Gejala

interface DiagnosisContract {
interface Presenter : BasePresenter {
fun loadListGejala()
// fun getSelectedItems(isSelected: Boolean): ArrayList<Gejala>
}

interface View : BaseView<Presenter> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
package com.makaryostudio.lovebird.feature.diagnosis

import com.makaryostudio.lovebird.R
import com.makaryostudio.lovebird.repository.model.Gejala
import com.makaryostudio.lovebird.model.Gejala

class DiagnosisPresenter internal constructor(private val view: DiagnosisContract.View) :
DiagnosisContract.Presenter {
// override fun getSelectedItems(isSelected: Boolean): ArrayList<Gejala> {
// TODO("mengambil list yang dipilih")
// var list: ArrayList<Gejala> = ArrayList()
//
// val gejala: Gejala = Gejala()
//
// gejala.checked
// }



override fun loadListGejala() {
val listGejala = arrayListOf(
Gejala(0, "Nafsu Makan Menurun", 5f),
Gejala(1,"Kotoran Cair",3f),
Gejala(1, "Kotoran Cair", 3f),
Gejala(2, "Bulu Tidak Rapi", 2f),
Gejala(3, "Kurang Bergairah/Lemas", 3f),
Gejala(4, "Bobot Burung Menurun", 2f),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,60 +1,49 @@
package com.makaryostudio.lovebird.feature.hasil

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.EditText

import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView

import com.makaryostudio.lovebird.R
import com.makaryostudio.lovebird.repository.model.Gejala
import com.makaryostudio.lovebird.repository.model.Penyakit

import com.makaryostudio.lovebird.model.Gejala

class HasilActivity : AppCompatActivity() {

private lateinit var textNamaBurung: TextView

private lateinit var adapter: RecyclerView
private lateinit var rvGejalaDialami: RecyclerView
private lateinit var adapter: HasilAdapter
private lateinit var textHasilDiagnosis: TextView
private lateinit var textSolusi: TextView
private lateinit var textPencegahan: TextView

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_hasil)
println("a")
//textNamaBurung = findViewById(R.id.text_nama_burung)

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

val gejala = intent.getParcelableExtra<Gejala>("gejala")
val checked = intent.getBooleanArrayExtra("checked")
//val namaBurung = intent.getStringExtra("namaBurung")
val checked = intent.getParcelableExtra<Gejala>("checked")
val penyakitBurung = intent.getStringExtra("penyakit")
val solusi = intent.getStringExtra("solusi")
val pencegahan = intent.getStringExtra("pencegahan")
val cbr = intent.getStringExtra("persentaseCBR")
// textNamaBurung = findViewById(R.id.namaBurung)

//textNamaBurung.text = "Penyakit Burung: $penyakitBurung"
textHasilDiagnosis.text = penyakitBurung
textSolusi.text=solusi
textPencegahan.text=pencegahan

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

adapter.loadListData(mListData)

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

bindView()
}

private fun bindView() {

adapter = findViewById(R.id.rv_gejala_dialami)

rvGejalaDialami = findViewById(R.id.rv_gejala_dialami)
rvGejalaDialami.layoutManager = LinearLayoutManager(this)
adapter = HasilAdapter()
rvGejalaDialami.adapter = adapter

}
}
Original file line number Diff line number Diff line change
@@ -1,32 +1,28 @@
package com.makaryostudio.lovebird.feature.hasil

import android.content.Context
import android.content.Intent
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.makaryostudio.lovebird.R
import com.makaryostudio.lovebird.repository.model.Gejala
import com.makaryostudio.lovebird.repository.model.Penyakit
import kotlinx.android.synthetic.main.item_hasil.view.*
import com.makaryostudio.lovebird.model.Gejala

class HasilAdapter internal constructor(private val context: Context) :
RecyclerView.Adapter<HasilAdapter.ViewHolder>() {
class HasilAdapter : RecyclerView.Adapter<HasilAdapter.ViewHolder>() {

private var mListData: List<Penyakit>
private var mListData: List<Gejala>

init {
mListData = ArrayList()
notifyDataSetChanged()
}

//constructor mListData
fun loadListData(mListData: List<Penyakit>) {
fun loadListData(mListData: List<Gejala>) {
this.mListData = mListData
notifyDataSetChanged()
}

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_hasil, parent, false)
Expand All @@ -38,11 +34,9 @@ class HasilAdapter internal constructor(private val context: Context) :
}

override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val penyakit = mListData[position]
val gejala = mListData[position]

// val gejala = Intent()
// gejala.getParcelableExtra<Gejala>("gejala")
holder.textGejalaDialami.text = penyakit.gejalaDialami
holder.textGejalaDialami.text = gejala.gejalaDialami
}

class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.makaryostudio.lovebird.repository.model
package com.makaryostudio.lovebird.model

import android.os.Parcel
import android.os.Parcelable
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 8d97539

Please sign in to comment.