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] 번개 개최뷰 나가기 모달, 프로그래스바 구현 #55

Merged
merged 7 commits into from
Jan 9, 2024
9 changes: 8 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ android {
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
buildConfigField("String", "BASE_URL", properties["base.url"].toString())
buildConfigField("String", "ACCESS_TOKEN", properties["access.token"].toString())
buildConfigField("String", "NAVER_MAP_CLIENT_ID", properties["naver.map.client.id"].toString())
buildConfigField(
"String",
"NAVER_MAP_CLIENT_ID",
properties["naver.map.client.id"].toString()
)
manifestPlaceholders["IO_SENTRY_DSN"] = properties["io.sentry.dsn"] as String
}

Expand Down Expand Up @@ -96,6 +100,9 @@ dependencies {

// Location
implementation(libs.play.services.location)

// progress Bar
implementation(libs.progress.bar)
}

ktlint {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import kotlinx.coroutines.flow.onEach
import org.sopt.pingle.R
import org.sopt.pingle.databinding.FragmentMapBinding
import org.sopt.pingle.presentation.type.CategoryType
import org.sopt.pingle.presentation.ui.common.AllModalDialogFragment
import org.sopt.pingle.presentation.ui.main.home.mainlist.MainListFragment
import org.sopt.pingle.util.base.BindingFragment
import org.sopt.pingle.util.component.AllModalDialogFragment
import org.sopt.pingle.util.component.OnPingleCardClickListener
import org.sopt.pingle.util.component.PingleChip
import org.sopt.pingle.util.fragment.navigateToFragment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import org.sopt.pingle.R
import org.sopt.pingle.databinding.ActivityPlanBinding
import org.sopt.pingle.presentation.ui.main.plan.planlocation.PlanLocationFragment
import org.sopt.pingle.util.base.BindingActivity
import org.sopt.pingle.util.component.AllModalDialogFragment

class PlanActivity : BindingActivity<ActivityPlanBinding>(R.layout.activity_plan) {
private val planViewModel: PlanViewModel by viewModels()
Expand All @@ -20,11 +21,20 @@ class PlanActivity : BindingActivity<ActivityPlanBinding>(R.layout.activity_plan
super.onCreate(savedInstanceState)

binding.viewModel = planViewModel

setPlanFragmentStateAdapter()
initView()
addListeners()
collectData()
}

private fun initView() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
private fun initView() {
private fun initLayout() {

with(binding.planProgress) {
min = 1f
max = fragmentList.size.toFloat()
}
}

private fun setPlanFragmentStateAdapter() {
// TODO 차후에 나머지 개최 프로세스 fragment 추가
fragmentList = ArrayList()
Expand Down Expand Up @@ -63,7 +73,7 @@ class PlanActivity : BindingActivity<ActivityPlanBinding>(R.layout.activity_plan
binding.toolbar.ivAllTopbarArrowWithTitleArrowLeft.setOnClickListener {
when (binding.vpPlan.currentItem) {
0 -> {
// TODO 나가기 확인 모달
showExitModalDialogFragment()
}

else -> {
Expand All @@ -72,12 +82,13 @@ class PlanActivity : BindingActivity<ActivityPlanBinding>(R.layout.activity_plan
}
}
binding.tvPlanClose.setOnClickListener {
// TODO 나가기 확인 모달
showExitModalDialogFragment()
}
}

private fun collectData() {
planViewModel.currentPage.flowWithLifecycle(lifecycle).onEach { currentPage ->
binding.planProgress.progress = currentPage.toFloat() + 1f
Copy link
Collaborator

Choose a reason for hiding this comment

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

refac 필요

when (currentPage) {
fragmentList.size - 1 -> {
binding.btnPlan.text = getString(R.string.plan_pingle)
Expand All @@ -89,4 +100,20 @@ class PlanActivity : BindingActivity<ActivityPlanBinding>(R.layout.activity_plan
}
}.launchIn(lifecycleScope)
}

private fun showExitModalDialogFragment() {
// TODO 차후에 나가기 눌렀을 때 finish() 되는지 확인
AllModalDialogFragment(
title = getString(R.string.plan_exit_modal_dialog_title),
detail = getString(R.string.plan_exit_modal_dialog_detail),
buttonText = getString(R.string.plan_exit_modal_dialog_btn_text),
textButtonText = getString(R.string.plan_exit_modal_dialog_text_btn_text),
clickBtn = {},
clickTextBtn = { finish() }
).show(supportFragmentManager, EXIT_MODAL)
}

companion object {
private const val EXIT_MODAL = "exitModal"
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.sopt.pingle.presentation.ui.common
package org.sopt.pingle.util.component

import android.content.DialogInterface
import android.os.Bundle
Expand Down
17 changes: 16 additions & 1 deletion app/src/main/res/layout/activity_plan.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,21 @@
android:id="@+id/toolbar"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
android:id="@+id/toolbar"
android:id="@+id/include_toolbar"

layout="@layout/view_all_topbar_arrow_with_title" />

<com.skydoves.progressview.ProgressView
android:id="@+id/plan_progress"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
android:id="@+id/plan_progress"
android:id="@+id/pv_plan_progress"

android:layout_width="0dp"
android:layout_height="4dp"
android:layout_marginHorizontal="27dp"
android:layout_marginTop="@dimen/spacing18"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/toolbar"
app:progressView_autoAnimate="true"
app:progressView_colorBackground="@color/g_07"
app:progressView_colorProgress="@color/pingle_green"
app:progressView_progressFromPrevious="true"
app:progressView_radius="5dp" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_start"
android:layout_width="wrap_content"
Expand All @@ -41,7 +56,7 @@
app:layout_constraintBottom_toTopOf="@+id/btn_plan"
app:layout_constraintEnd_toEndOf="@id/gl_end"
app:layout_constraintStart_toStartOf="@id/gl_start"
app:layout_constraintTop_toBottomOf="@id/toolbar" />
app:layout_constraintTop_toBottomOf="@id/plan_progress" />

<com.google.android.material.button.MaterialButton
android:id="@+id/btn_plan"
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
<string name="plan_open_chatting_hint">링크를 입력해주세요</string>
<string name="plan_open_chatting_title">채팅방 링크</string>

<!-- plan modal -->
<string name="plan_exit_modal_dialog_title">잠깐! 나가실건가요?</string>
<string name="plan_exit_modal_dialog_detail">지금까지 입력한 정보는 전부 사라져요</string>
<string name="plan_exit_modal_dialog_btn_text">이어서 작성하기</string>
<string name="plan_exit_modal_dialog_text_btn_text">그만두기</string>

<!-- join group success -->
<string name="join_group_success_btn">입장하기</string>
<string name="join_gorup_success_title">단체 입장\n완료!</string>
Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ kotlin-serialization-json = "1.5.1"
sentry = "4.1.1"
naver-maps = "3.17.0"
play-services-location = "21.0.1"
progress-bar = "1.1.3"

[libraries]
# AndroidX
Expand Down Expand Up @@ -77,6 +78,7 @@ retrofit-kotlin-serialization-converter = { group = "com.jakewharton.retrofit",
kotlin-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlin-serialization-json" }
naver-maps = { group = "com.naver.maps", name = "map-sdk", version.ref = "naver-maps" }
play-services-location = { group = "com.google.android.gms", name = "play-services-location", version.ref = "play-services-location" }
progress-bar = {group = "com.github.skydoves", name = "progressview", version.ref="progress-bar"}

[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
Expand Down
Loading