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] 신규 단체 개설하기 뷰 구현 #199

Merged
merged 46 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
a993e6d
[add] #178 아이콘 및 에셋 추가
Doreminwoo Feb 10, 2024
351cbef
[add] 178 신규 단체 개설 파일 생성
Doreminwoo Feb 15, 2024
414853c
[add] #178 그래픽 에셋 추가
Doreminwoo Feb 17, 2024
234ca5f
[mod] #178 Custom View 수정
Doreminwoo Feb 17, 2024
eccbf48
[feat] #178 activity_new_group View 구현
Doreminwoo Feb 17, 2024
356b126
[del] #178 파일 이름 변경으로 인한 삭제
Doreminwoo Feb 17, 2024
e11d66b
[feat] #178 fragment_new_group_input View 구현
Doreminwoo Feb 17, 2024
278e44d
[add] #178 string 리소스 추가
Doreminwoo Feb 17, 2024
d259ef7
[mod] #178 editText CustomView 수정
Doreminwoo Feb 17, 2024
461b4f9
[feat] #178 activity_new_group_info View 구현
Doreminwoo Feb 18, 2024
ac7e697
[add] #178 new group info - String 리소스 추가
Doreminwoo Feb 18, 2024
d7c9856
[feat] #178 fragment_new_group_keyword View 구현
Doreminwoo Feb 18, 2024
f494d67
[add] #178 String, theme 리소스 추가
Doreminwoo Feb 18, 2024
8b48fa2
[feat] #178 fragemnt_new_group_create View 구현
Doreminwoo Feb 18, 2024
0c2590a
[add] #178 String 리소스 추가
Doreminwoo Feb 18, 2024
b997abd
[feat] #178 activity_new_group_announcement VIew 구현
Doreminwoo Feb 18, 2024
73890ba
[add] #178 String 리소스 추가
Doreminwoo Feb 18, 2024
4b82e40
[mod] #178 디자인 재반영
Doreminwoo Feb 19, 2024
f21c7b5
[mod] #178 중복확인 버튼 수정
Doreminwoo Feb 20, 2024
137049c
[feat] #178 화면 전환 기능 구현
Doreminwoo Feb 21, 2024
a2e0409
[mod] #178 icon/btn visibility 적용
Doreminwoo Feb 21, 2024
cdb2000
[feat] #178 activity_new_group_share View 구현
Doreminwoo Feb 21, 2024
43875fc
[add] #178 new group share string 리소스 추가
Doreminwoo Feb 21, 2024
0e151f0
[feat] #178 Chip 동적 생성
Doreminwoo Feb 23, 2024
b04de99
[feat] #178 화면전환에 의한 스택관리
Doreminwoo Feb 23, 2024
40fcd85
Merge branch 'develop' into feat-new-group-view
Doreminwoo Feb 23, 2024
d5f8267
[del] #178 사용하지 않는 String 리소스
Doreminwoo Feb 23, 2024
8667c7a
[feat] #178 CustomEditText focusable 속성 추가
Doreminwoo Feb 23, 2024
9139db1
[chore] #178 카멜케이스로 변경
Doreminwoo Feb 23, 2024
29301a1
[chore] #178 git conflict 수정
Doreminwoo Feb 23, 2024
1b11ca6
[chore] #178 conflict 재해결
Doreminwoo Feb 23, 2024
70344e1
[del] #178 기존에 있던 파일 재사용
Doreminwoo Feb 25, 2024
d3e6815
[add] #178 visibility enum class 파일 생성 및 selector 네이밍 변경
Doreminwoo Feb 25, 2024
a0e6741
[chore] #178 코드리뷰 반영
Doreminwoo Feb 25, 2024
4459c5b
[feat] #178 화면전환 애니메이션
Doreminwoo Feb 25, 2024
9c9d846
Merge branch 'develop' into feat-new-group-view
Doreminwoo Feb 25, 2024
ac41292
[chore] #178 ktlint 적용
Doreminwoo Feb 25, 2024
e017d95
[chore] #178 코드리뷰 반영
Doreminwoo Feb 25, 2024
56b02b5
[chore] #178 코드리뷰 반영
Doreminwoo Feb 26, 2024
36a948a
[chore] #178 newgroup 패키지 상세 분리
Doreminwoo Feb 27, 2024
d1c144e
[chore] #178 코드리뷰 반영
Doreminwoo Feb 27, 2024
ba7b829
[chore] #178 VisibilityType 삭제 및 초기상태로 변경
Doreminwoo Feb 27, 2024
ba06955
Merge branch 'develop' into feat-new-group-view
Doreminwoo Feb 27, 2024
c335d47
[chore] #178 Tag 스타일 재사용
Doreminwoo Feb 28, 2024
99b0d07
Merge branch 'develop' into feat-new-group-view
Doreminwoo Mar 1, 2024
6a8116b
[chore] #178 ktlint 적용
Doreminwoo Mar 1, 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
20 changes: 20 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,26 @@
android:exported="false"
android:screenOrientation="portrait"
tools:ignore="LockedOrientationActivity" />
<activity
android:name=".presentation.ui.newgroup.NewGroupActivity"
android:exported="false"
android:screenOrientation="portrait"
tools:ignore="LockedOrientationActivity" />
<activity
android:name=".presentation.ui.newgroup.NewGroupInfoActivity"
android:exported="false"
android:screenOrientation="portrait"
tools:ignore="LockedOrientationActivity" />
<activity
android:name=".presentation.ui.newgroup.NewGroupAnnouncementActivity"
android:exported="false"
android:screenOrientation="portrait"
tools:ignore="LockedOrientationActivity" />
<activity
android:name=".presentation.ui.newgroup.NewGroupCodeShareActivity"
android:exported="false"
android:screenOrientation="portrait"
tools:ignore="LockedOrientationActivity" />
<activity
android:name=".presentation.ui.main.planannouncement.PlanAnnouncementActivity"
android:exported="false"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import org.sopt.pingle.R
import org.sopt.pingle.databinding.ActivityJoinGroupSearchBinding
import org.sopt.pingle.presentation.ui.onboarding.OnBoardingActivity
import org.sopt.pingle.presentation.ui.newgroup.NewGroupActivity
import org.sopt.pingle.util.base.BindingActivity
import org.sopt.pingle.util.context.hideKeyboard
import org.sopt.pingle.util.context.navigateToWebView
import org.sopt.pingle.util.view.UiState
import timber.log.Timber

Expand Down Expand Up @@ -66,7 +65,7 @@ class JoinGroupSearchActivity :
}

tvJoinGroupSearchCreate.setOnClickListener {
startActivity(navigateToWebView(OnBoardingActivity.NEW_GROUP_LINK))
navigateToNewGroup()
}

btnJoinGroupCodeNext.setOnClickListener {
Expand Down Expand Up @@ -117,6 +116,12 @@ class JoinGroupSearchActivity :
}
}

private fun navigateToNewGroup() {
Intent(this, NewGroupActivity::class.java).apply {
startActivity(this)
}
}

override fun onDestroy() {
binding.rvJoinGroupSearch.adapter = null
super.onDestroy()
Expand Down
Copy link
Collaborator

Choose a reason for hiding this comment

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

단체 정보 확인 페이지에서 버튼 텍스트 바뀌는 로직 빠져있는 것 같습니다.

Copy link
Collaborator

Choose a reason for hiding this comment

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

이쪽 개최 프로세스처럼 패키지 정리해주면 지현 언니가 더 좋아할듯용?ㅎ

image

Copy link
Collaborator

Choose a reason for hiding this comment

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

하지은 이제 나를 너무 잘 안다 무섭다 무서워

Copy link
Collaborator

Choose a reason for hiding this comment

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
package org.sopt.pingle.presentation.ui.newgroup

import android.app.ActivityOptions
import android.content.Intent
import android.os.Bundle
import androidx.activity.viewModels
import androidx.fragment.app.Fragment
import androidx.lifecycle.flowWithLifecycle
import androidx.lifecycle.lifecycleScope
import androidx.viewpager2.widget.ViewPager2
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import org.sopt.pingle.R
import org.sopt.pingle.databinding.ActivityNewGroupBinding
import org.sopt.pingle.util.base.BindingActivity
import org.sopt.pingle.util.context.stringOf
import org.sopt.pingle.util.view.PingleFragmentStateAdapter

@AndroidEntryPoint
class NewGroupActivity : BindingActivity<ActivityNewGroupBinding>(R.layout.activity_new_group) {
private val viewModel: NewGroupViewModel by viewModels()
private lateinit var fragmentList: ArrayList<Fragment>

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

initLayout()
addListeners()
collectData()
}

private fun initLayout() {
navigateToNewGroupInfo()
setPlanFragmentStateAdapter()
}

private fun addListeners() {
binding.btnNewGroupNext.setOnClickListener {
when (binding.vpNewGroup.currentItem) {
fragmentList.size - LAST_INDEX_OFFSET -> {
navigateToNewGroupAnnouncement()
finish()
}

else -> binding.vpNewGroup.currentItem++
}
}

binding.includeNewGroupTopbar.ivAllTopbarArrowWithTitleArrowLeft.setOnClickListener {
navigateToPreviousPage()
}

binding.ivNewGroupTopbarInfo.setOnClickListener {
navigateToNewGroupInfo()
}
}

private fun collectData() {
viewModel.currentPage.flowWithLifecycle(lifecycle).onEach { currentPage ->
when (currentPage) {
fragmentList.size - LAST_INDEX_OFFSET ->
binding.btnNewGroupNext.text =
stringOf(R.string.new_group_create)

else -> binding.btnNewGroupNext.text = stringOf(R.string.new_group_next)
}
}.launchIn(lifecycleScope)
}

private fun setPlanFragmentStateAdapter() {
fragmentList = ArrayList()
fragmentList.apply {
add(NewGroupInputFragment())
add(NewGroupKeywordFragment())
add(NewGroupCreateFragment())
}

val adapter = PingleFragmentStateAdapter(fragmentList, this)
with(binding.vpNewGroup) {
this.adapter = adapter
isUserInputEnabled = false

registerOnPageChangeCallback(object :
ViewPager2.OnPageChangeCallback() {
override fun onPageSelected(position: Int) {
super.onPageSelected(position)
viewModel.setCurrentPage(position)
}
})
}
}

private fun navigateToNewGroupInfo() {
Intent(this, NewGroupInfoActivity::class.java).apply {
startActivity(
this,
ActivityOptions.makeCustomAnimation(this@NewGroupActivity, R.anim.slide_up, 0)
.toBundle()
)
Comment on lines +101 to +105
Copy link
Collaborator

Choose a reason for hiding this comment

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

쏘굿도리 ~

}
}

private fun navigateToNewGroupAnnouncement() {
Intent(this, NewGroupAnnouncementActivity::class.java).apply {
startActivity(this)
}
}

private fun navigateToPreviousPage() {
when (binding.vpNewGroup.currentItem) {
FIRST_PAGE -> finish()
else -> binding.vpNewGroup.currentItem--
}
}

companion object {
const val FIRST_PAGE = 0
const val LAST_INDEX_OFFSET = 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package org.sopt.pingle.presentation.ui.newgroup

import android.content.Intent
import android.os.Bundle
import androidx.activity.OnBackPressedCallback
import dagger.hilt.android.AndroidEntryPoint
import org.sopt.pingle.R
import org.sopt.pingle.databinding.ActivityNewGroupAnnouncementBinding
import org.sopt.pingle.presentation.ui.main.MainActivity
import org.sopt.pingle.util.base.BindingActivity

@AndroidEntryPoint
class NewGroupAnnouncementActivity :
BindingActivity<ActivityNewGroupAnnouncementBinding>(R.layout.activity_new_group_announcement) {

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

addListeners()
}

private fun addListeners() {
onBackPressedCallBack()
binding.btnNewGroupAnnouncementInvitation.setOnClickListener {
navigateToNewGroupShare()
}
binding.tvNewGroupAnnouncementHome.setOnClickListener {
navigateToHome()
}
}

private fun navigateToNewGroupShare() {
Intent(this, NewGroupCodeShareActivity::class.java).apply {
startActivity(this)
}
}

private fun navigateToHome() {
Intent(this, MainActivity::class.java).apply {
startActivity(this)
finish()
}
}

private fun onBackPressedCallBack() {
onBackPressedDispatcher.addCallback(
this,
object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
navigateToHome()
finish()
Copy link
Collaborator

Choose a reason for hiding this comment

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

navigateHome에 finish가 있는ㄴ데 또 추가해야 하나용??

Copy link
Member Author

Choose a reason for hiding this comment

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

오옹 그러네요!?

}
}
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package org.sopt.pingle.presentation.ui.newgroup

import android.os.Bundle
import dagger.hilt.android.AndroidEntryPoint
import org.sopt.pingle.R
import org.sopt.pingle.databinding.ActivityNewGroupCodeShareBinding
import org.sopt.pingle.util.base.BindingActivity

@AndroidEntryPoint
class NewGroupCodeShareActivity :
BindingActivity<ActivityNewGroupCodeShareBinding>(R.layout.activity_new_group_code_share) {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

initLayout()
addListeners()
}

private fun initLayout() {
binding.etNewGroupCodeShareCode.editText.isEnabled = false
}

private fun addListeners() {
binding.includeNewGroupCodeShareTopbar.ivAllTopbarArrowWithTitleArrowLeft.setOnClickListener {
finish()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.sopt.pingle.presentation.ui.newgroup

import android.os.Bundle
import android.view.View
import dagger.hilt.android.AndroidEntryPoint
import org.sopt.pingle.R
import org.sopt.pingle.databinding.FragmentNewGroupCreateBinding
import org.sopt.pingle.util.base.BindingFragment

@AndroidEntryPoint
class NewGroupCreateFragment :
BindingFragment<FragmentNewGroupCreateBinding>(R.layout.fragment_new_group_create) {

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package org.sopt.pingle.presentation.ui.newgroup

import android.os.Bundle
import dagger.hilt.android.AndroidEntryPoint
import org.sopt.pingle.R
import org.sopt.pingle.databinding.ActivityNewGroupInfoBinding
import org.sopt.pingle.util.base.BindingActivity

@AndroidEntryPoint
class NewGroupInfoActivity :
BindingActivity<ActivityNewGroupInfoBinding>(R.layout.activity_new_group_info) {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

addListeners()
}

private fun addListeners() {
binding.ivNewGroupInfoX.setOnClickListener {
finish()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.sopt.pingle.presentation.ui.newgroup

import android.os.Bundle
import android.view.View
import dagger.hilt.android.AndroidEntryPoint
import org.sopt.pingle.R
import org.sopt.pingle.databinding.FragmentNewGroupInputBinding
import org.sopt.pingle.util.base.BindingFragment

@AndroidEntryPoint
class NewGroupInputFragment :
BindingFragment<FragmentNewGroupInputBinding>(R.layout.fragment_new_group_input) {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package org.sopt.pingle.presentation.ui.newgroup

import android.os.Bundle
import android.view.View
import com.google.android.material.chip.Chip
import dagger.hilt.android.AndroidEntryPoint
import org.sopt.pingle.R
import org.sopt.pingle.databinding.FragmentNewGroupKeywordBinding
import org.sopt.pingle.util.base.BindingFragment

@AndroidEntryPoint
class NewGroupKeywordFragment :
BindingFragment<FragmentNewGroupKeywordBinding>(R.layout.fragment_new_group_keyword) {
private val itemList =
listOf(Item(1, "연합동아리"), Item(2, "교내동아리"), Item(3, "학생회"), Item(4, "대학교"))
Copy link
Collaborator

Choose a reason for hiding this comment

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

여기두 다 상수화할 수 있지 않을까용?!

Copy link
Collaborator

Choose a reason for hiding this comment

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

이거 나중에 서버통신으로 불러올 거라 ㄱㅊ을 듯요 !!


override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

initLayout()
}

private fun initLayout() {
setChipKeyword()
}

private fun setChipKeyword() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

칩 spacing 처리 해주셨나요? 안 보여서

Copy link
Member Author

Choose a reason for hiding this comment

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

chip간의 간격은 xml 에서 chipSpacingHorizontal 속성으로 처리했습니다!

binding.cgNewGroupKeyword.removeAllViews()

for (item in itemList) {
val chip =
layoutInflater.inflate(R.layout.view_new_group_chip_keyword, null, false) as Chip
chip.text = item.name
chip.setOnCheckedChangeListener { _, isChecked ->
when (isChecked) {
true -> chip.setTextAppearance(R.style.TextAppearance_Pingle_Sub_Semi_16)
false -> chip.setTextAppearance(R.style.TextAppearance_Pingle_Body_Med_16)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

초기에 textAppearance 가 먹히지 않아서 처음에 칩 선택할 때 크기가 바뀌는 것 같아요 view_new_group_chip_keyword 여기에 있는 칩에 초기 textAppearance 값 추가해 주세요

}
binding.cgNewGroupKeyword.addView(chip)
}
}

// TODO Api연결시 response로 변경 예정
data class Item(val id: Int, val name: String)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package org.sopt.pingle.presentation.ui.newgroup

import androidx.lifecycle.ViewModel
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow

@HiltViewModel
class NewGroupViewModel @Inject constructor() : ViewModel() {
private val _currentPage = MutableStateFlow(FIRST_PAGE_POSITION)
val currentPage get() = _currentPage.asStateFlow()

fun setCurrentPage(position: Int) {
_currentPage.value = position
}

companion object {
const val FIRST_PAGE_POSITION = 0
}
}
Loading
Loading