From 003dd942e8b4a67eebe1386cc1c689f8aef398d6 Mon Sep 17 00:00:00 2001 From: hyooosong Date: Fri, 1 Jan 2021 12:30:58 +0900 Subject: [PATCH] =?UTF-8?q?[Fix]=20=EB=8D=B0=EC=9D=B4=ED=84=B0=EB=B0=94?= =?UTF-8?q?=EC=9D=B8=EB=94=A9=20Step.01=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 추가 변수 수정 Related to : #2, #6 --- .../practicegitanddatabinding/MainActivity.kt | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/sotp/semina/practicegitanddatabinding/MainActivity.kt b/app/src/main/java/sotp/semina/practicegitanddatabinding/MainActivity.kt index 99dfc4b..deab78c 100644 --- a/app/src/main/java/sotp/semina/practicegitanddatabinding/MainActivity.kt +++ b/app/src/main/java/sotp/semina/practicegitanddatabinding/MainActivity.kt @@ -2,11 +2,9 @@ package sotp.semina.practicegitanddatabinding import androidx.appcompat.app.AppCompatActivity import android.os.Bundle -import android.widget.Button import android.widget.EditText import android.widget.ImageView import android.widget.TextView -import androidx.databinding.BindingAdapter import androidx.databinding.DataBindingUtil import com.bumptech.glide.Glide import sotp.semina.practicegitanddatabinding.databinding.ActivityMainBinding @@ -14,24 +12,25 @@ import sotp.semina.practicegitanddatabinding.databinding.ActivityMainBinding class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - val binding : ActivityMainBinding = DataBindingUtil.setContentView(this, R.layout.activity_main) + val binding : ActivityMainBinding = + DataBindingUtil.setContentView(this, R.layout.activity_main) initProfileImage(binding.imageProfileImage) setProfileName(binding.textProfileName, DEFAULT_USER_NAME) addButtonClickEvent(binding) } - private fun initProfileImage(imageView: ImageView) { - Glide.with(imageView.context) + private fun initProfileImage(profileImage: ImageView) { + Glide.with(profileImage.context) .load(IMAGE_URL) - .into(imageView) + .into(profileImage) } - private fun setProfileName(profileName:TextView, content:String) { + private fun setProfileName(profileName: TextView, content: String) { profileName.text = content } - private fun addButtonClickEvent(binding : ActivityMainBinding) { + private fun addButtonClickEvent(binding: ActivityMainBinding) { binding.buttonProfileChangeButton.setOnClickListener { setProfileName(binding.textProfileName, getEditTextToString(binding.inputChangedProfile)) }