Skip to content

Commit

Permalink
[refactor] #178 refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
leeseokchan00 committed Nov 6, 2024
1 parent 0d207a2 commit daa0b79
Showing 1 changed file with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.sopt.home.viewholder

import android.view.View
import androidx.core.view.isGone
import androidx.core.view.isVisible
import androidx.recyclerview.widget.RecyclerView
Expand Down Expand Up @@ -27,21 +28,17 @@ class HomeClipViewHolder(
with(binding) {
tvLinkTitle.text = data.toastTitle
tvLinkUrl.text = data.linkUrl
if (data.categoryTitle.isNullOrEmpty()) {
tvLinkClipTitle.isGone = true
} else {
tvLinkClipTitle.isVisible = true
tvLinkClipTitle.text = data.categoryTitle
}
binding.tvLinkTitle.setVisible(!data.categoryTitle.isNullOrEmpty())
tvLinkClipTitle.text = data.categoryTitle
ivLinkThumnail.load(data.thumbnailUrl)
if (data.isRead) {
tvItemClipLink.isVisible = true
} else {
tvItemClipLink.isGone = true
}
tvItemClipLink.setVisible(data.isRead)
root.onThrottleClick {
onClickClip.invoke(data)
}
}
}

private fun View.setVisible(value: Boolean) {
visibility = if (value) View.VISIBLE else View.GONE
}
}

0 comments on commit daa0b79

Please sign in to comment.