Skip to content

Commit

Permalink
[feat/store]: fix 서버에서 내려주는 변수 추가로 인한 DTO 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
librarywon committed Jul 6, 2023
1 parent 5a266fb commit 7118363
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,33 @@ import com.teampophory.pophory.databinding.ItemStorePagerBinding
import com.teampophory.pophory.feature.home.store.model.AlbumItem

class StoreAdapter(
private val onItemClicked: (AlbumItem) -> Unit,
private val onPageChangedListener: OnPageChangedListener
private val onItemClicked: (AlbumItem) -> Unit,
private val onPageChangedListener: OnPageChangedListener
) : ListAdapter<AlbumItem, StoreAdapter.StoreViewHolder>(
ItemDiffCallback<AlbumItem>(
onItemsTheSame = { old, new -> old.hashCode() == new.hashCode() },
onContentsTheSame = { old, new -> old == new }
)
ItemDiffCallback<AlbumItem>(
onItemsTheSame = { old, new -> old.hashCode() == new.hashCode() },
onContentsTheSame = { old, new -> old == new }
)
) {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): StoreViewHolder {
val binding =
ItemStorePagerBinding.inflate(LayoutInflater.from(parent.context), parent, false)
ItemStorePagerBinding.inflate(LayoutInflater.from(parent.context), parent, false)
return StoreViewHolder(binding, onItemClicked, onPageChangedListener)
}

class StoreViewHolder(
private val binding: ItemStorePagerBinding,
private val onItemClicked: (AlbumItem) -> Unit,
private val onPageChangedListener: OnPageChangedListener
private val binding: ItemStorePagerBinding,
private val onItemClicked: (AlbumItem) -> Unit,
private val onPageChangedListener: OnPageChangedListener
) : RecyclerView.ViewHolder(binding.root) {
fun bind(albumItem: AlbumItem) {
itemView.setOnClickListener {
onItemClicked(albumItem)
onPageChangedListener.onPageChanged(albumItem)
}
with(binding) {

}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ package com.teampophory.pophory.feature.home.store.model
data class AlbumItem(
val id: Int,
val title: String,
val albumCover: Int,
val photoCount: Int
)
16 changes: 8 additions & 8 deletions app/src/main/res/layout/fragment_mypage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,26 +73,26 @@
android:layout_width="0dp"
android:layout_height="180dp"
android:layout_marginHorizontal="40dp"
android:layout_marginTop="34dp"
android:layout_marginBottom="16dp"
android:src="@drawable/ic_empty_feed"
android:visibility="visible"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@id/tv_mypage_feed_empty"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/rv_mypage" />
app:layout_constraintStart_toStartOf="parent" />

<TextView
android:id="@+id/tv_mypage_feed_empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginBottom="56dp"
android:text="@string/mypage_feed_empty"
android:textAppearance="?textAppearanceHeadlineSmall"
android:textColor="?colorOnSurface100"
android:textSize="18sp"
android:visibility="visible"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/iv_mypage_feed_empty" />
app:layout_constraintStart_toStartOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/layout/item_store_pager.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginHorizontal="45dp"
android:src="@drawable/img_album_cover"
android:src="@drawable/ic_album_cover_friends"
android:contentDescription="pager item image"
android:scaleType="centerCrop"
app:layout_constraintBottom_toBottomOf="parent"
Expand Down

0 comments on commit 7118363

Please sign in to comment.