Skip to content

Commit

Permalink
[Fix] 으아아아아 다시 만듦ㅋㅋㅋㅋ
Browse files Browse the repository at this point in the history
  • Loading branch information
jinsu4755 committed Dec 31, 2020
1 parent 0a1165d commit 32f7852
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@ import android.widget.ImageView
import androidx.databinding.BindingAdapter
import com.bumptech.glide.Glide

/*TODO step2 바인딩 어뎁터 생성
* Glide로 이미지를 띄워주는 바인딩 어뎁터를 만들어주세요
* 뷰에서 사용할 어트리뷰트 이름은 image로 합니다.*/
object BindingAdapter {
@BindingAdapter("app:image")
@JvmStatic
fun imageBinding(view: ImageView, url: String) {
Glide.with(view.context)
.load(url)
.into(view)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class MainActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
val binding: ActivityMainBinding =
DataBindingUtil.setContentView(this, R.layout.activity_main)
binding.userProfile = UserData(IMAGE_URL, DEFAULT_USER_NAME)
/*TODO step3 유저 데이터를 binding 변수에 넣어서 뷰에서 사용할 수 있도록 합니다.*/
addButtonClickEvent(binding)
}

Expand Down
7 changes: 2 additions & 5 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
xmlns:tools="http://schemas.android.com/tools">

<data>
<variable
name="userProfile"
type="sotp.semina.practicegitanddatabinding.UserData" />
<!--TODO step1 데이터 클래스 결합-->
</data>

<!--TODO step3 아래를 유저 데이터로 결합해주세요-->
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand All @@ -19,7 +18,6 @@
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_marginTop="100dp"
app:image="@{userProfile.userImage}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
Expand All @@ -32,7 +30,6 @@
android:layout_marginTop="16dp"
android:textColor="@color/black"
android:textSize="20sp"
android:text="@{userProfile.userName}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/image_profile_image"
Expand Down

0 comments on commit 32f7852

Please sign in to comment.