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/#220] 2차 스프린트 뷰 / 프로필, 확장함수, CustomEtv 전체 삭제 기능 구현 #222

Merged
merged 22 commits into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
6336fe1
[ADD/#220] delete btn 추가
chattymin Mar 1, 2024
ec39b2f
[ADD/#220] delete btn 연결
chattymin Mar 1, 2024
1ffee9f
[FEAT/#220] delete btn 클릭시 텍스트 제거 기능 구현
chattymin Mar 1, 2024
5c3e502
[FEAT/#220] 유형검사 건너뛰기 string 추가
chattymin Mar 1, 2024
677489d
[FEAT/#220] 유형검사 건너뛰기 string 밑줄 추가 및 페이지 연결
chattymin Mar 1, 2024
353318a
[FEAT/#220] 유형검사 건너뛰기 페이지 이동 구현
chattymin Mar 1, 2024
e4e9f31
[FEAT/#220] 회원가입 divider 색상 변경 및 구조 변경
chattymin Mar 1, 2024
16bbb9c
[FEAT/#220] circleImageView 추가
chattymin Mar 1, 2024
486bcc8
[FEAT/#220] 프로필 수정 버튼 구현 및 관련 컴포넌트 추가
chattymin Mar 1, 2024
2701460
[FEAT/#220] profile 뷰 수정 완료
chattymin Mar 1, 2024
300c5d4
[FEAT/#220] 프로필 수정 버튼 클릭리스너 연결 및 캐릭터 이미지 연결
chattymin Mar 1, 2024
a62475d
[FEAT/#220] ProfileEditActivity 구현
chattymin Mar 1, 2024
00a4c38
[FEAT/#220] ProfileEditActivity와 ProfileActivity 연결
chattymin Mar 1, 2024
fe5c517
[FIX/#220] Intent 값 오류 수정
chattymin Mar 1, 2024
96c250d
[REFACTOR/#220] Profile 폴더링
chattymin Mar 1, 2024
213956a
[CHORE/#220] 미사용 viewModel 제거
chattymin Mar 1, 2024
d431d87
[CHORE/#220] 네이밍 변경 및 enable 수정
chattymin Mar 1, 2024
c08f687
[FEAT/#220] 정보 변경시에만 버튼 활성화되는 기능 구현
chattymin Mar 1, 2024
418be77
Merge branch 'develop' into feat/#220-custometv-delete-all
chattymin Mar 1, 2024
6bee71f
Merge branch 'develop' into feat/#220-custometv-delete-all
chattymin Mar 1, 2024
a965f82
[CHORE/#220] 변수 private 설정
chattymin Mar 1, 2024
079a8aa
[CHORE/#220] clickListener -> 싱글클릭 변경
chattymin 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
8 changes: 7 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,16 @@
android:screenOrientation="portrait" />

<activity
android:name="com.going.presentation.profile.ProfileActivity"
android:name="com.going.presentation.profile.my.ProfileActivity"
android:exported="false"
android:screenOrientation="portrait" />

<activity
android:name="com.going.presentation.profile.edit.ProfileEditActivity"
android:exported="false"
android:screenOrientation="portrait" />


<activity
android:name="com.going.presentation.todo.ourtodo.checkfriends.CheckFriendsActivity"
android:exported="false"
Expand Down
1 change: 1 addition & 0 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ object ThirdPartyDependencies {
const val amplitude = "com.amplitude:android-sdk:${Versions.amplitudeVersion}"

const val flexbox = "com.google.android.flexbox:flexbox:${Versions.flexboxVersion}"
const val circleImageView = "de.hdodenhof:circleimageview:${Versions.circleImageViewVersion}"
Copy link
Member

Choose a reason for hiding this comment

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

와 보니깐 아워투두 친구목록에도 테두리 있었네 머지하면 쓰겟삼 최고~~

}

object ClassPathPlugins {
Expand Down
1 change: 1 addition & 0 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ object Versions {
const val espressoVersion = "3.3.0"
const val androidTestVersion = "1.1.2"
const val flexboxVersion = "3.0.0"
const val circleImageViewVersion = "3.1.0"

val javaVersion = JavaVersion.VERSION_17
const val jvmVersion = "17"
Expand Down
1 change: 1 addition & 0 deletions presentation/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ dependencies {
implementation(circularProgressBar)
implementation(circleIndicator)
implementation(flexbox)
implementation(circleImageView)
Comment on lines 86 to +87
Copy link
Member

Choose a reason for hiding this comment

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

좋아요!!

}

KakaoDependencies.run {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ class EmojiCounterEditText(context: Context, attrs: AttributeSet) :
var state: EditTextState = EditTextState.EMPTY
set(value) {
field = value

binding.btnDeleteText.isVisible = value != EditTextState.EMPTY
editTextStateMap[field]?.let { setEditTextState(it) }
}

Expand All @@ -65,15 +67,23 @@ class EmojiCounterEditText(context: Context, attrs: AttributeSet) :
true,
)

initDeleteBtnClickListener()
setBindingContent(typedArray)

typedArray.recycle()

checkTextAvailable()
}

private fun initDeleteBtnClickListener() = with(binding) {
btnDeleteText.setOnClickListener {
etEmojiCounterEtContent.text = null
}
Copy link
Member

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.

넹~ 수정했습니당!

근데 혹시 이유를 알 수 있을까요??
저는 이 버튼이 클릭 하는 순간 사라지기 때문에 굳이 싱글클릭을 안해도 될 것 같다 생각해서 그냥 클릭 리스너로 했습니다!

Copy link
Member

Choose a reason for hiding this comment

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

사실 상관없습니다! ㅋㅋ

}

private fun setBindingContent(typedArray: TypedArray) {
with(binding) {
btnDeleteText.isVisible = state != EditTextState.EMPTY
tvEmojiCounterEtTitle.text =
typedArray.getString(R.styleable.EmojiCounterEditText_title)
etEmojiCounterEtContent.hint =
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
package com.going.presentation.profile.edit

import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.activity.viewModels
import androidx.core.widget.doAfterTextChanged
import androidx.lifecycle.flowWithLifecycle
import androidx.lifecycle.lifecycleScope
import com.going.presentation.R
import com.going.presentation.databinding.ActivityProfileEditBinding
import com.going.ui.base.BaseActivity
import com.going.ui.extension.setOnSingleClickListener
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach

@AndroidEntryPoint
class ProfileEditActivity :
BaseActivity<ActivityProfileEditBinding>(R.layout.activity_profile_edit) {
private val viewModel by viewModels<ProfileEditViewModel>()

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

setEtNameArguments()
setEtInfoArguments()
getUserInfo()
observeNameTextChanged()
observeInfoTextChanged()
observeIsValueChanged()
initBackBtnClickListener()
}

private fun setEtNameArguments() {
with(binding.etProfileEditNickname) {
Comment on lines +35 to +36
Copy link
Member

Choose a reason for hiding this comment

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

with()를 이렇게 쓰니 코드가 간결하네욤

Copy link
Contributor

Choose a reason for hiding this comment

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

근데 진심 이거 쩌는 것 같아요...... 확 간결해지는 마법

setMaxLen(viewModel.getMaxNameLen())
overWarning = getString(R.string.name_over_error)
blankWarning = getString(R.string.name_blank_error)
}
}

private fun setEtInfoArguments() {
with(binding.etProfileEditInfo) {
setMaxLen(viewModel.getMaxInfoLen())
overWarning = getString(R.string.info_over_error)
}
}

private fun observeNameTextChanged() {
binding.etProfileEditNickname.editText.doAfterTextChanged { name ->
viewModel.checkIsNameChanged(name.toString())
}
}

private fun observeInfoTextChanged() {
binding.etProfileEditInfo.editText.doAfterTextChanged { info ->
viewModel.checkIsInfoChanged(info.toString())
}
}
Comment on lines +50 to +60
Copy link
Member

Choose a reason for hiding this comment

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

오,,,doAfterTextChanged를 사용해서 검사할 수도 있군요?!


private fun getUserInfo() {
val name = intent.getStringExtra(NICKNAME)
val info = intent.getStringExtra(INFO)

with(binding) {
etProfileEditNickname.editText.setText(name)
etProfileEditInfo.editText.setText(info)
}
viewModel.setDefaultValues(name.orEmpty(), info.orEmpty())
}

private fun observeIsValueChanged() {
viewModel.isValueChanged.flowWithLifecycle(lifecycle).onEach { state ->
binding.btnProfileEditFinish.isEnabled = state
}.launchIn(lifecycleScope)
}

private fun initBackBtnClickListener() {
binding.btnProfileEditBack.setOnSingleClickListener {
finish()
}
}

companion object {
const val NICKNAME = "NICKNAME"
const val INFO = "INFO"
Copy link
Member

Choose a reason for hiding this comment

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

createIntent를 활용하면 키값을 private으로 돌려도 작동함당 !
그것이... 캡슐화...

Copy link
Member Author

Choose a reason for hiding this comment

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

private 했습니다... 그것이..캡슐화니까...


@JvmStatic
fun createIntent(
context: Context,
nickName: String,
info: String,
): Intent = Intent(context, ProfileEditActivity::class.java).apply {
putExtra(NICKNAME, nickName)
putExtra(INFO, info)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.going.presentation.profile.edit

import androidx.lifecycle.ViewModel
import com.going.presentation.onboarding.signup.SignUpViewModel
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow

class ProfileEditViewModel : ViewModel() {
private val _isValueChanged = MutableStateFlow(false)
val isValueChanged: StateFlow<Boolean> = _isValueChanged

private var isNameChanged = false
private var isInfoChanged = false

private lateinit var nowName: String
private lateinit var nowInfo: String
private lateinit var defaultName: String
private lateinit var defaultInfo: String

fun setDefaultValues(name: String, info: String) {
nowName = name
nowInfo = info

defaultName = name
defaultInfo = info
}
Comment on lines +20 to +26
Copy link
Member

Choose a reason for hiding this comment

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

아하 요렇게 디폴트 값으로 이름이랑 정보 넣어두고 검사하는 로직이군여!!


fun checkIsNameChanged(name: String) {
nowName = name
isNameChanged = name != defaultName

checkIsValueChanged()
}

fun checkIsInfoChanged(info: String) {
nowInfo = info
isInfoChanged = info != defaultInfo

checkIsValueChanged()
}

private fun checkIsValueChanged() {
_isValueChanged.value =
nowName.length <= getMaxNameLen() && nowInfo.length <= getMaxInfoLen() && (isInfoChanged || isNameChanged)
}

fun getMaxNameLen() = SignUpViewModel.MAX_NAME_LEN

fun getMaxInfoLen() = SignUpViewModel.MAX_INFO_LEN
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.going.presentation.profile
package com.going.presentation.profile.my

import android.Manifest
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Bundle
import androidx.activity.viewModels
Expand All @@ -13,17 +12,16 @@ import coil.transform.CircleCropTransformation
import com.going.presentation.R
import com.going.presentation.databinding.ActivityProfileBinding
import com.going.presentation.designsystem.textview.ChartTextView
import com.going.presentation.profile.edit.ProfileEditActivity
import com.going.presentation.tendency.result.TendencyResultActivity.Companion.PERMISSION_REQUEST_CODE
import com.going.presentation.tendency.result.UserTendencyResultList
import com.going.presentation.tendency.splash.TendencySplashActivity
import com.going.presentation.util.downloadImage
import com.going.presentation.util.navigateToScreen
import com.going.presentation.util.navigateToScreenClear
import com.going.ui.base.BaseActivity
import com.going.ui.state.UiState
import com.going.ui.extension.setBulletPoint
import com.going.ui.extension.setOnSingleClickListener
import com.going.ui.extension.toast
import com.going.ui.state.UiState
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
Expand All @@ -38,9 +36,10 @@ class ProfileActivity :

getUserInfo()
observeUserInfoState()
initRestartBtnClickListener()
initBackBtnClickListener()
initSaveImgBtnClickListener()
initProfileEditBtnClickListener()
initRestartBtnClickListener()
}

private fun getUserInfo() {
Expand Down Expand Up @@ -75,6 +74,8 @@ class ProfileActivity :
tvProfileType.text = profileTitle
tvProfileSubType.text = profileSubTitle

ivProfileBig.load(resultImage)

tvProfileTag1.text = getString(R.string.tag, tags[0])
tvProfileTag2.text = getString(R.string.tag, tags[1])
tvProfileTag3.text = getString(R.string.tag, tags[2])
Expand Down Expand Up @@ -108,9 +109,9 @@ class ProfileActivity :
}
}

private fun initRestartBtnClickListener() {
binding.tvProfileRestart.setOnSingleClickListener {
navigateToScreenClear<TendencySplashActivity>()
private fun initBackBtnClickListener() {
binding.btnProfileBack.setOnSingleClickListener {
finish()
}
}

Expand All @@ -120,9 +121,21 @@ class ProfileActivity :
}
}

private fun initBackBtnClickListener() {
binding.btnProfileBack.setOnSingleClickListener {
finish()
private fun initProfileEditBtnClickListener() {
binding.btnProfileEdit.setOnSingleClickListener {
ProfileEditActivity.createIntent(
this,
binding.tvProfileName.text.toString(),
binding.tvProfileOneLine.text.toString()
).apply {
startActivity(this)
}
}
}

private fun initRestartBtnClickListener() {
binding.btnProfileRestart.setOnSingleClickListener {
navigateToScreenClear<TendencySplashActivity>()
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.going.presentation.profile
package com.going.presentation.profile.my

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,17 @@ package com.going.presentation.setting
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import androidx.activity.viewModels
import com.going.presentation.R
import com.going.presentation.databinding.ActivitySettingBinding
import com.going.presentation.profile.ProfileActivity
import com.going.presentation.profile.ProfileViewModel
import com.going.presentation.util.openWebView
import com.going.presentation.profile.my.ProfileActivity
import com.going.presentation.util.navigateToScreen
import com.going.presentation.util.openWebView
import com.going.ui.base.BaseActivity
import com.going.ui.extension.setOnSingleClickListener
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class SettingActivity : BaseActivity<ActivitySettingBinding>(R.layout.activity_setting) {
private val profileViewModel by viewModels<ProfileViewModel>()

private var quitDialog: SettingQuitDialogFragment? = null
private var logoutDialog: SettingLogoutDialogFragment? = null

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.going.presentation.tendency.splash

import android.content.Intent
import android.os.Bundle
import com.going.presentation.R
import com.going.presentation.dashboard.DashBoardActivity
import com.going.presentation.databinding.ActivityTendencySplashBinding
import com.going.presentation.tendency.ttest.TendencyTestActivity
import com.going.presentation.util.initOnBackPressedListener
import com.going.presentation.util.navigateToScreen
import com.going.presentation.util.navigateToScreenClear
import com.going.ui.base.BaseActivity
import com.going.ui.extension.setOnSingleClickListener

Expand All @@ -16,13 +16,18 @@ class TendencySplashActivity :
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

initSkipBtnClickListener()
initStartBtnClickListener()
initOnBackPressedListener(binding.root)
}

private fun initStartBtnClickListener() {
private fun initSkipBtnClickListener() =
binding.btnTendencySplashSkip.setOnSingleClickListener {
navigateToScreenClear<DashBoardActivity>()
}

private fun initStartBtnClickListener() =
binding.btnTendencySplashStart.setOnSingleClickListener {
navigateToScreen<TendencyTestActivity>(listOf(Intent.FLAG_ACTIVITY_CLEAR_TOP))
navigateToScreenClear<TendencyTestActivity>()
Copy link
Contributor

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
Expand Up @@ -16,7 +16,7 @@ import androidx.lifecycle.lifecycleScope
import androidx.viewpager2.widget.ViewPager2
import com.going.presentation.R
import com.going.presentation.databinding.FragmentMyTodoBinding
import com.going.presentation.profile.ProfileActivity
import com.going.presentation.profile.my.ProfileActivity
import com.going.presentation.todo.TodoActivity.Companion.EXTRA_TRIP_ID
import com.going.presentation.todo.create.TodoCreateActivity
import com.going.presentation.todo.mytodo.todolist.MyTodoViewPagerAdapter
Expand Down
Loading
Loading