-
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.
update hasil activity, add hasil adapter
- Loading branch information
1 parent
564dee8
commit 6ff61c7
Showing
8 changed files
with
263 additions
and
203 deletions.
There are no files selected for viewing
354 changes: 153 additions & 201 deletions
354
app/src/main/java/com/makaryostudio/lovebird/feature/diagnosis/DiagnosisAdapter.kt
Large diffs are not rendered by default.
Oops, something went wrong.
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
51 changes: 51 additions & 0 deletions
51
app/src/main/java/com/makaryostudio/lovebird/feature/hasil/HasilAdapter.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
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.* | ||
|
||
class HasilAdapter internal constructor(private val context: Context) : | ||
RecyclerView.Adapter<HasilAdapter.ViewHolder>() { | ||
|
||
private var mListData: List<Penyakit> | ||
|
||
init { | ||
mListData = ArrayList() | ||
notifyDataSetChanged() | ||
} | ||
|
||
//constructor mListData | ||
fun loadListData(mListData: List<Penyakit>) { | ||
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) | ||
return ViewHolder(view) | ||
} | ||
|
||
override fun getItemCount(): Int { | ||
return mListData.size | ||
} | ||
|
||
override fun onBindViewHolder(holder: ViewHolder, position: Int) { | ||
val penyakit = mListData[position] | ||
|
||
// val gejala = Intent() | ||
// gejala.getParcelableExtra<Gejala>("gejala") | ||
holder.textGejalaDialami.text = penyakit.gejalaDialami | ||
} | ||
|
||
class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { | ||
var textGejalaDialami: TextView = itemView.findViewById(R.id.text_hasil_gejala) | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<vector android:height="8dp" android:viewportHeight="512" | ||
android:viewportWidth="512" android:width="8dp" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<path android:fillColor="#22E863" android:pathData="M256,0C114.837,0 0,114.837 0,256s114.837,256 256,256s256,-114.837 256,-256S397.163,0 256,0z"/> | ||
</vector> |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:id="@+id/layout_gejala" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:orientation="horizontal"> | ||
|
||
<ImageView | ||
android:layout_marginStart="4dp" | ||
android:layout_gravity="center" | ||
android:src="@drawable/ic_circle_green_8dp" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:contentDescription="@string/hasil_green_dot_img" /> | ||
|
||
<TextView | ||
android:layout_marginStart="4dp" | ||
android:id="@+id/text_hasil_gejala" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:ellipsize="end" | ||
android:maxLines="1" | ||
tools:text="@tools:sample/lorem/random" /> | ||
</LinearLayout> |
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