From 2261353c9b46f3000c1776a81407a0936e3da3df Mon Sep 17 00:00:00 2001 From: gaeun Date: Fri, 12 May 2023 21:31:59 +0900 Subject: [PATCH] =?UTF-8?q?[Rename/#7]=20=ED=8C=8C=EC=9D=BC=EB=AA=85=20?= =?UTF-8?q?=ED=86=B5=EC=9D=BC=20=EB=B0=8F=20id=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/android/go/sopt/MultiViewAdapter.kt | 28 +++++++++---------- .../org/android/go/sopt/remote/ApiFactory.kt | 4 +-- ...istUsersService.kt => UsersListService.kt} | 2 +- app/src/main/res/layout/fragment_home.xml | 2 +- .../layout/{item_music.xml => item_users.xml} | 14 +++++----- 5 files changed, 24 insertions(+), 26 deletions(-) rename app/src/main/java/org/android/go/sopt/remote/service/{ListUsersService.kt => UsersListService.kt} (88%) rename app/src/main/res/layout/{item_music.xml => item_users.xml} (85%) diff --git a/app/src/main/java/org/android/go/sopt/MultiViewAdapter.kt b/app/src/main/java/org/android/go/sopt/MultiViewAdapter.kt index a0d74d4..2826363 100644 --- a/app/src/main/java/org/android/go/sopt/MultiViewAdapter.kt +++ b/app/src/main/java/org/android/go/sopt/MultiViewAdapter.kt @@ -1,8 +1,6 @@ package org.android.go.sopt -import android.app.Activity import android.content.Context -import android.util.Log import android.view.LayoutInflater import android.view.MotionEvent import android.view.ViewGroup @@ -17,8 +15,8 @@ import androidx.recyclerview.widget.RecyclerView.ViewHolder import com.bumptech.glide.Glide import org.android.go.sopt.data.* import org.android.go.sopt.databinding.ItemBottomBinding -import org.android.go.sopt.databinding.ItemMusicBinding import org.android.go.sopt.databinding.ItemTopBinding +import org.android.go.sopt.databinding.ItemUsersBinding import org.android.go.sopt.remote.model.ResponseListUsersDto @@ -43,16 +41,16 @@ class MultiViewAdapter(context: Context) : return TopRvTitleViewHolder(binding) } MULTI_TYPE2 -> { - val binding: ItemMusicBinding = ItemMusicBinding.inflate(inflater, parent, false) - return MusicListViewHolder(binding) + val binding: ItemUsersBinding = ItemUsersBinding.inflate(inflater, parent, false) + return UsersListViewHolder(binding) } MULTI_TYPE3 -> { val binding: ItemBottomBinding = ItemBottomBinding.inflate(inflater, parent, false) return BottomSponsorViewHolder(binding) } else -> { - val binding: ItemMusicBinding = ItemMusicBinding.inflate(inflater, parent, false) - return MusicListViewHolder(binding) + val binding: ItemUsersBinding = ItemUsersBinding.inflate(inflater, parent, false) + return UsersListViewHolder(binding) } @@ -92,7 +90,7 @@ class MultiViewAdapter(context: Context) : holder.setIsRecyclable(false) } MULTI_TYPE2 -> { - (holder as MusicListViewHolder).onBind(currentList[position - 1]) + (holder as UsersListViewHolder).onBind(currentList[position - 1]) holder.setIsRecyclable(false) } MULTI_TYPE3 -> { @@ -105,18 +103,18 @@ class MultiViewAdapter(context: Context) : class TopRvTitleViewHolder(private val binding: ItemTopBinding) : ViewHolder(binding.root) { fun onBind() { - binding.tvTitle.text = "노래 리스트" + binding.tvTitle.text = "유저 리스트" } } - inner class MusicListViewHolder(private val binding: ItemMusicBinding) : + inner class UsersListViewHolder(private val binding: ItemUsersBinding) : ViewHolder(binding.root) { fun onBind(item: ResponseListUsersDto.Data) { - binding.tvMusicTitle.text = item.first_name + item.last_name - binding.tvMusicSinger.text = item.email - Glide.with(context).load(item.avatar).into(binding.ivMusic) + binding.tvUserName.text = item.first_name + item.last_name + binding.tvUserEmail.text = item.email + Glide.with(context).load(item.avatar).into(binding.ivAvatar) if (selectionTracker != null && selectionTracker.isSelected(absoluteAdapterPosition.toLong())) { binding.chkSelect.setImageResource(R.drawable.ic_home) @@ -179,9 +177,9 @@ class MultiViewAdapter(context: Context) : @Nullable override fun getItemDetails(@NonNull motionEvent: MotionEvent): ItemDetails? { val view = recyclerView.findChildViewUnder(motionEvent.x, motionEvent.y) - if (view != null && recyclerView.getChildViewHolder(view) is MultiViewAdapter.MusicListViewHolder) { + if (view != null && recyclerView.getChildViewHolder(view) is MultiViewAdapter.UsersListViewHolder) { val viewHolder = - recyclerView.getChildViewHolder(view) as MultiViewAdapter.MusicListViewHolder + recyclerView.getChildViewHolder(view) as MultiViewAdapter.UsersListViewHolder return viewHolder.getItemDetails(viewHolder) } return null diff --git a/app/src/main/java/org/android/go/sopt/remote/ApiFactory.kt b/app/src/main/java/org/android/go/sopt/remote/ApiFactory.kt index 0cd3d51..9607047 100644 --- a/app/src/main/java/org/android/go/sopt/remote/ApiFactory.kt +++ b/app/src/main/java/org/android/go/sopt/remote/ApiFactory.kt @@ -5,7 +5,7 @@ import kotlinx.serialization.json.Json import okhttp3.MediaType.Companion.toMediaType import org.android.go.sopt.BuildConfig.AUTH_BASE_URL import org.android.go.sopt.BuildConfig.USERS_LIST_BASE_URL -import org.android.go.sopt.remote.service.ListUsersService +import org.android.go.sopt.remote.service.UsersListService import org.android.go.sopt.remote.service.LogInService import org.android.go.sopt.remote.service.SignUpService import retrofit2.Retrofit @@ -33,5 +33,5 @@ object ApiFactory { object ServicePool { // 서비스가 모여있는곳 val signUpService = ApiFactory.createAuth() val logInService = ApiFactory.createAuth() - val listUsersService = ApiFactory.createUsers() + val listUsersService = ApiFactory.createUsers() } \ No newline at end of file diff --git a/app/src/main/java/org/android/go/sopt/remote/service/ListUsersService.kt b/app/src/main/java/org/android/go/sopt/remote/service/UsersListService.kt similarity index 88% rename from app/src/main/java/org/android/go/sopt/remote/service/ListUsersService.kt rename to app/src/main/java/org/android/go/sopt/remote/service/UsersListService.kt index 2830794..f24c64c 100644 --- a/app/src/main/java/org/android/go/sopt/remote/service/ListUsersService.kt +++ b/app/src/main/java/org/android/go/sopt/remote/service/UsersListService.kt @@ -4,7 +4,7 @@ import org.android.go.sopt.remote.model.ResponseListUsersDto import retrofit2.Call import retrofit2.http.GET -interface ListUsersService { +interface UsersListService { @GET("users") fun getListUsers( ): Call diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index db9d0a8..1b27bfa 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -13,7 +13,7 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintBottom_toTopOf="@id/btn_delete_item" - tools:listitem="@layout/item_music" + tools:listitem="@layout/item_users" />