Skip to content

Commit

Permalink
[Fix] 데이터바인딩 Step.01 수정
Browse files Browse the repository at this point in the history
추가 변수 수정

Related to : #2, #6
  • Loading branch information
hyooosong committed Jan 1, 2021
1 parent e3515fd commit 003dd94
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,35 @@ 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

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))
}
Expand Down

0 comments on commit 003dd94

Please sign in to comment.