feat: 커뮤니티 전체보기
- gif 재생 되도록 추가
This commit is contained in:
@@ -18,6 +18,9 @@ import androidx.appcompat.widget.PopupMenu
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import coil.load
|
||||
import coil.transform.CircleCropTransformation
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
|
||||
import com.bumptech.glide.request.RequestOptions
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
||||
import kr.co.vividnext.sodalive.databinding.ItemCreatorCommunityAllBinding
|
||||
@@ -60,7 +63,7 @@ class CreatorCommunityAllAdapter(
|
||||
|
||||
if (item.price > 0) {
|
||||
if (item.existOrdered) {
|
||||
setContent(item, index)
|
||||
setContent(context, item, index)
|
||||
} else {
|
||||
binding.llLike.visibility = View.GONE
|
||||
binding.ivContent.visibility = View.GONE
|
||||
@@ -79,18 +82,18 @@ class CreatorCommunityAllAdapter(
|
||||
binding.tvPurchase.setOnClickListener {
|
||||
onClickPurchaseContent(item.postId, item.price) { post ->
|
||||
items[index] = post
|
||||
setContent(post, index)
|
||||
setContent(context, post, index)
|
||||
}
|
||||
}
|
||||
|
||||
setNoticeAndClickableUrl(binding.tvContent, item.content, item.isExpand, index)
|
||||
}
|
||||
} else {
|
||||
setContent(item, index)
|
||||
setContent(context, item, index)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setContent(item: GetCommunityPostListResponse, index: Int) {
|
||||
private fun setContent(context: Context, item: GetCommunityPostListResponse, index: Int) {
|
||||
binding.llLockPost.visibility = View.GONE
|
||||
binding.llLike.visibility = View.VISIBLE
|
||||
binding.llComment.visibility = View.VISIBLE
|
||||
@@ -126,7 +129,7 @@ class CreatorCommunityAllAdapter(
|
||||
binding.ivPlayOrPause.setOnClickListener {}
|
||||
}
|
||||
|
||||
setImageContent(binding.ivContent, item.imageUrl)
|
||||
setImageContent(context, binding.ivContent, item.imageUrl)
|
||||
setContentLike(item.isLike, item.likeCount, item.postId, index)
|
||||
setNoticeAndClickableUrl(binding.tvContent, item.content, item.isExpand, index)
|
||||
setContentComment(
|
||||
@@ -140,14 +143,21 @@ class CreatorCommunityAllAdapter(
|
||||
)
|
||||
}
|
||||
|
||||
private fun setImageContent(ivContent: ImageView, imageUrl: String?) {
|
||||
private fun setImageContent(context: Context, ivContent: ImageView, imageUrl: String?) {
|
||||
ivContent.visibility = View.VISIBLE
|
||||
if (imageUrl != null) {
|
||||
ivContent.visibility = View.VISIBLE
|
||||
ivContent.loadUrl(imageUrl) {
|
||||
crossfade(true)
|
||||
placeholder(R.drawable.bg_placeholder)
|
||||
}
|
||||
Glide.with(context)
|
||||
.load(imageUrl)
|
||||
.placeholder(R.drawable.ic_place_holder)
|
||||
.apply(
|
||||
RequestOptions().transform(
|
||||
RoundedCorners(
|
||||
8f.dpToPx().toInt()
|
||||
)
|
||||
)
|
||||
)
|
||||
.into(ivContent)
|
||||
} else {
|
||||
ivContent.visibility = View.GONE
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import android.view.View
|
||||
import android.widget.Toast
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.core.content.ContextCompat
|
||||
import coil.transform.RoundedCornersTransformation
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
|
||||
import com.bumptech.glide.request.RequestOptions
|
||||
@@ -30,7 +29,6 @@ import kr.co.vividnext.sodalive.common.RealPathUtil
|
||||
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
||||
import kr.co.vividnext.sodalive.databinding.ActivityCreatorCommunityModifyBinding
|
||||
import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||
import kr.co.vividnext.sodalive.extensions.loadUrl
|
||||
import org.koin.android.ext.android.inject
|
||||
import java.io.File
|
||||
|
||||
@@ -50,7 +48,7 @@ class CreatorCommunityModifyActivity : BaseActivity<ActivityCreatorCommunityModi
|
||||
val data = result.data
|
||||
|
||||
if (resultCode == RESULT_OK) {
|
||||
val fileUri = data?.data
|
||||
val fileUri = UCrop.getOutput(data!!)
|
||||
|
||||
if (fileUri != null) {
|
||||
handleCroppedImage(fileUri)
|
||||
@@ -58,7 +56,13 @@ class CreatorCommunityModifyActivity : BaseActivity<ActivityCreatorCommunityModi
|
||||
showWrongImageFile()
|
||||
}
|
||||
} else if (resultCode == ImagePicker.RESULT_ERROR) {
|
||||
showImagePickerError(data = data)
|
||||
val cropError = UCrop.getError(data!!)
|
||||
cropError?.printStackTrace()
|
||||
Toast.makeText(
|
||||
this,
|
||||
cropError?.message,
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ class CreatorCommunityWriteActivity : BaseActivity<ActivityCreatorCommunityWrite
|
||||
val data = result.data
|
||||
|
||||
if (resultCode == RESULT_OK) {
|
||||
val fileUri = data?.data
|
||||
val fileUri = UCrop.getOutput(data!!)
|
||||
|
||||
if (fileUri != null) {
|
||||
handleCroppedImage(fileUri)
|
||||
@@ -55,7 +55,13 @@ class CreatorCommunityWriteActivity : BaseActivity<ActivityCreatorCommunityWrite
|
||||
showWrongImageFile()
|
||||
}
|
||||
} else if (resultCode == ImagePicker.RESULT_ERROR) {
|
||||
showImagePickerError(data = data)
|
||||
val cropError = UCrop.getError(data!!)
|
||||
cropError?.printStackTrace()
|
||||
Toast.makeText(
|
||||
this,
|
||||
cropError?.message,
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user