Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT/#374] Event / 점심시간 이벤트 구현 #378

Merged
merged 22 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
0643e78
[UI/#374] 점심시간 이벤트 xml 구현
Feb 5, 2024
6c0fd24
[MERGE] : develop -> #374
Feb 6, 2024
c4c520f
[UI/#374] strings.xml 충돌 해결 및 보상 동적으로 동작하도록 xml 수정
Feb 6, 2024
73fd3d8
[UI/#374] Reward Dialog 파일 생성 및 xml 구현
Feb 6, 2024
5bbf9c6
[FEAT/#374] 이벤트 조회 서버통신 기본 설정
Feb 6, 2024
931ba9d
[FEAT/#374] 이벤트 조회 기본 동작 구현
Feb 7, 2024
37e8e56
[FEAT/#374] RewardAdapter 구현
Feb 7, 2024
cba4318
[FEAT/#374] 이벤트 상태 조회 서버통신 기본 설정
Feb 7, 2024
ca55a37
[FEAT/#374] 이벤트 상태 조회 동작 구현
Feb 7, 2024
cf8189c
[FEAT/#374] 이벤트 조회 로직 Main 뷰로 이동
Feb 7, 2024
df1dac7
[CHORE/#374] idempotencyKey intent에 extra로 전달
Feb 7, 2024
e07f736
[CHORE/#374] 이벤트 참여 서버통신 기본 설정
Feb 7, 2024
eb0e6ea
[FEAT/#374] 이벤트 참여 서버통신 연결
Feb 7, 2024
ee56bd6
[FIX/#374] 이벤트 보상 다이얼로그 로직 보완
Feb 7, 2024
4050ca2
[FIX/#374] adapter 설정 후 observe 순서 배치
Feb 7, 2024
0bdb1e1
[MERGE] : develop -> #374
Feb 7, 2024
0c71547
[CHORE/#374] 완료된 TODO 제거
Feb 7, 2024
ebc737e
[CHORE/#374] 투표 딜레이 시간 조정 및 flow job cancel 시점 변경
Feb 7, 2024
f6efcf5
Merge branch 'develop' of https://github.com/team-yello/YELLO-Android…
Feb 7, 2024
d9eef2b
[FIX/#374] 이벤트 상태 조회 onFailure 분기 제거
Feb 7, 2024
6cff21a
[UI/#374] 로티 이미지 변경 시 깜빡이지 않도록 보완
Feb 8, 2024
49247a1
[CHORE/#374] 함수 호출 순서 정렬
Feb 8, 2024
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
3 changes: 3 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ dependencies {
implementation(project(":core-ui"))
implementation(project(":data"))
implementation(project(":domain"))
implementation(libs.androidx.appCompat)
implementation(libs.materialDesign)
implementation(libs.androidx.constraintLayout)
}
38 changes: 9 additions & 29 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,16 @@
android:theme="@style/Theme.YELLO"
android:usesCleartextTraffic="true"
tools:targetApi="31">

<activity
android:name=".presentation.event.EventActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".presentation.splash.SplashActivity"
android:exported="true"
android:screenOrientation="portrait"
android:theme="@style/Theme.YELLO.Splash"
android:windowSoftInputMode="adjustNothing">

<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand All @@ -56,20 +58,18 @@
android:scheme="kakao${NATIVE_APP_KEY}" />
</intent-filter>
</activity>

<activity
android:name=".presentation.auth.SignInActivity"
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.auth.SocialSyncActivity"
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name="com.kakao.sdk.auth.AuthCodeHandlerActivity"
android:exported="true">
android:exported="true"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.VIEW" />

Expand All @@ -81,107 +81,87 @@
android:scheme="kakao${NATIVE_APP_KEY}" />
</intent-filter>
</activity>

<activity
android:name=".presentation.onboarding.activity.EditNameActivity"
android:exported="true"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.onboarding.activity.OnBoardingActivity"
android:exported="true"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.onboarding.activity.GetAlarmActivity"
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.tutorial.TutorialAActivity"
android:exported="true"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.tutorial.TutorialBActivity"
android:exported="true"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.tutorial.TutorialCActivity"
android:exported="true"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.tutorial.TutorialDActivity"
android:exported="true"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.tutorial.TutorialEndActivity"
android:exported="true"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.tutorial.TutorialEndPlusActivity"
android:exported="true"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.main.MainActivity"
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.main.yello.vote.VoteActivity"
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.main.profile.manage.ProfileManageActivity"
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.main.profile.manage.ProfileQuitTwoActivity"
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.main.profile.manage.ProfileQuitOneActivity"
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.main.profile.detail.ProfileDetailActivity"
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.main.profile.mod.SchoolProfileModActivity"
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.main.profile.mod.UnivProfileModActivity"
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.main.profile.manage.ProfileQuitReasonActivity"
android:exported="false"
android:windowSoftInputMode="adjustPan"
android:screenOrientation="portrait" />
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".presentation.main.myyello.read.MyYelloReadActivity"
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.pay.PayActivity"
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name=".presentation.search.SearchActivity"
android:exported="false"
Expand All @@ -199,6 +179,6 @@
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="@string/default_notification_channel_id" />

</application>

</manifest>
7 changes: 7 additions & 0 deletions app/src/main/java/com/el/yello/di/DataSourceModule.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.el.yello.di

import com.example.data.datasource.AuthDataSource
import com.example.data.datasource.EventDataSource
import com.example.data.datasource.NoticeDataSource
import com.example.data.datasource.OnboardingDataSource
import com.example.data.datasource.PayDataSource
Expand All @@ -10,6 +11,7 @@ import com.example.data.datasource.SearchDataSource
import com.example.data.datasource.VoteDataSource
import com.example.data.datasource.YelloDataSource
import com.example.data.datasource.remote.AuthDataSourceImpl
import com.example.data.datasource.remote.EventDataSourceImpl
import com.example.data.datasource.remote.NoticeDataSourceImpl
import com.example.data.datasource.remote.OnboardingDataSourceImpl
import com.example.data.datasource.remote.PayDataSourceImpl
Expand Down Expand Up @@ -71,4 +73,9 @@ object DataSourceModule {
@Singleton
fun provideNoticeDataSource(noticeDataSourceImpl: NoticeDataSourceImpl): NoticeDataSource =
noticeDataSourceImpl

@Provides
@Singleton
fun provideEventDataSource(eventDataSourceImpl: EventDataSourceImpl): EventDataSource =
eventDataSourceImpl
}
7 changes: 7 additions & 0 deletions app/src/main/java/com/el/yello/di/RepositoryModule.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.el.yello.di

import com.example.data.repository.AuthRepositoryImpl
import com.example.data.repository.EventRepositoryImpl
import com.example.data.repository.NoticeRepositoryImpl
import com.example.data.repository.OnboardingRepositoryImpl
import com.example.data.repository.PayRepositoryImpl
Expand All @@ -10,6 +11,7 @@ import com.example.data.repository.SearchRepositoryImpl
import com.example.data.repository.VoteRepositoryImpl
import com.example.data.repository.YelloRepositoryImpl
import com.example.domain.repository.AuthRepository
import com.example.domain.repository.EventRepository
import com.example.domain.repository.NoticeRepository
import com.example.domain.repository.OnboardingRepository
import com.example.domain.repository.PayRepository
Expand Down Expand Up @@ -71,4 +73,9 @@ object RepositoryModule {
@Singleton
fun provideNoticeRepository(noticeRepositoryImpl: NoticeRepositoryImpl): NoticeRepository =
noticeRepositoryImpl

@Provides
@Singleton
fun provideEventRepository(eventRepositoryImpl: EventRepositoryImpl): EventRepository =
eventRepositoryImpl
}
6 changes: 6 additions & 0 deletions app/src/main/java/com/el/yello/di/ServiceModule.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.el.yello.di

import com.example.data.remote.service.AuthService
import com.example.data.remote.service.EventService
import com.example.data.remote.service.LookService
import com.example.data.remote.service.NoticeService
import com.example.data.remote.service.OnboardingService
Expand Down Expand Up @@ -69,4 +70,9 @@ object ServiceModule {
@Singleton
fun provideNoticeService(retrofit: Retrofit): NoticeService =
retrofit.create(NoticeService::class.java)

@Provides
@Singleton
fun provideEventService(retrofit: Retrofit): EventService =
retrofit.create(EventService::class.java)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
package com.el.yello.presentation.event

import android.animation.Animator
import android.os.Bundle
import androidx.activity.viewModels
import com.el.yello.R
import com.el.yello.databinding.ActivityEventBinding
import com.el.yello.presentation.event.reward.RewardDialog
import com.el.yello.presentation.main.MainActivity.Companion.EXTRA_EVENT
import com.el.yello.presentation.main.MainActivity.Companion.EXTRA_IDEMPOTENCY_KEY
import com.el.yello.presentation.main.MainActivity.Companion.EXTRA_REWARD_LIST
import com.el.yello.presentation.main.ParcelableEvent
import com.el.yello.presentation.main.ParcelableReward
import com.example.ui.base.BindingActivity
import com.example.ui.intent.getCompatibleParcelableExtra
import com.example.ui.view.setOnSingleClickListener
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class EventActivity : BindingActivity<ActivityEventBinding>(R.layout.activity_event) {
private val viewModel by viewModels<EventViewModel>()

private var rewardAdapter: RewardAdapter? = null

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

initRewardAdapter()
getEventExtra()
}

private fun getEventExtra() {
val event = intent.getCompatibleParcelableExtra<ParcelableEvent>(EXTRA_EVENT) ?: return
with(event) {
binding.tvEventTitle.text = title
binding.tvEventSubtitle.text = subTitle

initEventLottieClickListener()
}

rewardAdapter?.submitList(
intent.getParcelableArrayListExtra<ParcelableReward>(
EXTRA_REWARD_LIST,
)?.toList(),
)

viewModel.setIdempotencyKey(intent.getStringExtra(EXTRA_IDEMPOTENCY_KEY) ?: return)
}

private fun initRewardAdapter() {
rewardAdapter = RewardAdapter()
binding.rvEventRewardItem.adapter = rewardAdapter
}

private fun initEventLottieClickListener() {
// TODO: 필요하면 터치 영역 조정
with(binding.lottieEvent) {
setOnSingleClickListener {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

깜빡임 이슈 제 견해로는 클릭 이벤트 처리가 애니메이션 시작 전에 발생돼서 클릭 시 깜빡일 수도 있을 것 같아욥 ..!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

한번 액티비티 onCreate 최상단에서 initEventLottieClickListener()를 호출하게 해봤는데 요거 말씀하신 게 맞을까요..? 계속 깜빡이네요ㅠ

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

앗 그렇군요 ,, 혹시 그럼 onAnimationEnd 시에 다이얼로그 호출하며 잠시 깜빡이는 건 아닐까욧 ..?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

제 생각에는 그 애니메이션 로티 이미지를 새로 그리면서 잠깐 깜빡였던 것 같은데 밑에 상호가 말해준 대로 해결했습니다!!!

setOnClickListener(null)
setAnimation(R.raw.lottie_event_open)
loop(false)
playAnimation()
addAnimatorListener(object : Animator.AnimatorListener {
override fun onAnimationStart(animation: Animator, isReverse: Boolean) {
super.onAnimationStart(animation, isReverse)
}

override fun onAnimationStart(p0: Animator) {}

override fun onAnimationEnd(animation: Animator, isReverse: Boolean) {
super.onAnimationEnd(animation, isReverse)
}

override fun onAnimationEnd(p0: Animator) {
startRewardDialog()
}

override fun onAnimationCancel(p0: Animator) {}

override fun onAnimationRepeat(p0: Animator) {}
})
}
}
}

private fun startRewardDialog() {
RewardDialog.newInstance().show(supportFragmentManager, TAG_DIALOG_REWARD)
}

companion object {
private const val TAG_DIALOG_REWARD = "DIALOG_REWARD"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.el.yello.presentation.event

import androidx.lifecycle.ViewModel
import com.example.domain.repository.EventRepository
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

@HiltViewModel
class EventViewModel @Inject constructor(
private val eventRepository: EventRepository,
) : ViewModel() {
private var idempotencyKey = ""

fun setIdempotencyKey(key: String) {
idempotencyKey = key
}

fun getIdempotencyKey() = idempotencyKey
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.el.yello.presentation.event

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView
import coil.load
import com.el.yello.databinding.ItemEventRewardBinding
import com.el.yello.presentation.main.ParcelableReward
import com.example.ui.diff.DiffCallback

class RewardAdapter : ListAdapter<ParcelableReward, RewardAdapter.RewardViewHolder>(diffUtil) {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RewardViewHolder =
RewardViewHolder(
ItemEventRewardBinding.inflate(
LayoutInflater.from(parent.context),
parent,
false,
),
)

override fun onBindViewHolder(holder: RewardViewHolder, position: Int) {
holder.setReward(getItem(position))
}

class RewardViewHolder(private val binding: ItemEventRewardBinding) :
RecyclerView.ViewHolder(binding.root) {
fun setReward(reward: ParcelableReward) {
binding.ivEventReward.load(reward.imageUrl)
binding.tvEventRewardDescription.text = reward.name
}
}

companion object {
private val diffUtil = DiffCallback<ParcelableReward>(
onItemsTheSame = { old, new -> old.name == new.name },
onContentsTheSame = { old, new -> old == new },
)
}
}
Loading
Loading