Skip to content

Commit

Permalink
[AN/USER] feat: 알림 화면을 구현한다(#771) (#772)
Browse files Browse the repository at this point in the history
* feat(NotificationList): 알림 목록 화면 생성

* feat(NotificationList): 뒤로가기 클릭 시 알림 목록 종료

* feat(NotificationList): 알림 목록 뷰모델 생성

* reactor(NotificationList): 뒤로가기 클릭 함수 분리
  • Loading branch information
SeongHoonC authored Mar 6, 2024
1 parent 1f3cf51 commit ee2cfc9
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 1 deletion.
5 changes: 4 additions & 1 deletion android/festago/presentation/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application>
<activity
android:name=".ui.notificationlist.NotificationListActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".ui.home.HomeActivity"
android:exported="true"
Expand All @@ -13,5 +17,4 @@
</activity>
</application>


</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import com.festago.festago.presentation.ui.home.festivallist.festival.FestivalLi
import com.festago.festago.presentation.ui.home.festivallist.uistate.FestivalListUiState
import com.festago.festago.presentation.ui.home.festivallist.uistate.FestivalMoreItemUiState
import com.festago.festago.presentation.ui.home.festivallist.uistate.FestivalTabUiState
import com.festago.festago.presentation.ui.notificationlist.NotificationListActivity
import com.festago.festago.presentation.ui.schooldetail.SchoolDetailFragment
import com.festago.festago.presentation.util.repeatOnStarted
import com.festago.festago.presentation.util.setOnApplyWindowInsetsCompatListener
Expand Down Expand Up @@ -82,6 +83,9 @@ class FestivalListFragment : Fragment() {
binding.ivSearch.setOnClickListener { // 임시 연결
showSchoolDetail()
}
binding.ivAlarm.setOnClickListener {
showNotificationList()
}
}

private fun initViewPager() {
Expand Down Expand Up @@ -178,6 +182,10 @@ class FestivalListFragment : Fragment() {
.commit()
}

private fun showNotificationList() {
startActivity(NotificationListActivity.getIntent(requireContext()))
}

override fun onDestroyView() {
_binding = null
super.onDestroyView()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.festago.festago.presentation.ui.notificationlist

import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import com.festago.festago.presentation.databinding.ActivityNotificationListBinding

class NotificationListActivity : AppCompatActivity() {

private val binding: ActivityNotificationListBinding by lazy {
ActivityNotificationListBinding.inflate(layoutInflater)
}

private val vm: NotificationListViewModel by viewModels()

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(binding.root)
initBackPressed()
}

private fun initBackPressed() {
binding.ivBack.setOnClickListener {
onBackPressedDispatcher.onBackPressed()
}
}

companion object {
fun getIntent(context: Context): Intent {
return Intent(context, NotificationListActivity::class.java)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.festago.festago.presentation.ui.notificationlist

import androidx.lifecycle.ViewModel

class NotificationListViewModel : ViewModel()
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">

<data>

</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.notificationlist.NotificationListActivity">

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/clAppBar"
android:layout_width="match_parent"
android:layout_height="56dp"
app:layout_constraintTop_toTopOf="parent">

<ImageView
android:id="@+id/ivBack"
android:layout_width="wrap_content"
android:layout_height="24dp"
android:layout_marginStart="16dp"
android:contentDescription="@null"
android:src="@drawable/ic_arrow_back_ios_new_24"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:tint="@color/contents_gray_07" />

<TextView
style="@style/H4Bold16Lh20"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/notification_list_tv_notification_app_bar"
android:textColor="@color/contents_gray_07"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

<TextView
android:id="@+id/tvNoNotification"
style="@style/H5Bold14Lh16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/notification_list_tv_no_notification"
android:textColor="@color/contents_gray_06"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/clAppBar" />

<TextView
android:id="@+id/tvNoNotificationExplain"
style="@style/B4Medium12Lh14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/notification_list_tv_no_notification_explain"
android:textColor="@color/contents_gray_05"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvNoNotification" />
</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 @@ -22,4 +22,9 @@
<!-- String related to artist detail -->
<string name="artist_detail_tv_dday_format">D%1$s</string>

<!-- String related to notification list-->
<string name="notification_list_tv_notification_app_bar">알림</string>
<string name="notification_list_tv_no_notification">아직 도착한 알림이 없어요</string>
<string name="notification_list_tv_no_notification_explain">새로운 소식이 도착하면 알려드릴게요</string>

</resources>

0 comments on commit ee2cfc9

Please sign in to comment.