Skip to content

Commit

Permalink
[chore] #5 카멜케이스 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
YuBeen-Park committed Dec 26, 2022
1 parent e55dc29 commit ec169f9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
8 changes: 4 additions & 4 deletions app/src/main/java/org/sopt/sample/adapter/GalleryAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ import org.sopt.sample.data.remote.response.ResponseUser
import org.sopt.sample.databinding.LayoutGalleryRowBinding

class GalleryAdapter : RecyclerView.Adapter<GalleryAdapter.GalleryViewHolder>() {
private var userItems: List<ResponseUser.userListInfo>? = emptyList()
private var userItems: List<ResponseUser.UserListInfo>? = emptyList()

fun setItems(items: List<ResponseUser.userListInfo>) {
fun setItems(items: List<ResponseUser.UserListInfo>) {
this.userItems = items
notifyDataSetChanged()
}

class GalleryViewHolder(
private val binding: LayoutGalleryRowBinding
) : RecyclerView.ViewHolder(binding.root) {
fun bind(user: ResponseUser.userListInfo) {
binding.tvFirstName.text = user.first_name
fun bind(user: ResponseUser.UserListInfo) {
binding.tvFirstName.text = user.firstName
binding.tvEmail.text = user.email
Glide.with(binding.root).load(user.avatar).error(R.drawable.github)
.into(binding.ivAvatar)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
package org.sopt.sample.data.remote.response

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class ResponseUser(
val page: Int,
val per_page: Int,
@SerialName("per_page")
val perPage: Int,
val total: Int,
val total_pages: Int,
val data: List<userListInfo>,
val support: supportInfo
@SerialName("total_pages")
val totalPages: Int,
val data: List<UserListInfo>,
val support: SupportInfo
) {
@Serializable
data class userListInfo(
data class UserListInfo(
val id: Int,
val email: String,
val first_name: String,
val last_name: String,
@SerialName("first_name")
val firstName: String,
@SerialName("last_name")
val lastName: String,
val avatar: String
)

@Serializable
data class supportInfo(
data class SupportInfo(
val url: String,
val text: String
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import timber.log.Timber
class HomeViewModel : ViewModel() {

private val userService = ServicePool.userListService
private val _userResult = MutableLiveData<UiState<List<ResponseUser.userListInfo>>>()
val userResult: LiveData<UiState<List<ResponseUser.userListInfo>>>
private val _userResult = MutableLiveData<UiState<List<ResponseUser.UserListInfo>>>()
val userResult: LiveData<UiState<List<ResponseUser.UserListInfo>>>
get() = _userResult


Expand Down

0 comments on commit ec169f9

Please sign in to comment.