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
package com.danielmalone.dansinvoicing | |
data class Invoice( | |
val id: String, | |
val title: String, | |
val client: String, | |
val date: String | |
) |
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
<?xml version="1.0" encoding="utf-8"?> | |
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content"> | |
<TextView | |
android:id="@+id/invoiceTitle" | |
android:layout_width="0dp" |
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
package com.danielmalone.dansinvoicing | |
import android.os.Bundle | |
import androidx.appcompat.app.AppCompatActivity | |
import androidx.recyclerview.widget.LinearLayoutManager | |
import kotlinx.android.synthetic.main.activity_main.* | |
import kotlinx.android.synthetic.main.content_main.* | |
class MainActivity : AppCompatActivity() { |
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
package com.danielmalone.dansinvoicing | |
import android.view.LayoutInflater | |
import android.view.View | |
import android.view.ViewGroup | |
import androidx.recyclerview.widget.DiffUtil | |
import androidx.recyclerview.widget.ListAdapter | |
import androidx.recyclerview.widget.RecyclerView | |
import kotlinx.android.synthetic.main.invoice_row.view.* |
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
class ViewHolder(view: View) : RecyclerView.ViewHolder(view) { | |
fun bind(invoice: Invoice) { | |
itemView.invoiceTitle.text = invoice.title | |
itemView.invoiceClient.text = invoice.client | |
itemView.invoiceDate.text = invoice.date | |
} | |
} |
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
<?xml version="1.0" encoding="utf-8"?> | |
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content"> | |
<TextView | |
android:id="@+id/invoiceTitle" | |
android:layout_width="0dp" |
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
<?xml version="1.0" encoding="utf-8"?> | |
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content"> | |
<TextView | |
android:id="@+id/invoiceTitle" | |
android:layout_width="0dp" | |
android:layout_height="wrap_content" |
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
override fun onBindViewHolder(holder: ViewHolder, position: Int) { | |
holder.bind(getItem(position)) | |
} | |
class ViewHolder(view: View) : RecyclerView.ViewHolder(view) { | |
fun bind(invoice: Invoice) { | |
itemView.invoiceTitle.text = invoice.title | |
} |
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
package com.danielmalone.dansinvoicing | |
import android.os.Bundle | |
import androidx.appcompat.app.AppCompatActivity | |
import androidx.recyclerview.widget.LinearLayoutManager | |
import kotlinx.android.synthetic.main.activity_main.* | |
import kotlinx.android.synthetic.main.content_main.* | |
class MainActivity : AppCompatActivity() { |
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
package com.danielmalone.dansinvoicing | |
import android.view.LayoutInflater | |
import android.view.View | |
import android.view.ViewGroup | |
import androidx.recyclerview.widget.DiffUtil | |
import androidx.recyclerview.widget.ListAdapter | |
import androidx.recyclerview.widget.RecyclerView | |
class InvoicesAdapter : ListAdapter<Invoice, InvoicesAdapter.ViewHolder>(InvoicesDiff()) { |
NewerOlder