Compare commits
78 Commits
ad7a5b36f1
...
v1.0.8
| Author | SHA1 | Date | |
|---|---|---|---|
| b68b4eb8da | |||
| d8cc218139 | |||
| 0226a696d4 | |||
| c9eb0f0e01 | |||
| 5c293e79cf | |||
| 5cdb7426c6 | |||
| cc73f471d2 | |||
| dc3240f224 | |||
| 04eda1ffbd | |||
| 39d790c1c3 | |||
| 3e3d0de7ca | |||
| 165b75487b | |||
| 19b351ef2a | |||
| 83575aa1eb | |||
| 26c9a236ec | |||
| da7f72544f | |||
| 444f031f57 | |||
| 3e7d06a2aa | |||
| e6b8e55966 | |||
| fe1a1cc3cb | |||
| 2f17e04e1e | |||
| 41d175a19f | |||
| 8266167c02 | |||
| 2cfc4b97f4 | |||
| fbad5f9d98 | |||
| ac6b0c52d0 | |||
| 413c526a6a | |||
| 622021913d | |||
| 5ed5a86e0d | |||
| 3bf4f273d2 | |||
| 0e6c78a6c0 | |||
| 71cd52d30a | |||
| d35b920470 | |||
| 5a4355044f | |||
| b74d4b18e7 | |||
| a53b76415b | |||
| a286ee760d | |||
| 92b72db25c | |||
| eed7bfa158 | |||
| 549644a224 | |||
| ecec8be386 | |||
| 46b423e3e6 | |||
| 1206977907 | |||
| b38fd26b77 | |||
| 302e7d9a45 | |||
| b7a986c33c | |||
| 6fc474cff4 | |||
| 4bcc1b2680 | |||
| 318bae54a1 | |||
| 959d20fe6f | |||
| 00277117f1 | |||
| 42613dfc76 | |||
| 90df714a44 | |||
| 62fc0e1d59 | |||
| e3679fd1dc | |||
| 9626823f0c | |||
| 9fc795afac | |||
| 6610f13619 | |||
| f9401d91c4 | |||
| 52e6965472 | |||
| 0343c91f1c | |||
| cce1b4f446 | |||
| db1981b5fe | |||
| cae15b7f39 | |||
| 26e43bd548 | |||
| f6cbaffd3b | |||
| 4d4ddb50ac | |||
| 9ed175191b | |||
| 4d5c3acff5 | |||
| d791147886 | |||
| dc028f297d | |||
| e13eb3c404 | |||
| b6359f9b8d | |||
| 5522672195 | |||
| e9370e02be | |||
| 4f54545081 | |||
| 8a4ad41212 | |||
| e371fd2ac2 |
@@ -26,6 +26,7 @@ android {
|
||||
|
||||
lintOptions {
|
||||
checkDependencies true
|
||||
checkReleaseBuilds false
|
||||
}
|
||||
|
||||
dependenciesInfo {
|
||||
@@ -39,8 +40,8 @@ android {
|
||||
applicationId "kr.co.vividnext.sodalive"
|
||||
minSdk 23
|
||||
targetSdk 33
|
||||
versionCode 2
|
||||
versionName "1.0.1"
|
||||
versionCode 9
|
||||
versionName "1.0.8"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
@@ -148,4 +149,7 @@ dependencies {
|
||||
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
|
||||
|
||||
implementation "com.michalsvec:single-row-calednar:1.0.0"
|
||||
|
||||
// PointClick Maven Remote Repo
|
||||
implementation 'kr.co.pointclick.sdk.offerwall:pointclick-sdk-offerwall:1.0.17'
|
||||
}
|
||||
|
||||
7
app/proguard-rules.pro
vendored
@@ -221,3 +221,10 @@
|
||||
-keep class androidx.viewpager2.widget.**{*;}
|
||||
|
||||
-keep class kr.co.bootpay.core.** { *; }
|
||||
|
||||
-keep class kr.co.pointclick.sdk.offerwall.core.consts.** {*;}
|
||||
-keep interface kr.co.pointclick.sdk.offerwall.core.consts.** {*;}
|
||||
-keep class kr.co.pointclick.sdk.offerwall.core.models.** {*;}
|
||||
-keep interface kr.co.pointclick.sdk.offerwall.core.models.** {*;}
|
||||
-keep class kr.co.pointclick.sdk.offerwall.core.PointClickAd {*;}
|
||||
-keep class kr.co.pointclick.sdk.offerwall.core.events.PackageReceiver {*;}
|
||||
|
||||
@@ -28,6 +28,21 @@
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
||||
<uses-permission android:name="com.google.android.gms.permission.AD_ID" />
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission
|
||||
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||
android:maxSdkVersion="32"
|
||||
tools:ignore="ScopedStorage" />
|
||||
|
||||
<queries>
|
||||
<intent>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
</intent>
|
||||
</queries>
|
||||
|
||||
<application
|
||||
android:name=".app.SodaLiveApp"
|
||||
android:allowBackup="true"
|
||||
@@ -106,6 +121,9 @@
|
||||
<activity android:name=".mypage.profile.ProfileUpdateActivity" />
|
||||
<activity android:name=".mypage.profile.nickname.NicknameUpdateActivity" />
|
||||
<activity android:name=".mypage.profile.password.ModifyPasswordActivity" />
|
||||
<activity android:name=".audio_content.curation.AudioContentCurationActivity" />
|
||||
<activity android:name=".audio_content.all.AudioContentNewAllActivity" />
|
||||
<activity android:name=".audio_content.all.AudioContentRankingAllActivity" />
|
||||
|
||||
<activity
|
||||
android:name="com.google.android.gms.oss.licenses.OssLicensesMenuActivity"
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
package kr.co.vividnext.sodalive.audio_content
|
||||
|
||||
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.ModifyCommentRequest
|
||||
import kr.co.vividnext.sodalive.audio_content.comment.RegisterAudioContentCommentRequest
|
||||
import kr.co.vividnext.sodalive.audio_content.curation.GetCurationContentResponse
|
||||
import kr.co.vividnext.sodalive.audio_content.detail.GetAudioContentDetailResponse
|
||||
import kr.co.vividnext.sodalive.audio_content.detail.PutAudioContentLikeRequest
|
||||
import kr.co.vividnext.sodalive.audio_content.detail.PutAudioContentLikeResponse
|
||||
import kr.co.vividnext.sodalive.audio_content.donation.AudioContentDonationRequest
|
||||
import kr.co.vividnext.sodalive.audio_content.main.GetAudioContentMainItem
|
||||
import kr.co.vividnext.sodalive.audio_content.main.GetAudioContentMainResponse
|
||||
import kr.co.vividnext.sodalive.audio_content.main.GetAudioContentRanking
|
||||
import kr.co.vividnext.sodalive.audio_content.order.GetAudioContentOrderListResponse
|
||||
import kr.co.vividnext.sodalive.audio_content.order.OrderRequest
|
||||
import kr.co.vividnext.sodalive.audio_content.upload.theme.GetAudioContentThemeResponse
|
||||
@@ -132,9 +136,44 @@ interface AudioContentApi {
|
||||
@Header("Authorization") authHeader: String
|
||||
): 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")
|
||||
fun donation(
|
||||
@Body request: AudioContentDonationRequest,
|
||||
@Header("Authorization") authHeader: String
|
||||
): Single<ApiResponse<Any>>
|
||||
|
||||
@PUT("/audio-content/comment")
|
||||
fun modifyComment(
|
||||
@Body request: ModifyCommentRequest,
|
||||
@Header("Authorization") authHeader: String
|
||||
): Single<ApiResponse<Any>>
|
||||
|
||||
@GET("/audio-content/curation/{id}")
|
||||
fun getAudioContentListByCurationId(
|
||||
@Path("id") id: Long,
|
||||
@Query("page") page: Int,
|
||||
@Query("size") size: Int,
|
||||
@Query("sort-type") sort: AudioContentViewModel.Sort,
|
||||
@Header("Authorization") authHeader: String
|
||||
): Single<ApiResponse<GetCurationContentResponse>>
|
||||
|
||||
@GET("/audio-content/main/theme")
|
||||
fun getNewContentThemeList(
|
||||
@Header("Authorization") authHeader: String
|
||||
): Single<ApiResponse<List<String>>>
|
||||
|
||||
@GET("/audio-content/ranking")
|
||||
fun getContentRanking(
|
||||
@Query("page") page: Int,
|
||||
@Query("size") size: Int,
|
||||
@Header("Authorization") authHeader: String
|
||||
): Single<ApiResponse<GetAudioContentRanking>>
|
||||
}
|
||||
|
||||
@@ -14,6 +14,20 @@ class AudioContentRepository(
|
||||
private val api: AudioContentApi,
|
||||
private val userApi: UserApi
|
||||
) {
|
||||
fun getAudioContentListByCurationId(
|
||||
curationId: Long,
|
||||
page: Int,
|
||||
size: Int,
|
||||
sort: AudioContentViewModel.Sort = AudioContentViewModel.Sort.NEWEST,
|
||||
token: String
|
||||
) = api.getAudioContentListByCurationId(
|
||||
id = curationId,
|
||||
page = page - 1,
|
||||
size = size,
|
||||
sort = sort,
|
||||
authHeader = token
|
||||
)
|
||||
|
||||
fun getAudioContentList(
|
||||
id: Long,
|
||||
page: Int,
|
||||
@@ -122,6 +136,20 @@ class AudioContentRepository(
|
||||
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(
|
||||
contentId: Long,
|
||||
can: Int,
|
||||
@@ -135,4 +163,14 @@ class AudioContentRepository(
|
||||
),
|
||||
authHeader = token
|
||||
)
|
||||
|
||||
fun getContentRanking(
|
||||
page: Int,
|
||||
size: Int,
|
||||
token: String
|
||||
) = api.getContentRanking(
|
||||
page = page - 1,
|
||||
size = size,
|
||||
authHeader = token
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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,131 @@
|
||||
package kr.co.vividnext.sodalive.audio_content.all
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.graphics.Rect
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.Toast
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import kr.co.vividnext.sodalive.audio_content.detail.AudioContentDetailActivity
|
||||
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.ActivityAudioContentRankingAllBinding
|
||||
import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||
import org.koin.android.ext.android.inject
|
||||
|
||||
class AudioContentRankingAllActivity : BaseActivity<ActivityAudioContentRankingAllBinding>(
|
||||
ActivityAudioContentRankingAllBinding::inflate
|
||||
) {
|
||||
private val viewModel: AudioContentRankingAllViewModel by inject()
|
||||
|
||||
private lateinit var loadingDialog: LoadingDialog
|
||||
private lateinit var adapter: AudioContentRankingAllAdapter
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
bindData()
|
||||
viewModel.getAudioContentRanking()
|
||||
}
|
||||
|
||||
override fun setupView() {
|
||||
loadingDialog = LoadingDialog(this, layoutInflater)
|
||||
binding.toolbar.tvBack.setOnClickListener { finish() }
|
||||
binding.toolbar.tvBack.text = "인기 콘텐츠"
|
||||
|
||||
adapter = AudioContentRankingAllAdapter {
|
||||
val intent = Intent(applicationContext, AudioContentDetailActivity::class.java)
|
||||
.apply {
|
||||
putExtra(Constants.EXTRA_AUDIO_CONTENT_ID, it)
|
||||
}
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
binding.rvContentRanking.layoutManager = LinearLayoutManager(
|
||||
applicationContext,
|
||||
LinearLayoutManager.VERTICAL,
|
||||
false
|
||||
)
|
||||
|
||||
binding.rvContentRanking.addItemDecoration(object : RecyclerView.ItemDecoration() {
|
||||
override fun getItemOffsets(
|
||||
outRect: Rect,
|
||||
view: View,
|
||||
parent: RecyclerView,
|
||||
state: RecyclerView.State
|
||||
) {
|
||||
super.getItemOffsets(outRect, view, parent, state)
|
||||
|
||||
outRect.left = 13.3f.dpToPx().toInt()
|
||||
outRect.right = 13.3f.dpToPx().toInt()
|
||||
|
||||
when (parent.getChildAdapterPosition(view)) {
|
||||
0 -> {
|
||||
outRect.top = 0
|
||||
outRect.bottom = 10f.dpToPx().toInt()
|
||||
}
|
||||
|
||||
adapter.itemCount - 1 -> {
|
||||
outRect.top = 10f.dpToPx().toInt()
|
||||
outRect.bottom = 0
|
||||
}
|
||||
|
||||
else -> {
|
||||
outRect.top = 10f.dpToPx().toInt()
|
||||
outRect.bottom = 10f.dpToPx().toInt()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
binding.rvContentRanking.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.getAudioContentRanking()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
binding.rvContentRanking.adapter = adapter
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
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.dateStringLiveData.observe(this) {
|
||||
binding.tvDate.text = it
|
||||
}
|
||||
|
||||
viewModel.contentRankingItemsLiveData.observe(this) {
|
||||
if (viewModel.page == 0) {
|
||||
adapter.items.clear()
|
||||
}
|
||||
|
||||
adapter.items.addAll(it)
|
||||
adapter.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package kr.co.vividnext.sodalive.audio_content.all
|
||||
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import coil.load
|
||||
import coil.transform.RoundedCornersTransformation
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.audio_content.main.GetAudioContentRankingItem
|
||||
import kr.co.vividnext.sodalive.databinding.ItemAudioContentRankingAllBinding
|
||||
import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||
import kr.co.vividnext.sodalive.extensions.moneyFormat
|
||||
|
||||
class AudioContentRankingAllAdapter(
|
||||
private val onItemClick: (Long) -> Unit
|
||||
) : RecyclerView.Adapter<AudioContentRankingAllAdapter.ViewHolder>() {
|
||||
|
||||
inner class ViewHolder(
|
||||
private val context: Context,
|
||||
private val binding: ItemAudioContentRankingAllBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
fun bind(item: GetAudioContentRankingItem, index: Int) {
|
||||
binding.root.setOnClickListener { onItemClick(item.contentId) }
|
||||
binding.ivCover.load(item.coverImageUrl) {
|
||||
crossfade(true)
|
||||
placeholder(R.drawable.bg_placeholder)
|
||||
transformations(RoundedCornersTransformation(5.3f.dpToPx()))
|
||||
}
|
||||
|
||||
binding.tvTitle.text = item.title
|
||||
binding.tvRank.text = index.plus(1).toString()
|
||||
binding.tvTheme.text = item.themeStr
|
||||
binding.tvDuration.text = item.duration
|
||||
binding.tvNickname.text = item.creatorNickname
|
||||
|
||||
if (item.price < 1) {
|
||||
binding.tvPrice.text = "무료"
|
||||
binding.tvPrice.setTextColor(ContextCompat.getColor(context, R.color.white))
|
||||
binding.tvPrice.setCompoundDrawables(null, null, null, null)
|
||||
binding.tvPrice.setPadding(
|
||||
5.3f.dpToPx().toInt(),
|
||||
2.7f.dpToPx().toInt(),
|
||||
5.3f.dpToPx().toInt(),
|
||||
2.7f.dpToPx().toInt()
|
||||
)
|
||||
binding.tvPrice.setBackgroundResource(R.drawable.bg_round_corner_2_6_cf5c37)
|
||||
} else {
|
||||
binding.tvPrice.text = item.price.moneyFormat()
|
||||
binding.tvPrice.setTextColor(ContextCompat.getColor(context, R.color.color_909090))
|
||||
binding.tvPrice.setCompoundDrawablesWithIntrinsicBounds(
|
||||
R.drawable.ic_can,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
)
|
||||
binding.tvPrice.setPadding(0, 0, 0, 0)
|
||||
binding.tvPrice.setBackgroundResource(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val items = mutableListOf<GetAudioContentRankingItem>()
|
||||
|
||||
override fun onCreateViewHolder(
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
) = ViewHolder(
|
||||
parent.context,
|
||||
ItemAudioContentRankingAllBinding.inflate(
|
||||
LayoutInflater.from(parent.context),
|
||||
parent,
|
||||
false
|
||||
)
|
||||
)
|
||||
|
||||
override fun getItemCount() = items.size
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
holder.bind(items[position], position)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
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.GetAudioContentRankingItem
|
||||
import kr.co.vividnext.sodalive.base.BaseViewModel
|
||||
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
||||
|
||||
class AudioContentRankingAllViewModel(
|
||||
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 _dateStringLiveData = MutableLiveData<String>()
|
||||
val dateStringLiveData: LiveData<String>
|
||||
get() = _dateStringLiveData
|
||||
|
||||
private var _contentRankingItemsLiveData = MutableLiveData<List<GetAudioContentRankingItem>>()
|
||||
val contentRankingItemsLiveData: LiveData<List<GetAudioContentRankingItem>>
|
||||
get() = _contentRankingItemsLiveData
|
||||
|
||||
var page = 1
|
||||
private var pageSize = 10
|
||||
private var isLast = false
|
||||
|
||||
fun getAudioContentRanking() {
|
||||
if (!_isLoading.value!! && !isLast && page <= 5) {
|
||||
_isLoading.value = true
|
||||
compositeDisposable.add(
|
||||
repository.getContentRanking(
|
||||
page = page,
|
||||
size = pageSize,
|
||||
token = "Bearer ${SharedPreferenceManager.token}"
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
{
|
||||
if (it.success && it.data != null) {
|
||||
_isLoading.value = false
|
||||
_dateStringLiveData.value =
|
||||
"${it.data.startDate}~${it.data.endDate}"
|
||||
|
||||
if (it.data.items.isNotEmpty()) {
|
||||
page += 1
|
||||
_contentRankingItemsLiveData.value = it.data.items
|
||||
} else {
|
||||
isLast = true
|
||||
_contentRankingItemsLiveData.value = listOf()
|
||||
}
|
||||
} else {
|
||||
_isLoading.value = false
|
||||
if (it.message != null) {
|
||||
_toastLiveData.postValue(it.message)
|
||||
} else {
|
||||
_toastLiveData.postValue(
|
||||
"알 수 없는 오류가 발생했습니다. 다시 시도해 주세요."
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
it.message?.let { message -> Logger.e(message) }
|
||||
_toastLiveData.postValue("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
)
|
||||
@@ -1,24 +1,31 @@
|
||||
package kr.co.vividnext.sodalive.audio_content.comment
|
||||
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.LinearLayout
|
||||
import androidx.appcompat.widget.PopupMenu
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import coil.load
|
||||
import coil.transform.CircleCropTransformation
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
||||
import kr.co.vividnext.sodalive.databinding.ItemAudioContentCommentBinding
|
||||
import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||
import kr.co.vividnext.sodalive.extensions.moneyFormat
|
||||
|
||||
class AudioContentCommentAdapter(
|
||||
private val creatorId: Long,
|
||||
private val modifyComment: (Long, String) -> Unit,
|
||||
private val onClickDelete: (Long) -> Unit,
|
||||
private val onItemClick: (GetAudioContentCommentListItem) -> Unit
|
||||
) : RecyclerView.Adapter<AudioContentCommentAdapter.ViewHolder>() {
|
||||
|
||||
var items = mutableSetOf<GetAudioContentCommentListItem>()
|
||||
|
||||
inner class ViewHolder(
|
||||
private val context: Context,
|
||||
private val binding: ItemAudioContentCommentBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
|
||||
@@ -82,12 +89,42 @@ class AudioContentCommentAdapter(
|
||||
"답글 쓰기"
|
||||
}
|
||||
|
||||
if (
|
||||
item.writerId == SharedPreferenceManager.userId ||
|
||||
creatorId == SharedPreferenceManager.userId
|
||||
) {
|
||||
binding.etCommentModify.setText(item.comment)
|
||||
binding.ivMenu.visibility = View.VISIBLE
|
||||
binding.ivMenu.setOnClickListener {
|
||||
showOptionMenu(
|
||||
context,
|
||||
binding.ivMenu,
|
||||
commentId = item.id,
|
||||
writerId = item.writerId,
|
||||
creatorId = creatorId,
|
||||
onClickModify = {
|
||||
binding.rlCommentModify.visibility = View.VISIBLE
|
||||
binding.tvComment.visibility = View.GONE
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
binding.tvModify.setOnClickListener {
|
||||
binding.rlCommentModify.visibility = View.GONE
|
||||
binding.tvComment.visibility = View.VISIBLE
|
||||
modifyComment(item.id, binding.etCommentModify.text.toString())
|
||||
}
|
||||
} else {
|
||||
binding.ivMenu.visibility = View.GONE
|
||||
}
|
||||
|
||||
binding.tvWriteReply.setOnClickListener { onItemClick(item) }
|
||||
binding.root.setOnClickListener { onItemClick(item) }
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ViewHolder(
|
||||
parent.context,
|
||||
ItemAudioContentCommentBinding.inflate(
|
||||
LayoutInflater.from(parent.context),
|
||||
parent,
|
||||
@@ -100,4 +137,38 @@ class AudioContentCommentAdapter(
|
||||
}
|
||||
|
||||
override fun getItemCount() = items.size
|
||||
|
||||
private fun showOptionMenu(
|
||||
context: Context,
|
||||
v: View,
|
||||
commentId: Long,
|
||||
writerId: Long,
|
||||
creatorId: Long,
|
||||
onClickModify: () -> Unit
|
||||
) {
|
||||
val popup = PopupMenu(context, v)
|
||||
val inflater = popup.menuInflater
|
||||
|
||||
if (writerId == SharedPreferenceManager.userId) {
|
||||
inflater.inflate(R.menu.content_comment_option_menu, popup.menu)
|
||||
} else if (creatorId == SharedPreferenceManager.userId) {
|
||||
inflater.inflate(R.menu.content_comment_option_menu2, popup.menu)
|
||||
}
|
||||
|
||||
popup.setOnMenuItemClickListener {
|
||||
when (it.itemId) {
|
||||
R.id.menu_review_modify -> {
|
||||
onClickModify()
|
||||
}
|
||||
|
||||
R.id.menu_review_delete -> {
|
||||
onClickDelete(commentId)
|
||||
}
|
||||
}
|
||||
|
||||
true
|
||||
}
|
||||
|
||||
popup.show()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,10 @@ import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.databinding.DialogAudioContentCommentBinding
|
||||
|
||||
class AudioContentCommentFragment(private val audioContentId: Long) : BottomSheetDialogFragment() {
|
||||
class AudioContentCommentFragment(
|
||||
private val creatorId: Long,
|
||||
private val audioContentId: Long
|
||||
) : BottomSheetDialogFragment() {
|
||||
|
||||
private lateinit var binding: DialogAudioContentCommentBinding
|
||||
|
||||
@@ -46,6 +49,7 @@ class AudioContentCommentFragment(private val audioContentId: Long) : BottomShee
|
||||
|
||||
val commentListFragmentTag = "COMMENT_LIST_FRAGMENT"
|
||||
val commentListFragment = AudioContentCommentListFragment.newInstance(
|
||||
creatorId = creatorId,
|
||||
audioContentId = audioContentId
|
||||
)
|
||||
val fragmentTransaction = childFragmentManager.beginTransaction()
|
||||
@@ -61,6 +65,7 @@ class AudioContentCommentFragment(private val audioContentId: Long) : BottomShee
|
||||
fun onClickComment(comment: GetAudioContentCommentListItem) {
|
||||
val commentReplyFragmentTag = "COMMENT_REPLY_FRAGMENT"
|
||||
val commentReplyFragment = AudioContentCommentReplyFragment.newInstance(
|
||||
creatorId = creatorId,
|
||||
audioContentId = audioContentId,
|
||||
comment = comment
|
||||
)
|
||||
|
||||
@@ -15,6 +15,7 @@ import coil.load
|
||||
import coil.transform.CircleCropTransformation
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.base.BaseFragment
|
||||
import kr.co.vividnext.sodalive.base.SodaDialog
|
||||
import kr.co.vividnext.sodalive.common.Constants
|
||||
import kr.co.vividnext.sodalive.common.LoadingDialog
|
||||
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
||||
@@ -32,6 +33,7 @@ class AudioContentCommentListFragment : BaseFragment<FragmentAudioContentComment
|
||||
private lateinit var loadingDialog: LoadingDialog
|
||||
private lateinit var adapter: AudioContentCommentAdapter
|
||||
|
||||
private var creatorId: Long = 0
|
||||
private var audioContentId: Long = 0
|
||||
|
||||
override fun onCreateView(
|
||||
@@ -39,6 +41,7 @@ class AudioContentCommentListFragment : BaseFragment<FragmentAudioContentComment
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
creatorId = arguments?.getLong(Constants.EXTRA_AUDIO_CONTENT_CREATOR_ID) ?: 0
|
||||
audioContentId = arguments?.getLong(Constants.EXTRA_AUDIO_CONTENT_ID) ?: 0
|
||||
return super.onCreateView(inflater, container, savedInstanceState)
|
||||
}
|
||||
@@ -74,9 +77,38 @@ class AudioContentCommentListFragment : BaseFragment<FragmentAudioContentComment
|
||||
viewModel.registerComment(audioContentId, comment)
|
||||
}
|
||||
|
||||
adapter = AudioContentCommentAdapter {
|
||||
(parentFragment as AudioContentCommentFragment).onClickComment(it)
|
||||
}
|
||||
adapter = AudioContentCommentAdapter(
|
||||
creatorId = creatorId,
|
||||
modifyComment = { commentId, comment ->
|
||||
hideKeyboard()
|
||||
viewModel.modifyComment(
|
||||
commentId = commentId,
|
||||
audioContentId = audioContentId,
|
||||
comment = comment
|
||||
)
|
||||
},
|
||||
onClickDelete = {
|
||||
SodaDialog(
|
||||
activity = requireActivity(),
|
||||
layoutInflater = layoutInflater,
|
||||
title = "댓글 삭제",
|
||||
desc = "삭제하시겠습니까?",
|
||||
confirmButtonTitle = "삭제",
|
||||
confirmButtonClick = {
|
||||
viewModel.modifyComment(
|
||||
commentId = it,
|
||||
audioContentId = audioContentId,
|
||||
isActive = false
|
||||
)
|
||||
},
|
||||
cancelButtonTitle = "취소",
|
||||
cancelButtonClick = {}
|
||||
).show(screenWidth)
|
||||
},
|
||||
onItemClick = {
|
||||
(parentFragment as AudioContentCommentFragment).onClickComment(it)
|
||||
}
|
||||
)
|
||||
|
||||
val recyclerView = binding.rvComment
|
||||
recyclerView.setHasFixedSize(true)
|
||||
@@ -170,8 +202,9 @@ class AudioContentCommentListFragment : BaseFragment<FragmentAudioContentComment
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun newInstance(audioContentId: Long): AudioContentCommentListFragment {
|
||||
fun newInstance(creatorId: Long, audioContentId: Long): AudioContentCommentListFragment {
|
||||
val args = Bundle()
|
||||
args.putLong(Constants.EXTRA_AUDIO_CONTENT_CREATOR_ID, creatorId)
|
||||
args.putLong(Constants.EXTRA_AUDIO_CONTENT_ID, audioContentId)
|
||||
|
||||
val fragment = AudioContentCommentListFragment()
|
||||
|
||||
@@ -48,11 +48,12 @@ class AudioContentCommentListViewModel(
|
||||
if (it.success && it.data != null) {
|
||||
_totalCommentCount.postValue(it.data.totalCount)
|
||||
|
||||
page += 1
|
||||
if (it.data.items.isNotEmpty()) {
|
||||
page += 1
|
||||
_commentList.postValue(it.data.items)
|
||||
} else {
|
||||
isLast = true
|
||||
_commentList.postValue(listOf())
|
||||
}
|
||||
} else {
|
||||
if (it.message != null) {
|
||||
@@ -122,4 +123,61 @@ class AudioContentCommentListViewModel(
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
fun modifyComment(
|
||||
commentId: Long,
|
||||
audioContentId: Long,
|
||||
comment: String? = null,
|
||||
isActive: Boolean? = null
|
||||
) {
|
||||
if (comment == null && isActive == null) {
|
||||
_toastLiveData.postValue("변경사항이 없습니다.")
|
||||
return
|
||||
}
|
||||
|
||||
if (comment != null && comment.isBlank()) {
|
||||
_toastLiveData.postValue("내용을 입력하세요")
|
||||
return
|
||||
}
|
||||
|
||||
_isLoading.value = true
|
||||
|
||||
val request = ModifyCommentRequest(commentId = commentId)
|
||||
|
||||
if (comment != null) {
|
||||
request.comment = comment
|
||||
}
|
||||
|
||||
if (isActive != null) {
|
||||
request.isActive = isActive
|
||||
}
|
||||
|
||||
compositeDisposable.add(
|
||||
repository.modifyComment(
|
||||
request = request,
|
||||
token = "Bearer ${SharedPreferenceManager.token}"
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
{
|
||||
_isLoading.value = false
|
||||
|
||||
if (it.success) {
|
||||
page = 1
|
||||
isLast = false
|
||||
getCommentList(audioContentId)
|
||||
} else {
|
||||
val message = it.message ?: "알 수 없는 오류가 발생했습니다. 다시 시도해 주세요."
|
||||
_toastLiveData.postValue(message)
|
||||
}
|
||||
},
|
||||
{
|
||||
_isLoading.value = false
|
||||
it.message?.let { message -> Logger.e(message) }
|
||||
_toastLiveData.postValue("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,27 @@
|
||||
package kr.co.vividnext.sodalive.audio_content.comment
|
||||
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.LinearLayout
|
||||
import androidx.appcompat.widget.PopupMenu
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.viewbinding.ViewBinding
|
||||
import coil.load
|
||||
import coil.transform.CircleCropTransformation
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
||||
import kr.co.vividnext.sodalive.databinding.ItemAudioContentCommentBinding
|
||||
import kr.co.vividnext.sodalive.databinding.ItemAudioContentCommentReplyBinding
|
||||
import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||
import kr.co.vividnext.sodalive.extensions.moneyFormat
|
||||
|
||||
class AudioContentCommentReplyAdapter :
|
||||
RecyclerView.Adapter<AudioContentCommentReplyViewHolder>() {
|
||||
class AudioContentCommentReplyAdapter(
|
||||
private val creatorId: Long,
|
||||
private val modifyComment: (Long, String) -> Unit,
|
||||
private val onClickDelete: (Long) -> Unit
|
||||
) : RecyclerView.Adapter<AudioContentCommentReplyViewHolder>() {
|
||||
|
||||
var items = mutableSetOf<GetAudioContentCommentListItem>()
|
||||
|
||||
@@ -22,19 +31,25 @@ class AudioContentCommentReplyAdapter :
|
||||
): AudioContentCommentReplyViewHolder {
|
||||
return if (viewType == 0) {
|
||||
AudioContentCommentReplyHeaderViewHolder(
|
||||
ItemAudioContentCommentBinding.inflate(
|
||||
binding = ItemAudioContentCommentBinding.inflate(
|
||||
LayoutInflater.from(parent.context),
|
||||
parent,
|
||||
false
|
||||
)
|
||||
),
|
||||
)
|
||||
} else {
|
||||
AudioContentCommentReplyItemViewHolder(
|
||||
context = parent.context,
|
||||
creatorId = creatorId,
|
||||
ItemAudioContentCommentReplyBinding.inflate(
|
||||
LayoutInflater.from(parent.context),
|
||||
parent,
|
||||
false
|
||||
)
|
||||
),
|
||||
showOptionMenu = { context, view, commentId, writerId, creatorId, onClickModify ->
|
||||
showOptionMenu(context, view, commentId, writerId, creatorId, onClickModify)
|
||||
},
|
||||
modifyComment = modifyComment
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -48,6 +63,40 @@ class AudioContentCommentReplyAdapter :
|
||||
override fun getItemViewType(position: Int): Int {
|
||||
return position
|
||||
}
|
||||
|
||||
private fun showOptionMenu(
|
||||
context: Context,
|
||||
v: View,
|
||||
commentId: Long,
|
||||
writerId: Long,
|
||||
creatorId: Long,
|
||||
onClickModify: () -> Unit
|
||||
) {
|
||||
val popup = PopupMenu(context, v)
|
||||
val inflater = popup.menuInflater
|
||||
|
||||
if (writerId == SharedPreferenceManager.userId) {
|
||||
inflater.inflate(R.menu.content_comment_option_menu, popup.menu)
|
||||
} else if (creatorId == SharedPreferenceManager.userId) {
|
||||
inflater.inflate(R.menu.content_comment_option_menu2, popup.menu)
|
||||
}
|
||||
|
||||
popup.setOnMenuItemClickListener {
|
||||
when (it.itemId) {
|
||||
R.id.menu_review_modify -> {
|
||||
onClickModify()
|
||||
}
|
||||
|
||||
R.id.menu_review_delete -> {
|
||||
onClickDelete(commentId)
|
||||
}
|
||||
}
|
||||
|
||||
true
|
||||
}
|
||||
|
||||
popup.show()
|
||||
}
|
||||
}
|
||||
|
||||
abstract class AudioContentCommentReplyViewHolder(
|
||||
@@ -67,16 +116,66 @@ class AudioContentCommentReplyHeaderViewHolder(
|
||||
transformations(CircleCropTransformation())
|
||||
}
|
||||
|
||||
val tvCommentLayoutParams = binding.tvComment.layoutParams as LinearLayout.LayoutParams
|
||||
val can = item.donationCan
|
||||
if (can > 0) {
|
||||
tvCommentLayoutParams.topMargin = 0
|
||||
binding.llDonationCan.visibility = View.VISIBLE
|
||||
binding.tvDonationCan.text = can.moneyFormat()
|
||||
binding.llDonationCan.setBackgroundResource(
|
||||
when {
|
||||
can >= 100000 -> {
|
||||
R.drawable.bg_round_corner_10_7_973a3a
|
||||
}
|
||||
|
||||
can >= 50000 -> {
|
||||
R.drawable.bg_round_corner_10_7_d85e37
|
||||
}
|
||||
|
||||
can >= 10000 -> {
|
||||
R.drawable.bg_round_corner_10_7_d38c38
|
||||
}
|
||||
|
||||
can >= 5000 -> {
|
||||
R.drawable.bg_round_corner_10_7_59548f
|
||||
}
|
||||
|
||||
can >= 1000 -> {
|
||||
R.drawable.bg_round_corner_10_7_4d6aa4
|
||||
}
|
||||
|
||||
can >= 500 -> {
|
||||
R.drawable.bg_round_corner_10_7_2d7390
|
||||
}
|
||||
|
||||
else -> {
|
||||
R.drawable.bg_round_corner_10_7_548f7d
|
||||
}
|
||||
}
|
||||
)
|
||||
} else {
|
||||
tvCommentLayoutParams.topMargin = 13.3f.dpToPx().toInt()
|
||||
binding.llDonationCan.visibility = View.GONE
|
||||
}
|
||||
binding.tvComment.layoutParams = tvCommentLayoutParams
|
||||
|
||||
binding.tvComment.text = item.comment
|
||||
binding.tvCommentDate.text = item.date
|
||||
binding.tvCommentNickname.text = item.nickname
|
||||
|
||||
binding.tvWriteReply.visibility = View.GONE
|
||||
binding.ivMenu.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
class AudioContentCommentReplyItemViewHolder(
|
||||
private val binding: ItemAudioContentCommentReplyBinding
|
||||
private val context: Context,
|
||||
private val creatorId: Long,
|
||||
private val binding: ItemAudioContentCommentReplyBinding,
|
||||
private val showOptionMenu: (
|
||||
Context, View, Long, Long, Long, onClickModify: () -> Unit
|
||||
) -> Unit,
|
||||
private val modifyComment: (Long, String) -> Unit
|
||||
) : AudioContentCommentReplyViewHolder(binding) {
|
||||
|
||||
override fun bind(item: GetAudioContentCommentListItem) {
|
||||
@@ -89,5 +188,33 @@ class AudioContentCommentReplyItemViewHolder(
|
||||
binding.tvComment.text = item.comment
|
||||
binding.tvCommentDate.text = item.date
|
||||
binding.tvCommentNickname.text = item.nickname
|
||||
|
||||
if (
|
||||
item.writerId == SharedPreferenceManager.userId ||
|
||||
creatorId == SharedPreferenceManager.userId
|
||||
) {
|
||||
binding.etCommentModify.setText(item.comment)
|
||||
binding.ivMenu.visibility = View.VISIBLE
|
||||
binding.ivMenu.setOnClickListener {
|
||||
showOptionMenu(
|
||||
context,
|
||||
binding.ivMenu,
|
||||
item.id,
|
||||
item.writerId,
|
||||
creatorId
|
||||
) {
|
||||
binding.rlCommentModify.visibility = View.VISIBLE
|
||||
binding.tvComment.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
binding.tvModify.setOnClickListener {
|
||||
binding.rlCommentModify.visibility = View.GONE
|
||||
binding.tvComment.visibility = View.VISIBLE
|
||||
modifyComment(item.id, binding.etCommentModify.text.toString())
|
||||
}
|
||||
} else {
|
||||
binding.ivMenu.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import coil.load
|
||||
import coil.transform.CircleCropTransformation
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.base.BaseFragment
|
||||
import kr.co.vividnext.sodalive.base.SodaDialog
|
||||
import kr.co.vividnext.sodalive.common.Constants
|
||||
import kr.co.vividnext.sodalive.common.LoadingDialog
|
||||
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
||||
@@ -34,6 +35,8 @@ class AudioContentCommentReplyFragment : BaseFragment<FragmentAudioContentCommen
|
||||
private lateinit var adapter: AudioContentCommentReplyAdapter
|
||||
|
||||
private var originalComment: GetAudioContentCommentListItem? = null
|
||||
|
||||
private var creatorId: Long = 0
|
||||
private var audioContentId: Long = 0
|
||||
|
||||
override fun onCreateView(
|
||||
@@ -41,6 +44,7 @@ class AudioContentCommentReplyFragment : BaseFragment<FragmentAudioContentCommen
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
creatorId = arguments?.getLong(Constants.EXTRA_AUDIO_CONTENT_CREATOR_ID) ?: 0
|
||||
audioContentId = arguments?.getLong(Constants.EXTRA_AUDIO_CONTENT_ID) ?: 0
|
||||
originalComment = BundleCompat.getParcelable(
|
||||
requireArguments(),
|
||||
@@ -94,7 +98,35 @@ class AudioContentCommentReplyFragment : BaseFragment<FragmentAudioContentCommen
|
||||
viewModel.registerComment(audioContentId, originalComment!!.id, comment)
|
||||
}
|
||||
|
||||
adapter = AudioContentCommentReplyAdapter().apply {
|
||||
adapter = AudioContentCommentReplyAdapter(
|
||||
creatorId = creatorId,
|
||||
modifyComment = { commentId, comment ->
|
||||
hideKeyboard()
|
||||
viewModel.modifyComment(
|
||||
commentId = commentId,
|
||||
parentCommentId = originalComment!!.id,
|
||||
comment = comment
|
||||
)
|
||||
},
|
||||
onClickDelete = {
|
||||
SodaDialog(
|
||||
activity = requireActivity(),
|
||||
layoutInflater = layoutInflater,
|
||||
title = "댓글 삭제",
|
||||
desc = "삭제하시겠습니까?",
|
||||
confirmButtonTitle = "삭제",
|
||||
confirmButtonClick = {
|
||||
viewModel.modifyComment(
|
||||
commentId = it,
|
||||
parentCommentId = originalComment!!.id,
|
||||
isActive = false
|
||||
)
|
||||
},
|
||||
cancelButtonTitle = "취소",
|
||||
cancelButtonClick = {}
|
||||
).show(screenWidth)
|
||||
}
|
||||
).apply {
|
||||
items.add(originalComment!!)
|
||||
}
|
||||
|
||||
@@ -189,11 +221,13 @@ class AudioContentCommentReplyFragment : BaseFragment<FragmentAudioContentCommen
|
||||
|
||||
companion object {
|
||||
fun newInstance(
|
||||
creatorId: Long,
|
||||
audioContentId: Long,
|
||||
comment: GetAudioContentCommentListItem
|
||||
): AudioContentCommentReplyFragment {
|
||||
val args = Bundle()
|
||||
args.putLong(Constants.EXTRA_AUDIO_CONTENT_ID, audioContentId)
|
||||
args.putLong(Constants.EXTRA_AUDIO_CONTENT_CREATOR_ID, creatorId)
|
||||
args.putParcelable(Constants.EXTRA_AUDIO_CONTENT_COMMENT, comment)
|
||||
|
||||
val fragment = AudioContentCommentReplyFragment()
|
||||
|
||||
@@ -42,11 +42,12 @@ class AudioContentCommentReplyViewModel(
|
||||
.subscribe(
|
||||
{
|
||||
if (it.success && it.data != null) {
|
||||
page += 1
|
||||
if (it.data.items.isNotEmpty()) {
|
||||
page += 1
|
||||
_commentList.postValue(it.data.items)
|
||||
} else {
|
||||
isLast = true
|
||||
_commentList.postValue(listOf())
|
||||
}
|
||||
} else {
|
||||
if (it.message != null) {
|
||||
@@ -117,4 +118,61 @@ class AudioContentCommentReplyViewModel(
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
fun modifyComment(
|
||||
commentId: Long,
|
||||
parentCommentId: Long,
|
||||
comment: String? = null,
|
||||
isActive: Boolean? = null
|
||||
) {
|
||||
if (comment == null && isActive == null) {
|
||||
_toastLiveData.postValue("변경사항이 없습니다.")
|
||||
return
|
||||
}
|
||||
|
||||
if (comment != null && comment.isBlank()) {
|
||||
_toastLiveData.postValue("내용을 입력하세요")
|
||||
return
|
||||
}
|
||||
|
||||
_isLoading.value = true
|
||||
|
||||
val request = ModifyCommentRequest(commentId = commentId)
|
||||
|
||||
if (comment != null) {
|
||||
request.comment = comment
|
||||
}
|
||||
|
||||
if (isActive != null) {
|
||||
request.isActive = isActive
|
||||
}
|
||||
|
||||
compositeDisposable.add(
|
||||
repository.modifyComment(
|
||||
request = request,
|
||||
token = "Bearer ${SharedPreferenceManager.token}"
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
{
|
||||
_isLoading.value = false
|
||||
|
||||
if (it.success) {
|
||||
page = 1
|
||||
isLast = false
|
||||
getCommentReplyList(parentCommentId)
|
||||
} else {
|
||||
val message = it.message ?: "알 수 없는 오류가 발생했습니다. 다시 시도해 주세요."
|
||||
_toastLiveData.postValue(message)
|
||||
}
|
||||
},
|
||||
{
|
||||
_isLoading.value = false
|
||||
it.message?.let { message -> Logger.e(message) }
|
||||
_toastLiveData.postValue("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,4 +43,9 @@ class AudioContentCommentRepository(private val api: AudioContentApi) {
|
||||
timezone = TimeZone.getDefault().id,
|
||||
authHeader = token
|
||||
)
|
||||
|
||||
fun modifyComment(request: ModifyCommentRequest, token: String) = api.modifyComment(
|
||||
request = request,
|
||||
authHeader = token
|
||||
)
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ data class GetAudioContentCommentListResponse(
|
||||
@Parcelize
|
||||
data class GetAudioContentCommentListItem(
|
||||
@SerializedName("id") val id: Long,
|
||||
@SerializedName("writerId") val writerId: Long,
|
||||
@SerializedName("nickname") val nickname: String,
|
||||
@SerializedName("profileUrl") val profileUrl: String,
|
||||
@SerializedName("comment") val comment: String,
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package kr.co.vividnext.sodalive.audio_content.comment
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
data class ModifyCommentRequest(
|
||||
@SerializedName("commentId") val commentId: Long,
|
||||
@SerializedName("comment") var comment: String? = null,
|
||||
@SerializedName("isActive") var isActive: Boolean? = null
|
||||
)
|
||||
@@ -0,0 +1,211 @@
|
||||
package kr.co.vividnext.sodalive.audio_content.curation
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.graphics.Rect
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.audio_content.AudioContentViewModel
|
||||
import kr.co.vividnext.sodalive.audio_content.all.AudioContentNewAllAdapter
|
||||
import kr.co.vividnext.sodalive.audio_content.detail.AudioContentDetailActivity
|
||||
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.ActivityAudioContentCurationBinding
|
||||
import kr.co.vividnext.sodalive.explorer.profile.UserProfileActivity
|
||||
import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||
import org.koin.android.ext.android.inject
|
||||
|
||||
class AudioContentCurationActivity : BaseActivity<ActivityAudioContentCurationBinding>(
|
||||
ActivityAudioContentCurationBinding::inflate
|
||||
) {
|
||||
|
||||
private val viewModel: AudioContentCurationViewModel by inject()
|
||||
|
||||
private lateinit var loadingDialog: LoadingDialog
|
||||
private lateinit var adapter: AudioContentNewAllAdapter
|
||||
|
||||
private var curationId: Long = 0
|
||||
private lateinit var title: String
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
title = intent.getStringExtra(Constants.EXTRA_AUDIO_CONTENT_CURATION_TITLE) ?: ""
|
||||
curationId = intent.getLongExtra(Constants.EXTRA_AUDIO_CONTENT_CURATION_ID, 0)
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
if (title.isBlank() || curationId <= 0) {
|
||||
Toast.makeText(applicationContext, "잘못된 요청입니다.", Toast.LENGTH_LONG).show()
|
||||
finish()
|
||||
}
|
||||
|
||||
bindData()
|
||||
viewModel.getContentList(curationId = curationId)
|
||||
}
|
||||
|
||||
override fun setupView() {
|
||||
loadingDialog = LoadingDialog(this, layoutInflater)
|
||||
binding.toolbar.tvBack.text = title
|
||||
binding.toolbar.tvBack.setOnClickListener { finish() }
|
||||
|
||||
adapter = 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.rvCuration.layoutManager = GridLayoutManager(this, 2)
|
||||
|
||||
binding.rvCuration.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()
|
||||
}
|
||||
|
||||
adapter.itemCount - 1, adapter.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.rvCuration.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.getContentList(curationId)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
binding.rvCuration.adapter = adapter
|
||||
|
||||
binding.tvSortNewest.setOnClickListener {
|
||||
viewModel.changeSort(AudioContentViewModel.Sort.NEWEST)
|
||||
}
|
||||
|
||||
binding.tvSortPriceLow.setOnClickListener {
|
||||
viewModel.changeSort(AudioContentViewModel.Sort.PRICE_LOW)
|
||||
}
|
||||
|
||||
binding.tvSortPriceHigh.setOnClickListener {
|
||||
viewModel.changeSort(AudioContentViewModel.Sort.PRICE_HIGH)
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
private fun bindData() {
|
||||
viewModel.toastLiveData.observe(this) {
|
||||
it?.let { Toast.makeText(applicationContext, it, Toast.LENGTH_LONG).show() }
|
||||
}
|
||||
|
||||
viewModel.isLoading.observe(this) {
|
||||
if (it) {
|
||||
loadingDialog.show(screenWidth, "")
|
||||
} else {
|
||||
loadingDialog.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.contentListLiveData.observe(this) {
|
||||
if (viewModel.page - 1 == 1) {
|
||||
adapter.clear()
|
||||
binding.rvCuration.scrollToPosition(0)
|
||||
}
|
||||
|
||||
binding.tvTotalCount.text = "${it.totalCount}"
|
||||
adapter.addItems(it.items)
|
||||
}
|
||||
|
||||
viewModel.sort.observe(this) {
|
||||
deselectSort()
|
||||
selectSort(
|
||||
when (it) {
|
||||
AudioContentViewModel.Sort.PRICE_HIGH -> {
|
||||
binding.tvSortPriceHigh
|
||||
}
|
||||
|
||||
AudioContentViewModel.Sort.PRICE_LOW -> {
|
||||
binding.tvSortPriceLow
|
||||
}
|
||||
|
||||
else -> {
|
||||
binding.tvSortNewest
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
viewModel.getContentList(curationId = curationId)
|
||||
}
|
||||
}
|
||||
|
||||
private fun deselectSort() {
|
||||
val color = ContextCompat.getColor(
|
||||
applicationContext,
|
||||
R.color.color_88e2e2e2
|
||||
)
|
||||
|
||||
binding.tvSortNewest.setTextColor(color)
|
||||
binding.tvSortPriceLow.setTextColor(color)
|
||||
binding.tvSortPriceHigh.setTextColor(color)
|
||||
}
|
||||
|
||||
private fun selectSort(view: TextView) {
|
||||
view.setTextColor(
|
||||
ContextCompat.getColor(
|
||||
applicationContext,
|
||||
R.color.color_e2e2e2
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package kr.co.vividnext.sodalive.audio_content.curation
|
||||
|
||||
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.AudioContentViewModel
|
||||
import kr.co.vividnext.sodalive.base.BaseViewModel
|
||||
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
||||
|
||||
class AudioContentCurationViewModel(
|
||||
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 _contentListLiveData = MutableLiveData<GetCurationContentResponse>()
|
||||
val contentListLiveData: LiveData<GetCurationContentResponse>
|
||||
get() = _contentListLiveData
|
||||
|
||||
private val _sort = MutableLiveData(AudioContentViewModel.Sort.NEWEST)
|
||||
val sort: LiveData<AudioContentViewModel.Sort>
|
||||
get() = _sort
|
||||
|
||||
private var isLast = false
|
||||
var page = 1
|
||||
private val size = 10
|
||||
|
||||
fun getContentList(curationId: Long) {
|
||||
if (!_isLoading.value!! && !isLast) {
|
||||
_isLoading.value = true
|
||||
|
||||
compositeDisposable.add(
|
||||
repository.getAudioContentListByCurationId(
|
||||
curationId = curationId,
|
||||
page = page,
|
||||
size = size,
|
||||
sort = _sort.value!!,
|
||||
token = "Bearer ${SharedPreferenceManager.token}"
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
{
|
||||
if (it.success && it.data != null) {
|
||||
if (it.data.items.isNotEmpty()) {
|
||||
page += 1
|
||||
_contentListLiveData.postValue(it.data!!)
|
||||
} 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 changeSort(sort: AudioContentViewModel.Sort) {
|
||||
page = 1
|
||||
isLast = false
|
||||
_sort.postValue(sort)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package kr.co.vividnext.sodalive.audio_content.curation
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import kr.co.vividnext.sodalive.audio_content.main.GetAudioContentMainItem
|
||||
|
||||
data class GetCurationContentResponse(
|
||||
@SerializedName("totalCount") val totalCount: Int,
|
||||
@SerializedName("items") val items: List<GetAudioContentMainItem>
|
||||
)
|
||||
@@ -56,6 +56,8 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
|
||||
private var isAlertPreview = false
|
||||
private val audioContentReceiver = AudioContentReceiver()
|
||||
|
||||
private var creatorId: Long = 0
|
||||
|
||||
private var refresh = false
|
||||
set(value) {
|
||||
field = value
|
||||
@@ -69,7 +71,7 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
|
||||
|
||||
binding.scrollView.scrollTo(0, 0)
|
||||
binding.sbProgress.progress = 0
|
||||
binding.ivPlayOrPause.setImageResource(R.drawable.btn_audio_content_play)
|
||||
binding.ivPlayOrPause.setImageResource(0)
|
||||
binding.tvTotalDuration.text = " / 00:00:00"
|
||||
binding.tvCurrentDuration.text = "00:00:00"
|
||||
binding.rlPreviewAlert.visibility = View.GONE
|
||||
@@ -102,8 +104,8 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
unregisterReceiver(audioContentReceiver)
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
override fun setupView() {
|
||||
@@ -388,6 +390,14 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
|
||||
isAlertPreview = it.creator.creatorId != SharedPreferenceManager.userId &&
|
||||
!it.existOrdered &&
|
||||
it.price > 0
|
||||
|
||||
binding.ivPlayOrPause.setImageResource(
|
||||
if (isAlertPreview) {
|
||||
R.drawable.btn_audio_content_preview_play
|
||||
} else {
|
||||
R.drawable.btn_audio_content_play
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
viewModel.isContentPlayLoopLiveData.observe(this) {
|
||||
@@ -474,7 +484,10 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
|
||||
}
|
||||
|
||||
private fun showCommentBottomSheetDialog() {
|
||||
val dialog = AudioContentCommentFragment(audioContentId = audioContentId)
|
||||
val dialog = AudioContentCommentFragment(
|
||||
creatorId = creatorId,
|
||||
audioContentId = audioContentId
|
||||
)
|
||||
dialog.show(
|
||||
supportFragmentManager,
|
||||
dialog.tag
|
||||
@@ -491,8 +504,14 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
|
||||
binding.llPurchase.visibility = View.VISIBLE
|
||||
binding.tvPrice.text = response.price.toString()
|
||||
|
||||
binding.tvStrPurchaseOrRental.text = if (response.isOnlyRental) {
|
||||
" 대여하기"
|
||||
} else {
|
||||
" 구매하기"
|
||||
}
|
||||
|
||||
binding.llPurchase.setOnClickListener {
|
||||
showOrderDialog(audioContent = response)
|
||||
showOrderDialog(audioContent = response, isOnlyRental = response.isOnlyRental)
|
||||
}
|
||||
} else {
|
||||
binding.llPurchase.visibility = View.GONE
|
||||
@@ -629,6 +648,7 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
|
||||
}
|
||||
|
||||
private fun setupCreatorArea(creator: AudioContentCreator) {
|
||||
this.creatorId = creator.creatorId
|
||||
binding.rlProfile.setOnClickListener {
|
||||
startActivity(
|
||||
Intent(applicationContext, UserProfileActivity::class.java).apply {
|
||||
@@ -670,11 +690,15 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
|
||||
}
|
||||
}
|
||||
|
||||
private fun showOrderDialog(audioContent: GetAudioContentDetailResponse) {
|
||||
private fun showOrderDialog(
|
||||
audioContent: GetAudioContentDetailResponse,
|
||||
isOnlyRental: Boolean = false
|
||||
) {
|
||||
val dialog = AudioContentOrderFragment(
|
||||
price = audioContent.price,
|
||||
onClickKeep = { showOrderConfirmDialog(audioContent, OrderType.KEEP) },
|
||||
onClickRental = { showOrderConfirmDialog(audioContent, OrderType.RENTAL) }
|
||||
isOnlyRental = isOnlyRental,
|
||||
onClickKeep = { showOrderConfirmDialog(audioContent, isOnlyRental, OrderType.KEEP) },
|
||||
onClickRental = { showOrderConfirmDialog(audioContent, isOnlyRental, OrderType.RENTAL) }
|
||||
)
|
||||
|
||||
dialog.show(
|
||||
@@ -685,6 +709,7 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
|
||||
|
||||
private fun showOrderConfirmDialog(
|
||||
audioContent: GetAudioContentDetailResponse,
|
||||
isOnlyRental: Boolean = false,
|
||||
orderType: OrderType
|
||||
) {
|
||||
AudioContentOrderConfirmDialog(
|
||||
@@ -696,6 +721,7 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
|
||||
profileImageUrl = audioContent.creator.profileImageUrl,
|
||||
nickname = audioContent.creator.nickname,
|
||||
duration = audioContent.duration,
|
||||
isOnlyRental = isOnlyRental,
|
||||
orderType = orderType,
|
||||
price = audioContent.price,
|
||||
confirmButtonClick = {
|
||||
@@ -751,7 +777,11 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
|
||||
if (isPlaying != null && isPlaying) {
|
||||
R.drawable.btn_audio_content_pause
|
||||
} else {
|
||||
R.drawable.btn_audio_content_play
|
||||
if (isAlertPreview) {
|
||||
R.drawable.btn_audio_content_preview_play
|
||||
} else {
|
||||
R.drawable.btn_audio_content_play
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -190,7 +190,13 @@ class AudioContentDetailViewModel(
|
||||
{
|
||||
if (it.success && it.data != null) {
|
||||
getAudioContentDetail(audioContentId = contentId)
|
||||
_toastLiveData.postValue("구매가 완료되었습니다.")
|
||||
_toastLiveData.postValue(
|
||||
if (orderType == OrderType.RENTAL) {
|
||||
"대여가 완료되었습니다."
|
||||
} else {
|
||||
"구매가 완료되었습니다."
|
||||
}
|
||||
)
|
||||
} else {
|
||||
if (it.message != null) {
|
||||
_toastLiveData.postValue(it.message)
|
||||
|
||||
@@ -16,6 +16,7 @@ data class GetAudioContentDetailResponse(
|
||||
@SerializedName("duration") val duration: String,
|
||||
@SerializedName("isAdult") val isAdult: Boolean,
|
||||
@SerializedName("isMosaic") val isMosaic: Boolean,
|
||||
@SerializedName("isOnlyRental") val isOnlyRental: Boolean,
|
||||
@SerializedName("existOrdered") val existOrdered: Boolean,
|
||||
@SerializedName("orderType") val orderType: OrderType?,
|
||||
@SerializedName("remainingTime") val remainingTime: String?,
|
||||
|
||||
@@ -14,6 +14,7 @@ import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||
class AudioContentMainCurationAdapter(
|
||||
private val onClickItem: (Long) -> Unit,
|
||||
private val onClickCreator: (Long) -> Unit,
|
||||
private val onClickCurationMore: (Long, String) -> Unit
|
||||
) : RecyclerView.Adapter<AudioContentMainCurationAdapter.ViewHolder>() {
|
||||
|
||||
private val items = mutableListOf<GetAudioContentCurationResponse>()
|
||||
@@ -25,6 +26,7 @@ class AudioContentMainCurationAdapter(
|
||||
fun bind(item: GetAudioContentCurationResponse) {
|
||||
binding.tvTitle.text = item.title
|
||||
binding.tvDesc.text = item.description
|
||||
binding.ivAll.setOnClickListener { onClickCurationMore(item.curationId, item.title) }
|
||||
setAudioContentList(item.audioContents)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package kr.co.vividnext.sodalive.audio_content.main
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Service
|
||||
import android.content.Intent
|
||||
import android.graphics.Rect
|
||||
@@ -10,12 +11,17 @@ import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.Toast
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.zhpan.bannerview.BaseBannerAdapter
|
||||
import com.zhpan.indicator.enums.IndicatorSlideMode
|
||||
import com.zhpan.indicator.enums.IndicatorStyle
|
||||
import kr.co.pointclick.sdk.offerwall.core.PointClickAd
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.audio_content.all.AudioContentNewAllActivity
|
||||
import kr.co.vividnext.sodalive.audio_content.all.AudioContentRankingAllActivity
|
||||
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.order.AudioContentOrderListActivity
|
||||
import kr.co.vividnext.sodalive.audio_content.upload.AudioContentUploadActivity
|
||||
@@ -44,6 +50,7 @@ class AudioContentMainFragment : BaseFragment<FragmentAudioContentMainBinding>(
|
||||
private lateinit var orderListAdapter: AudioContentMainContentAdapter
|
||||
private lateinit var newContentThemeAdapter: AudioContentMainNewContentThemeAdapter
|
||||
private lateinit var newContentAdapter: AudioContentMainContentAdapter
|
||||
private lateinit var contentRankingAdapter: AudioContentMainRankingAdapter
|
||||
private lateinit var curationAdapter: AudioContentMainCurationAdapter
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
@@ -80,12 +87,17 @@ class AudioContentMainFragment : BaseFragment<FragmentAudioContentMainBinding>(
|
||||
setupOrderList()
|
||||
setupNewContentTheme()
|
||||
setupNewContent()
|
||||
setupContentRanking()
|
||||
setupCuration()
|
||||
|
||||
binding.swipeRefreshLayout.setOnRefreshListener {
|
||||
binding.swipeRefreshLayout.isRefreshing = false
|
||||
viewModel.getMain()
|
||||
}
|
||||
|
||||
binding.ivCanFree.setOnClickListener {
|
||||
PointClickAd.showOfferwall(requireActivity(), "무료충전")
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupNewContentCreator() {
|
||||
@@ -116,7 +128,7 @@ class AudioContentMainFragment : BaseFragment<FragmentAudioContentMainBinding>(
|
||||
outRect.right = 10.7f.dpToPx().toInt()
|
||||
}
|
||||
|
||||
orderListAdapter.itemCount - 1 -> {
|
||||
newContentCreatorAdapter.itemCount - 1 -> {
|
||||
outRect.left = 10.7f.dpToPx().toInt()
|
||||
outRect.right = 0
|
||||
}
|
||||
@@ -280,7 +292,7 @@ class AudioContentMainFragment : BaseFragment<FragmentAudioContentMainBinding>(
|
||||
outRect.right = 4f.dpToPx().toInt()
|
||||
}
|
||||
|
||||
orderListAdapter.itemCount - 1 -> {
|
||||
newContentThemeAdapter.itemCount - 1 -> {
|
||||
outRect.left = 4f.dpToPx().toInt()
|
||||
outRect.right = 0
|
||||
}
|
||||
@@ -297,6 +309,10 @@ class AudioContentMainFragment : BaseFragment<FragmentAudioContentMainBinding>(
|
||||
}
|
||||
|
||||
private fun setupNewContent() {
|
||||
binding.ivNewContentAll.setOnClickListener {
|
||||
startActivity(Intent(requireContext(), AudioContentNewAllActivity::class.java))
|
||||
}
|
||||
|
||||
newContentAdapter = AudioContentMainContentAdapter(
|
||||
onClickItem = {
|
||||
startActivity(
|
||||
@@ -335,7 +351,7 @@ class AudioContentMainFragment : BaseFragment<FragmentAudioContentMainBinding>(
|
||||
outRect.right = 6.7f.dpToPx().toInt()
|
||||
}
|
||||
|
||||
orderListAdapter.itemCount - 1 -> {
|
||||
newContentAdapter.itemCount - 1 -> {
|
||||
outRect.left = 6.7f.dpToPx().toInt()
|
||||
outRect.right = 0
|
||||
}
|
||||
@@ -351,6 +367,46 @@ class AudioContentMainFragment : BaseFragment<FragmentAudioContentMainBinding>(
|
||||
binding.rvNewContent.adapter = newContentAdapter
|
||||
}
|
||||
|
||||
private fun setupContentRanking() {
|
||||
binding.ivContentRankingAll.setOnClickListener {
|
||||
startActivity(Intent(requireContext(), AudioContentRankingAllActivity::class.java))
|
||||
}
|
||||
|
||||
contentRankingAdapter = AudioContentMainRankingAdapter(
|
||||
width = (screenWidth * 0.66).toInt()
|
||||
) {
|
||||
startActivity(
|
||||
Intent(requireContext(), AudioContentDetailActivity::class.java).apply {
|
||||
putExtra(Constants.EXTRA_AUDIO_CONTENT_ID, it)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
binding.rvContentRanking.layoutManager = GridLayoutManager(
|
||||
context,
|
||||
3,
|
||||
GridLayoutManager.HORIZONTAL,
|
||||
false
|
||||
)
|
||||
|
||||
binding.rvContentRanking.addItemDecoration(object : RecyclerView.ItemDecoration() {
|
||||
override fun getItemOffsets(
|
||||
outRect: Rect,
|
||||
view: View,
|
||||
parent: RecyclerView,
|
||||
state: RecyclerView.State
|
||||
) {
|
||||
super.getItemOffsets(outRect, view, parent, state)
|
||||
outRect.top = 13.3f.dpToPx().toInt()
|
||||
outRect.bottom = 13.3f.dpToPx().toInt()
|
||||
outRect.left = 13.3f.dpToPx().toInt()
|
||||
outRect.right = 13.3f.dpToPx().toInt()
|
||||
}
|
||||
})
|
||||
|
||||
binding.rvContentRanking.adapter = contentRankingAdapter
|
||||
}
|
||||
|
||||
private fun setupCuration() {
|
||||
curationAdapter = AudioContentMainCurationAdapter(
|
||||
onClickItem = {
|
||||
@@ -366,6 +422,15 @@ class AudioContentMainFragment : BaseFragment<FragmentAudioContentMainBinding>(
|
||||
putExtra(Constants.EXTRA_USER_ID, it)
|
||||
}
|
||||
)
|
||||
},
|
||||
|
||||
onClickCurationMore = { curationId, title ->
|
||||
startActivity(
|
||||
Intent(requireContext(), AudioContentCurationActivity::class.java).apply {
|
||||
putExtra(Constants.EXTRA_AUDIO_CONTENT_CURATION_ID, curationId)
|
||||
putExtra(Constants.EXTRA_AUDIO_CONTENT_CURATION_TITLE, title)
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
@@ -405,6 +470,7 @@ class AudioContentMainFragment : BaseFragment<FragmentAudioContentMainBinding>(
|
||||
binding.rvCuration.adapter = curationAdapter
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun bindData() {
|
||||
viewModel.isLoading.observe(viewLifecycleOwner) {
|
||||
if (it) {
|
||||
@@ -470,5 +536,11 @@ class AudioContentMainFragment : BaseFragment<FragmentAudioContentMainBinding>(
|
||||
View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.contentRankingLiveData.observe(viewLifecycleOwner) {
|
||||
binding.llContentRanking.visibility = View.VISIBLE
|
||||
binding.tvDate.text = "${it.startDate}~${it.endDate}"
|
||||
contentRankingAdapter.addItems(it.items)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package kr.co.vividnext.sodalive.audio_content.main
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import coil.load
|
||||
import coil.transform.RoundedCornersTransformation
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.databinding.ItemAudioContentMainRankingBinding
|
||||
import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||
|
||||
class AudioContentMainRankingAdapter(
|
||||
private val width: Int,
|
||||
private val onClickItem: (Long) -> Unit
|
||||
) : RecyclerView.Adapter<AudioContentMainRankingAdapter.AudioContentMainRankingItemViewHolder>() {
|
||||
|
||||
inner class AudioContentMainRankingItemViewHolder(
|
||||
private val binding: ItemAudioContentMainRankingBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
@SuppressLint("SetTextI18n")
|
||||
fun bind(item: GetAudioContentRankingItem, index: Int) {
|
||||
val lp = binding.root.layoutParams
|
||||
lp.width = width
|
||||
binding.root.layoutParams = lp
|
||||
|
||||
binding.root.setOnClickListener { onClickItem(item.contentId) }
|
||||
binding.tvTitle.text = item.title
|
||||
binding.tvRank.text = "${index + 1}"
|
||||
binding.tvNickname.text = item.creatorNickname
|
||||
|
||||
binding.ivCover.load(item.coverImageUrl) {
|
||||
crossfade(true)
|
||||
placeholder(R.drawable.ic_place_holder)
|
||||
transformations(RoundedCornersTransformation(2.7f.dpToPx()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val items = mutableListOf<GetAudioContentRankingItem>()
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
fun addItems(items: List<GetAudioContentRankingItem>) {
|
||||
this.items.clear()
|
||||
this.items.addAll(items)
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
) = AudioContentMainRankingItemViewHolder(
|
||||
ItemAudioContentMainRankingBinding.inflate(
|
||||
LayoutInflater.from(parent.context),
|
||||
parent,
|
||||
false
|
||||
)
|
||||
)
|
||||
|
||||
override fun getItemCount() = items.size
|
||||
|
||||
override fun onBindViewHolder(holder: AudioContentMainRankingItemViewHolder, position: Int) {
|
||||
holder.bind(items[position], index = position)
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,10 @@ class AudioContentMainViewModel(
|
||||
val curationListLiveData: LiveData<List<GetAudioContentCurationResponse>>
|
||||
get() = _curationListLiveData
|
||||
|
||||
private var _contentRankingLiveData = MutableLiveData<GetAudioContentRanking>()
|
||||
val contentRankingLiveData: LiveData<GetAudioContentRanking>
|
||||
get() = _contentRankingLiveData
|
||||
|
||||
fun getMain() {
|
||||
_isLoading.value = true
|
||||
compositeDisposable.add(
|
||||
@@ -61,6 +65,7 @@ class AudioContentMainViewModel(
|
||||
_orderListLiveData.value = data.orderList
|
||||
_bannerLiveData.value = data.bannerList
|
||||
_curationListLiveData.value = data.curationList
|
||||
_contentRankingLiveData.value = data.contentRanking
|
||||
|
||||
val themeList = listOf("전체").union(data.themeList).toList()
|
||||
_themeListLiveData.value = themeList
|
||||
|
||||
@@ -10,7 +10,8 @@ data class GetAudioContentMainResponse(
|
||||
@SerializedName("orderList") val orderList: List<GetAudioContentMainItem>,
|
||||
@SerializedName("themeList") val themeList: List<String>,
|
||||
@SerializedName("newContentList") val newContentList: List<GetAudioContentMainItem>,
|
||||
@SerializedName("curationList") val curationList: List<GetAudioContentCurationResponse>
|
||||
@SerializedName("curationList") val curationList: List<GetAudioContentCurationResponse>,
|
||||
@SerializedName("contentRanking") val contentRanking: GetAudioContentRanking
|
||||
)
|
||||
|
||||
data class GetNewContentUploadCreator(
|
||||
@@ -23,13 +24,30 @@ data class GetAudioContentMainItem(
|
||||
@SerializedName("contentId") val contentId: Long,
|
||||
@SerializedName("coverImageUrl") val coverImageUrl: String,
|
||||
@SerializedName("title") val title: String,
|
||||
@SerializedName("isAdult") val isAdult: Boolean,
|
||||
@SerializedName("creatorId") val creatorId: Long,
|
||||
@SerializedName("creatorProfileImageUrl") val creatorProfileImageUrl: String,
|
||||
@SerializedName("creatorNickname") val creatorNickname: String
|
||||
)
|
||||
|
||||
data class GetAudioContentRanking(
|
||||
@SerializedName("startDate") val startDate: String,
|
||||
@SerializedName("endDate") val endDate: String,
|
||||
@SerializedName("items") val items: List<GetAudioContentRankingItem>
|
||||
)
|
||||
|
||||
data class GetAudioContentRankingItem(
|
||||
@SerializedName("contentId") val contentId: Long,
|
||||
@SerializedName("title") val title: String,
|
||||
@SerializedName("coverImageUrl") val coverImageUrl: String,
|
||||
@SerializedName("themeStr") val themeStr: String,
|
||||
@SerializedName("price") val price: Int,
|
||||
@SerializedName("duration") val duration: String,
|
||||
@SerializedName("creatorId") val creatorId: Long,
|
||||
@SerializedName("creatorNickname") val creatorNickname: String
|
||||
)
|
||||
|
||||
data class GetAudioContentCurationResponse(
|
||||
@SerializedName("curationId") val curationId: Long,
|
||||
@SerializedName("title") val title: String,
|
||||
@SerializedName("description") val description: String,
|
||||
@SerializedName("contents") val audioContents: List<GetAudioContentMainItem>
|
||||
|
||||
@@ -23,6 +23,7 @@ class AudioContentOrderConfirmDialog(
|
||||
profileImageUrl: String,
|
||||
nickname: String,
|
||||
duration: String,
|
||||
isOnlyRental: Boolean,
|
||||
orderType: OrderType,
|
||||
price: Int,
|
||||
confirmButtonClick: () -> Unit,
|
||||
@@ -57,7 +58,7 @@ class AudioContentOrderConfirmDialog(
|
||||
}
|
||||
|
||||
dialogView.tvDuration.text = duration
|
||||
dialogView.tvPrice.text = if (orderType == OrderType.RENTAL) {
|
||||
dialogView.tvPrice.text = if (orderType == OrderType.RENTAL && !isOnlyRental) {
|
||||
"${ceil(price * 0.6).toInt()}"
|
||||
} else {
|
||||
"$price"
|
||||
|
||||
@@ -10,6 +10,7 @@ import kotlin.math.ceil
|
||||
|
||||
class AudioContentOrderFragment(
|
||||
private val price: Int,
|
||||
private val isOnlyRental: Boolean,
|
||||
private val onClickRental: () -> Unit,
|
||||
private val onClickKeep: () -> Unit
|
||||
) : BottomSheetDialogFragment() {
|
||||
@@ -28,12 +29,18 @@ class AudioContentOrderFragment(
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
binding.tvKeep.text = "$price"
|
||||
binding.tvRental.text = "${ceil(price * 0.6).toInt()}"
|
||||
if (isOnlyRental) {
|
||||
binding.tvRental.text = "$price"
|
||||
binding.rlKeep.visibility = View.GONE
|
||||
} else {
|
||||
binding.tvKeep.text = "$price"
|
||||
binding.tvRental.text = "${ceil(price * 0.6).toInt()}"
|
||||
|
||||
binding.llKeep.setOnClickListener {
|
||||
onClickKeep()
|
||||
dismiss()
|
||||
binding.rlKeep.visibility = View.VISIBLE
|
||||
binding.llKeep.setOnClickListener {
|
||||
onClickKeep()
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
binding.llRental.setOnClickListener {
|
||||
|
||||
@@ -81,6 +81,23 @@ class AudioContentOrderListActivity : BaseActivity<ActivityAudioContentOrderList
|
||||
}
|
||||
})
|
||||
|
||||
binding.rvOrderList.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.getAudioContentOrderList {}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
binding.rvOrderList.adapter = adapter
|
||||
}
|
||||
|
||||
@@ -106,5 +123,9 @@ class AudioContentOrderListActivity : BaseActivity<ActivityAudioContentOrderList
|
||||
adapter.items.addAll(it)
|
||||
adapter.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
viewModel.totalCount.observe(this) {
|
||||
binding.tvTotalCount.text = "$it"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ class AudioContentOrderListAdapter(
|
||||
binding.tvTitle.text = item.title
|
||||
binding.tvTheme.text = item.themeStr
|
||||
binding.tvDuration.text = item.duration
|
||||
binding.tvCreatorNickname.text = item.creatorNickname
|
||||
binding.tvLikeCount.text = item.likeCount.moneyFormat()
|
||||
binding.tvCommentCount.text = item.commentCount.moneyFormat()
|
||||
|
||||
|
||||
@@ -25,53 +25,60 @@ class AudioContentOrderListViewModel(
|
||||
val orderList: LiveData<List<GetAudioContentOrderListItem>>
|
||||
get() = _orderList
|
||||
|
||||
private var _totalCount = MutableLiveData<Int>()
|
||||
val totalCount: LiveData<Int>
|
||||
get() = _totalCount
|
||||
|
||||
private var isLast = false
|
||||
var page = 1
|
||||
private val size = 10
|
||||
|
||||
fun getAudioContentOrderList(onFailure: (() -> Unit)? = null) {
|
||||
_isLoading.value = true
|
||||
compositeDisposable.add(
|
||||
repository.getAudioContentOrderList(
|
||||
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
|
||||
_orderList.postValue(it.data.items)
|
||||
if (_isLoading.value == false) {
|
||||
_isLoading.value = true
|
||||
compositeDisposable.add(
|
||||
repository.getAudioContentOrderList(
|
||||
page = page,
|
||||
size = size,
|
||||
token = "Bearer ${SharedPreferenceManager.token}"
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
{
|
||||
if (it.success && it.data != null) {
|
||||
_totalCount.value = it.data.totalCount
|
||||
if (it.data.items.isNotEmpty()) {
|
||||
page += 1
|
||||
_orderList.postValue(it.data.items)
|
||||
} else {
|
||||
isLast = true
|
||||
}
|
||||
} else {
|
||||
isLast = true
|
||||
}
|
||||
} else {
|
||||
if (it.message != null) {
|
||||
_toastLiveData.postValue(it.message)
|
||||
} else {
|
||||
_toastLiveData.postValue(
|
||||
"알 수 없는 오류가 발생했습니다. 다시 시도해 주세요."
|
||||
)
|
||||
}
|
||||
if (it.message != null) {
|
||||
_toastLiveData.postValue(it.message)
|
||||
} else {
|
||||
_toastLiveData.postValue(
|
||||
"알 수 없는 오류가 발생했습니다. 다시 시도해 주세요."
|
||||
)
|
||||
}
|
||||
|
||||
if (onFailure != null) {
|
||||
onFailure()
|
||||
}
|
||||
}
|
||||
_isLoading.value = false
|
||||
},
|
||||
{
|
||||
_isLoading.value = false
|
||||
it.message?.let { message -> Logger.e(message) }
|
||||
_toastLiveData.postValue("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
|
||||
if (onFailure != null) {
|
||||
onFailure()
|
||||
}
|
||||
}
|
||||
_isLoading.value = false
|
||||
},
|
||||
{
|
||||
_isLoading.value = false
|
||||
it.message?.let { message -> Logger.e(message) }
|
||||
_toastLiveData.postValue("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
|
||||
if (onFailure != null) {
|
||||
onFailure()
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ data class GetAudioContentOrderListResponse(
|
||||
data class GetAudioContentOrderListItem(
|
||||
@SerializedName("contentId") val contentId: Long,
|
||||
@SerializedName("coverImageUrl") val coverImageUrl: String,
|
||||
@SerializedName("creatorNickname") val creatorNickname: String,
|
||||
@SerializedName("title") val title: String,
|
||||
@SerializedName("themeStr") val themeStr: String,
|
||||
@SerializedName("duration") val duration: String?,
|
||||
|
||||
@@ -169,6 +169,8 @@ class AudioContentUploadActivity : BaseActivity<ActivityAudioContentUploadBindin
|
||||
|
||||
binding.llPricePaid.setOnClickListener { viewModel.setPriceFree(false) }
|
||||
binding.llPriceFree.setOnClickListener { viewModel.setPriceFree(true) }
|
||||
binding.llRentalAndKeep.setOnClickListener { viewModel.setIsOnlyRental(false) }
|
||||
binding.llOnlyRental.setOnClickListener { viewModel.setIsOnlyRental(true) }
|
||||
binding.llCommentNo.setOnClickListener { viewModel.setAvailableComment(false) }
|
||||
binding.llCommentYes.setOnClickListener { viewModel.setAvailableComment(true) }
|
||||
|
||||
@@ -258,6 +260,32 @@ class AudioContentUploadActivity : BaseActivity<ActivityAudioContentUploadBindin
|
||||
}
|
||||
)
|
||||
|
||||
compositeDisposable.add(
|
||||
binding.etPreviewStartTime.textChanges().skip(1)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe {
|
||||
if (it.isNotBlank()) {
|
||||
viewModel.previewStartTime = it.toString()
|
||||
} else {
|
||||
viewModel.previewStartTime = null
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
compositeDisposable.add(
|
||||
binding.etPreviewEndTime.textChanges().skip(1)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe {
|
||||
if (it.isNotBlank()) {
|
||||
viewModel.previewEndTime = it.toString()
|
||||
} else {
|
||||
viewModel.previewEndTime = null
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
viewModel.toastLiveData.observe(this) {
|
||||
it?.let { Toast.makeText(applicationContext, it, Toast.LENGTH_LONG).show() }
|
||||
}
|
||||
@@ -272,51 +300,17 @@ class AudioContentUploadActivity : BaseActivity<ActivityAudioContentUploadBindin
|
||||
|
||||
viewModel.isPriceFreeLiveData.observe(this) {
|
||||
if (it) {
|
||||
viewModel.price = 0
|
||||
binding.etSetPrice.setText("0")
|
||||
binding.llSetPrice.visibility = View.GONE
|
||||
|
||||
binding.ivPriceFree.visibility = View.VISIBLE
|
||||
binding.tvPriceFree.setTextColor(
|
||||
ContextCompat.getColor(
|
||||
applicationContext,
|
||||
R.color.color_eeeeee
|
||||
)
|
||||
)
|
||||
binding.llPriceFree.setBackgroundResource(R.drawable.bg_round_corner_6_7_9970ff)
|
||||
|
||||
binding.ivPricePaid.visibility = View.GONE
|
||||
binding.tvPricePaid.setTextColor(
|
||||
ContextCompat.getColor(
|
||||
applicationContext,
|
||||
R.color.color_9970ff
|
||||
)
|
||||
)
|
||||
binding.llPricePaid.setBackgroundResource(
|
||||
R.drawable.bg_round_corner_6_7_1f1734_9970ff
|
||||
)
|
||||
checkPriceFree()
|
||||
} else {
|
||||
binding.llSetPrice.visibility = View.VISIBLE
|
||||
checkPricePaid()
|
||||
}
|
||||
}
|
||||
|
||||
binding.ivPricePaid.visibility = View.VISIBLE
|
||||
binding.tvPricePaid.setTextColor(
|
||||
ContextCompat.getColor(
|
||||
applicationContext,
|
||||
R.color.color_eeeeee
|
||||
)
|
||||
)
|
||||
binding.llPricePaid.setBackgroundResource(R.drawable.bg_round_corner_6_7_9970ff)
|
||||
|
||||
binding.ivPriceFree.visibility = View.GONE
|
||||
binding.tvPriceFree.setTextColor(
|
||||
ContextCompat.getColor(
|
||||
applicationContext,
|
||||
R.color.color_9970ff
|
||||
)
|
||||
)
|
||||
binding.llPriceFree.setBackgroundResource(
|
||||
R.drawable.bg_round_corner_6_7_1f1734_9970ff
|
||||
)
|
||||
viewModel.isOnlyRentalLiveData.observe(this) {
|
||||
if (it) {
|
||||
checkOnlyRental()
|
||||
} else {
|
||||
checkRentalAndKeep()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -414,6 +408,109 @@ class AudioContentUploadActivity : BaseActivity<ActivityAudioContentUploadBindin
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkPriceFree() {
|
||||
viewModel.price = 0
|
||||
binding.etSetPrice.setText("0")
|
||||
binding.llSetPrice.visibility = View.GONE
|
||||
binding.llConfigKeep.visibility = View.GONE
|
||||
binding.tvTitleConfigKeep.visibility = View.GONE
|
||||
|
||||
binding.ivPriceFree.visibility = View.VISIBLE
|
||||
binding.tvPriceFree.setTextColor(
|
||||
ContextCompat.getColor(
|
||||
applicationContext,
|
||||
R.color.color_eeeeee
|
||||
)
|
||||
)
|
||||
binding.llPriceFree.setBackgroundResource(R.drawable.bg_round_corner_6_7_9970ff)
|
||||
|
||||
binding.ivPricePaid.visibility = View.GONE
|
||||
binding.tvPricePaid.setTextColor(
|
||||
ContextCompat.getColor(
|
||||
applicationContext,
|
||||
R.color.color_9970ff
|
||||
)
|
||||
)
|
||||
binding.llPricePaid.setBackgroundResource(
|
||||
R.drawable.bg_round_corner_6_7_1f1734_9970ff
|
||||
)
|
||||
|
||||
binding.llConfigPreviewTime.visibility = View.GONE
|
||||
}
|
||||
|
||||
private fun checkPricePaid() {
|
||||
binding.llSetPrice.visibility = View.VISIBLE
|
||||
binding.llConfigKeep.visibility = View.VISIBLE
|
||||
binding.tvTitleConfigKeep.visibility = View.VISIBLE
|
||||
|
||||
binding.ivPricePaid.visibility = View.VISIBLE
|
||||
binding.tvPricePaid.setTextColor(
|
||||
ContextCompat.getColor(
|
||||
applicationContext,
|
||||
R.color.color_eeeeee
|
||||
)
|
||||
)
|
||||
binding.llPricePaid.setBackgroundResource(R.drawable.bg_round_corner_6_7_9970ff)
|
||||
|
||||
binding.ivPriceFree.visibility = View.GONE
|
||||
binding.tvPriceFree.setTextColor(
|
||||
ContextCompat.getColor(
|
||||
applicationContext,
|
||||
R.color.color_9970ff
|
||||
)
|
||||
)
|
||||
binding.llPriceFree.setBackgroundResource(
|
||||
R.drawable.bg_round_corner_6_7_1f1734_9970ff
|
||||
)
|
||||
binding.llConfigPreviewTime.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
private fun checkRentalAndKeep() {
|
||||
binding.tvPriceTitle.text = "소장 가격"
|
||||
binding.ivRentalAndKeep.visibility = View.VISIBLE
|
||||
binding.tvRentalAndKeep.setTextColor(
|
||||
ContextCompat.getColor(
|
||||
applicationContext,
|
||||
R.color.color_eeeeee
|
||||
)
|
||||
)
|
||||
binding.llRentalAndKeep.setBackgroundResource(R.drawable.bg_round_corner_6_7_9970ff)
|
||||
|
||||
binding.ivOnlyRental.visibility = View.GONE
|
||||
binding.tvOnlyRental.setTextColor(
|
||||
ContextCompat.getColor(
|
||||
applicationContext,
|
||||
R.color.color_9970ff
|
||||
)
|
||||
)
|
||||
binding.llOnlyRental.setBackgroundResource(
|
||||
R.drawable.bg_round_corner_6_7_1f1734_9970ff
|
||||
)
|
||||
}
|
||||
|
||||
private fun checkOnlyRental() {
|
||||
binding.tvPriceTitle.text = "대여 가격"
|
||||
binding.ivOnlyRental.visibility = View.VISIBLE
|
||||
binding.tvOnlyRental.setTextColor(
|
||||
ContextCompat.getColor(
|
||||
applicationContext,
|
||||
R.color.color_eeeeee
|
||||
)
|
||||
)
|
||||
binding.llOnlyRental.setBackgroundResource(R.drawable.bg_round_corner_6_7_9970ff)
|
||||
|
||||
binding.ivRentalAndKeep.visibility = View.GONE
|
||||
binding.tvRentalAndKeep.setTextColor(
|
||||
ContextCompat.getColor(
|
||||
applicationContext,
|
||||
R.color.color_9970ff
|
||||
)
|
||||
)
|
||||
binding.llRentalAndKeep.setBackgroundResource(
|
||||
R.drawable.bg_round_corner_6_7_1f1734_9970ff
|
||||
)
|
||||
}
|
||||
|
||||
private fun getFileName(uri: Uri): String? {
|
||||
val scheme = uri.scheme
|
||||
var fileName: String? = null
|
||||
|
||||
@@ -18,6 +18,8 @@ import okhttp3.RequestBody
|
||||
import okhttp3.RequestBody.Companion.toRequestBody
|
||||
import okio.BufferedSink
|
||||
import java.io.File
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Locale
|
||||
|
||||
class AudioContentUploadViewModel(
|
||||
private val repository: AudioContentRepository
|
||||
@@ -35,6 +37,10 @@ class AudioContentUploadViewModel(
|
||||
val isAdultLiveData: LiveData<Boolean>
|
||||
get() = _isAdultLiveData
|
||||
|
||||
private val _isOnlyRentalLiveData = MutableLiveData(false)
|
||||
val isOnlyRentalLiveData: LiveData<Boolean>
|
||||
get() = _isOnlyRentalLiveData
|
||||
|
||||
private val _isAvailableCommentLiveData = MutableLiveData(true)
|
||||
val isAvailableCommentLiveData: LiveData<Boolean>
|
||||
get() = _isAvailableCommentLiveData
|
||||
@@ -52,6 +58,8 @@ class AudioContentUploadViewModel(
|
||||
var theme: GetAudioContentThemeResponse? = null
|
||||
var coverImageUri: Uri? = null
|
||||
var contentUri: Uri? = null
|
||||
var previewStartTime: String? = null
|
||||
var previewEndTime: String? = null
|
||||
|
||||
fun setAdult(isAdult: Boolean) {
|
||||
_isAdultLiveData.postValue(isAdult)
|
||||
@@ -63,6 +71,14 @@ class AudioContentUploadViewModel(
|
||||
|
||||
fun setPriceFree(isPriceFree: Boolean) {
|
||||
_isPriceFreeLiveData.postValue(isPriceFree)
|
||||
|
||||
if (isPriceFree) {
|
||||
_isOnlyRentalLiveData.postValue(false)
|
||||
}
|
||||
}
|
||||
|
||||
fun setIsOnlyRental(isOnlyRental: Boolean) {
|
||||
_isOnlyRentalLiveData.postValue(isOnlyRental)
|
||||
}
|
||||
|
||||
fun uploadAudioContent(onSuccess: () -> Unit) {
|
||||
@@ -76,7 +92,10 @@ class AudioContentUploadViewModel(
|
||||
price = price,
|
||||
themeId = theme!!.id,
|
||||
isAdult = _isAdultLiveData.value!!,
|
||||
isCommentAvailable = _isAvailableCommentLiveData.value!!
|
||||
isOnlyRental = _isOnlyRentalLiveData.value!!,
|
||||
isCommentAvailable = _isAvailableCommentLiveData.value!!,
|
||||
previewStartTime = previewStartTime,
|
||||
previewEndTime = previewEndTime
|
||||
)
|
||||
|
||||
val requestJson = Gson().toJson(request)
|
||||
@@ -206,6 +225,52 @@ class AudioContentUploadViewModel(
|
||||
return false
|
||||
}
|
||||
|
||||
if (previewStartTime != null && previewEndTime != null) {
|
||||
val startTimeArray = previewStartTime!!.split(":")
|
||||
if (startTimeArray.size != 3) {
|
||||
_toastLiveData.postValue("미리 듣기 시간 형식은 00:30:00 과 같아야 합니다")
|
||||
return false
|
||||
}
|
||||
|
||||
for (time in startTimeArray) {
|
||||
if (time.length != 2) {
|
||||
_toastLiveData.postValue("미리 듣기 시간 형식은 00:30:00 과 같아야 합니다")
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
val endTimeArray = previewEndTime!!.split(":")
|
||||
if (endTimeArray.size != 3) {
|
||||
_toastLiveData.postValue("미리 듣기 시간 형식은 00:30:00 과 같아야 합니다")
|
||||
return false
|
||||
}
|
||||
|
||||
for (time in endTimeArray) {
|
||||
if (time.length != 2) {
|
||||
_toastLiveData.postValue("미리 듣기 시간 형식은 00:30:00 과 같아야 합니다")
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
val timeDifference = timeDifference(previewStartTime!!, previewEndTime!!)
|
||||
|
||||
if (timeDifference < 30000) {
|
||||
_toastLiveData.postValue(
|
||||
"미리 듣기의 최소 시간은 30초 입니다."
|
||||
)
|
||||
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
if (previewStartTime != null || previewEndTime != null) {
|
||||
_toastLiveData.postValue(
|
||||
"미리 듣기 시작 시간과 종료 시간 둘 다 입력을 하거나 둘 다 입력 하지 않아야 합니다."
|
||||
)
|
||||
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
if (contentUri == null) {
|
||||
_toastLiveData.postValue("오디오 콘텐츠를 선택해 주세요.")
|
||||
return false
|
||||
@@ -218,4 +283,28 @@ class AudioContentUploadViewModel(
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
private fun timeDifference(startTime: String, endTime: String): Long {
|
||||
try {
|
||||
// Define a date format for parsing the times
|
||||
val dateFormat = SimpleDateFormat("HH:mm:ss", Locale.KOREAN)
|
||||
|
||||
// Parse the input times into Date objects
|
||||
val date1 = dateFormat.parse(startTime)
|
||||
val date2 = dateFormat.parse(endTime)
|
||||
|
||||
// Check if either date is null
|
||||
if (date1 == null || date2 == null) {
|
||||
return 0
|
||||
}
|
||||
|
||||
// Calculate the absolute time difference in milliseconds
|
||||
|
||||
// Check if the time difference is greater than 30 seconds (30000 milliseconds)
|
||||
return date2.time - date1.time
|
||||
} catch (e: Exception) {
|
||||
// Handle invalid time formats or parsing errors
|
||||
return 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,5 +9,8 @@ data class CreateAudioContentRequest(
|
||||
@SerializedName("price") val price: Int,
|
||||
@SerializedName("themeId") val themeId: Long,
|
||||
@SerializedName("isAdult") val isAdult: Boolean,
|
||||
@SerializedName("isOnlyRental") val isOnlyRental: Boolean,
|
||||
@SerializedName("isCommentAvailable") val isCommentAvailable: Boolean,
|
||||
@SerializedName("previewStartTime") val previewStartTime: String? = null,
|
||||
@SerializedName("previewEndTime") val previewEndTime: String? = null
|
||||
)
|
||||
|
||||
@@ -8,6 +8,7 @@ object Constants {
|
||||
const val PREF_IS_ADULT = "pref_is_adult"
|
||||
const val PREF_NICKNAME = "pref_nickname"
|
||||
const val PREF_USER_ROLE = "pref_user_role"
|
||||
const val PREF_NO_CHAT_ROOM = "pref_no_chat"
|
||||
const val PREF_PUSH_TOKEN = "pref_push_token"
|
||||
const val PREF_PROFILE_IMAGE = "pref_profile_image"
|
||||
const val PREF_IS_CONTENT_PLAY_LOOP = "pref_is_content_play_loop"
|
||||
@@ -46,6 +47,8 @@ object Constants {
|
||||
const val EXTRA_AUDIO_CONTENT_COMMENT = "audio_content_comment"
|
||||
const val EXTRA_AUDIO_CONTENT_LOADING = "audio_content_loading"
|
||||
const val EXTRA_AUDIO_CONTENT_CREATOR_ID = "audio_content_creator_id"
|
||||
const val EXTRA_AUDIO_CONTENT_CURATION_ID = "extra_audio_content_curation_id"
|
||||
const val EXTRA_AUDIO_CONTENT_CURATION_TITLE = "extra_audio_content_curation_title"
|
||||
const val EXTRA_AUDIO_CONTENT_NEXT_ACTION = "audio_content_next_action"
|
||||
const val EXTRA_AUDIO_CONTENT_ALERT_PREVIEW = "audio_content_alert_preview"
|
||||
const val EXTRA_AUDIO_CONTENT_COVER_IMAGE_URL = "audio_content_cover_image_url"
|
||||
|
||||
@@ -3,6 +3,8 @@ package kr.co.vividnext.sodalive.common
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import androidx.preference.PreferenceManager
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import kr.co.vividnext.sodalive.settings.notification.MemberRole
|
||||
|
||||
object SharedPreferenceManager {
|
||||
@@ -122,4 +124,18 @@ object SharedPreferenceManager {
|
||||
set(value) {
|
||||
sharedPreferences[Constants.PREF_IS_VIEWED_ON_BOARDING_TUTORIAL] = value
|
||||
}
|
||||
|
||||
var noChatRoomList: List<Long>
|
||||
get() {
|
||||
val list = sharedPreferences[Constants.PREF_NO_CHAT_ROOM, ""]
|
||||
val gson = Gson()
|
||||
val listType = object : TypeToken<List<Long>>() {}.type
|
||||
val myList = gson.fromJson<List<Long>>(list, listType)
|
||||
return myList ?: emptyList()
|
||||
}
|
||||
set(value) {
|
||||
val gson = Gson()
|
||||
val listJson = gson.toJson(value)
|
||||
sharedPreferences[Constants.PREF_NO_CHAT_ROOM] = listJson
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +7,12 @@ import kr.co.vividnext.sodalive.audio_content.AudioContentApi
|
||||
import kr.co.vividnext.sodalive.audio_content.AudioContentRepository
|
||||
import kr.co.vividnext.sodalive.audio_content.AudioContentViewModel
|
||||
import kr.co.vividnext.sodalive.audio_content.PlaybackTrackingRepository
|
||||
import kr.co.vividnext.sodalive.audio_content.all.AudioContentNewAllViewModel
|
||||
import kr.co.vividnext.sodalive.audio_content.all.AudioContentRankingAllViewModel
|
||||
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.AudioContentCommentRepository
|
||||
import kr.co.vividnext.sodalive.audio_content.curation.AudioContentCurationViewModel
|
||||
import kr.co.vividnext.sodalive.audio_content.detail.AudioContentDetailViewModel
|
||||
import kr.co.vividnext.sodalive.audio_content.main.AudioContentMainViewModel
|
||||
import kr.co.vividnext.sodalive.audio_content.modify.AudioContentModifyViewModel
|
||||
@@ -190,7 +193,10 @@ class AppDI(private val context: Context, isDebugMode: Boolean) {
|
||||
viewModel { ProfileUpdateViewModel(get()) }
|
||||
viewModel { NicknameUpdateViewModel(get()) }
|
||||
viewModel { MemberTagViewModel(get()) }
|
||||
viewModel { UserProfileDonationAllViewModel(get()) }
|
||||
viewModel { UserProfileDonationAllViewModel(get(), get()) }
|
||||
viewModel { AudioContentCurationViewModel(get()) }
|
||||
viewModel { AudioContentNewAllViewModel(get()) }
|
||||
viewModel { AudioContentRankingAllViewModel(get()) }
|
||||
}
|
||||
|
||||
private val repositoryModule = module {
|
||||
|
||||
@@ -27,6 +27,7 @@ class ExplorerAdapter(
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
fun bind(item: GetExplorerSectionResponse) {
|
||||
setTitle(item)
|
||||
setDesc(item)
|
||||
setCreatorList(item)
|
||||
}
|
||||
|
||||
@@ -56,8 +57,20 @@ class ExplorerAdapter(
|
||||
}
|
||||
}
|
||||
|
||||
private fun setDesc(item: GetExplorerSectionResponse) {
|
||||
if (item.desc != null) {
|
||||
binding.llDesc.visibility = View.VISIBLE
|
||||
binding.tvDesc.text = item.desc
|
||||
} else {
|
||||
binding.llDesc.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
private fun setCreatorList(item: GetExplorerSectionResponse) {
|
||||
val adapter = ExplorerSectionAdapter(onClickItem = onClickItem)
|
||||
val adapter = ExplorerSectionAdapter(
|
||||
onClickItem = onClickItem,
|
||||
isVisibleRanking = item.desc != null
|
||||
)
|
||||
|
||||
binding.rvExplorerSection.layoutManager = LinearLayoutManager(
|
||||
context,
|
||||
|
||||
@@ -85,17 +85,17 @@ class ExplorerFragment : BaseFragment<FragmentExplorerBinding>(
|
||||
when (parent.getChildAdapterPosition(view)) {
|
||||
0 -> {
|
||||
outRect.top = 0
|
||||
outRect.bottom = 30f.dpToPx().toInt()
|
||||
outRect.bottom = 15f.dpToPx().toInt()
|
||||
}
|
||||
|
||||
adapter.itemCount - 1 -> {
|
||||
outRect.top = 30f.dpToPx().toInt()
|
||||
outRect.top = 15f.dpToPx().toInt()
|
||||
outRect.bottom = 0
|
||||
}
|
||||
|
||||
else -> {
|
||||
outRect.top = 30f.dpToPx().toInt()
|
||||
outRect.bottom = 30f.dpToPx().toInt()
|
||||
outRect.top = 15f.dpToPx().toInt()
|
||||
outRect.bottom = 15f.dpToPx().toInt()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,14 +56,10 @@ class ExplorerRepository(
|
||||
)
|
||||
|
||||
fun modifyCheers(
|
||||
cheersId: Long,
|
||||
content: String,
|
||||
request: PutModifyCheersRequest,
|
||||
token: String
|
||||
) = api.modifyCheers(
|
||||
request = PutModifyCheersRequest(
|
||||
cheersId = cheersId,
|
||||
content = content
|
||||
),
|
||||
request = request,
|
||||
authHeader = token
|
||||
)
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package kr.co.vividnext.sodalive.explorer
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import coil.load
|
||||
@@ -10,7 +11,8 @@ import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.databinding.ItemExplorerSectionBinding
|
||||
|
||||
class ExplorerSectionAdapter(
|
||||
private val onClickItem: (Long) -> Unit
|
||||
private val onClickItem: (Long) -> Unit,
|
||||
private val isVisibleRanking: Boolean
|
||||
) : RecyclerView.Adapter<ExplorerSectionAdapter.ViewHolder>() {
|
||||
|
||||
private val items = mutableListOf<GetExplorerSectionCreatorResponse>()
|
||||
@@ -18,7 +20,8 @@ class ExplorerSectionAdapter(
|
||||
inner class ViewHolder(
|
||||
private val binding: ItemExplorerSectionBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
fun bind(item: GetExplorerSectionCreatorResponse) {
|
||||
fun bind(item: GetExplorerSectionCreatorResponse, index: Int) {
|
||||
binding.root.setOnClickListener { onClickItem(item.id) }
|
||||
binding.tvNickname.text = item.nickname
|
||||
binding.tvTags.text = item.tags
|
||||
|
||||
@@ -28,7 +31,39 @@ class ExplorerSectionAdapter(
|
||||
crossfade(true)
|
||||
}
|
||||
|
||||
binding.root.setOnClickListener { onClickItem(item.id) }
|
||||
if (isVisibleRanking) {
|
||||
when (index) {
|
||||
0 -> {
|
||||
binding.ivBg.setImageResource(R.drawable.bg_circle_ffdc00_ffb600)
|
||||
binding.ivBg.visibility = View.VISIBLE
|
||||
|
||||
binding.ivCrown.setImageResource(R.drawable.ic_crown_1)
|
||||
binding.ivCrown.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
1 -> {
|
||||
binding.ivBg.setImageResource(R.drawable.bg_circle_ffffff_9f9f9f)
|
||||
binding.ivBg.visibility = View.VISIBLE
|
||||
|
||||
binding.ivCrown.setImageResource(R.drawable.ic_crown_2)
|
||||
binding.ivCrown.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
2 -> {
|
||||
binding.ivBg.setImageResource(R.drawable.bg_circle_e6a77a_c67e4a)
|
||||
binding.ivBg.visibility = View.VISIBLE
|
||||
|
||||
binding.ivCrown.setImageResource(R.drawable.ic_crown_3)
|
||||
binding.ivCrown.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
else -> {
|
||||
binding.ivBg.setImageResource(0)
|
||||
binding.ivBg.visibility = View.GONE
|
||||
binding.ivCrown.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +76,7 @@ class ExplorerSectionAdapter(
|
||||
)
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
holder.bind(items[position])
|
||||
holder.bind(items[position], index = position)
|
||||
}
|
||||
|
||||
override fun getItemCount() = items.size
|
||||
|
||||
@@ -10,6 +10,7 @@ data class GetExplorerSectionResponse(
|
||||
@SerializedName("title") val title: String,
|
||||
@SerializedName("coloredTitle") val coloredTitle: String?,
|
||||
@SerializedName("color") val color: String?,
|
||||
@SerializedName("desc") val desc: String?,
|
||||
@SerializedName("creators") val creators: List<GetExplorerSectionCreatorResponse>
|
||||
)
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ data class GetCheersResponse(
|
||||
|
||||
data class GetCheersResponseItem(
|
||||
@SerializedName("cheersId") val cheersId: Long,
|
||||
@SerializedName("memberId") val memberId: Long,
|
||||
@SerializedName("nickname") val nickname: String,
|
||||
@SerializedName("profileUrl") val profileUrl: String,
|
||||
@SerializedName("content") val content: String,
|
||||
|
||||
@@ -28,6 +28,7 @@ import kr.co.vividnext.sodalive.audio_content.AudioContentAdapter
|
||||
import kr.co.vividnext.sodalive.audio_content.detail.AudioContentDetailActivity
|
||||
import kr.co.vividnext.sodalive.audio_content.upload.AudioContentUploadActivity
|
||||
import kr.co.vividnext.sodalive.base.BaseActivity
|
||||
import kr.co.vividnext.sodalive.base.SodaDialog
|
||||
import kr.co.vividnext.sodalive.common.Constants
|
||||
import kr.co.vividnext.sodalive.common.LoadingDialog
|
||||
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
||||
@@ -398,7 +399,34 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
|
||||
)
|
||||
}
|
||||
},
|
||||
onClickReport = { showCheersReportPopup(it) }
|
||||
modifyCheers = { cheersId, content ->
|
||||
hideKeyboard {
|
||||
viewModel.modifyCheers(
|
||||
cheersId = cheersId,
|
||||
creatorId = userId,
|
||||
cheersContent = content,
|
||||
)
|
||||
}
|
||||
},
|
||||
onClickReport = { showCheersReportPopup(it) },
|
||||
onClickDelete = {
|
||||
SodaDialog(
|
||||
activity = this@UserProfileActivity,
|
||||
layoutInflater = layoutInflater,
|
||||
title = "응원글 삭제",
|
||||
desc = "삭제하시겠습니까?",
|
||||
confirmButtonTitle = "삭제",
|
||||
confirmButtonClick = {
|
||||
viewModel.modifyCheers(
|
||||
cheersId = it,
|
||||
creatorId = userId,
|
||||
isActive = false
|
||||
)
|
||||
},
|
||||
cancelButtonTitle = "취소",
|
||||
cancelButtonClick = {}
|
||||
).show(screenWidth)
|
||||
}
|
||||
)
|
||||
|
||||
rvCheers.layoutManager = LinearLayoutManager(
|
||||
|
||||
@@ -15,6 +15,7 @@ import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
import kr.co.vividnext.sodalive.base.BaseViewModel
|
||||
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
||||
import kr.co.vividnext.sodalive.explorer.ExplorerRepository
|
||||
import kr.co.vividnext.sodalive.explorer.profile.cheers.PutModifyCheersRequest
|
||||
import kr.co.vividnext.sodalive.report.ReportRepository
|
||||
import kr.co.vividnext.sodalive.report.ReportRequest
|
||||
import kr.co.vividnext.sodalive.report.ReportType
|
||||
@@ -256,18 +257,37 @@ class UserProfileViewModel(
|
||||
)
|
||||
}
|
||||
|
||||
fun modifyCheers(cheersId: Long, creatorId: Long, cheersContent: String) {
|
||||
if (cheersContent.isBlank()) {
|
||||
fun modifyCheers(
|
||||
cheersId: Long,
|
||||
creatorId: Long,
|
||||
cheersContent: String? = null,
|
||||
isActive: Boolean? = null
|
||||
) {
|
||||
if (cheersContent == null && isActive == null) {
|
||||
_toastLiveData.postValue("변경사항이 없습니다.")
|
||||
return
|
||||
}
|
||||
|
||||
if (cheersContent != null && cheersContent.isBlank()) {
|
||||
_toastLiveData.postValue("내용을 입력하세요")
|
||||
return
|
||||
}
|
||||
|
||||
_isLoading.value = true
|
||||
|
||||
val request = PutModifyCheersRequest(cheersId = cheersId)
|
||||
|
||||
if (cheersContent != null) {
|
||||
request.content = cheersContent
|
||||
}
|
||||
|
||||
if (isActive != null) {
|
||||
request.isActive = isActive
|
||||
}
|
||||
|
||||
compositeDisposable.add(
|
||||
repository.modifyCheers(
|
||||
cheersId = cheersId,
|
||||
content = cheersContent,
|
||||
request = request,
|
||||
token = "Bearer ${SharedPreferenceManager.token}"
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
|
||||
@@ -4,5 +4,6 @@ import com.google.gson.annotations.SerializedName
|
||||
|
||||
data class PutModifyCheersRequest(
|
||||
@SerializedName("cheersId") val cheersId: Long,
|
||||
@SerializedName("content") val content: String
|
||||
@SerializedName("content") var content: String? = null,
|
||||
@SerializedName("isActive") var isActive: Boolean? = null,
|
||||
)
|
||||
|
||||
@@ -17,8 +17,10 @@ import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||
class UserProfileCheersAdapter(
|
||||
private val userId: Long,
|
||||
private val enterReply: (Long, String) -> Unit,
|
||||
private val modifyReply: (Long, String) -> Unit,
|
||||
private val onClickReport: (Long) -> Unit
|
||||
private val modifyReply: (Long, String?) -> Unit,
|
||||
private val modifyCheers: (Long, String) -> Unit,
|
||||
private val onClickReport: (Long) -> Unit,
|
||||
private val onClickDelete: (Long) -> Unit
|
||||
) : RecyclerView.Adapter<UserProfileCheersAdapter.ViewHolder>() {
|
||||
|
||||
val items = mutableListOf<GetCheersResponseItem>()
|
||||
@@ -42,12 +44,33 @@ class UserProfileCheersAdapter(
|
||||
binding.tvNickname.text = cheers.nickname
|
||||
binding.tvDate.text = cheers.date
|
||||
|
||||
binding.ivMenu.setOnClickListener {
|
||||
showOptionMenu(
|
||||
context,
|
||||
binding.ivMenu,
|
||||
cheersId = cheers.cheersId
|
||||
)
|
||||
if (
|
||||
cheers.memberId == SharedPreferenceManager.userId ||
|
||||
userId == SharedPreferenceManager.userId
|
||||
) {
|
||||
binding.etContentModify.setText(cheers.content)
|
||||
binding.ivMenu.visibility = View.VISIBLE
|
||||
binding.ivMenu.setOnClickListener {
|
||||
showOptionMenu(
|
||||
context,
|
||||
binding.ivMenu,
|
||||
cheersId = cheers.cheersId,
|
||||
memberId = cheers.memberId,
|
||||
creatorId = userId,
|
||||
onClickModify = {
|
||||
binding.rlContentModify.visibility = View.VISIBLE
|
||||
binding.tvContent.visibility = View.GONE
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
binding.tvModify.setOnClickListener {
|
||||
binding.rlContentModify.visibility = View.GONE
|
||||
binding.tvContent.visibility = View.VISIBLE
|
||||
modifyCheers(cheers.cheersId, binding.etContentModify.text.toString())
|
||||
}
|
||||
} else {
|
||||
binding.ivMenu.visibility = View.GONE
|
||||
}
|
||||
|
||||
if (cheers.replyList.isNotEmpty()) {
|
||||
@@ -106,16 +129,38 @@ class UserProfileCheersAdapter(
|
||||
|
||||
override fun getItemCount() = items.count()
|
||||
|
||||
private fun showOptionMenu(context: Context, v: View, cheersId: Long) {
|
||||
private fun showOptionMenu(
|
||||
context: Context,
|
||||
v: View,
|
||||
cheersId: Long,
|
||||
memberId: Long,
|
||||
creatorId: Long,
|
||||
onClickModify: () -> Unit
|
||||
) {
|
||||
val popup = PopupMenu(context, v)
|
||||
val inflater = popup.menuInflater
|
||||
inflater.inflate(R.menu.review_option_menu, popup.menu)
|
||||
|
||||
if (memberId == SharedPreferenceManager.userId) {
|
||||
inflater.inflate(R.menu.review_option_menu3, popup.menu)
|
||||
} else if (creatorId == SharedPreferenceManager.userId) {
|
||||
inflater.inflate(R.menu.review_option_menu2, popup.menu)
|
||||
} else {
|
||||
inflater.inflate(R.menu.review_option_menu, popup.menu)
|
||||
}
|
||||
|
||||
popup.setOnMenuItemClickListener {
|
||||
when (it.itemId) {
|
||||
R.id.menu_review_report -> {
|
||||
onClickReport(cheersId)
|
||||
}
|
||||
|
||||
R.id.menu_review_modify -> {
|
||||
onClickModify()
|
||||
}
|
||||
|
||||
R.id.menu_review_delete -> {
|
||||
onClickDelete(cheersId)
|
||||
}
|
||||
}
|
||||
|
||||
true
|
||||
|
||||
@@ -10,6 +10,8 @@ data class GetDonationAllResponse(
|
||||
val accumulatedCansLastWeek: Int,
|
||||
@SerializedName("accumulatedCansThisMonth")
|
||||
val accumulatedCansThisMonth: Int,
|
||||
@SerializedName("isVisibleDonationRank")
|
||||
val isVisibleDonationRank: Boolean,
|
||||
@SerializedName("totalCount")
|
||||
val totalCount: Int,
|
||||
@SerializedName("userDonationRanking")
|
||||
|
||||
@@ -53,9 +53,9 @@ class UserProfileDonationAllAdapter(private val userId: Long) :
|
||||
binding.ivCrown.visibility = View.VISIBLE
|
||||
binding.rlDonationRankingRoot.setBackgroundResource(
|
||||
if (items.size == 1) {
|
||||
R.drawable.bg_round_corner_4_7_2b2635
|
||||
R.drawable.bg_round_corner_4_7_13181b
|
||||
} else {
|
||||
R.drawable.bg_top_round_corner_4_7_2b2635
|
||||
R.drawable.bg_top_round_corner_4_7_13181b
|
||||
}
|
||||
)
|
||||
|
||||
@@ -81,11 +81,11 @@ class UserProfileDonationAllAdapter(private val userId: Long) :
|
||||
|
||||
if (items.size == 2) {
|
||||
binding.rlDonationRankingRoot.setBackgroundResource(
|
||||
R.drawable.bg_bottom_round_corner_4_7_2b2635
|
||||
R.drawable.bg_bottom_round_corner_4_7_13181b
|
||||
)
|
||||
} else {
|
||||
binding.rlDonationRankingRoot.setBackgroundColor(
|
||||
ContextCompat.getColor(context, R.color.color_2b2635)
|
||||
ContextCompat.getColor(context, R.color.color_13181b)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ class UserProfileDonationAllAdapter(private val userId: Long) :
|
||||
binding.ivCrown.setImageResource(R.drawable.ic_crown_3)
|
||||
binding.ivCrown.visibility = View.VISIBLE
|
||||
binding.rlDonationRankingRoot.setBackgroundResource(
|
||||
R.drawable.bg_bottom_round_corner_4_7_2b2635
|
||||
R.drawable.bg_bottom_round_corner_4_7_13181b
|
||||
)
|
||||
|
||||
lp.setMargins(
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.view.View
|
||||
import android.widget.Toast
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.base.BaseActivity
|
||||
import kr.co.vividnext.sodalive.common.Constants
|
||||
import kr.co.vividnext.sodalive.common.LoadingDialog
|
||||
@@ -117,8 +118,13 @@ class UserProfileDonationAllViewActivity : BaseActivity<ActivityUserProfileLiveA
|
||||
|
||||
if (SharedPreferenceManager.userId == userId) {
|
||||
binding.llTotal.visibility = View.VISIBLE
|
||||
binding.llVisibleDonationRanking.visibility = View.VISIBLE
|
||||
binding.ivVisibleDonationRank.setOnClickListener {
|
||||
viewModel.onClickToggleVisibleDonationRank()
|
||||
}
|
||||
} else {
|
||||
binding.llTotal.visibility = View.GONE
|
||||
binding.llVisibleDonationRanking.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,5 +151,15 @@ class UserProfileDonationAllViewActivity : BaseActivity<ActivityUserProfileLiveA
|
||||
adapter.items.addAll(it.userDonationRanking)
|
||||
adapter.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
viewModel.isVisibleDonationRank.observe(this) {
|
||||
binding.ivVisibleDonationRank.setImageResource(
|
||||
if (it) {
|
||||
R.drawable.btn_toggle_on_big
|
||||
} else {
|
||||
R.drawable.btn_toggle_off_big
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,12 @@ import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
import kr.co.vividnext.sodalive.base.BaseViewModel
|
||||
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
||||
import kr.co.vividnext.sodalive.explorer.ExplorerRepository
|
||||
import kr.co.vividnext.sodalive.mypage.profile.ProfileUpdateRequest
|
||||
import kr.co.vividnext.sodalive.user.UserRepository
|
||||
|
||||
class UserProfileDonationAllViewModel(
|
||||
private val repository: ExplorerRepository
|
||||
private val repository: ExplorerRepository,
|
||||
private val memberRepository: UserRepository
|
||||
) : BaseViewModel() {
|
||||
|
||||
private val _toastLiveData = MutableLiveData<String?>()
|
||||
@@ -25,6 +28,10 @@ class UserProfileDonationAllViewModel(
|
||||
val donationLiveData: LiveData<GetDonationAllResponse>
|
||||
get() = _donationLiveData
|
||||
|
||||
private var _isVisibleDonationRank = MutableLiveData<Boolean>()
|
||||
val isVisibleDonationRank: LiveData<Boolean>
|
||||
get() = _isVisibleDonationRank
|
||||
|
||||
private var isLast = false
|
||||
private var page = 1
|
||||
private val size = 10
|
||||
@@ -51,6 +58,7 @@ class UserProfileDonationAllViewModel(
|
||||
} else {
|
||||
isLast = true
|
||||
}
|
||||
_isVisibleDonationRank.postValue(it.data.isVisibleDonationRank)
|
||||
} else {
|
||||
if (it.message != null) {
|
||||
_toastLiveData.postValue(it.message)
|
||||
@@ -78,4 +86,43 @@ class UserProfileDonationAllViewModel(
|
||||
isLast = false
|
||||
getCreatorProfileDonationRanking(userId)
|
||||
}
|
||||
|
||||
fun onClickToggleVisibleDonationRank() {
|
||||
val nowStateVisibleDonationRank = _isVisibleDonationRank.value!!
|
||||
|
||||
_isLoading.value = true
|
||||
compositeDisposable.add(
|
||||
memberRepository.updateProfile(
|
||||
request = ProfileUpdateRequest(
|
||||
email = SharedPreferenceManager.email,
|
||||
isVisibleDonationRank = !nowStateVisibleDonationRank
|
||||
),
|
||||
token = "Bearer ${SharedPreferenceManager.token}"
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
{
|
||||
if (it.success) {
|
||||
_isVisibleDonationRank.postValue(!nowStateVisibleDonationRank)
|
||||
} 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("알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.")
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import android.widget.Toast
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import kr.co.vividnext.sodalive.base.BaseActivity
|
||||
import kr.co.vividnext.sodalive.base.SodaDialog
|
||||
import kr.co.vividnext.sodalive.common.Constants
|
||||
import kr.co.vividnext.sodalive.common.LoadingDialog
|
||||
import kr.co.vividnext.sodalive.databinding.ActivityUserProfileFantalkAllBinding
|
||||
@@ -88,7 +89,34 @@ class UserProfileFantalkAllViewActivity : BaseActivity<ActivityUserProfileFantal
|
||||
)
|
||||
}
|
||||
},
|
||||
onClickReport = { showCheersReportPopup(it) }
|
||||
modifyCheers = { cheersId, content ->
|
||||
hideKeyboard {
|
||||
viewModel.modifyCheers(
|
||||
cheersId = cheersId,
|
||||
creatorId = userId,
|
||||
cheersContent = content,
|
||||
)
|
||||
}
|
||||
},
|
||||
onClickReport = { showCheersReportPopup(it) },
|
||||
onClickDelete = {
|
||||
SodaDialog(
|
||||
activity = this@UserProfileFantalkAllViewActivity,
|
||||
layoutInflater = layoutInflater,
|
||||
title = "응원글 삭제",
|
||||
desc = "삭제하시겠습니까?",
|
||||
confirmButtonTitle = "삭제",
|
||||
confirmButtonClick = {
|
||||
viewModel.modifyCheers(
|
||||
cheersId = it,
|
||||
creatorId = userId,
|
||||
isActive = false
|
||||
)
|
||||
},
|
||||
cancelButtonTitle = "취소",
|
||||
cancelButtonClick = {}
|
||||
).show(screenWidth)
|
||||
}
|
||||
)
|
||||
|
||||
rvCheers.layoutManager = LinearLayoutManager(
|
||||
|
||||
@@ -9,6 +9,7 @@ import kr.co.vividnext.sodalive.base.BaseViewModel
|
||||
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
||||
import kr.co.vividnext.sodalive.explorer.ExplorerRepository
|
||||
import kr.co.vividnext.sodalive.explorer.profile.GetCheersResponse
|
||||
import kr.co.vividnext.sodalive.explorer.profile.cheers.PutModifyCheersRequest
|
||||
import kr.co.vividnext.sodalive.report.ReportRepository
|
||||
import kr.co.vividnext.sodalive.report.ReportRequest
|
||||
import kr.co.vividnext.sodalive.report.ReportType
|
||||
@@ -146,18 +147,37 @@ class UserProfileFantalkAllViewModel(
|
||||
)
|
||||
}
|
||||
|
||||
fun modifyCheers(cheersId: Long, creatorId: Long, cheersContent: String) {
|
||||
if (cheersContent.isBlank()) {
|
||||
fun modifyCheers(
|
||||
cheersId: Long,
|
||||
creatorId: Long,
|
||||
cheersContent: String? = null,
|
||||
isActive: Boolean? = null
|
||||
) {
|
||||
if (cheersContent == null && isActive == null) {
|
||||
_toastLiveData.postValue("변경사항이 없습니다.")
|
||||
return
|
||||
}
|
||||
|
||||
if (cheersContent != null && cheersContent.isBlank()) {
|
||||
_toastLiveData.postValue("내용을 입력하세요")
|
||||
return
|
||||
}
|
||||
|
||||
_isLoading.value = true
|
||||
|
||||
val request = PutModifyCheersRequest(cheersId = cheersId)
|
||||
|
||||
if (cheersContent != null) {
|
||||
request.content = cheersContent
|
||||
}
|
||||
|
||||
if (isActive != null) {
|
||||
request.isActive = isActive
|
||||
}
|
||||
|
||||
compositeDisposable.add(
|
||||
repository.modifyCheers(
|
||||
cheersId = cheersId,
|
||||
content = cheersContent,
|
||||
request = request,
|
||||
token = "Bearer ${SharedPreferenceManager.token}"
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
package kr.co.vividnext.sodalive.live.reservation
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import coil.load
|
||||
import coil.transform.RoundedCornersTransformation
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.load.resource.bitmap.CenterCrop
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
|
||||
import com.bumptech.glide.request.target.CustomTarget
|
||||
import com.bumptech.glide.request.transition.Transition
|
||||
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
||||
import kr.co.vividnext.sodalive.databinding.ItemLiveReservationBinding
|
||||
import kr.co.vividnext.sodalive.databinding.ItemMyLiveReservationBinding
|
||||
@@ -24,6 +29,7 @@ class LiveReservationAdapter(
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
|
||||
return if (viewType == 1) {
|
||||
MyLiveViewHolder(
|
||||
parent.context,
|
||||
ItemMyLiveReservationBinding.inflate(
|
||||
LayoutInflater.from(parent.context),
|
||||
parent,
|
||||
@@ -32,6 +38,7 @@ class LiveReservationAdapter(
|
||||
)
|
||||
} else {
|
||||
ViewHolder(
|
||||
parent.context,
|
||||
ItemLiveReservationBinding.inflate(
|
||||
LayoutInflater.from(parent.context),
|
||||
parent,
|
||||
@@ -70,15 +77,32 @@ class LiveReservationAdapter(
|
||||
}
|
||||
|
||||
inner class ViewHolder(
|
||||
private val context: Context,
|
||||
private val binding: ItemLiveReservationBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
|
||||
fun bind(item: GetRoomListResponse) {
|
||||
binding.ivCover.load(item.coverImageUrl) {
|
||||
crossfade(true)
|
||||
placeholder(R.drawable.ic_place_holder)
|
||||
transformations(RoundedCornersTransformation(4.7f.dpToPx()))
|
||||
}
|
||||
val lp = binding.ivCover.layoutParams
|
||||
lp.width = 80f.dpToPx().toInt()
|
||||
lp.height = 116.7f.dpToPx().toInt()
|
||||
|
||||
Glide
|
||||
.with(context)
|
||||
.asBitmap()
|
||||
.transform(CenterCrop(), RoundedCorners(16f.dpToPx().toInt()))
|
||||
.load(item.coverImageUrl)
|
||||
.into(object : CustomTarget<Bitmap>() {
|
||||
override fun onResourceReady(
|
||||
resource: Bitmap,
|
||||
transition: Transition<in Bitmap>?
|
||||
) {
|
||||
binding.ivCover.setImageBitmap(resource)
|
||||
binding.ivCover.layoutParams = lp
|
||||
}
|
||||
|
||||
override fun onLoadCleared(placeholder: Drawable?) {
|
||||
}
|
||||
})
|
||||
binding.tvDate.text = item.beginDateTime
|
||||
binding.tvNickname.text = item.creatorNickname
|
||||
binding.tvTitle.text = item.title
|
||||
@@ -106,6 +130,7 @@ class LiveReservationAdapter(
|
||||
}
|
||||
|
||||
inner class MyLiveViewHolder(
|
||||
private val context: Context,
|
||||
private val binding: ItemMyLiveReservationBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
fun bind(item: GetRoomListResponse, position: Int) {
|
||||
@@ -114,11 +139,28 @@ class LiveReservationAdapter(
|
||||
} else {
|
||||
View.GONE
|
||||
}
|
||||
binding.ivCover.load(item.coverImageUrl) {
|
||||
crossfade(true)
|
||||
placeholder(R.drawable.ic_place_holder)
|
||||
transformations(RoundedCornersTransformation(4f.dpToPx()))
|
||||
}
|
||||
|
||||
val lp = binding.ivCover.layoutParams
|
||||
lp.width = 80f.dpToPx().toInt()
|
||||
lp.height = 116.7f.dpToPx().toInt()
|
||||
|
||||
Glide
|
||||
.with(context)
|
||||
.asBitmap()
|
||||
.load(item.coverImageUrl)
|
||||
.transform(CenterCrop(), RoundedCorners(16f.dpToPx().toInt()))
|
||||
.into(object : CustomTarget<Bitmap>() {
|
||||
override fun onResourceReady(
|
||||
resource: Bitmap,
|
||||
transition: Transition<in Bitmap>?
|
||||
) {
|
||||
binding.ivCover.setImageBitmap(resource)
|
||||
binding.ivCover.layoutParams = lp
|
||||
}
|
||||
|
||||
override fun onLoadCleared(placeholder: Drawable?) {
|
||||
}
|
||||
})
|
||||
binding.tvDate.text = item.beginDateTime
|
||||
binding.tvNickname.text = item.creatorNickname
|
||||
binding.tvTitle.text = item.title
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
package kr.co.vividnext.sodalive.live.reservation.all
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.graphics.Rect
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.activity.result.ActivityResultLauncher
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
@@ -30,7 +27,6 @@ import kr.co.vividnext.sodalive.live.LiveViewModel
|
||||
import kr.co.vividnext.sodalive.live.reservation.LiveReservationAdapter
|
||||
import kr.co.vividnext.sodalive.live.reservation.complete.LiveReservationCompleteActivity
|
||||
import kr.co.vividnext.sodalive.live.room.LiveRoomActivity
|
||||
import kr.co.vividnext.sodalive.live.room.create.LiveRoomCreateActivity
|
||||
import kr.co.vividnext.sodalive.live.room.detail.GetRoomDetailResponse
|
||||
import kr.co.vividnext.sodalive.live.room.detail.LiveRoomDetailFragment
|
||||
import kr.co.vividnext.sodalive.live.room.dialog.LiveCancelDialog
|
||||
@@ -51,19 +47,9 @@ class LiveReservationAllActivity : BaseActivity<ActivityLiveReservationAllBindin
|
||||
private lateinit var loadingDialog: LoadingDialog
|
||||
private lateinit var adapter: LiveReservationAdapter
|
||||
private lateinit var selectedDateString: String
|
||||
private lateinit var activityResultLauncher: ActivityResultLauncher<Intent>
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
activityResultLauncher = registerForActivityResult(
|
||||
ActivityResultContracts.StartActivityForResult()
|
||||
) {
|
||||
if (it.resultCode == Activity.RESULT_OK) {
|
||||
refresh()
|
||||
}
|
||||
}
|
||||
|
||||
setupCalendar()
|
||||
}
|
||||
|
||||
@@ -198,10 +184,6 @@ class LiveReservationAllActivity : BaseActivity<ActivityLiveReservationAllBindin
|
||||
if (adapter.items.isEmpty()) {
|
||||
binding.swipeRefreshLayout.visibility = View.GONE
|
||||
binding.llNoItems.visibility = View.VISIBLE
|
||||
binding.llNoItems.setOnClickListener {
|
||||
val intent = Intent(applicationContext, LiveRoomCreateActivity::class.java)
|
||||
activityResultLauncher.launch(intent)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
binding.swipeRefreshLayout.visibility = View.VISIBLE
|
||||
|
||||
@@ -11,6 +11,7 @@ import android.graphics.Rect
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.CountDownTimer
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.text.Spannable
|
||||
@@ -107,6 +108,57 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
|
||||
private var isSpeaker = false
|
||||
private var isSpeakerFold = false
|
||||
|
||||
private var isNoChatting = false
|
||||
private var remainingNoChattingTime = noChattingTime
|
||||
|
||||
private val countDownTimer = object : CountDownTimer(remainingNoChattingTime * 1000, 1000) {
|
||||
override fun onTick(millisUntilFinished: Long) {
|
||||
remainingNoChattingTime -= 1
|
||||
}
|
||||
|
||||
override fun onFinish() {
|
||||
isNoChatting = false
|
||||
remainingNoChattingTime = noChattingTime
|
||||
removeNoChatRoom()
|
||||
Toast.makeText(
|
||||
applicationContext,
|
||||
"채팅금지가 해제되었습니다.",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
|
||||
private fun startNoChatting() {
|
||||
hideKeyboard {
|
||||
binding.etChat.clearFocus()
|
||||
|
||||
isNoChatting = true
|
||||
Toast.makeText(
|
||||
applicationContext,
|
||||
"${viewModel.getManagerNickname()}님이 3분간 채팅을 금지하였습니다.",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
countDownTimer.start()
|
||||
}
|
||||
}
|
||||
|
||||
private fun addNoChatRoom() {
|
||||
val noChatRoomList = SharedPreferenceManager.noChatRoomList.toMutableList()
|
||||
noChatRoomList.add(roomId)
|
||||
SharedPreferenceManager.noChatRoomList = noChatRoomList
|
||||
}
|
||||
|
||||
private fun removeNoChatRoom() {
|
||||
val noChatRoomList = SharedPreferenceManager.noChatRoomList.toMutableList()
|
||||
noChatRoomList.remove(roomId)
|
||||
SharedPreferenceManager.noChatRoomList = noChatRoomList
|
||||
}
|
||||
|
||||
private fun containNoChatRoom(): Boolean {
|
||||
val noChatRoomList = SharedPreferenceManager.noChatRoomList
|
||||
return noChatRoomList.contains(roomId)
|
||||
}
|
||||
|
||||
private val onBackPressedCallback = object : OnBackPressedCallback(true) {
|
||||
override fun handleOnBackPressed() {
|
||||
onClickQuit()
|
||||
@@ -150,6 +202,17 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
|
||||
|
||||
viewModel.getMemberCan()
|
||||
viewModel.getRoomInfo(roomId)
|
||||
|
||||
binding.etChat.setOnFocusChangeListener { view, hasFocus ->
|
||||
if (isNoChatting && hasFocus) {
|
||||
Toast.makeText(
|
||||
applicationContext,
|
||||
"${remainingNoChattingTime}초 동안 채팅하실 수 없습니다",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
view.clearFocus()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
@@ -232,6 +295,15 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
|
||||
|
||||
changeListenerMessage(memberId)
|
||||
},
|
||||
onClickNoChatting = { userId, nickname, profileUrl ->
|
||||
LiveRoomNoChattingDialog(
|
||||
activity = this,
|
||||
layoutInflater = layoutInflater,
|
||||
nickname = nickname,
|
||||
profileUrl = profileUrl,
|
||||
confirmButtonClick = { setNoChatting(userId, nickname) }
|
||||
).show(screenWidth)
|
||||
},
|
||||
onClickKickOut = {
|
||||
LiveDialog(
|
||||
activity = this,
|
||||
@@ -304,6 +376,15 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
|
||||
cancelButtonClick = {}
|
||||
).show(screenWidth)
|
||||
},
|
||||
onClickNoChatting = { userId, nickname, profileUrl ->
|
||||
LiveRoomNoChattingDialog(
|
||||
activity = this,
|
||||
layoutInflater = layoutInflater,
|
||||
nickname = nickname,
|
||||
profileUrl = profileUrl,
|
||||
confirmButtonClick = { setNoChatting(userId, nickname) }
|
||||
).show(screenWidth)
|
||||
},
|
||||
onClickPopupMenu = { userId, nickname, isBlock, view ->
|
||||
showOptionMenu(
|
||||
this,
|
||||
@@ -398,6 +479,7 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
|
||||
agora.deInitAgoraEngine()
|
||||
}
|
||||
}
|
||||
countDownTimer.cancel()
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
@@ -677,7 +759,13 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
|
||||
}
|
||||
}
|
||||
|
||||
binding.llViewUsers.setOnClickListener { roomProfileDialog.show() }
|
||||
if (response.creatorId == SharedPreferenceManager.userId) {
|
||||
binding.llViewUsers.visibility = View.VISIBLE
|
||||
binding.llViewUsers.setOnClickListener { roomProfileDialog.show() }
|
||||
} else {
|
||||
binding.llViewUsers.visibility = View.GONE
|
||||
}
|
||||
|
||||
binding.tvParticipate.text = "${response.participantsCount}"
|
||||
setNoticeAndClickableUrl(binding.tvNotice, response.notice)
|
||||
|
||||
@@ -967,6 +1055,17 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
|
||||
}
|
||||
}
|
||||
|
||||
private fun setNoChatting(userId: Long, nickname: String) {
|
||||
agora.sendRawMessageToPeer(
|
||||
receiverUid = userId.toString(),
|
||||
requestType = LiveRoomRequestType.NO_CHATTING
|
||||
) {
|
||||
handler.post {
|
||||
showDialog(content = "${nickname}님을 3분간 채팅금지를 하였습니다.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showDialog(
|
||||
content: String,
|
||||
cancelTitle: String = "",
|
||||
@@ -1008,7 +1107,13 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
|
||||
val profileUrl = viewModel.getUserProfileUrl(SharedPreferenceManager.userId.toInt())
|
||||
val rank = viewModel.getUserRank(SharedPreferenceManager.userId)
|
||||
|
||||
if (binding.etChat.text.isNotBlank() && nickname.isNotBlank() && profileUrl.isNotBlank()) {
|
||||
if (isNoChatting) {
|
||||
Toast.makeText(
|
||||
applicationContext,
|
||||
"${remainingNoChattingTime}초 동안 채팅하실 수 없습니다",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
} else if (binding.etChat.text.isNotBlank() && nickname.isNotBlank() && profileUrl.isNotBlank()) {
|
||||
val message = binding.etChat.text.toString()
|
||||
chatAdapter.items.add(
|
||||
LiveRoomNormalChat(
|
||||
@@ -1086,6 +1191,8 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
|
||||
}
|
||||
|
||||
private fun joinChannel(roomInfo: GetRoomInfoResponse) {
|
||||
loadingDialog.show(width = screenWidth, message = "라이브에 입장하고 있습니다.")
|
||||
|
||||
val userId = SharedPreferenceManager.userId
|
||||
agora.joinRtcChannel(
|
||||
uid = userId.toInt(),
|
||||
@@ -1194,6 +1301,10 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
|
||||
}
|
||||
},
|
||||
rtmChannelJoinSuccess = {
|
||||
handler.post {
|
||||
loadingDialog.dismiss()
|
||||
}
|
||||
|
||||
if (userId == roomInfo.creatorId) {
|
||||
setBroadcaster()
|
||||
} else {
|
||||
@@ -1208,6 +1319,10 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
|
||||
} else {
|
||||
startService(intent)
|
||||
}
|
||||
|
||||
if (containNoChatRoom()) {
|
||||
startNoChatting()
|
||||
}
|
||||
},
|
||||
rtmChannelJoinFail = {
|
||||
agoraConnectFail()
|
||||
@@ -1216,8 +1331,11 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
|
||||
}
|
||||
|
||||
private fun agoraConnectFail() {
|
||||
showToast("라이브에 접속하지 못했습니다.\n다시 시도해 주세요.")
|
||||
finish()
|
||||
handler.post {
|
||||
loadingDialog.dismiss()
|
||||
showToast("라이브에 접속하지 못했습니다.\n다시 시도해 주세요.")
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
private val rtcEventHandler = object : IRtcEngineEventHandler() {
|
||||
@@ -1402,7 +1520,19 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
|
||||
viewModel.getRoomInfo(roomId = roomId)
|
||||
return
|
||||
}
|
||||
|
||||
if (rawMessage == LiveRoomRequestType.NO_CHATTING.toString() && !isNoChatting) {
|
||||
handler.post {
|
||||
addNoChatRoom()
|
||||
startNoChatting()
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val noChattingTime = 180L
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package kr.co.vividnext.sodalive.live.room
|
||||
|
||||
import android.app.Activity
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.view.LayoutInflater
|
||||
import android.view.WindowManager
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import coil.load
|
||||
import coil.transform.CircleCropTransformation
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.databinding.DialogLiveNoChattingBinding
|
||||
import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||
|
||||
class LiveRoomNoChattingDialog(
|
||||
activity: Activity,
|
||||
layoutInflater: LayoutInflater,
|
||||
nickname: String,
|
||||
profileUrl: String,
|
||||
confirmButtonClick: () -> Unit,
|
||||
) {
|
||||
|
||||
private val alertDialog: AlertDialog
|
||||
|
||||
val dialogView = DialogLiveNoChattingBinding.inflate(layoutInflater)
|
||||
|
||||
init {
|
||||
val dialogBuilder = AlertDialog.Builder(activity)
|
||||
dialogBuilder.setView(dialogView.root)
|
||||
|
||||
alertDialog = dialogBuilder.create()
|
||||
alertDialog.setCancelable(false)
|
||||
alertDialog.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
|
||||
|
||||
dialogView.tvCancel.setOnClickListener {
|
||||
alertDialog.dismiss()
|
||||
}
|
||||
|
||||
dialogView.tvConfirm.setOnClickListener {
|
||||
alertDialog.dismiss()
|
||||
confirmButtonClick()
|
||||
}
|
||||
|
||||
dialogView.tvNickname.text = nickname
|
||||
dialogView.ivProfile.load(profileUrl) {
|
||||
crossfade(true)
|
||||
placeholder(R.drawable.bg_placeholder)
|
||||
transformations(CircleCropTransformation())
|
||||
}
|
||||
}
|
||||
|
||||
fun show(width: Int) {
|
||||
alertDialog.show()
|
||||
|
||||
val lp = WindowManager.LayoutParams()
|
||||
lp.copyFrom(alertDialog.window?.attributes)
|
||||
lp.width = width - (26.7f.dpToPx()).toInt()
|
||||
lp.height = WindowManager.LayoutParams.WRAP_CONTENT
|
||||
|
||||
alertDialog.window?.attributes = lp
|
||||
}
|
||||
}
|
||||
@@ -8,4 +8,5 @@ enum class LiveRoomRequestType {
|
||||
@SerializedName("KICK_OUT") KICK_OUT,
|
||||
@SerializedName("SET_MANAGER") SET_MANAGER,
|
||||
@SerializedName("RELEASE_MANAGER") RELEASE_MANAGER,
|
||||
@SerializedName("NO_CHATTING") NO_CHATTING,
|
||||
}
|
||||
|
||||
@@ -58,9 +58,8 @@ class LiveRoomDetailFragment(
|
||||
behavior.state = BottomSheetBehavior.STATE_EXPANDED
|
||||
|
||||
bindData()
|
||||
viewModel.getDetail(roomId) { dismiss() }
|
||||
|
||||
binding.ivClose.setOnClickListener { dismiss() }
|
||||
viewModel.getDetail(roomId) { dismiss() }
|
||||
}
|
||||
|
||||
private fun bindData() {
|
||||
|
||||
@@ -62,9 +62,9 @@ class LiveRoomDonationRankingAdapter :
|
||||
binding.ivCrown.visibility = View.VISIBLE
|
||||
binding.root.setBackgroundResource(
|
||||
if (items.size == 1) {
|
||||
R.drawable.bg_round_corner_4_7_2b2635
|
||||
R.drawable.bg_round_corner_4_7_13181b
|
||||
} else {
|
||||
R.drawable.bg_top_round_corner_4_7_2b2635
|
||||
R.drawable.bg_top_round_corner_4_7_13181b
|
||||
}
|
||||
)
|
||||
|
||||
@@ -90,11 +90,11 @@ class LiveRoomDonationRankingAdapter :
|
||||
|
||||
if (items.size == 2) {
|
||||
binding.root.setBackgroundResource(
|
||||
R.drawable.bg_bottom_round_corner_4_7_2b2635
|
||||
R.drawable.bg_bottom_round_corner_4_7_13181b
|
||||
)
|
||||
} else {
|
||||
binding.root.setBackgroundColor(
|
||||
ContextCompat.getColor(context, R.color.color_2b2635)
|
||||
ContextCompat.getColor(context, R.color.color_13181b)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ class LiveRoomDonationRankingAdapter :
|
||||
binding.ivCrown.setImageResource(R.drawable.ic_crown_3)
|
||||
binding.ivCrown.visibility = View.VISIBLE
|
||||
binding.root.setBackgroundResource(
|
||||
R.drawable.bg_bottom_round_corner_4_7_2b2635
|
||||
R.drawable.bg_bottom_round_corner_4_7_13181b
|
||||
)
|
||||
|
||||
lp.setMargins(
|
||||
|
||||
@@ -15,6 +15,7 @@ class LiveRoomProfileAdapter(
|
||||
private val isStaff: () -> Boolean,
|
||||
private val onClickInviteSpeaker: (Long) -> Unit,
|
||||
private val onClickChangeListener: (Long) -> Unit,
|
||||
private val onClickNoChatting: (Long, String, String) -> Unit,
|
||||
private val kickOut: (Long) -> Unit,
|
||||
private val onClickProfile: (Long) -> Unit
|
||||
) : RecyclerView.Adapter<LiveRoomProfileViewHolder>() {
|
||||
@@ -164,6 +165,7 @@ class LiveRoomProfileAdapter(
|
||||
managerId = managerId,
|
||||
onClickInviteSpeaker = onClickInviteSpeaker,
|
||||
onClickChangeListener = onClickChangeListener,
|
||||
onClickNoChatting = onClickNoChatting,
|
||||
kickOut = kickOut,
|
||||
onClickProfile = onClickProfile
|
||||
)
|
||||
@@ -233,6 +235,7 @@ class LiveRoomProfileUserViewHolder(
|
||||
private val managerId: Long,
|
||||
private val onClickInviteSpeaker: (Long) -> Unit,
|
||||
private val onClickChangeListener: (Long) -> Unit,
|
||||
private val onClickNoChatting: (Long, String, String) -> Unit,
|
||||
private val kickOut: (Long) -> Unit,
|
||||
private val onClickProfile: (Long) -> Unit
|
||||
) : LiveRoomProfileViewHolder(binding) {
|
||||
@@ -241,6 +244,7 @@ class LiveRoomProfileUserViewHolder(
|
||||
item.managerId = managerId
|
||||
item.onClickInviteSpeaker = onClickInviteSpeaker
|
||||
item.onClickChangeListener = onClickChangeListener
|
||||
item.onClickNoChatting = onClickNoChatting
|
||||
item.kickOut = kickOut
|
||||
item.onClickProfile = onClickProfile
|
||||
item.bind(binding)
|
||||
|
||||
@@ -17,6 +17,7 @@ class LiveRoomProfileDialog(
|
||||
onClickInviteSpeaker: (Long) -> Unit,
|
||||
onClickChangeListener: (Long) -> Unit,
|
||||
onClickKickOut: (Long) -> Unit,
|
||||
onClickNoChatting: (Long, String, String) -> Unit,
|
||||
onClickProfile: (Long) -> Unit
|
||||
) {
|
||||
private val bottomSheetDialog: BottomSheetDialog = BottomSheetDialog(activity)
|
||||
@@ -25,6 +26,7 @@ class LiveRoomProfileDialog(
|
||||
isStaff = isStaff,
|
||||
onClickInviteSpeaker = onClickInviteSpeaker,
|
||||
onClickChangeListener = onClickChangeListener,
|
||||
onClickNoChatting = onClickNoChatting,
|
||||
kickOut = onClickKickOut,
|
||||
onClickProfile = onClickProfile
|
||||
)
|
||||
|
||||
@@ -42,6 +42,7 @@ abstract class LiveRoomProfileItem {
|
||||
open var managerId = 0L
|
||||
open var onClickInviteSpeaker: (Long) -> Unit = {}
|
||||
open var onClickChangeListener: (Long) -> Unit = {}
|
||||
open var onClickNoChatting: (Long, String, String) -> Unit = { _, _, _ -> }
|
||||
open var kickOut: (Long) -> Unit = {}
|
||||
open var onClickProfile: (Long) -> Unit = {}
|
||||
abstract fun bind(binding: ViewBinding)
|
||||
@@ -197,5 +198,18 @@ data class LiveRoomProfileItemUser(
|
||||
} else {
|
||||
itemBinding.llControlButtons.visibility = View.GONE
|
||||
}
|
||||
|
||||
if (managerId == SharedPreferenceManager.userId) {
|
||||
itemBinding.tvNoChatting.visibility = View.VISIBLE
|
||||
itemBinding.tvNoChatting.setOnClickListener {
|
||||
onClickNoChatting(
|
||||
id,
|
||||
nickname,
|
||||
profileUrl
|
||||
)
|
||||
}
|
||||
} else {
|
||||
itemBinding.tvNoChatting.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ class LiveRoomUserProfileDialog(
|
||||
private val onClickInviteSpeaker: (Long) -> Unit,
|
||||
private val onClickChangeListener: (Long) -> Unit,
|
||||
private val onClickKickOut: (Long) -> Unit,
|
||||
private val onClickNoChatting: (Long, String, String) -> Unit,
|
||||
private val onClickPopupMenu: (Long, String, Boolean, View) -> Unit,
|
||||
) {
|
||||
private val alertDialog: AlertDialog
|
||||
@@ -128,6 +129,7 @@ class LiveRoomUserProfileDialog(
|
||||
|
||||
if (userProfile.isManager != null) {
|
||||
dialogView.tvSetManager.visibility = View.VISIBLE
|
||||
dialogView.tvNoChatting.visibility = View.VISIBLE
|
||||
|
||||
if (userProfile.isManager) {
|
||||
dialogView.tvSetManager.text = "스탭 해제"
|
||||
@@ -142,8 +144,17 @@ class LiveRoomUserProfileDialog(
|
||||
alertDialog.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
dialogView.tvNoChatting.setOnClickListener {
|
||||
onClickNoChatting(
|
||||
userProfile.userId,
|
||||
userProfile.nickname,
|
||||
userProfile.profileUrl
|
||||
)
|
||||
}
|
||||
} else {
|
||||
dialogView.tvSetManager.visibility = View.GONE
|
||||
dialogView.tvNoChatting.visibility = View.GONE
|
||||
}
|
||||
|
||||
if (
|
||||
|
||||
@@ -19,6 +19,8 @@ import com.google.firebase.messaging.FirebaseMessaging
|
||||
import com.gun0912.tedpermission.PermissionListener
|
||||
import com.gun0912.tedpermission.normal.TedPermission
|
||||
import com.orhanobut.logger.Logger
|
||||
import kr.co.pointclick.sdk.offerwall.core.PointClickAd
|
||||
import kr.co.pointclick.sdk.offerwall.core.events.PackageReceiver
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.audio_content.AudioContentPlayService
|
||||
import kr.co.vividnext.sodalive.audio_content.detail.AudioContentDetailActivity
|
||||
@@ -50,6 +52,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>(ActivityMainBinding::infl
|
||||
private val handler = Handler(Looper.getMainLooper())
|
||||
private val audioContentReceiver = AudioContentReceiver()
|
||||
|
||||
private var packageReceiver: PackageReceiver? = null
|
||||
|
||||
override fun onNewIntent(intent: Intent) {
|
||||
super.onNewIntent(intent)
|
||||
executeDeeplink()
|
||||
@@ -63,6 +67,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(ActivityMainBinding::infl
|
||||
getMemberInfo()
|
||||
getEventPopup()
|
||||
|
||||
initPointClick()
|
||||
handler.postDelayed({ executeDeeplink() }, 500)
|
||||
}
|
||||
|
||||
@@ -79,8 +84,15 @@ class MainActivity : BaseActivity<ActivityMainBinding>(ActivityMainBinding::infl
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
unregisterReceiver(audioContentReceiver)
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
if (packageReceiver != null) {
|
||||
applicationContext.unregisterReceiver(packageReceiver)
|
||||
}
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
override fun setupView() {
|
||||
@@ -362,6 +374,25 @@ class MainActivity : BaseActivity<ActivityMainBinding>(ActivityMainBinding::infl
|
||||
}
|
||||
}
|
||||
|
||||
private fun initPointClick() {
|
||||
try {
|
||||
val intentFilter = IntentFilter()
|
||||
intentFilter.addAction(Intent.ACTION_PACKAGE_ADDED);
|
||||
intentFilter.addAction(Intent.ACTION_PACKAGE_REMOVED);
|
||||
intentFilter.addDataScheme("package");
|
||||
|
||||
packageReceiver = PackageReceiver()
|
||||
applicationContext.registerReceiver(packageReceiver, intentFilter)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
PointClickAd.init(
|
||||
"fc07cfb1-ef16-455c-bdad-22aa9e8fd78c",
|
||||
SharedPreferenceManager.userId.toString()
|
||||
)
|
||||
}
|
||||
|
||||
inner class AudioContentReceiver : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context?, intent: Intent?) {
|
||||
val contentId = intent?.getLongExtra(Constants.EXTRA_AUDIO_CONTENT_ID, 0)
|
||||
|
||||
@@ -113,17 +113,7 @@ class MainViewModel(
|
||||
val playbackTrackingList = playbackTrackingRepository.getAllPlaybackTracking()
|
||||
val trackingDataList = playbackTrackingList
|
||||
.filter { it.endPosition != null }
|
||||
.filter {
|
||||
if (it.isFree) {
|
||||
// 무료 콘텐츠의 경우
|
||||
// 러닝타임의 30% 이상 재생된 데이터
|
||||
it.endPosition!! - it.startPosition > it.totalDuration * 0.3
|
||||
} else {
|
||||
// 유료 콘텐츠의 경우
|
||||
// 러닝타임의 20% 이상 재생된 데이터
|
||||
it.endPosition!! - it.startPosition > it.totalDuration * 0.2
|
||||
}
|
||||
}
|
||||
.filter { it.endPosition!! - it.startPosition >= 12000 }
|
||||
.map {
|
||||
PlaybackTrackingData(it.contentId, it.playDateTime, it.isPreview)
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class TextMessageViewModel(private val repository: MessageRepository) : BaseView
|
||||
|
||||
var page = 1
|
||||
var pageSize = 10
|
||||
private var totalCount = 0
|
||||
private var isLast = false
|
||||
|
||||
private var _isLoading = MutableLiveData(false)
|
||||
val isLoading: LiveData<Boolean>
|
||||
@@ -35,6 +35,7 @@ class TextMessageViewModel(private val repository: MessageRepository) : BaseView
|
||||
|
||||
fun selectMessageBox(messageBox: MessageBox) {
|
||||
if (messageBox != _messageBoxLiveData.value!!) {
|
||||
isLast = false
|
||||
page = 1
|
||||
_messageBoxLiveData.postValue(messageBox)
|
||||
getMessages(messageBox)
|
||||
@@ -42,7 +43,7 @@ class TextMessageViewModel(private val repository: MessageRepository) : BaseView
|
||||
}
|
||||
|
||||
fun getMessages(messageBox: MessageBox = _messageBoxLiveData.value!!) {
|
||||
if (!_isLoading.value!! && (page - 1 == 0 || totalCount > page * pageSize)) {
|
||||
if (!_isLoading.value!! && !isLast) {
|
||||
_isLoading.postValue(true)
|
||||
|
||||
val messageBoxObservable = when (messageBox) {
|
||||
@@ -78,10 +79,13 @@ class TextMessageViewModel(private val repository: MessageRepository) : BaseView
|
||||
.subscribe(
|
||||
{
|
||||
if (it.success && it.data != null) {
|
||||
totalCount = it.data.totalCount
|
||||
_getMessagesLiveData.postValue(it.data.items)
|
||||
|
||||
page += 1
|
||||
if (it.data.items.isNotEmpty()) {
|
||||
_getMessagesLiveData.postValue(it.data.items)
|
||||
} else {
|
||||
isLast = true
|
||||
_getMessagesLiveData.postValue(listOf())
|
||||
}
|
||||
} else {
|
||||
if (it.message != null) {
|
||||
_toastLiveData.postValue(it.message)
|
||||
|
||||
@@ -27,7 +27,7 @@ class VoiceMessageViewModel(private val repository: MessageRepository) : BaseVie
|
||||
|
||||
var page = 1
|
||||
var pageSize = 10
|
||||
private var totalCount = 0
|
||||
private var isLast = false
|
||||
|
||||
private var _isLoading = MutableLiveData(false)
|
||||
val isLoading: LiveData<Boolean>
|
||||
@@ -35,6 +35,7 @@ class VoiceMessageViewModel(private val repository: MessageRepository) : BaseVie
|
||||
|
||||
fun selectMessageBox(messageBox: MessageBox) {
|
||||
if (messageBox != _messageBoxLiveData.value!!) {
|
||||
isLast = false
|
||||
page = 1
|
||||
_messageBoxLiveData.postValue(messageBox)
|
||||
getMessages(messageBox)
|
||||
@@ -42,7 +43,7 @@ class VoiceMessageViewModel(private val repository: MessageRepository) : BaseVie
|
||||
}
|
||||
|
||||
fun getMessages(messageBox: MessageBox = _messageBoxLiveData.value!!) {
|
||||
if (!_isLoading.value!! && (page - 1 == 0 || totalCount > page * pageSize)) {
|
||||
if (!_isLoading.value!! && !isLast) {
|
||||
_isLoading.postValue(true)
|
||||
val messageBoxObservable = when (messageBox) {
|
||||
MessageBox.SENT -> {
|
||||
@@ -77,10 +78,13 @@ class VoiceMessageViewModel(private val repository: MessageRepository) : BaseVie
|
||||
.subscribe(
|
||||
{
|
||||
if (it.success && it.data != null) {
|
||||
totalCount = it.data.totalCount
|
||||
_getMessagesLiveData.postValue(it.data.items)
|
||||
|
||||
page += 1
|
||||
if (it.data.items.isNotEmpty()) {
|
||||
_getMessagesLiveData.postValue(it.data.items)
|
||||
} else {
|
||||
isLast = true
|
||||
_getMessagesLiveData.postValue(listOf())
|
||||
}
|
||||
} else {
|
||||
if (it.message != null) {
|
||||
_toastLiveData.postValue(it.message)
|
||||
|
||||
@@ -32,7 +32,7 @@ class CanPaymentActivity : BaseActivity<ActivityCanPaymentBinding>(
|
||||
ActivityCanPaymentBinding::inflate
|
||||
) {
|
||||
enum class PaymentMethod(val method: String) {
|
||||
CARD("디지털카드"), BANK("디지털계좌이체")
|
||||
CARD("디지털카드"), BANK("디지털계좌이체"), PHONE("휴대폰")
|
||||
}
|
||||
|
||||
private val viewModel: CanPaymentViewModel by inject()
|
||||
@@ -103,6 +103,7 @@ class CanPaymentActivity : BaseActivity<ActivityCanPaymentBinding>(
|
||||
|
||||
binding.tvMethodCard.setOnClickListener { viewModel.setPaymentMethod(PaymentMethod.CARD) }
|
||||
binding.tvMethodBank.setOnClickListener { viewModel.setPaymentMethod(PaymentMethod.BANK) }
|
||||
binding.tvMethodPhone.setOnClickListener { viewModel.setPaymentMethod(PaymentMethod.PHONE) }
|
||||
|
||||
viewModel.paymentMethodLiveData.observe(this) {
|
||||
allPaymentMethodSelectFalse()
|
||||
@@ -111,6 +112,7 @@ class CanPaymentActivity : BaseActivity<ActivityCanPaymentBinding>(
|
||||
when (it) {
|
||||
PaymentMethod.CARD -> paymentMethodSelect(binding.tvMethodCard)
|
||||
PaymentMethod.BANK -> paymentMethodSelect(binding.tvMethodBank)
|
||||
PaymentMethod.PHONE -> paymentMethodSelect(binding.tvMethodPhone)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -119,6 +121,7 @@ class CanPaymentActivity : BaseActivity<ActivityCanPaymentBinding>(
|
||||
private fun allPaymentMethodSelectFalse() {
|
||||
paymentMethodSelectFalse(binding.tvMethodBank)
|
||||
paymentMethodSelectFalse(binding.tvMethodCard)
|
||||
paymentMethodSelectFalse(binding.tvMethodPhone)
|
||||
}
|
||||
|
||||
private fun paymentMethodSelectFalse(view: TextView) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.os.Bundle
|
||||
import android.widget.Toast
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import com.google.android.material.tabs.TabLayout
|
||||
import kr.co.pointclick.sdk.offerwall.core.PointClickAd
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.base.BaseActivity
|
||||
import kr.co.vividnext.sodalive.common.LoadingDialog
|
||||
@@ -41,7 +42,7 @@ class CanStatusActivity : BaseActivity<ActivityCanStatusBinding>(
|
||||
override fun setupView() {
|
||||
binding.toolbar.tvBack.text = "캔내역"
|
||||
binding.toolbar.tvBack.setOnClickListener { onClickBackButton() }
|
||||
binding.llChargeCan.setOnClickListener {
|
||||
binding.flChargeCan.setOnClickListener {
|
||||
startActivity(
|
||||
Intent(
|
||||
applicationContext,
|
||||
@@ -49,6 +50,9 @@ class CanStatusActivity : BaseActivity<ActivityCanStatusBinding>(
|
||||
)
|
||||
)
|
||||
}
|
||||
binding.tvFreeChargeCan.setOnClickListener {
|
||||
PointClickAd.showOfferwall(this, "무료충전")
|
||||
}
|
||||
|
||||
loadingDialog = LoadingDialog(this, layoutInflater)
|
||||
|
||||
|
||||
@@ -16,5 +16,6 @@ data class ProfileUpdateRequest(
|
||||
@SerializedName("instagramUrl") val instagramUrl: String? = null,
|
||||
@SerializedName("websiteUrl") val websiteUrl: String? = null,
|
||||
@SerializedName("blogUrl") val blogUrl: String? = null,
|
||||
@SerializedName("isVisibleDonationRank") val isVisibleDonationRank: Boolean? = null,
|
||||
@SerializedName("container") val container: String = "aos"
|
||||
)
|
||||
|
||||
|
After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 978 B After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 845 B After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 927 B After Width: | Height: | Size: 4.6 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_ads_can.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 4.3 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/ic_notification.png
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/color_2b2635" />
|
||||
<solid android:color="@color/color_13181b" />
|
||||
<corners
|
||||
android:bottomLeftRadius="4.7dp"
|
||||
android:bottomRightRadius="4.7dp" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/color_2b2635" />
|
||||
android:color="@color/color_13181b" />
|
||||
</shape>
|
||||
8
app/src/main/res/drawable/bg_round_corner_10_2e6279.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/color_2e6279" />
|
||||
<corners android:radius="10dp" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/color_2e6279" />
|
||||
</shape>
|
||||
8
app/src/main/res/drawable/bg_round_corner_10_b1ef2c.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/color_b1ef2c" />
|
||||
<corners android:radius="10dp" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/color_b1ef2c" />
|
||||
</shape>
|
||||
8
app/src/main/res/drawable/bg_round_corner_2_6_cf5c37.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/color_cf5c37" />
|
||||
<corners android:radius="2.6dp" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/color_cf5c37" />
|
||||
</shape>
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/color_2b2635" />
|
||||
<solid android:color="@color/color_13181b" />
|
||||
<corners android:radius="4.7dp" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/color_2b2635" />
|
||||
android:color="@color/color_13181b" />
|
||||
</shape>
|
||||
8
app/src/main/res/drawable/bg_round_corner_4_7_3bb9f1.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/color_3bb9f1" />
|
||||
<corners android:radius="4.7dp" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/color_3bb9f1" />
|
||||
</shape>
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/color_2b2635" />
|
||||
<solid android:color="@color/color_13181b" />
|
||||
<corners android:radius="8dp" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/color_2b2635" />
|
||||
android:color="@color/color_13181b" />
|
||||
</shape>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@android:color/transparent" />
|
||||
<corners android:radius="8dp" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/color_3bb9f1" />
|
||||
</shape>
|
||||
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/color_2b2635" />
|
||||
<solid android:color="@color/color_13181b" />
|
||||
<corners
|
||||
android:topLeftRadius="4.7dp"
|
||||
android:topRightRadius="4.7dp" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/color_2b2635" />
|
||||
android:color="@color/color_13181b" />
|
||||
</shape>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/color_9970ff" />
|
||||
<solid android:color="@color/color_3bb9f1" />
|
||||
<size android:width="1.5dp" />
|
||||
</shape>
|
||||
|
||||
99
app/src/main/res/layout/activity_audio_content_curation.xml
Normal file
@@ -0,0 +1,99 @@
|
||||
<?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" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="13.3dp"
|
||||
android:background="@color/color_161616"
|
||||
android:gravity="end"
|
||||
android:orientation="horizontal"
|
||||
android:paddingHorizontal="20dp"
|
||||
android:paddingVertical="13.3dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_sort_newest"
|
||||
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_88e2e2e2"
|
||||
android:textSize="13.3sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_sort_price_high"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="13.3dp"
|
||||
android:fontFamily="@font/gmarket_sans_medium"
|
||||
android:gravity="center"
|
||||
android:text="높은 가격순"
|
||||
android:textColor="@color/color_88e2e2e2"
|
||||
android:textSize="13.3sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_sort_price_low"
|
||||
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_88e2e2e2"
|
||||
android:textSize="13.3sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
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_curation"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -115,7 +115,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/btn_audio_content_play" />
|
||||
tools:src="@drawable/btn_audio_content_play" />
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/sb_progress"
|
||||
@@ -430,6 +430,7 @@
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_str_purchase_or_rental"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/gmarket_sans_bold"
|
||||
@@ -536,12 +537,6 @@
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="6.7dp"
|
||||
android:layout_marginTop="26.7dp"
|
||||
android:background="@color/color_232323" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -568,7 +563,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="21.3dp"
|
||||
android:background="@drawable/bg_round_corner_4_7_2b2635"
|
||||
android:background="@drawable/bg_round_corner_4_7_13181b"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:paddingVertical="13.3dp"
|
||||
@@ -624,7 +619,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="21.3dp"
|
||||
android:background="@drawable/bg_round_corner_4_7_2b2635"
|
||||
android:background="@drawable/bg_round_corner_4_7_13181b"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:paddingVertical="13.3dp"
|
||||
|
||||
76
app/src/main/res/layout/activity_audio_content_new_all.xml
Normal file
@@ -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>
|
||||