diff --git a/app/src/main/java/com/infinity/omos/adapters/BindingAdapters.kt b/app/src/main/java/com/infinity/omos/adapters/BindingAdapters.kt
index 33e7bb1e..205de27e 100644
--- a/app/src/main/java/com/infinity/omos/adapters/BindingAdapters.kt
+++ b/app/src/main/java/com/infinity/omos/adapters/BindingAdapters.kt
@@ -24,8 +24,19 @@ fun bindImageFromUrl(view: ImageView, imageUrl: String?) {
if (!imageUrl.isNullOrEmpty()) {
Glide.with(view.context)
.load(imageUrl)
- .error(R.drawable.ic_record)
- .fallback(R.drawable.ic_record)
+ .placeholder(R.color.gray_06)
+ .into(view)
+ }
+}
+
+@BindingAdapter("profileImageFromUrl")
+fun bindProfileImageFromUrl(view: ImageView, imageUrl: String?) {
+ if (!imageUrl.isNullOrEmpty()) {
+ Glide.with(view.context)
+ .load(imageUrl)
+ .error(R.drawable.ic_profile)
+ .fallback(R.drawable.ic_profile)
+ .placeholder(R.drawable.ic_profile)
.into(view)
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/infinity/omos/data/record/RecordMapper.kt b/app/src/main/java/com/infinity/omos/data/record/RecordMapper.kt
index 1f5d4f61..cf785d43 100644
--- a/app/src/main/java/com/infinity/omos/data/record/RecordMapper.kt
+++ b/app/src/main/java/com/infinity/omos/data/record/RecordMapper.kt
@@ -5,7 +5,7 @@ import com.infinity.omos.data.music.toPresentation
fun SumRecord.toPresentation(): SumRecordModel {
return SumRecordModel(
music = music.toPresentation(),
- nickname = nickname,
+ nickname = "by. $nickname",
recordId = recordId,
recordImageUrl = recordImageUrl,
recordTitle = recordTitle,
diff --git a/app/src/main/java/com/infinity/omos/ui/main/today/TodayFragment.kt b/app/src/main/java/com/infinity/omos/ui/main/today/TodayFragment.kt
index 3dfba368..b0cc4c08 100644
--- a/app/src/main/java/com/infinity/omos/ui/main/today/TodayFragment.kt
+++ b/app/src/main/java/com/infinity/omos/ui/main/today/TodayFragment.kt
@@ -1,5 +1,6 @@
package com.infinity.omos.ui.main.today
+import android.content.Intent
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
@@ -11,6 +12,8 @@ import com.infinity.omos.BuildConfig
import com.infinity.omos.adapters.dj.RecommendedDjListAdapter
import com.infinity.omos.adapters.record.HorizontalRecordListAdapter
import com.infinity.omos.databinding.FragmentTodayBinding
+import com.infinity.omos.ui.record.DetailRecordActivity
+import com.infinity.omos.ui.write.SelectCategoryActivity
import com.infinity.omos.utils.repeatOnStarted
import dagger.hilt.android.AndroidEntryPoint
import java.util.*
@@ -49,7 +52,10 @@ class TodayFragment : Fragment() {
}
private fun initListener() {
-
+ binding.swipeRefresh.setOnRefreshListener {
+ viewModel.refresh()
+ binding.swipeRefresh.isRefreshing = false
+ }
}
private fun collectData() {
diff --git a/app/src/main/java/com/infinity/omos/ui/main/today/TodayViewModel.kt b/app/src/main/java/com/infinity/omos/ui/main/today/TodayViewModel.kt
index 44aff462..61b4cbfd 100644
--- a/app/src/main/java/com/infinity/omos/ui/main/today/TodayViewModel.kt
+++ b/app/src/main/java/com/infinity/omos/ui/main/today/TodayViewModel.kt
@@ -39,10 +39,7 @@ class TodayViewModel @Inject constructor(
val lovedMusicUiState = _lovedMusicUiState.asStateFlow()
init {
- fetchTodayMusic()
- fetchFamousRecords()
- fetchRecommendedDjs()
- fetchLovedMusic()
+ refresh()
}
private fun fetchTodayMusic() {
@@ -96,6 +93,13 @@ class TodayViewModel @Inject constructor(
}
}
}
+
+ fun refresh() {
+ fetchTodayMusic()
+ fetchFamousRecords()
+ fetchRecommendedDjs()
+ fetchLovedMusic()
+ }
}
sealed interface TodayMusicUiState {
diff --git a/app/src/main/res/layout/fragment_today.xml b/app/src/main/res/layout/fragment_today.xml
index 96f704ed..563abaff 100644
--- a/app/src/main/res/layout/fragment_today.xml
+++ b/app/src/main/res/layout/fragment_today.xml
@@ -14,328 +14,335 @@
type="com.infinity.omos.data.music.LovedMusicModel" />
-
-
-
-
-
-
-
-
+ android:layout_height="match_parent">
-
+
-
-
-
-
-
+
+
+
+
+ android:paddingHorizontal="@dimen/normal_padding"
+ android:paddingVertical="@dimen/small_padding">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ android:id="@+id/iv_loved_record_image"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:contentDescription="@string/record_image"
+ android:scaleType="centerCrop"
+ app:imageFromUrl="@{lovedMusic.recordImageUrl}" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:contentDescription="@string/record_image"
+ android:src="@drawable/bg_gradient_01" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/list_item_horizontal_record.xml b/app/src/main/res/layout/list_item_horizontal_record.xml
index 39b6f67e..ac33bda9 100644
--- a/app/src/main/res/layout/list_item_horizontal_record.xml
+++ b/app/src/main/res/layout/list_item_horizontal_record.xml
@@ -107,6 +107,7 @@
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginBottom="4dp"
+ android:text="@{record.nickname}"
android:textColor="?attr/colorSecondary"
android:textSize="12sp"
app:layout_constraintBottom_toTopOf="@id/tv_record_title"
diff --git a/app/src/main/res/layout/list_item_recommended_dj.xml b/app/src/main/res/layout/list_item_recommended_dj.xml
index 032d0451..c69dbf83 100644
--- a/app/src/main/res/layout/list_item_recommended_dj.xml
+++ b/app/src/main/res/layout/list_item_recommended_dj.xml
@@ -21,7 +21,7 @@
android:id="@+id/iv_profile"
android:layout_width="88dp"
android:layout_height="88dp"
- app:imageFromUrl="@{profile.profileUrl}"
+ app:profileImageFromUrl="@{profile.profileUrl}"
tools:src="@color/gray_06" />