Skip to content

Commit

Permalink
Show the name of the document in document adapter (#323)
Browse files Browse the repository at this point in the history
* Show the name of the document in document adapter

* Rename some fields and add some paddings in DocumentViewHolder
  • Loading branch information
mblcdr authored Mar 31, 2022
1 parent cec09b1 commit 3825c86
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package de.solarisbank.identhub.contract.adapter

import androidx.recyclerview.widget.RecyclerView
import de.solarisbank.identhub.contract.adapter.DocumentViewHolder
import de.solarisbank.sdk.data.dto.DocumentDto
import com.jakewharton.rxrelay2.PublishRelay
import android.view.ViewGroup
import android.view.LayoutInflater
import android.view.View
import de.solarisbank.identhub.R
import io.reactivex.Observable
import java.util.ArrayList
Expand All @@ -25,7 +23,7 @@ class DocumentAdapter : RecyclerView.Adapter<DocumentViewHolder>() {

override fun onBindViewHolder(holder: DocumentViewHolder, position: Int) {
val document = documents[position]
holder.bindAction { actionClickRelay.accept(document) }
holder.bind(document) { actionClickRelay.accept(document) }
}

override fun getItemCount(): Int {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
package de.solarisbank.identhub.contract.adapter

import android.view.View
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import de.solarisbank.identhub.R
import de.solarisbank.sdk.data.dto.DocumentDto

class DocumentViewHolder(holderView: View) : RecyclerView.ViewHolder(holderView) {

private val documentLayout: View = holderView.findViewById(R.id.viewDocumentLayout)
private val downloadLayout: View = holderView.findViewById(R.id.downloadLayout)
private val documentNameText: TextView = holderView.findViewById(R.id.documentNameText)

fun bindAction(clickListener: View.OnClickListener?) {
fun bind(document: DocumentDto, clickListener: View.OnClickListener?) {
documentNameText.text = document.name
documentLayout.setOnClickListener(clickListener)
downloadLayout.setOnClickListener(clickListener)
}
Expand Down
5 changes: 4 additions & 1 deletion identhub/src/main/res/layout/identhub_item_document.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:gravity="center_vertical">
android:gravity="center_vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp">

<LinearLayout
android:id="@+id/viewDocumentLayout"
Expand All @@ -26,6 +28,7 @@
android:src="@drawable/identhub_ic_view_document"/>

<TextView
android:id="@+id/documentNameText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/identhub_contract_signing_preview_view_document"
Expand Down

0 comments on commit 3825c86

Please sign in to comment.