Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ class NotificationFragment: Fragment() {
viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) {
viewModel.notifications.collect { list ->
notificationAdapter.submitList(list)
val isEmpty = list.isEmpty()

binding.tvNoNotificationTitle.visibility = if (isEmpty) View.VISIBLE else View.GONE
binding.tvNoNotificationContent.visibility = if (isEmpty) View.VISIBLE else View.GONE
}
}
}
Expand Down
41 changes: 38 additions & 3 deletions app/src/main/res/layout/fragment_notification.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/ll_notification_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<LinearLayout
android:id="@+id/ll_notification_top_bar"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_width="match_parent"
android:layout_height="48dp"
android:gravity="center_vertical"
Expand Down Expand Up @@ -40,8 +44,39 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_notification"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="@id/ll_notification_top_bar"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:background="@color/layer_white"
android:paddingHorizontal="16dp" />

<TextView
android:id="@+id/tv_no_notification_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16dp"
android:textColor="@color/neutral"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:textAlignment="center"
android:fontFamily="@font/arita_semibold"
android:text="도착한 알림이 없어요" />

<TextView
android:id="@+id/tv_no_notification_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="14dp"
android:textColor="@color/neutral"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginTop="12dp"
app:layout_constraintTop_toBottomOf="@id/tv_no_notification_title"
android:textAlignment="center"
android:fontFamily="@font/arita_medium"
android:text="알림이 도착하면\n바로 알려드릴게요" />

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