From a2226af98311daa0f841365779973fb5fff55067 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ros=C3=A1rio=20Pereira=20Fernandes?= Date: Mon, 30 Nov 2020 18:40:03 +0200 Subject: [PATCH] refactor(database, firestore): remove kotlin synthetic binding (#1220) --- database/app/build.gradle | 5 ---- .../kotlin/viewholder/PostViewHolder.kt | 26 ++++++++++--------- firestore/app/build.gradle | 5 ---- 3 files changed, 14 insertions(+), 22 deletions(-) diff --git a/database/app/build.gradle b/database/app/build.gradle index ed63997fc..ea04d48ac 100644 --- a/database/app/build.gradle +++ b/database/app/build.gradle @@ -1,6 +1,5 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' -apply plugin: 'org.jetbrains.kotlin.android.extensions' check.dependsOn 'assembleDebugAndroidTest' @@ -29,10 +28,6 @@ android { } } -androidExtensions { - experimental = true -} - dependencies { implementation project(":internal:lintchecks") implementation project(":internal:chooserx") diff --git a/database/app/src/main/java/com/google/firebase/quickstart/database/kotlin/viewholder/PostViewHolder.kt b/database/app/src/main/java/com/google/firebase/quickstart/database/kotlin/viewholder/PostViewHolder.kt index f3a9754f2..b407d7935 100644 --- a/database/app/src/main/java/com/google/firebase/quickstart/database/kotlin/viewholder/PostViewHolder.kt +++ b/database/app/src/main/java/com/google/firebase/quickstart/database/kotlin/viewholder/PostViewHolder.kt @@ -2,30 +2,32 @@ package com.google.firebase.quickstart.database.kotlin.viewholder import androidx.recyclerview.widget.RecyclerView import android.view.View +import android.widget.ImageView +import android.widget.TextView import com.google.firebase.quickstart.database.R import com.google.firebase.quickstart.database.kotlin.models.Post -import kotlinx.android.synthetic.main.include_post_author.view.postAuthor -import kotlinx.android.synthetic.main.include_post_text.view.postBody -import kotlinx.android.synthetic.main.include_post_text.view.postTitle -import kotlinx.android.synthetic.main.item_post.view.postNumStars -import kotlinx.android.synthetic.main.item_post.view.star class PostViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { + private val postTitle: TextView = itemView.findViewById(R.id.postTitle) + private val postAuthor: TextView = itemView.findViewById(R.id.postAuthor) + private val postNumStars: TextView = itemView.findViewById(R.id.postNumStars) + private val postBody: TextView = itemView.findViewById(R.id.postBody) + private val star: ImageView = itemView.findViewById(R.id.star) fun bindToPost(post: Post, starClickListener: View.OnClickListener) { - itemView.postTitle.text = post.title - itemView.postAuthor.text = post.author - itemView.postNumStars.text = post.starCount.toString() - itemView.postBody.text = post.body + postTitle.text = post.title + postAuthor.text = post.author + postNumStars.text = post.starCount.toString() + postBody.text = post.body - itemView.star.setOnClickListener(starClickListener) + star.setOnClickListener(starClickListener) } fun setLikedState(liked: Boolean) { if (liked) { - itemView.star.setImageResource(R.drawable.ic_toggle_star_24) + star.setImageResource(R.drawable.ic_toggle_star_24) } else { - itemView.star.setImageResource(R.drawable.ic_toggle_star_outline_24) + star.setImageResource(R.drawable.ic_toggle_star_outline_24) } } } diff --git a/firestore/app/build.gradle b/firestore/app/build.gradle index 9a6432793..9b686b20f 100644 --- a/firestore/app/build.gradle +++ b/firestore/app/build.gradle @@ -1,6 +1,5 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' -apply plugin: 'org.jetbrains.kotlin.android.extensions' android { testBuildType "release" @@ -36,10 +35,6 @@ android { } } -androidExtensions { - experimental = true -} - dependencies { implementation project(":internal:lintchecks") implementation project(":internal:chooserx")