Skip to content

Commit

Permalink
[FEATURE] #30 Profile Ui 연동
Browse files Browse the repository at this point in the history
  • Loading branch information
eshc123 committed Sep 28, 2022
1 parent 6cdc9b0 commit 02f3a69
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.eshc.feature.profile

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.activity.viewModels
import androidx.databinding.DataBindingUtil
import com.eshc.feature.profile.databinding.ActivityProfileBinding
import dagger.hilt.android.AndroidEntryPoint
Expand All @@ -11,12 +12,15 @@ class ProfileActivity : AppCompatActivity() {
private var _binding : ActivityProfileBinding? = null
private val binding get() = _binding

private val viewModel : ProfileViewModel by viewModels()

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
_binding = DataBindingUtil.setContentView(
this,R.layout.activity_profile
)
binding?.lifecycleOwner = this

binding?.viewModel = viewModel
viewModel.getUser()
}
}
15 changes: 13 additions & 2 deletions feature-profile/src/main/res/layout/activity_profile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
xmlns:tools="http://schemas.android.com/tools">

<data>

<variable
name="viewModel"
type="com.eshc.feature.profile.ProfileViewModel" />

</data>

Expand Down Expand Up @@ -46,6 +48,7 @@
android:layout_height="@dimen/size_80"
android:layout_marginStart="@dimen/margin_24"
android:layout_marginTop="@dimen/margin_24"
app:iconImage="@{viewModel.uiState.user.avatarUrl}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

Expand All @@ -57,6 +60,7 @@
android:layout_marginTop="@dimen/margin_26"
android:textColor="@color/white"
android:textSize="@dimen/text_size_18"
android:text="@{viewModel.uiState.user.login}"
app:layout_constraintStart_toEndOf="@id/iv_profile"
app:layout_constraintTop_toTopOf="parent" />

Expand All @@ -67,6 +71,7 @@
android:layout_marginStart="@dimen/margin_16"
android:textColor="@color/gray"
android:textSize="@dimen/text_size_16"
android:text="@{viewModel.uiState.user.name}"
app:layout_constraintStart_toEndOf="@id/iv_profile"
app:layout_constraintTop_toBottomOf="@id/tv_login" />

Expand All @@ -83,6 +88,7 @@
android:paddingEnd="@dimen/padding_8"
android:paddingBottom="@dimen/padding_4"
android:textColor="@color/gray"
android:text="@{viewModel.uiState.user.bio}"
app:layout_constraintStart_toEndOf="@id/iv_profile"
app:layout_constraintTop_toBottomOf="@id/tv_name" />

Expand All @@ -106,6 +112,7 @@
android:gravity="center_vertical"
android:textColor="@color/white"
android:textSize="@dimen/text_size_14"
android:text="@{viewModel.uiState.user.location}"
app:drawableStartCompat="@drawable/ic_location"
app:drawableTint="@color/gray"
app:layout_constraintStart_toStartOf="parent"
Expand All @@ -121,6 +128,7 @@
android:gravity="center_vertical"
android:textColor="@color/white"
android:textSize="@dimen/text_size_14"
android:text="@{viewModel.uiState.user.blog}"
app:drawableStartCompat="@drawable/ic_link"
app:drawableTint="@color/gray"
app:layout_constraintStart_toStartOf="parent"
Expand All @@ -136,6 +144,7 @@
android:gravity="center_vertical"
android:textColor="@color/white"
android:textSize="@dimen/text_size_14"
android:text="@{viewModel.uiState.user.email}"
app:drawableStartCompat="@drawable/ic_mail"
app:drawableTint="@color/gray"
app:layout_constraintStart_toStartOf="parent"
Expand All @@ -152,13 +161,14 @@
android:gravity="center_vertical"
android:textColor="@color/white"
android:textSize="@dimen/text_size_14"
android:text="@{@string/profile_follow(viewModel.uiState.user.followers,viewModel.uiState.user.following)}"
app:drawableStartCompat="@drawable/ic_user"
app:drawableTint="@color/gray"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_email" />

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_repo_start"
android:id="@+id/cl_repo_star"
android:layout_width="match_parent"
android:layout_height="@dimen/size_128"
android:layout_marginHorizontal="@dimen/margin_24"
Expand Down Expand Up @@ -226,6 +236,7 @@
android:gravity="center_vertical"
android:textColor="@color/white"
android:textSize="@dimen/text_size_14"
android:text="@{String.valueOf(viewModel.uiState.user.publicRepos)}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/ib_repository" />

Expand Down
2 changes: 2 additions & 0 deletions feature-profile/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<resources>
<string name="profile_repository">Repositories</string>
<string name="profile_starred">Starred</string>

<string name="profile_follow">%d Followers • %d Following</string>
</resources>

0 comments on commit 02f3a69

Please sign in to comment.