Skip to content

Commit

Permalink
[Rename/#7] 파일명 통일 및 id 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
gaeun5744 committed May 12, 2023
1 parent 75a2d6b commit 2261353
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 26 deletions.
28 changes: 13 additions & 15 deletions app/src/main/java/org/android/go/sopt/MultiViewAdapter.kt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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


Expand All @@ -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)
}


Expand Down Expand Up @@ -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 -> {
Expand All @@ -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)
Expand Down Expand Up @@ -179,9 +177,9 @@ class MultiViewAdapter(context: Context) :
@Nullable
override fun getItemDetails(@NonNull motionEvent: MotionEvent): ItemDetails<Long>? {
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
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/org/android/go/sopt/remote/ApiFactory.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -33,5 +33,5 @@ object ApiFactory {
object ServicePool { // 서비스가 모여있는곳
val signUpService = ApiFactory.createAuth<SignUpService>()
val logInService = ApiFactory.createAuth<LogInService>()
val listUsersService = ApiFactory.createUsers<ListUsersService>()
val listUsersService = ApiFactory.createUsers<UsersListService>()
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<ResponseListUsersDto>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
/>

<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
android:layout_height="wrap_content"
android:src="@drawable/ic_music"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/iv_music"
app:layout_constraintEnd_toStartOf="@id/iv_avatar"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />


<ImageView
android:id="@+id/iv_music"
android:id="@+id/iv_avatar"
android:layout_width="0dp"
android:layout_height="60dp"
android:layout_marginStart="20dp"
Expand All @@ -34,7 +34,7 @@
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/tv_music_title"
android:id="@+id/tv_user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
Expand All @@ -47,15 +47,15 @@
tools:text="음악 제목" />

<TextView
android:id="@+id/tv_music_singer"
android:id="@+id/tv_user_email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/nanum_gothic_light"
android:textColor="?attr/colorOnBackground"
android:textSize="10sp"
app:layout_constraintEnd_toEndOf="@id/tv_music_title"
app:layout_constraintStart_toStartOf="@id/tv_music_title"
app:layout_constraintTop_toBottomOf="@id/tv_music_title"
app:layout_constraintEnd_toEndOf="@id/tv_user_name"
app:layout_constraintStart_toStartOf="@id/tv_user_name"
app:layout_constraintTop_toBottomOf="@id/tv_user_name"
tools:text="음악 주인" />


Expand Down

0 comments on commit 2261353

Please sign in to comment.