새로운 콘텐츠 전체보기 페이지 추가
This commit is contained in:
parent
46b423e3e6
commit
ecec8be386
|
@ -116,6 +116,7 @@
|
||||||
<activity android:name=".mypage.profile.nickname.NicknameUpdateActivity" />
|
<activity android:name=".mypage.profile.nickname.NicknameUpdateActivity" />
|
||||||
<activity android:name=".mypage.profile.password.ModifyPasswordActivity" />
|
<activity android:name=".mypage.profile.password.ModifyPasswordActivity" />
|
||||||
<activity android:name=".audio_content.curation.AudioContentCurationActivity" />
|
<activity android:name=".audio_content.curation.AudioContentCurationActivity" />
|
||||||
|
<activity android:name=".audio_content.all.AudioContentNewAllActivity" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="com.google.android.gms.oss.licenses.OssLicensesMenuActivity"
|
android:name="com.google.android.gms.oss.licenses.OssLicensesMenuActivity"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package kr.co.vividnext.sodalive.audio_content
|
package kr.co.vividnext.sodalive.audio_content
|
||||||
|
|
||||||
import io.reactivex.rxjava3.core.Single
|
import io.reactivex.rxjava3.core.Single
|
||||||
|
import kr.co.vividnext.sodalive.audio_content.all.GetNewContentAllResponse
|
||||||
import kr.co.vividnext.sodalive.audio_content.comment.GetAudioContentCommentListResponse
|
import kr.co.vividnext.sodalive.audio_content.comment.GetAudioContentCommentListResponse
|
||||||
import kr.co.vividnext.sodalive.audio_content.comment.ModifyCommentRequest
|
import kr.co.vividnext.sodalive.audio_content.comment.ModifyCommentRequest
|
||||||
import kr.co.vividnext.sodalive.audio_content.comment.RegisterAudioContentCommentRequest
|
import kr.co.vividnext.sodalive.audio_content.comment.RegisterAudioContentCommentRequest
|
||||||
|
@ -134,6 +135,14 @@ interface AudioContentApi {
|
||||||
@Header("Authorization") authHeader: String
|
@Header("Authorization") authHeader: String
|
||||||
): Single<ApiResponse<List<GetAudioContentMainItem>>>
|
): Single<ApiResponse<List<GetAudioContentMainItem>>>
|
||||||
|
|
||||||
|
@GET("/audio-content/main/new/all")
|
||||||
|
fun getNewContentAllOfTheme(
|
||||||
|
@Query("theme") theme: String,
|
||||||
|
@Query("page") page: Int,
|
||||||
|
@Query("size") size: Int,
|
||||||
|
@Header("Authorization") authHeader: String
|
||||||
|
): Single<ApiResponse<GetNewContentAllResponse>>
|
||||||
|
|
||||||
@POST("/audio-content/donation")
|
@POST("/audio-content/donation")
|
||||||
fun donation(
|
fun donation(
|
||||||
@Body request: AudioContentDonationRequest,
|
@Body request: AudioContentDonationRequest,
|
||||||
|
@ -154,4 +163,9 @@ interface AudioContentApi {
|
||||||
@Query("sort-type") sort: AudioContentViewModel.Sort,
|
@Query("sort-type") sort: AudioContentViewModel.Sort,
|
||||||
@Header("Authorization") authHeader: String
|
@Header("Authorization") authHeader: String
|
||||||
): Single<ApiResponse<GetCurationContentResponse>>
|
): Single<ApiResponse<GetCurationContentResponse>>
|
||||||
|
|
||||||
|
@GET("/audio-content/main/theme")
|
||||||
|
fun getNewContentThemeList(
|
||||||
|
@Header("Authorization") authHeader: String
|
||||||
|
): Single<ApiResponse<List<String>>>
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,6 +136,20 @@ class AudioContentRepository(
|
||||||
authHeader = token
|
authHeader = token
|
||||||
)
|
)
|
||||||
|
|
||||||
|
fun getNewContentAllOfTheme(
|
||||||
|
theme: String,
|
||||||
|
page: Int,
|
||||||
|
size: Int,
|
||||||
|
token: String
|
||||||
|
) = api.getNewContentAllOfTheme(
|
||||||
|
theme = theme,
|
||||||
|
page = page - 1,
|
||||||
|
size = size,
|
||||||
|
authHeader = token
|
||||||
|
)
|
||||||
|
|
||||||
|
fun getNewContentThemeList(token: String) = api.getNewContentThemeList(authHeader = token)
|
||||||
|
|
||||||
fun donation(
|
fun donation(
|
||||||
contentId: Long,
|
contentId: Long,
|
||||||
can: Int,
|
can: Int,
|
||||||
|
|
|
@ -0,0 +1,194 @@
|
||||||
|
package kr.co.vividnext.sodalive.audio_content.all
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
|
import android.graphics.Rect
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
|
import android.widget.Toast
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import kr.co.vividnext.sodalive.audio_content.detail.AudioContentDetailActivity
|
||||||
|
import kr.co.vividnext.sodalive.audio_content.main.AudioContentMainNewContentThemeAdapter
|
||||||
|
import kr.co.vividnext.sodalive.base.BaseActivity
|
||||||
|
import kr.co.vividnext.sodalive.common.Constants
|
||||||
|
import kr.co.vividnext.sodalive.common.LoadingDialog
|
||||||
|
import kr.co.vividnext.sodalive.databinding.ActivityAudioContentNewAllBinding
|
||||||
|
import kr.co.vividnext.sodalive.explorer.profile.UserProfileActivity
|
||||||
|
import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||||
|
import org.koin.android.ext.android.inject
|
||||||
|
|
||||||
|
class AudioContentNewAllActivity : BaseActivity<ActivityAudioContentNewAllBinding>(
|
||||||
|
ActivityAudioContentNewAllBinding::inflate
|
||||||
|
) {
|
||||||
|
private val viewModel: AudioContentNewAllViewModel by inject()
|
||||||
|
|
||||||
|
private lateinit var loadingDialog: LoadingDialog
|
||||||
|
|
||||||
|
private lateinit var newContentThemeAdapter: AudioContentMainNewContentThemeAdapter
|
||||||
|
private lateinit var newContentAdapter: AudioContentNewAllAdapter
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
bindData()
|
||||||
|
viewModel.getThemeList()
|
||||||
|
viewModel.getNewContentList()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun setupView() {
|
||||||
|
loadingDialog = LoadingDialog(this, layoutInflater)
|
||||||
|
binding.toolbar.tvBack.text = "새로운 콘텐츠"
|
||||||
|
binding.toolbar.tvBack.setOnClickListener { finish() }
|
||||||
|
|
||||||
|
setupNewContentTheme()
|
||||||
|
setupNewContent()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setupNewContentTheme() {
|
||||||
|
newContentThemeAdapter = AudioContentMainNewContentThemeAdapter {
|
||||||
|
newContentAdapter.clear()
|
||||||
|
viewModel.selectTheme(it)
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.rvNewContentTheme.layoutManager = LinearLayoutManager(
|
||||||
|
this,
|
||||||
|
LinearLayoutManager.HORIZONTAL,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
|
||||||
|
binding.rvNewContentTheme.addItemDecoration(object : RecyclerView.ItemDecoration() {
|
||||||
|
override fun getItemOffsets(
|
||||||
|
outRect: Rect,
|
||||||
|
view: View,
|
||||||
|
parent: RecyclerView,
|
||||||
|
state: RecyclerView.State
|
||||||
|
) {
|
||||||
|
super.getItemOffsets(outRect, view, parent, state)
|
||||||
|
|
||||||
|
when (parent.getChildAdapterPosition(view)) {
|
||||||
|
0 -> {
|
||||||
|
outRect.left = 0
|
||||||
|
outRect.right = 4f.dpToPx().toInt()
|
||||||
|
}
|
||||||
|
|
||||||
|
newContentThemeAdapter.itemCount - 1 -> {
|
||||||
|
outRect.left = 4f.dpToPx().toInt()
|
||||||
|
outRect.right = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {
|
||||||
|
outRect.left = 4f.dpToPx().toInt()
|
||||||
|
outRect.right = 4f.dpToPx().toInt()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
binding.rvNewContentTheme.adapter = newContentThemeAdapter
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setupNewContent() {
|
||||||
|
newContentAdapter = AudioContentNewAllAdapter(
|
||||||
|
itemWidth = (screenWidth - 40f.dpToPx().toInt()) / 2,
|
||||||
|
onClickItem = {
|
||||||
|
startActivity(
|
||||||
|
Intent(this, AudioContentDetailActivity::class.java).apply {
|
||||||
|
putExtra(Constants.EXTRA_AUDIO_CONTENT_ID, it)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
onClickCreator = {
|
||||||
|
startActivity(
|
||||||
|
Intent(this, UserProfileActivity::class.java).apply {
|
||||||
|
putExtra(Constants.EXTRA_USER_ID, it)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
binding.rvContent.layoutManager = GridLayoutManager(this, 2)
|
||||||
|
|
||||||
|
binding.rvContent.addItemDecoration(object : RecyclerView.ItemDecoration() {
|
||||||
|
override fun getItemOffsets(
|
||||||
|
outRect: Rect,
|
||||||
|
view: View,
|
||||||
|
parent: RecyclerView,
|
||||||
|
state: RecyclerView.State
|
||||||
|
) {
|
||||||
|
super.getItemOffsets(outRect, view, parent, state)
|
||||||
|
|
||||||
|
val position = parent.getChildAdapterPosition(view)
|
||||||
|
if (position % 2 == 0) {
|
||||||
|
outRect.left = 13.3f.dpToPx().toInt()
|
||||||
|
outRect.right = 6.7f.dpToPx().toInt()
|
||||||
|
} else {
|
||||||
|
outRect.left = 6.7f.dpToPx().toInt()
|
||||||
|
outRect.right = 13.3f.dpToPx().toInt()
|
||||||
|
}
|
||||||
|
|
||||||
|
when (position) {
|
||||||
|
0, 1 -> {
|
||||||
|
outRect.top = 13.3f.dpToPx().toInt()
|
||||||
|
outRect.bottom = 6.7f.dpToPx().toInt()
|
||||||
|
}
|
||||||
|
|
||||||
|
newContentAdapter.itemCount - 1, newContentAdapter.itemCount - 2 -> {
|
||||||
|
outRect.top = 6.7f.dpToPx().toInt()
|
||||||
|
outRect.bottom = 13.3f.dpToPx().toInt()
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {
|
||||||
|
outRect.top = 6.7f.dpToPx().toInt()
|
||||||
|
outRect.bottom = 6.7f.dpToPx().toInt()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
binding.rvContent.addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
||||||
|
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
||||||
|
super.onScrolled(recyclerView, dx, dy)
|
||||||
|
|
||||||
|
val lastVisibleItemPosition = (recyclerView.layoutManager as LinearLayoutManager?)!!
|
||||||
|
.findLastCompletelyVisibleItemPosition()
|
||||||
|
val itemTotalCount = recyclerView.adapter!!.itemCount - 1
|
||||||
|
|
||||||
|
// 스크롤이 끝에 도달했는지 확인
|
||||||
|
if (!recyclerView.canScrollVertically(1) &&
|
||||||
|
lastVisibleItemPosition == itemTotalCount
|
||||||
|
) {
|
||||||
|
viewModel.getNewContentList()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
binding.rvContent.adapter = newContentAdapter
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun bindData() {
|
||||||
|
viewModel.isLoading.observe(this) {
|
||||||
|
if (it) {
|
||||||
|
loadingDialog.show(screenWidth)
|
||||||
|
} else {
|
||||||
|
loadingDialog.dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
viewModel.toastLiveData.observe(this) {
|
||||||
|
it?.let { Toast.makeText(applicationContext, it, Toast.LENGTH_LONG).show() }
|
||||||
|
}
|
||||||
|
|
||||||
|
viewModel.themeListLiveData.observe(this) {
|
||||||
|
newContentThemeAdapter.addItems(it)
|
||||||
|
}
|
||||||
|
|
||||||
|
viewModel.newContentListLiveData.observe(this) {
|
||||||
|
newContentAdapter.addItems(it)
|
||||||
|
}
|
||||||
|
|
||||||
|
viewModel.newContentTotalCountLiveData.observe(this) {
|
||||||
|
binding.tvTotalCount.text = "$it"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,85 @@
|
||||||
|
package kr.co.vividnext.sodalive.audio_content.all
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import coil.load
|
||||||
|
import coil.transform.CircleCropTransformation
|
||||||
|
import coil.transform.RoundedCornersTransformation
|
||||||
|
import kr.co.vividnext.sodalive.R
|
||||||
|
import kr.co.vividnext.sodalive.audio_content.main.GetAudioContentMainItem
|
||||||
|
import kr.co.vividnext.sodalive.databinding.ItemAudioContentNewAllBinding
|
||||||
|
import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||||
|
|
||||||
|
class AudioContentNewAllAdapter(
|
||||||
|
private val itemWidth: Int,
|
||||||
|
private val onClickItem: (Long) -> Unit,
|
||||||
|
private val onClickCreator: (Long) -> Unit,
|
||||||
|
) : RecyclerView.Adapter<AudioContentNewAllAdapter.ViewHolder>() {
|
||||||
|
|
||||||
|
inner class ViewHolder(
|
||||||
|
private val binding: ItemAudioContentNewAllBinding,
|
||||||
|
private val onClickItem: (Long) -> Unit,
|
||||||
|
private val onClickCreator: (Long) -> Unit
|
||||||
|
) : RecyclerView.ViewHolder(binding.root) {
|
||||||
|
fun bind(item: GetAudioContentMainItem) {
|
||||||
|
binding.ivAudioContentCoverImage.load(item.coverImageUrl) {
|
||||||
|
crossfade(true)
|
||||||
|
placeholder(R.drawable.ic_place_holder)
|
||||||
|
transformations(RoundedCornersTransformation(2.7f.dpToPx()))
|
||||||
|
|
||||||
|
val layoutParams = binding.ivAudioContentCoverImage
|
||||||
|
.layoutParams as ConstraintLayout.LayoutParams
|
||||||
|
|
||||||
|
layoutParams.width = itemWidth
|
||||||
|
layoutParams.height = itemWidth
|
||||||
|
binding.ivAudioContentCoverImage.layoutParams = layoutParams
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.ivAudioContentCreator.load(item.creatorProfileImageUrl) {
|
||||||
|
crossfade(true)
|
||||||
|
placeholder(R.drawable.ic_place_holder)
|
||||||
|
transformations(CircleCropTransformation())
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.tvAudioContentTitle.text = item.title
|
||||||
|
binding.tvAudioContentCreatorNickname.text = item.creatorNickname
|
||||||
|
|
||||||
|
binding.ivAudioContentCreator.setOnClickListener { onClickCreator(item.creatorId) }
|
||||||
|
binding.root.setOnClickListener { onClickItem(item.contentId) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private val items = mutableListOf<GetAudioContentMainItem>()
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(
|
||||||
|
parent: ViewGroup,
|
||||||
|
viewType: Int
|
||||||
|
) = ViewHolder(
|
||||||
|
ItemAudioContentNewAllBinding.inflate(
|
||||||
|
LayoutInflater.from(parent.context),
|
||||||
|
parent,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
onClickItem = onClickItem,
|
||||||
|
onClickCreator = onClickCreator
|
||||||
|
)
|
||||||
|
|
||||||
|
override fun getItemCount() = items.size
|
||||||
|
|
||||||
|
override fun onBindViewHolder(holder: AudioContentNewAllAdapter.ViewHolder, position: Int) {
|
||||||
|
holder.bind(items[position])
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
|
fun addItems(items: List<GetAudioContentMainItem>) {
|
||||||
|
this.items.addAll(items)
|
||||||
|
notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun clear() {
|
||||||
|
this.items.clear()
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,127 @@
|
||||||
|
package kr.co.vividnext.sodalive.audio_content.all
|
||||||
|
|
||||||
|
import androidx.lifecycle.LiveData
|
||||||
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import com.orhanobut.logger.Logger
|
||||||
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||||
|
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||||
|
import kr.co.vividnext.sodalive.audio_content.AudioContentRepository
|
||||||
|
import kr.co.vividnext.sodalive.audio_content.main.GetAudioContentMainItem
|
||||||
|
import kr.co.vividnext.sodalive.base.BaseViewModel
|
||||||
|
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
||||||
|
|
||||||
|
class AudioContentNewAllViewModel(
|
||||||
|
private val repository: AudioContentRepository
|
||||||
|
) : BaseViewModel() {
|
||||||
|
private val _toastLiveData = MutableLiveData<String?>()
|
||||||
|
val toastLiveData: LiveData<String?>
|
||||||
|
get() = _toastLiveData
|
||||||
|
|
||||||
|
private var _isLoading = MutableLiveData(false)
|
||||||
|
val isLoading: LiveData<Boolean>
|
||||||
|
get() = _isLoading
|
||||||
|
|
||||||
|
private var _themeListLiveData = MutableLiveData<List<String>>()
|
||||||
|
val themeListLiveData: LiveData<List<String>>
|
||||||
|
get() = _themeListLiveData
|
||||||
|
|
||||||
|
private var _newContentListLiveData = MutableLiveData<List<GetAudioContentMainItem>>()
|
||||||
|
val newContentListLiveData: LiveData<List<GetAudioContentMainItem>>
|
||||||
|
get() = _newContentListLiveData
|
||||||
|
|
||||||
|
private var _newContentTotalCountLiveData = MutableLiveData<Int>()
|
||||||
|
val newContentTotalCountLiveData: LiveData<Int>
|
||||||
|
get() = _newContentTotalCountLiveData
|
||||||
|
|
||||||
|
private var isLast = false
|
||||||
|
private var page = 1
|
||||||
|
private val size = 10
|
||||||
|
private var selectedTheme = ""
|
||||||
|
|
||||||
|
fun getNewContentList() {
|
||||||
|
if (!_isLoading.value!! && !isLast) {
|
||||||
|
_isLoading.value = true
|
||||||
|
|
||||||
|
compositeDisposable.add(
|
||||||
|
repository.getNewContentAllOfTheme(
|
||||||
|
theme = if (selectedTheme == "전체") {
|
||||||
|
""
|
||||||
|
} else {
|
||||||
|
selectedTheme
|
||||||
|
},
|
||||||
|
page = page,
|
||||||
|
size = size,
|
||||||
|
token = "Bearer ${SharedPreferenceManager.token}"
|
||||||
|
)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(
|
||||||
|
{
|
||||||
|
if (it.success && it.data != null) {
|
||||||
|
if (it.data.items.isNotEmpty()) {
|
||||||
|
page += 1
|
||||||
|
_newContentListLiveData.postValue(it.data.items)
|
||||||
|
_newContentTotalCountLiveData.postValue(it.data.totalCount)
|
||||||
|
} else {
|
||||||
|
isLast = true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (it.message != null) {
|
||||||
|
_toastLiveData.postValue(it.message)
|
||||||
|
} else {
|
||||||
|
_toastLiveData.postValue(
|
||||||
|
"알 수 없는 오류가 발생했습니다. 다시 시도해 주세요."
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_isLoading.value = false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
_isLoading.value = false
|
||||||
|
it.message?.let { message -> Logger.e(message) }
|
||||||
|
_toastLiveData.postValue("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getThemeList() {
|
||||||
|
compositeDisposable.add(
|
||||||
|
repository.getNewContentThemeList(token = "Bearer ${SharedPreferenceManager.token}")
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(
|
||||||
|
{
|
||||||
|
if (it.success && it.data != null) {
|
||||||
|
val themeList = listOf("전체").union(it.data).toList()
|
||||||
|
_themeListLiveData.postValue(themeList)
|
||||||
|
} else {
|
||||||
|
if (it.message != null) {
|
||||||
|
_toastLiveData.postValue(it.message)
|
||||||
|
} else {
|
||||||
|
_toastLiveData.postValue(
|
||||||
|
"알 수 없는 오류가 발생했습니다. 다시 시도해 주세요."
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_isLoading.value = false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
_isLoading.value = false
|
||||||
|
it.message?.let { message -> Logger.e(message) }
|
||||||
|
_toastLiveData.postValue("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun selectTheme(theme: String) {
|
||||||
|
isLast = false
|
||||||
|
page = 1
|
||||||
|
selectedTheme = theme
|
||||||
|
getNewContentList()
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package kr.co.vividnext.sodalive.audio_content.all
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName
|
||||||
|
import kr.co.vividnext.sodalive.audio_content.main.GetAudioContentMainItem
|
||||||
|
|
||||||
|
data class GetNewContentAllResponse(
|
||||||
|
@SerializedName("totalCount") val totalCount: Int,
|
||||||
|
@SerializedName("items") val items: List<GetAudioContentMainItem>
|
||||||
|
)
|
|
@ -18,6 +18,7 @@ import com.zhpan.indicator.enums.IndicatorSlideMode
|
||||||
import com.zhpan.indicator.enums.IndicatorStyle
|
import com.zhpan.indicator.enums.IndicatorStyle
|
||||||
import kr.co.pointclick.sdk.offerwall.core.PointClickAd
|
import kr.co.pointclick.sdk.offerwall.core.PointClickAd
|
||||||
import kr.co.vividnext.sodalive.R
|
import kr.co.vividnext.sodalive.R
|
||||||
|
import kr.co.vividnext.sodalive.audio_content.all.AudioContentNewAllActivity
|
||||||
import kr.co.vividnext.sodalive.audio_content.curation.AudioContentCurationActivity
|
import kr.co.vividnext.sodalive.audio_content.curation.AudioContentCurationActivity
|
||||||
import kr.co.vividnext.sodalive.audio_content.detail.AudioContentDetailActivity
|
import kr.co.vividnext.sodalive.audio_content.detail.AudioContentDetailActivity
|
||||||
import kr.co.vividnext.sodalive.audio_content.order.AudioContentOrderListActivity
|
import kr.co.vividnext.sodalive.audio_content.order.AudioContentOrderListActivity
|
||||||
|
@ -138,7 +139,7 @@ class AudioContentMainFragment : BaseFragment<FragmentAudioContentMainBinding>(
|
||||||
outRect.right = 10.7f.dpToPx().toInt()
|
outRect.right = 10.7f.dpToPx().toInt()
|
||||||
}
|
}
|
||||||
|
|
||||||
orderListAdapter.itemCount - 1 -> {
|
newContentCreatorAdapter.itemCount - 1 -> {
|
||||||
outRect.left = 10.7f.dpToPx().toInt()
|
outRect.left = 10.7f.dpToPx().toInt()
|
||||||
outRect.right = 0
|
outRect.right = 0
|
||||||
}
|
}
|
||||||
|
@ -302,7 +303,7 @@ class AudioContentMainFragment : BaseFragment<FragmentAudioContentMainBinding>(
|
||||||
outRect.right = 4f.dpToPx().toInt()
|
outRect.right = 4f.dpToPx().toInt()
|
||||||
}
|
}
|
||||||
|
|
||||||
orderListAdapter.itemCount - 1 -> {
|
newContentThemeAdapter.itemCount - 1 -> {
|
||||||
outRect.left = 4f.dpToPx().toInt()
|
outRect.left = 4f.dpToPx().toInt()
|
||||||
outRect.right = 0
|
outRect.right = 0
|
||||||
}
|
}
|
||||||
|
@ -319,6 +320,10 @@ class AudioContentMainFragment : BaseFragment<FragmentAudioContentMainBinding>(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupNewContent() {
|
private fun setupNewContent() {
|
||||||
|
binding.ivNewContentAll.setOnClickListener {
|
||||||
|
startActivity(Intent(requireContext(), AudioContentNewAllActivity::class.java))
|
||||||
|
}
|
||||||
|
|
||||||
newContentAdapter = AudioContentMainContentAdapter(
|
newContentAdapter = AudioContentMainContentAdapter(
|
||||||
onClickItem = {
|
onClickItem = {
|
||||||
startActivity(
|
startActivity(
|
||||||
|
@ -357,7 +362,7 @@ class AudioContentMainFragment : BaseFragment<FragmentAudioContentMainBinding>(
|
||||||
outRect.right = 6.7f.dpToPx().toInt()
|
outRect.right = 6.7f.dpToPx().toInt()
|
||||||
}
|
}
|
||||||
|
|
||||||
orderListAdapter.itemCount - 1 -> {
|
newContentAdapter.itemCount - 1 -> {
|
||||||
outRect.left = 6.7f.dpToPx().toInt()
|
outRect.left = 6.7f.dpToPx().toInt()
|
||||||
outRect.right = 0
|
outRect.right = 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import kr.co.vividnext.sodalive.audio_content.AudioContentApi
|
||||||
import kr.co.vividnext.sodalive.audio_content.AudioContentRepository
|
import kr.co.vividnext.sodalive.audio_content.AudioContentRepository
|
||||||
import kr.co.vividnext.sodalive.audio_content.AudioContentViewModel
|
import kr.co.vividnext.sodalive.audio_content.AudioContentViewModel
|
||||||
import kr.co.vividnext.sodalive.audio_content.PlaybackTrackingRepository
|
import kr.co.vividnext.sodalive.audio_content.PlaybackTrackingRepository
|
||||||
|
import kr.co.vividnext.sodalive.audio_content.all.AudioContentNewAllViewModel
|
||||||
import kr.co.vividnext.sodalive.audio_content.comment.AudioContentCommentListViewModel
|
import kr.co.vividnext.sodalive.audio_content.comment.AudioContentCommentListViewModel
|
||||||
import kr.co.vividnext.sodalive.audio_content.comment.AudioContentCommentReplyViewModel
|
import kr.co.vividnext.sodalive.audio_content.comment.AudioContentCommentReplyViewModel
|
||||||
import kr.co.vividnext.sodalive.audio_content.comment.AudioContentCommentRepository
|
import kr.co.vividnext.sodalive.audio_content.comment.AudioContentCommentRepository
|
||||||
|
@ -193,6 +194,7 @@ class AppDI(private val context: Context, isDebugMode: Boolean) {
|
||||||
viewModel { MemberTagViewModel(get()) }
|
viewModel { MemberTagViewModel(get()) }
|
||||||
viewModel { UserProfileDonationAllViewModel(get()) }
|
viewModel { UserProfileDonationAllViewModel(get()) }
|
||||||
viewModel { AudioContentCurationViewModel(get()) }
|
viewModel { AudioContentCurationViewModel(get()) }
|
||||||
|
viewModel { AudioContentNewAllViewModel(get()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private val repositoryModule = module {
|
private val repositoryModule = module {
|
||||||
|
|
|
@ -0,0 +1,76 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/black"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
layout="@layout/detail_toolbar" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="13.3dp"
|
||||||
|
android:background="@color/color_222222"
|
||||||
|
android:fontFamily="@font/gmarket_sans_medium"
|
||||||
|
android:paddingHorizontal="13.3dp"
|
||||||
|
android:paddingVertical="8dp"
|
||||||
|
android:text="※ 최근 2주간 등록된 새로운 콘텐츠 입니다."
|
||||||
|
android:textSize="14.67sp" />
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/rv_new_content_theme"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="13.3dp"
|
||||||
|
android:clipToPadding="false"
|
||||||
|
android:paddingHorizontal="13.3dp" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginTop="13.3dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingHorizontal="20dp"
|
||||||
|
android:paddingVertical="13.3dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fontFamily="@font/gmarket_sans_medium"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="전체"
|
||||||
|
android:textColor="@color/color_e2e2e2"
|
||||||
|
android:textSize="13.3sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_total_count"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:fontFamily="@font/gmarket_sans_medium"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="0"
|
||||||
|
android:textColor="@color/color_ff5c49"
|
||||||
|
android:textSize="13.3sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="2dp"
|
||||||
|
android:fontFamily="@font/gmarket_sans_medium"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="개"
|
||||||
|
android:textColor="@color/color_e2e2e2"
|
||||||
|
android:textSize="13.3sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/rv_content"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:clipToPadding="false" />
|
||||||
|
</LinearLayout>
|
|
@ -119,15 +119,29 @@
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:visibility="gone">
|
android:visibility="gone">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="13.3dp"
|
||||||
android:fontFamily="@font/gmarket_sans_bold"
|
android:fontFamily="@font/gmarket_sans_bold"
|
||||||
android:paddingHorizontal="13.3dp"
|
|
||||||
android:text="새로운 콘텐츠"
|
android:text="새로운 콘텐츠"
|
||||||
android:textColor="@color/color_eeeeee"
|
android:textColor="@color/color_eeeeee"
|
||||||
android:textSize="18.3sp" />
|
android:textSize="18.3sp" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_new_content_all"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:contentDescription="@null"
|
||||||
|
android:paddingHorizontal="13.3dp"
|
||||||
|
android:src="@drawable/ic_forward" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/rv_new_content_theme"
|
android:id="@+id/rv_new_content_theme"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_audio_content_cover_image"
|
||||||
|
android:layout_width="133.3dp"
|
||||||
|
android:layout_height="133.3dp"
|
||||||
|
android:contentDescription="@null"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_audio_content_title"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:fontFamily="@font/gmarket_sans_medium"
|
||||||
|
android:maxLines="2"
|
||||||
|
android:textColor="@color/color_d2d2d2"
|
||||||
|
android:textSize="13.3sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="@+id/iv_audio_content_cover_image"
|
||||||
|
app:layout_constraintStart_toStartOf="@+id/iv_audio_content_cover_image"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/iv_audio_content_cover_image"
|
||||||
|
tools:text="빛이 나는 사람" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_audio_content_creator"
|
||||||
|
android:layout_width="21.3dp"
|
||||||
|
android:layout_height="21.3dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:contentDescription="@null"
|
||||||
|
app:layout_constraintStart_toStartOf="@+id/iv_audio_content_cover_image"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/tv_audio_content_title"
|
||||||
|
tools:src="@mipmap/ic_launcher" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_audio_content_creator_nickname"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginStart="5.3dp"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:textColor="@color/color_777777"
|
||||||
|
android:textSize="12sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/iv_audio_content_creator"
|
||||||
|
app:layout_constraintEnd_toEndOf="@+id/iv_audio_content_cover_image"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/iv_audio_content_creator"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/iv_audio_content_creator"
|
||||||
|
tools:ignore="SmallSp"
|
||||||
|
tools:text="pgwkil" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
Reference in New Issue