Skip to content

Commit

Permalink
feat: 학교 상세 및 아티스트 상세에서 축제 목록이 없다면 해당되는 메세지를 보여준다.
Browse files Browse the repository at this point in the history
  • Loading branch information
SeongHoonC committed Apr 18, 2024
1 parent 155c802 commit 2bcd286
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class ArtistDetailFragment : Fragment() {
private fun initObserve() {
repeatOnStarted(viewLifecycleOwner) {
vm.uiState.collect {
binding.uiState = it
updateUi(it)
}
}
Expand All @@ -79,8 +80,8 @@ class ArtistDetailFragment : Fragment() {
}

private fun handleSuccess(uiState: ArtistDetailUiState.Success) {
binding.uiState = uiState
adapter.submitList(uiState.stages)
binding.successUiState = uiState
adapter.submitList(uiState.festivals)

binding.llcArtistMedia.removeAllViews()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ sealed interface ArtistDetailUiState {

data class Success(
val artist: ArtistDetail,
val stages: List<FestivalItemUiState>,
val festivals: List<FestivalItemUiState>,
) : ArtistDetailUiState

val shouldShowEmptyFestivals get() = this is Success && festivals.isEmpty()
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ sealed interface SchoolDetailUiState {
val shouldShowSuccess get() = this is Success
val shouldShowLoading get() = this is Loading
val shouldShowError get() = this is Error
val shouldShowEmptyFestivals get() = this is Success && festivals.isEmpty()
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

<variable
name="uiState"
type="com.festago.festago.presentation.ui.artistdetail.uistate.ArtistDetailUiState" />

<variable
name="successUiState"
type="com.festago.festago.presentation.ui.artistdetail.uistate.ArtistDetailUiState.Success" />
</data>

Expand All @@ -22,7 +26,7 @@

<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/ivBackgroundImage"
imageUrl="@{uiState.artist.backgroundUrl}"
imageUrl="@{successUiState.artist.backgroundUrl}"
android:layout_width="match_parent"
android:layout_height="136dp"
android:adjustViewBounds="true"
Expand Down Expand Up @@ -69,13 +73,13 @@

<ImageView
android:id="@+id/ivProfileImage"
imageUrl="@{uiState.artist.profileUrl}"
imageUrl="@{successUiState.artist.profileUrl}"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:contentDescription="@null"
android:scaleType="centerCrop"
tools:src="@color/background_gray_03"/>
tools:src="@color/background_gray_03" />
</androidx.cardview.widget.CardView>

<androidx.cardview.widget.CardView
Expand Down Expand Up @@ -105,7 +109,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="@{uiState.artist.artistName}"
android:text="@{successUiState.artist.artistName}"
app:layout_constraintBottom_toBottomOf="@+id/cvProfileImage"
app:layout_constraintStart_toEndOf="@id/cvProfileImage"
tools:text="뉴진스" />
Expand Down Expand Up @@ -134,6 +138,19 @@
app:layout_constraintTop_toBottomOf="@id/llcArtistMedia"
app:layout_constraintVertical_weight="1" />

<TextView
android:id="@+id/tvFestivalsEmpty"
style="@style/H5Bold14Lh16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/artist_detail_tv_empty_festivals"
android:textColor="@color/contents_gray_06"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:visibility="@{uiState.shouldShowEmptyFestivals}" />

</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,20 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/tvFestivalsEmpty"
style="@style/H5Bold14Lh16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/school_detail_tv_empty_festivals"
android:textColor="@color/contents_gray_06"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:visibility="@{uiState.shouldShowEmptyFestivals}" />


</androidx.constraintlayout.widget.ConstraintLayout>

</layout>
5 changes: 5 additions & 0 deletions android/festago/presentation/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

<!-- String related to artist detail -->
<string name="artist_detail_tv_dday_format">D%1$s</string>
<string name="artist_detail_tv_empty_festivals">아직 축제가 없어요</string>

<!-- String related to notification list-->
<string name="notification_list_tv_notification_app_bar">알림</string>
Expand All @@ -40,6 +41,9 @@
<!-- String related to region bottom sheet -->
<string name="region_bottom_sheet_tv_region">지역별</string>

<!-- String related to artist detail -->
<string name="school_detail_tv_empty_festivals">아직 축제가 없어요</string>

<!-- String related to search -->
<string name="search_et_search_hint">학교명, 아티스트명, 축제명으로 입력하세요.</string>
<string name="search_tv_recent_search">최근 검색어</string>
Expand Down Expand Up @@ -69,4 +73,5 @@
<string name="ok_dialog_btn_update">업데이트</string>
<string name="ok_dialog_btn_cancel">취소</string>


</resources>

0 comments on commit 2bcd286

Please sign in to comment.