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"?> | |
<TextView android:id="@+id/txt_title" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:paddingStart="16dp" | |
android:paddingTop="16dp" | |
android:paddingEnd="16dp" | |
android:textColor="#1b3c59" | |
android:textSize="21sp" | |
tools:text="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
class TitleAdapter(private val title: Title) : RecyclerView.Adapter<TitleAdapter.DataViewHolder>() { | |
class DataViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { | |
fun bind(title: Title) { | |
itemView.txt_title.text = title.text | |
} | |
} | |
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = | |
DataViewHolder( |
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"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:orientation="vertical"> | |
<LinearLayout | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" |
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 HeaderAdapter(private val header: Header) : | |
RecyclerView.Adapter<HeaderAdapter.DataViewHolder>() { | |
class DataViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { | |
fun bind(header: Header) { | |
itemView.frm_color.setBackgroundColor(header.color) | |
itemView.txt_header.text = header.text | |
} | |
} |
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
object MergeAdapterDataSource { | |
fun getHeader() = Header(Color.BLUE, "RECYCLERVIEW") | |
fun getTitle() = Title("Merge Adapter") | |
fun getImage() = Image(R.drawable.placeholder) | |
} |
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
data class Header(val color: Int = 0, | |
val text: String = "") | |
data class Title(val text: String = "") | |
data class Image(val image: Int = 0) |
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
<uses-permission android:name="android.permission.INTERNET"/> |
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
apiClient.getUserFromApi { isSuccess, response, message -> | |
if (isSuccess) { | |
val name = response?.documents?.first()?.fields?.name | |
val surname = response?.documents?.first()?.fields?.surname | |
name?.let { _name -> | |
txt_name.text = _name.stringValue | |
} | |
surname?.let { _surname -> | |
txt_surname.text = _surname.stringValue | |
} |
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
private val apiClient by lazy { ApiClient() } |
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"?> | |
<LinearLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:orientation="vertical" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:gravity="center" | |
tools:context=".MainActivity"> |