diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 5ae0c135..7a08c658 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -56,7 +56,8 @@ + android:screenOrientation="portrait" + android:windowSoftInputMode="adjustResize" /> + binding.btnDeleteText.isVisible = hasFocus && (state != EditTextState.EMPTY) + } + } + private fun checkTextAvailable() { binding.etEmojiCounterEtContent.doAfterTextChanged { text -> val len = text.toString().getGraphemeLength() diff --git a/presentation/src/main/java/com/going/presentation/onboarding/signup/SignUpActivity.kt b/presentation/src/main/java/com/going/presentation/onboarding/signup/SignUpActivity.kt index 17117ccc..6fc530f4 100644 --- a/presentation/src/main/java/com/going/presentation/onboarding/signup/SignUpActivity.kt +++ b/presentation/src/main/java/com/going/presentation/onboarding/signup/SignUpActivity.kt @@ -7,11 +7,9 @@ import androidx.lifecycle.flowWithLifecycle import androidx.lifecycle.lifecycleScope import com.going.domain.entity.AuthState import com.going.presentation.R -import com.going.presentation.dashboard.DashBoardActivity import com.going.presentation.databinding.ActivitySignUpBinding import com.going.presentation.tendency.splash.TendencySplashActivity import com.going.presentation.util.initOnBackPressedListener -import com.going.presentation.util.navigateToScreenClear import com.going.ui.base.BaseActivity import com.going.ui.extension.setOnSingleClickListener import com.going.ui.extension.toast @@ -83,8 +81,12 @@ class SignUpActivity : TendencySplashActivity.createIntent( this, TendencySplashActivity.TENDENCY - ).apply { startActivity(this) } + ).apply { + startActivity(this) + finish() + } } + AuthState.FAILURE -> toast(getString(R.string.server_error)) AuthState.OTHER_PAGE -> return@onEach } diff --git a/presentation/src/main/java/com/going/presentation/profile/edit/ProfileEditViewModel.kt b/presentation/src/main/java/com/going/presentation/profile/edit/ProfileEditViewModel.kt index 4ccb9a27..5735bff2 100644 --- a/presentation/src/main/java/com/going/presentation/profile/edit/ProfileEditViewModel.kt +++ b/presentation/src/main/java/com/going/presentation/profile/edit/ProfileEditViewModel.kt @@ -56,7 +56,7 @@ class ProfileEditViewModel @Inject constructor( private fun checkIsValueChanged() { _isValueChanged.value = - nowName.length <= getMaxNameLen() && nowInfo.length <= getMaxInfoLen() && (isInfoChanged || isNameChanged) + nowName.isNotBlank() && nowName.length <= getMaxNameLen() && nowInfo.isNotBlank() && nowInfo.length <= getMaxInfoLen() && (isInfoChanged || isNameChanged) } fun patchUserInfo() { diff --git a/presentation/src/main/java/com/going/presentation/profile/my/ProfileActivity.kt b/presentation/src/main/java/com/going/presentation/profile/my/ProfileActivity.kt index cc3af0af..04b97f6e 100644 --- a/presentation/src/main/java/com/going/presentation/profile/my/ProfileActivity.kt +++ b/presentation/src/main/java/com/going/presentation/profile/my/ProfileActivity.kt @@ -35,7 +35,6 @@ class ProfileActivity : override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - getUserInfo() observeUserInfoState() initBackBtnClickListener() initSaveImgBtnClickListener() @@ -46,6 +45,7 @@ class ProfileActivity : override fun onResume() { super.onResume() getUserInfo() + setFragmentHeight() scrollTop() } @@ -80,6 +80,7 @@ class ProfileActivity : if (profileViewModel.profileId.value != -1) { viewProfileEmpty.isVisible = false + viewProfile.isVisible = true UserTendencyResultList[number].apply { ivProfile.load(profileImage) { transformations(CircleCropTransformation()) diff --git a/presentation/src/main/java/com/going/presentation/profile/participant/ParticipantProfileActivity.kt b/presentation/src/main/java/com/going/presentation/profile/participant/ParticipantProfileActivity.kt index 4e7edf31..9c10e4ba 100644 --- a/presentation/src/main/java/com/going/presentation/profile/participant/ParticipantProfileActivity.kt +++ b/presentation/src/main/java/com/going/presentation/profile/participant/ParticipantProfileActivity.kt @@ -95,12 +95,7 @@ class ParticipantProfileActivity : btnTripProfileDownload.isVisible = this && profile.result != -1 btnProfileEdit.isVisible = this - if (!this) tvTripProfileTitle.setText( - getString( - R.string.participant_profile_friend_title, - profile.name - ) - ) + if (!this) tvTripProfileTitle.text = getString(R.string.participant_profile_friend_title) } } } diff --git a/presentation/src/main/java/com/going/presentation/profile/participant/profilecharacter/ParticipantProfileCharacterFragment.kt b/presentation/src/main/java/com/going/presentation/profile/participant/profilecharacter/ParticipantProfileCharacterFragment.kt index 1b458c3f..e25ad7da 100644 --- a/presentation/src/main/java/com/going/presentation/profile/participant/profilecharacter/ParticipantProfileCharacterFragment.kt +++ b/presentation/src/main/java/com/going/presentation/profile/participant/profilecharacter/ParticipantProfileCharacterFragment.kt @@ -13,8 +13,8 @@ import com.going.presentation.designsystem.textview.ChartTextView import com.going.presentation.profile.participant.ParticipantProfileViewModel import com.going.presentation.tendency.result.UserTendencyResultList import com.going.presentation.tendency.splash.TendencySplashActivity -import com.going.presentation.util.navigateToScreenClear import com.going.ui.base.BaseFragment +import com.going.ui.extension.setOnSingleClickListener import com.going.ui.extension.toast import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.flow.launchIn @@ -32,6 +32,7 @@ class ParticipantProfileCharacterFragment : setViewModel() btnParticipantProfileEmptyOwnerClickListener() + btnTripProfileRestartClickListener() } private fun setViewModel() { @@ -53,6 +54,9 @@ class ParticipantProfileCharacterFragment : UserTendencyResultList[result].run { ivTripProfileBig.load(resultImage) + tvTripProfileType.text = profileTitle + tvTripProfileSubType.text = profileSubTitle + tvTripProfileTag1.text = getString(R.string.tag, tags[0]) tvTripProfileTag2.text = getString(R.string.tag, tags[1]) tvTripProfileTag3.text = getString(R.string.tag, tags[2]) @@ -73,7 +77,19 @@ class ParticipantProfileCharacterFragment : private fun btnParticipantProfileEmptyOwnerClickListener() { binding.btnParticipantProfileEmptyOwner.setOnClickListener { - requireActivity().navigateToScreenClear() + TendencySplashActivity.createIntent( + requireActivity(), + TendencySplashActivity.PROFILE + ).apply { startActivity(this) } + } + } + + private fun btnTripProfileRestartClickListener() { + binding.btnTripProfileRestart.setOnSingleClickListener { + TendencySplashActivity.createIntent( + requireActivity(), + TendencySplashActivity.PROFILE + ).apply { startActivity(this) } } } diff --git a/presentation/src/main/java/com/going/presentation/profile/participant/profiletag/changetag/ChangeTagActivity.kt b/presentation/src/main/java/com/going/presentation/profile/participant/profiletag/changetag/ChangeTagActivity.kt index e2589c74..a1e31ede 100644 --- a/presentation/src/main/java/com/going/presentation/profile/participant/profiletag/changetag/ChangeTagActivity.kt +++ b/presentation/src/main/java/com/going/presentation/profile/participant/profiletag/changetag/ChangeTagActivity.kt @@ -28,13 +28,13 @@ class ChangeTagActivity : private var _adapter: ChangeTagAdapter? = null private val adapter get() = requireNotNull(_adapter) { getString(R.string.adapter_not_initialized_error_msg) } - private val preferenceAnswers = MutableList(5) { 0 } - override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) initAdapter() + setTripId() initPreferenceList() + observeIsButtonValid() initItemDecoration() initChangeClickListener() initBackClickListener() @@ -46,6 +46,10 @@ class ChangeTagActivity : binding.rvChangeTag.adapter = adapter } + private fun setTripId() { + tagViewModel.tripId = intent.getLongExtra(TRIP_ID, 0) + } + private fun initPreferenceList() { if (intent != null) { val styleA = intent.getIntExtra(STYLE_A, 0) @@ -64,34 +68,28 @@ class ChangeTagActivity : ) ) - preferenceAnswers[0] = styleA - preferenceAnswers[1] = styleB - preferenceAnswers[2] = styleC - preferenceAnswers[3] = styleD - preferenceAnswers[4] = styleE + tagViewModel.setDefaultPreference(styleA, styleB, styleC, styleD, styleE) } } private fun preferenceTagClickListener(item: ProfilePreferenceData, checkedIndex: Int) { - preferenceAnswers[item.number.toInt() - 1] = checkedIndex - setButtonValid() - sendPreferenceInfo() - } - - private fun setButtonValid() { - binding.btnChangeStart.isEnabled = true - binding.btnChangeStart.setTextColor( - colorOf(R.color.white_000) - ) + tagViewModel.checkIsPreferenceChange(item.number.toInt(), checkedIndex) } - private fun sendPreferenceInfo() { - tagViewModel.tripId = intent.getLongExtra(TRIP_ID, 0) - tagViewModel.styleA.value = preferenceAnswers[0] - tagViewModel.styleB.value = preferenceAnswers[1] - tagViewModel.styleC.value = preferenceAnswers[2] - tagViewModel.styleD.value = preferenceAnswers[3] - tagViewModel.styleE.value = preferenceAnswers[4] + private fun observeIsButtonValid() { + tagViewModel.isButtonValid.flowWithLifecycle(lifecycle).onEach { state -> + if (state) { + binding.btnChangeStart.isEnabled = true + binding.btnChangeStart.setTextColor( + colorOf(R.color.white_000) + ) + } else { + binding.btnChangeStart.isEnabled = false + binding.btnChangeStart.setTextColor( + colorOf(R.color.gray_200) + ) + } + }.launchIn(lifecycleScope) } private fun initItemDecoration() { diff --git a/presentation/src/main/java/com/going/presentation/profile/participant/profiletag/changetag/ChangeTagViewModel.kt b/presentation/src/main/java/com/going/presentation/profile/participant/profiletag/changetag/ChangeTagViewModel.kt index c3ba95c6..053bcd43 100644 --- a/presentation/src/main/java/com/going/presentation/profile/participant/profiletag/changetag/ChangeTagViewModel.kt +++ b/presentation/src/main/java/com/going/presentation/profile/participant/profiletag/changetag/ChangeTagViewModel.kt @@ -1,6 +1,5 @@ package com.going.presentation.profile.participant.profiletag.changetag -import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.going.domain.entity.ProfilePreferenceData @@ -8,7 +7,9 @@ import com.going.domain.entity.request.PreferenceChangeRequestModel import com.going.domain.repository.ProfileRepository import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.MutableSharedFlow +import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.SharedFlow +import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.launch import javax.inject.Inject @@ -20,24 +21,91 @@ class ChangeTagViewModel @Inject constructor( private val _preferencePatchState = MutableSharedFlow() val preferencePatchState: SharedFlow = _preferencePatchState + private val _isButtonValid = MutableStateFlow(false) + val isButtonValid: StateFlow = _isButtonValid + var tripId: Long = 0 - val styleA = MutableLiveData(0) - val styleB = MutableLiveData(0) - val styleC = MutableLiveData(0) - val styleD = MutableLiveData(0) - val styleE = MutableLiveData(0) + private var defaultStyleA: Int? = 0 + private var defaultStyleB: Int? = 0 + private var defaultStyleC: Int? = 0 + private var defaultStyleD: Int? = 0 + private var defaultStyleE: Int? = 0 + + private var styleA: Int? = 0 + private var styleB: Int? = 0 + private var styleC: Int? = 0 + private var styleD: Int? = 0 + private var styleE: Int? = 0 + + private var isStyleAChanged: Boolean = false + private var isStyleBChanged: Boolean = false + private var isStyleCChanged: Boolean = false + private var isStyleDChanged: Boolean = false + private var isStyleEChanged: Boolean = false + + fun setDefaultPreference(styleA: Int, styleB: Int, styleC: Int, styleD: Int, styleE: Int) { + defaultStyleA = styleA + this.styleA = styleA + + defaultStyleB = styleB + this.styleB = styleB + + defaultStyleC = styleC + this.styleC = styleC + + defaultStyleD = styleD + this.styleD = styleD + + defaultStyleE = styleE + this.styleE = styleE + } + + fun checkIsPreferenceChange(number: Int, index: Int) { + when (number) { + 1 -> { + styleA = index + isStyleAChanged = index != defaultStyleA + } + + 2 -> { + styleB = index + isStyleBChanged = index != defaultStyleB + } + + 3 -> { + styleC = index + isStyleCChanged = index != defaultStyleC + } + + 4 -> { + styleD = index + isStyleDChanged = index != defaultStyleD + } + + 5 -> { + styleE = index + isStyleEChanged = index != defaultStyleE + } + } + checkIsButtonValid() + } + + private fun checkIsButtonValid() { + _isButtonValid.value = + isStyleAChanged || isStyleBChanged || isStyleCChanged || isStyleDChanged || isStyleEChanged + } fun patchPreferenceTagToServer() { viewModelScope.launch { profileRepository.patchPreferenceTag( tripId, PreferenceChangeRequestModel( - styleA.value ?: 0, - styleB.value ?: 0, - styleC.value ?: 0, - styleD.value ?: 0, - styleE.value ?: 0 + styleA ?: 0, + styleB ?: 0, + styleC ?: 0, + styleD ?: 0, + styleE ?: 0 ) ) .onSuccess { diff --git a/presentation/src/main/java/com/going/presentation/todo/change/TodoAllocatorAdapter.kt b/presentation/src/main/java/com/going/presentation/todo/change/ChangeAllocatorAdapter.kt similarity index 75% rename from presentation/src/main/java/com/going/presentation/todo/change/TodoAllocatorAdapter.kt rename to presentation/src/main/java/com/going/presentation/todo/change/ChangeAllocatorAdapter.kt index 7827f0f5..b0f10c86 100644 --- a/presentation/src/main/java/com/going/presentation/todo/change/TodoAllocatorAdapter.kt +++ b/presentation/src/main/java/com/going/presentation/todo/change/ChangeAllocatorAdapter.kt @@ -7,17 +7,17 @@ import com.going.domain.entity.response.TodoAllocatorModel import com.going.presentation.databinding.ItemTodoCreateNameBinding import com.going.ui.util.ItemDiffCallback -class TodoAllocatorAdapter( +class ChangeAllocatorAdapter( private val itemClick: (Int) -> Unit -) : ListAdapter(diffUtil) { +) : ListAdapter(diffUtil) { - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): TodoAllocatorViewHolder { + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ChangeAllocatorViewHolder { val binding: ItemTodoCreateNameBinding = ItemTodoCreateNameBinding.inflate(LayoutInflater.from(parent.context), parent, false) - return TodoAllocatorViewHolder(binding, itemClick) + return ChangeAllocatorViewHolder(binding, itemClick) } - override fun onBindViewHolder(holder: TodoAllocatorViewHolder, position: Int) { + override fun onBindViewHolder(holder: ChangeAllocatorViewHolder, position: Int) { holder.onBind(getItem(position), position) } diff --git a/presentation/src/main/java/com/going/presentation/todo/change/TodoAllocatorViewHolder.kt b/presentation/src/main/java/com/going/presentation/todo/change/ChangeAllocatorViewHolder.kt similarity index 97% rename from presentation/src/main/java/com/going/presentation/todo/change/TodoAllocatorViewHolder.kt rename to presentation/src/main/java/com/going/presentation/todo/change/ChangeAllocatorViewHolder.kt index 524c2100..75e299e1 100644 --- a/presentation/src/main/java/com/going/presentation/todo/change/TodoAllocatorViewHolder.kt +++ b/presentation/src/main/java/com/going/presentation/todo/change/ChangeAllocatorViewHolder.kt @@ -6,7 +6,7 @@ import com.going.presentation.R import com.going.presentation.databinding.ItemTodoCreateNameBinding import com.going.ui.extension.colorOf -class TodoAllocatorViewHolder( +class ChangeAllocatorViewHolder( val binding: ItemTodoCreateNameBinding, private val itemClick: (Int) -> Unit ) : RecyclerView.ViewHolder(binding.root) { diff --git a/presentation/src/main/java/com/going/presentation/todo/change/TodoChangeActivity.kt b/presentation/src/main/java/com/going/presentation/todo/change/TodoChangeActivity.kt index 85c68f07..296ad2d0 100644 --- a/presentation/src/main/java/com/going/presentation/todo/change/TodoChangeActivity.kt +++ b/presentation/src/main/java/com/going/presentation/todo/change/TodoChangeActivity.kt @@ -27,7 +27,7 @@ class TodoChangeActivity : BaseActivity(R.layout.acti private val viewModel by viewModels() - private var _adapter: TodoAllocatorAdapter? = null + private var _adapter: ChangeAllocatorAdapter? = null private val adapter get() = requireNotNull(_adapter) { getString(R.string.adapter_not_initialized_error_msg) } @@ -115,7 +115,7 @@ class TodoChangeActivity : BaseActivity(R.layout.acti } private fun initOurTodoNameListAdapter() { - _adapter = TodoAllocatorAdapter { position -> + _adapter = ChangeAllocatorAdapter { position -> viewModel.allocatorModelList[position].also { it.isAllocated = !it.isAllocated } viewModel.checkIsFinishAvailable() } diff --git a/presentation/src/main/java/com/going/presentation/todo/create/TripParticipantAdapter.kt b/presentation/src/main/java/com/going/presentation/todo/create/CreateParticipantAdapter.kt similarity index 75% rename from presentation/src/main/java/com/going/presentation/todo/create/TripParticipantAdapter.kt rename to presentation/src/main/java/com/going/presentation/todo/create/CreateParticipantAdapter.kt index 78d101b1..227f369c 100644 --- a/presentation/src/main/java/com/going/presentation/todo/create/TripParticipantAdapter.kt +++ b/presentation/src/main/java/com/going/presentation/todo/create/CreateParticipantAdapter.kt @@ -7,18 +7,18 @@ import com.going.domain.entity.response.TripParticipantModel import com.going.presentation.databinding.ItemTodoCreateNameBinding import com.going.ui.util.ItemDiffCallback -class TripParticipantAdapter( +class CreateParticipantAdapter( private val isFixed: Boolean, private val itemClick: (Int) -> Unit -) : ListAdapter(diffUtil) { +) : ListAdapter(diffUtil) { - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): TripParticipantViewHolder { + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CreateParticipantViewHolder { val binding: ItemTodoCreateNameBinding = ItemTodoCreateNameBinding.inflate(LayoutInflater.from(parent.context), parent, false) - return TripParticipantViewHolder(binding, isFixed, itemClick) + return CreateParticipantViewHolder(binding, isFixed, itemClick) } - override fun onBindViewHolder(holder: TripParticipantViewHolder, position: Int) { + override fun onBindViewHolder(holder: CreateParticipantViewHolder, position: Int) { holder.onBind(getItem(position), position) } diff --git a/presentation/src/main/java/com/going/presentation/todo/create/TripParticipantViewHolder.kt b/presentation/src/main/java/com/going/presentation/todo/create/CreateParticipantViewHolder.kt similarity index 97% rename from presentation/src/main/java/com/going/presentation/todo/create/TripParticipantViewHolder.kt rename to presentation/src/main/java/com/going/presentation/todo/create/CreateParticipantViewHolder.kt index af75cd97..21b2fec5 100644 --- a/presentation/src/main/java/com/going/presentation/todo/create/TripParticipantViewHolder.kt +++ b/presentation/src/main/java/com/going/presentation/todo/create/CreateParticipantViewHolder.kt @@ -6,7 +6,7 @@ import com.going.presentation.R import com.going.presentation.databinding.ItemTodoCreateNameBinding import com.going.ui.extension.colorOf -class TripParticipantViewHolder( +class CreateParticipantViewHolder( val binding: ItemTodoCreateNameBinding, private val isFixed: Boolean, private val itemClick: (Int) -> Unit diff --git a/presentation/src/main/java/com/going/presentation/todo/create/TodoCreateActivity.kt b/presentation/src/main/java/com/going/presentation/todo/create/TodoCreateActivity.kt index a4977be2..52fd4517 100644 --- a/presentation/src/main/java/com/going/presentation/todo/create/TodoCreateActivity.kt +++ b/presentation/src/main/java/com/going/presentation/todo/create/TodoCreateActivity.kt @@ -27,7 +27,7 @@ class TodoCreateActivity : BaseActivity(R.layout.acti private val viewModel by viewModels() - private var _adapter: TripParticipantAdapter? = null + private var _adapter: CreateParticipantAdapter? = null private val adapter get() = requireNotNull(_adapter) { getString(R.string.adapter_not_initialized_error_msg) } @@ -104,7 +104,7 @@ class TodoCreateActivity : BaseActivity(R.layout.acti } private fun initOurTodoNameListAdapter() { - _adapter = TripParticipantAdapter(false) { position -> + _adapter = CreateParticipantAdapter(false) { position -> viewModel.participantModelList[position].also { it.isSelected = !it.isSelected } viewModel.checkIsFinishAvailable() } diff --git a/presentation/src/main/java/com/going/presentation/todo/detail/TripAllocatorAdapter.kt b/presentation/src/main/java/com/going/presentation/todo/detail/DetailAllocatorAdapter.kt similarity index 76% rename from presentation/src/main/java/com/going/presentation/todo/detail/TripAllocatorAdapter.kt rename to presentation/src/main/java/com/going/presentation/todo/detail/DetailAllocatorAdapter.kt index 3d6144de..88d7719d 100644 --- a/presentation/src/main/java/com/going/presentation/todo/detail/TripAllocatorAdapter.kt +++ b/presentation/src/main/java/com/going/presentation/todo/detail/DetailAllocatorAdapter.kt @@ -7,16 +7,16 @@ import com.going.domain.entity.response.TodoAllocatorModel import com.going.presentation.databinding.ItemTodoCreateNameBinding import com.going.ui.util.ItemDiffCallback -class TripAllocatorAdapter : ListAdapter(diffUtil) { +class DetailAllocatorAdapter : ListAdapter(diffUtil) { - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): TripAllocatorViewHolder { + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): DetailAllocatorViewHolder { val inflater by lazy { LayoutInflater.from(parent.context) } val binding: ItemTodoCreateNameBinding = ItemTodoCreateNameBinding.inflate(inflater, parent, false) - return TripAllocatorViewHolder(binding) + return DetailAllocatorViewHolder(binding) } - override fun onBindViewHolder(holder: TripAllocatorViewHolder, position: Int) { + override fun onBindViewHolder(holder: DetailAllocatorViewHolder, position: Int) { holder.onBind(getItem(position)) } diff --git a/presentation/src/main/java/com/going/presentation/todo/detail/TripAllocatorViewHolder.kt b/presentation/src/main/java/com/going/presentation/todo/detail/DetailAllocatorViewHolder.kt similarity index 96% rename from presentation/src/main/java/com/going/presentation/todo/detail/TripAllocatorViewHolder.kt rename to presentation/src/main/java/com/going/presentation/todo/detail/DetailAllocatorViewHolder.kt index 20185e00..62fe6c1c 100644 --- a/presentation/src/main/java/com/going/presentation/todo/detail/TripAllocatorViewHolder.kt +++ b/presentation/src/main/java/com/going/presentation/todo/detail/DetailAllocatorViewHolder.kt @@ -6,7 +6,7 @@ import com.going.presentation.R import com.going.presentation.databinding.ItemTodoCreateNameBinding import com.going.ui.extension.colorOf -class TripAllocatorViewHolder( +class DetailAllocatorViewHolder( val binding: ItemTodoCreateNameBinding ) : RecyclerView.ViewHolder(binding.root) { diff --git a/presentation/src/main/java/com/going/presentation/todo/detail/TodoDetailActivity.kt b/presentation/src/main/java/com/going/presentation/todo/detail/TodoDetailActivity.kt index 50ed3b6f..d1dd0b2d 100644 --- a/presentation/src/main/java/com/going/presentation/todo/detail/TodoDetailActivity.kt +++ b/presentation/src/main/java/com/going/presentation/todo/detail/TodoDetailActivity.kt @@ -31,7 +31,7 @@ class TodoDetailActivity : private val viewModel by viewModels() - private var _adapter: TripAllocatorAdapter? = null + private var _adapter: DetailAllocatorAdapter? = null private val adapter get() = requireNotNull(_adapter) { getString(R.string.adapter_not_initialized_error_msg) } @@ -89,7 +89,7 @@ class TodoDetailActivity : private fun initAllocatorListAdapter() { if (viewModel.isPublic) { - _adapter = TripAllocatorAdapter() + _adapter = DetailAllocatorAdapter() binding.rvOurTodoDetailPerson.adapter = adapter } } diff --git a/presentation/src/main/java/com/going/presentation/todo/allocator/TodoAllocatorAdapter.kt b/presentation/src/main/java/com/going/presentation/todo/list/ListAllocatorAdapter.kt similarity index 75% rename from presentation/src/main/java/com/going/presentation/todo/allocator/TodoAllocatorAdapter.kt rename to presentation/src/main/java/com/going/presentation/todo/list/ListAllocatorAdapter.kt index befbde4b..33b39541 100644 --- a/presentation/src/main/java/com/going/presentation/todo/allocator/TodoAllocatorAdapter.kt +++ b/presentation/src/main/java/com/going/presentation/todo/list/ListAllocatorAdapter.kt @@ -1,4 +1,4 @@ -package com.going.presentation.todo.allocator +package com.going.presentation.todo.list import android.view.LayoutInflater import android.view.ViewGroup @@ -7,18 +7,18 @@ import com.going.domain.entity.response.TodoListAllocatorModel import com.going.presentation.databinding.ItemTodoNameBinding import com.going.ui.util.ItemDiffCallback -class TodoAllocatorAdapter( +class ListAllocatorAdapter( private val isCompleted: Boolean -) : ListAdapter(diffUtil) { +) : ListAdapter(diffUtil) { - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): TodoAllocatorViewHolder { + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ListAllocatorViewHolder { val inflater by lazy { LayoutInflater.from(parent.context) } val binding: ItemTodoNameBinding = ItemTodoNameBinding.inflate(inflater, parent, false) - return TodoAllocatorViewHolder(binding, isCompleted) + return ListAllocatorViewHolder(binding, isCompleted) } - override fun onBindViewHolder(holder: TodoAllocatorViewHolder, position: Int) { + override fun onBindViewHolder(holder: ListAllocatorViewHolder, position: Int) { holder.onBind(getItem(position)) } diff --git a/presentation/src/main/java/com/going/presentation/todo/allocator/TodoAllocatorViewHolder.kt b/presentation/src/main/java/com/going/presentation/todo/list/ListAllocatorViewHolder.kt similarity index 93% rename from presentation/src/main/java/com/going/presentation/todo/allocator/TodoAllocatorViewHolder.kt rename to presentation/src/main/java/com/going/presentation/todo/list/ListAllocatorViewHolder.kt index 4169aa2d..d0b5cd19 100644 --- a/presentation/src/main/java/com/going/presentation/todo/allocator/TodoAllocatorViewHolder.kt +++ b/presentation/src/main/java/com/going/presentation/todo/list/ListAllocatorViewHolder.kt @@ -1,4 +1,4 @@ -package com.going.presentation.todo.allocator +package com.going.presentation.todo.list import androidx.recyclerview.widget.RecyclerView import com.going.domain.entity.response.TodoListAllocatorModel @@ -6,7 +6,7 @@ import com.going.presentation.R import com.going.presentation.databinding.ItemTodoNameBinding import com.going.ui.extension.colorOf -class TodoAllocatorViewHolder( +class ListAllocatorViewHolder( val binding: ItemTodoNameBinding, private val isCompleted: Boolean ) : RecyclerView.ViewHolder(binding.root) { diff --git a/presentation/src/main/java/com/going/presentation/todo/mytodo/todolist/MyTodoListViewHolder.kt b/presentation/src/main/java/com/going/presentation/todo/mytodo/todolist/MyTodoListViewHolder.kt index bea34144..ca45f004 100644 --- a/presentation/src/main/java/com/going/presentation/todo/mytodo/todolist/MyTodoListViewHolder.kt +++ b/presentation/src/main/java/com/going/presentation/todo/mytodo/todolist/MyTodoListViewHolder.kt @@ -5,7 +5,7 @@ import androidx.recyclerview.widget.RecyclerView import com.going.domain.entity.response.TodoModel import com.going.presentation.R import com.going.presentation.databinding.ItemMyTodoBinding -import com.going.presentation.todo.allocator.TodoAllocatorAdapter +import com.going.presentation.todo.list.ListAllocatorAdapter import com.going.ui.extension.colorOf import com.going.ui.extension.setOnSingleClickListener @@ -28,7 +28,7 @@ class MyTodoListViewHolder( cbMyTodoSelected.isVisible = isCompleted cbMyTodoUnselected.isVisible = !isCompleted - rvMyTodoName.adapter = TodoAllocatorAdapter(isCompleted).apply { + rvMyTodoName.adapter = ListAllocatorAdapter(isCompleted).apply { submitList(item.allocators) } diff --git a/presentation/src/main/java/com/going/presentation/todo/ourtodo/OurTodoFragment.kt b/presentation/src/main/java/com/going/presentation/todo/ourtodo/OurTodoFragment.kt index b6528e88..3fd6b29c 100644 --- a/presentation/src/main/java/com/going/presentation/todo/ourtodo/OurTodoFragment.kt +++ b/presentation/src/main/java/com/going/presentation/todo/ourtodo/OurTodoFragment.kt @@ -135,7 +135,8 @@ class OurTodoFragment() : BaseFragment(R.layout.fragment binding.btnOurTripFriend.setOnSingleClickListener { CheckFriendsActivity.createIntent( requireContext(), - viewModel.tripId + viewModel.tripId, + viewModel.inviteCode ).apply { startActivity(this) } } } diff --git a/presentation/src/main/java/com/going/presentation/todo/ourtodo/checkfriends/CheckFriendsActivity.kt b/presentation/src/main/java/com/going/presentation/todo/ourtodo/checkfriends/CheckFriendsActivity.kt index eef8a08e..9cdad3a8 100644 --- a/presentation/src/main/java/com/going/presentation/todo/ourtodo/checkfriends/CheckFriendsActivity.kt +++ b/presentation/src/main/java/com/going/presentation/todo/ourtodo/checkfriends/CheckFriendsActivity.kt @@ -7,6 +7,7 @@ import android.text.SpannableStringBuilder import android.text.Spanned import android.text.style.ForegroundColorSpan import androidx.activity.viewModels +import androidx.core.view.isVisible import androidx.lifecycle.flowWithLifecycle import androidx.lifecycle.lifecycleScope import com.going.domain.entity.response.CheckFriendsModel @@ -14,6 +15,7 @@ import com.going.presentation.R import com.going.presentation.databinding.ActivityCheckFriendsBinding import com.going.presentation.profile.participant.ParticipantProfileActivity import com.going.presentation.todo.TodoActivity.Companion.EXTRA_TRIP_ID +import com.going.presentation.todo.ourtodo.invite.FriendInviteEmptyDialog import com.going.ui.base.BaseActivity import com.going.ui.extension.colorOf import com.going.ui.extension.setOnSingleClickListener @@ -33,6 +35,8 @@ class CheckFriendsActivity : private val viewModel by viewModels() + private var friendInviteDialog: FriendInviteEmptyDialog? = null + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -84,11 +88,28 @@ class CheckFriendsActivity : } private fun setFriendsData(data: CheckFriendsModel) { - adapter.submitList(data.participants) + if (data.participants.size == 1) { + binding.layoutCheckFriendsEmpty.isVisible = true + setInviteCode() + initInviteBtnListener() + } else { + binding.svCheckFriends.isVisible = true + adapter.submitList(data.participants) + setProgressBarStatus(data.styles.map { it.rates }) + setCountStatus(data.styles.map { it.counts }) + setResultTextColor(data.bestPrefer) + } + } - setProgressBarStatus(data.styles.map { it.rates }) - setCountStatus(data.styles.map { it.counts }) - setResultTextColor(data.bestPrefer) + private fun setInviteCode() { + viewModel.inviteCode = intent.getStringExtra(INVITE_CODE) + } + + private fun initInviteBtnListener() { + binding.btnCheckFriendsInvite.setOnSingleClickListener { + friendInviteDialog = FriendInviteEmptyDialog() + friendInviteDialog?.show(supportFragmentManager, INVITE_DIALOG) + } } private fun setProgressBarStatus(rates: List>) { @@ -203,17 +224,22 @@ class CheckFriendsActivity : override fun onDestroy() { super.onDestroy() _adapter = null + if (friendInviteDialog?.isAdded == true) friendInviteDialog?.dismiss() } companion object { private const val TRIP_ID = "TRIP_ID" + private const val INVITE_CODE = "INVITE_CODE" + private const val INVITE_DIALOG = "INVITE_DIALOG" @JvmStatic fun createIntent( context: Context, - tripId: Long + tripId: Long, + inviteCode: String ): Intent = Intent(context, CheckFriendsActivity::class.java).apply { putExtra(TRIP_ID, tripId) + putExtra(INVITE_CODE, inviteCode) } } diff --git a/presentation/src/main/java/com/going/presentation/todo/ourtodo/checkfriends/CheckFriendsViewHolder.kt b/presentation/src/main/java/com/going/presentation/todo/ourtodo/checkfriends/CheckFriendsViewHolder.kt index 712e26ef..f85b2f25 100644 --- a/presentation/src/main/java/com/going/presentation/todo/ourtodo/checkfriends/CheckFriendsViewHolder.kt +++ b/presentation/src/main/java/com/going/presentation/todo/ourtodo/checkfriends/CheckFriendsViewHolder.kt @@ -26,7 +26,8 @@ class CheckFriendsViewHolder( 4 -> R.drawable.img_profile_8 5 -> R.drawable.img_profile_5 6 -> R.drawable.img_profile_7 - else -> R.drawable.img_profile_3 + 7 -> R.drawable.img_profile_3 + else -> R.drawable.img_profile_guest } ivTodoFriend.load(profileImage) { transformations(CircleCropTransformation()) diff --git a/presentation/src/main/java/com/going/presentation/todo/ourtodo/checkfriends/CheckFriendsViewModel.kt b/presentation/src/main/java/com/going/presentation/todo/ourtodo/checkfriends/CheckFriendsViewModel.kt index f2f01568..5f311316 100644 --- a/presentation/src/main/java/com/going/presentation/todo/ourtodo/checkfriends/CheckFriendsViewModel.kt +++ b/presentation/src/main/java/com/going/presentation/todo/ourtodo/checkfriends/CheckFriendsViewModel.kt @@ -19,6 +19,8 @@ class CheckFriendsViewModel @Inject constructor( private val _checkFriendsListState = MutableStateFlow>(UiState.Empty) val checkFriendsListState: StateFlow> get() = _checkFriendsListState + var inviteCode: String? = "" + fun getFriendsListFromServer( tripId: Long ) { diff --git a/presentation/src/main/java/com/going/presentation/todo/ourtodo/invite/FriendInviteEmptyDialog.kt b/presentation/src/main/java/com/going/presentation/todo/ourtodo/invite/FriendInviteEmptyDialog.kt new file mode 100644 index 00000000..3ff29c00 --- /dev/null +++ b/presentation/src/main/java/com/going/presentation/todo/ourtodo/invite/FriendInviteEmptyDialog.kt @@ -0,0 +1,65 @@ +package com.going.presentation.todo.ourtodo.invite + +import android.content.ClipData +import android.content.ClipboardManager +import android.content.Context +import android.os.Build +import android.os.Bundle +import android.view.View +import android.view.WindowManager +import androidx.fragment.app.activityViewModels +import com.going.presentation.R +import com.going.presentation.databinding.FragmentFriendInviteDialogBinding +import com.going.presentation.todo.ourtodo.checkfriends.CheckFriendsViewModel +import com.going.ui.base.BaseDialog +import com.going.ui.extension.setOnSingleClickListener +import com.going.ui.extension.toast + +class FriendInviteEmptyDialog : + BaseDialog(R.layout.fragment_friend_invite_dialog) { + + private val viewModel by activityViewModels() + + override fun onStart() { + super.onStart() + dialog?.window?.apply { + setLayout( + WindowManager.LayoutParams.MATCH_PARENT, + WindowManager.LayoutParams.WRAP_CONTENT, + ) + setBackgroundDrawableResource(R.color.transparent) + } + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + + setInviteCode() + initExitBtnListener() + initLinkInviteBtnListener() + } + + private fun setInviteCode() { + binding.tvTodoInviteCode.text = viewModel.inviteCode + } + + private fun initExitBtnListener() { + binding.btnTodoInviteFinish.setOnSingleClickListener { + dismiss() + } + } + + private fun initLinkInviteBtnListener() { + binding.tvTodoInviteTermsText.setOnSingleClickListener { + val clipboardManager = + requireContext().getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager + val clipData = ClipData.newPlainText(CLIP_LABEL, viewModel.inviteCode) + clipboardManager.setPrimaryClip(clipData) + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.S_V2) toast(getString(R.string.finish_trip_tv_copy_code_complete)) + } + } + + companion object { + const val CLIP_LABEL = "RECOMMEND_LINK" + } +} diff --git a/presentation/src/main/java/com/going/presentation/todo/ourtodo/todolist/OurTodoListViewHolder.kt b/presentation/src/main/java/com/going/presentation/todo/ourtodo/todolist/OurTodoListViewHolder.kt index ded7c72c..ea6c3120 100644 --- a/presentation/src/main/java/com/going/presentation/todo/ourtodo/todolist/OurTodoListViewHolder.kt +++ b/presentation/src/main/java/com/going/presentation/todo/ourtodo/todolist/OurTodoListViewHolder.kt @@ -5,7 +5,7 @@ import androidx.recyclerview.widget.RecyclerView import com.going.domain.entity.response.TodoModel import com.going.presentation.R import com.going.presentation.databinding.ItemOurTodoBinding -import com.going.presentation.todo.allocator.TodoAllocatorAdapter +import com.going.presentation.todo.list.ListAllocatorAdapter import com.going.ui.extension.colorOf import com.going.ui.extension.setOnSingleClickListener @@ -25,7 +25,7 @@ class OurTodoListViewHolder( } else { rvOurTodoName.visibility = View.VISIBLE layoutOurTodoEmptyAllocator.visibility = View.INVISIBLE - rvOurTodoName.adapter = TodoAllocatorAdapter(isCompleted).apply { + rvOurTodoName.adapter = ListAllocatorAdapter(isCompleted).apply { submitList(item.allocators) } } diff --git a/presentation/src/main/res/drawable/ic_empty_check_friends.xml b/presentation/src/main/res/drawable/ic_empty_check_friends.xml new file mode 100644 index 00000000..f915c76c --- /dev/null +++ b/presentation/src/main/res/drawable/ic_empty_check_friends.xml @@ -0,0 +1,158 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/presentation/src/main/res/layout/activity_change_tag.xml b/presentation/src/main/res/layout/activity_change_tag.xml index eba0d1d2..e193b149 100644 --- a/presentation/src/main/res/layout/activity_change_tag.xml +++ b/presentation/src/main/res/layout/activity_change_tag.xml @@ -19,7 +19,6 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:background="@drawable/layer_list_preference_tag_gray100_line" - android:backgroundTint="@color/white_000" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> @@ -77,7 +76,6 @@ android:layout_marginHorizontal="24dp" android:layout_marginBottom="22dp" android:background="@drawable/sel_rounded_corner_button" - android:enabled="false" android:outlineProvider="none" android:text="@string/change_tag_btn_change" android:textColor="@color/gray_200" diff --git a/presentation/src/main/res/layout/activity_check_friends.xml b/presentation/src/main/res/layout/activity_check_friends.xml index 8cc88faf..c7e87594 100644 --- a/presentation/src/main/res/layout/activity_check_friends.xml +++ b/presentation/src/main/res/layout/activity_check_friends.xml @@ -46,8 +46,10 @@ + + + + + + + + + + diff --git a/presentation/src/main/res/layout/activity_enter_preference.xml b/presentation/src/main/res/layout/activity_enter_preference.xml index 5b02ad06..341a7cac 100644 --- a/presentation/src/main/res/layout/activity_enter_preference.xml +++ b/presentation/src/main/res/layout/activity_enter_preference.xml @@ -18,7 +18,6 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:background="@drawable/layer_list_preference_tag_gray100_line" - android:backgroundTint="@color/white_000" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> diff --git a/presentation/src/main/res/layout/activity_finish_preference.xml b/presentation/src/main/res/layout/activity_finish_preference.xml index 9db8388d..9abb9d59 100644 --- a/presentation/src/main/res/layout/activity_finish_preference.xml +++ b/presentation/src/main/res/layout/activity_finish_preference.xml @@ -10,7 +10,7 @@ + app:layout_constraintTop_toTopOf="@id/tv_profile_name" + app:layout_constraintBottom_toBottomOf="@id/tv_profile_one_line"/> @@ -142,11 +141,12 @@ android:id="@+id/view_gray" android:layout_width="wrap_content" android:layout_height="8dp" - android:layout_marginTop="22dp" + android:layout_marginTop="26dp" android:background="@color/gray_50" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@id/iv_profile" /> + app:layout_constraintTop_toBottomOf="@id/tv_profile_one_line" + app:layout_constraintBottom_toBottomOf="parent"/> diff --git a/presentation/src/main/res/layout/activity_profile.xml b/presentation/src/main/res/layout/activity_profile.xml index 52f24fd7..db7a617d 100644 --- a/presentation/src/main/res/layout/activity_profile.xml +++ b/presentation/src/main/res/layout/activity_profile.xml @@ -82,25 +82,25 @@ android:layout_width="wrap_content" android:layout_height="0dp" android:layout_marginStart="24dp" - android:layout_marginTop="23dp" android:src="@drawable/img_profile_guest" app:civ_border_color="@color/gray_100" app:civ_border_width="1dp" - app:layout_constraintBottom_toTopOf="@id/view_gray" app:layout_constraintDimensionRatio="1" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintTop_toTopOf="@id/tv_profile_name" + app:layout_constraintBottom_toBottomOf="@id/tv_profile_one_line"/> + app:layout_constraintTop_toBottomOf="@id/tv_profile_one_line" + app:layout_constraintBottom_toBottomOf="parent"/> - - + - + - + + + diff --git a/presentation/src/main/res/values/strings.xml b/presentation/src/main/res/values/strings.xml index 034575d3..ca019eef 100644 --- a/presentation/src/main/res/values/strings.xml +++ b/presentation/src/main/res/values/strings.xml @@ -6,15 +6,15 @@ %s Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. - 서버 통신에 실패했습니다 + 서버 통신에 실패했어요 닉네임에는 공백만 입력할 수 없어요 - 닉네임은 3자 이하여야 합니다 - 자기소개는 20자 이하여야 합니다 - 여행 이름은 15자 이하여야 합니다 - 할일은 15자 이하여야 합니다 + 닉네임은 3자 이하여야 해요 + 자기소개는 20자 이하여야 해요 + 여행 이름은 15자 이하여야 해요 + 할일은 15자 이하여야 해요 제목에는 공백만 입력할 수 없어요 - 메모는 1000자 이하여야 합니다 - 종료일이 시작일보다 빨라야합니다 + 메모는 1000자 이하여야 해요 + 종료일이 시작일보다 빨라야해요 해당 기능은 추후 업데이트 예정이에요 :) @@ -23,7 +23,7 @@ 개인정보처리방침 - 버튼을 한번 더 누르면 종료됩니다 + 버튼을 한번 더 누르면 종료돼요 #%s %1$d/%2$d @@ -181,10 +181,10 @@ 두릅이 나는 두릅이 좋다. 다시 해볼래요 - 존재하지 않는 여행입니다. + 존재하지 않는 여행이에요 프로필 수정 이미지가 저장되었어요\n친구들에게 공유해보세요! - 이미지를 저장할 수 없습니다\n안드로이드 버전을 확인해주세요 + 이미지를 저장할 수 없어요\n안드로이드 버전을 확인해주세요 나의 여행 캐릭터 여행 취향 태그 @@ -192,7 +192,7 @@ 여행 캐릭터 검사하러 가기 여행 캐릭터 검사를 아직 진행하지 않았어요 지금 바로 나를 대신 할 여행 캐릭터를 만나보세요! - %s의 여행 프로필 + 친구 여행 프로필 여행 입장하기 @@ -200,9 +200,9 @@ 친구에게 받은 초대코드 6자리를 입력해 주세요 잘못된 초대코드예요 초대코드 확인하기 - 존재하지 않는 여행입니다 - 입장할 수 있는 최대 인원은 6명입니다 - 이미 존재하는 참가자입니다 + 존재하지 않는 여행이에요 + 입장할 수 있는 최대 인원은 6명이에요 + 이미 존재하는 참가자에요 초대받은 여행이 맞는지\n 확인해 주세요 @@ -213,21 +213,18 @@ 우리의 여행 취향 프로필 사진을 눌러서 친구의 취향을 구경해보세요  %d명 + 상관없어 여행 계획 철저하게 - 아무렇게 즉흥으로 여행 장소 관광지 - 어디든 로컬장소 식당 유명 맛집 - 아무데나 가까운 곳 사진 - 사진필수 - 상관없어 + 사진 필수 눈에 담기 여행 일정 알차게 @@ -238,6 +235,8 @@ %s에 대한 여행 취향이 잘 맞네요! 달라서 즐거운 여행! 친구와 서로의 취향을 이야기해 봐요 최고의 여행 친구! 모든 여행 취향이 일치해요 + 아직 함께하는 친구들이 없어요!\n친구를 초대하고 함께 여행 취향을 알아보세요 + 여행 친구 초대하기 카카오톡 초대코드 오류 @@ -257,7 +256,7 @@ %1$d.%2$d.%3$d 시작일을 먼저 입력해 주세요 여행방 나가기 - 나가기를 하면 정보가 모두 삭제되고,\n여행 목록에서도 삭제됩니다 + 나가기를 하면 정보가 모두 삭제되고,\n 여행 목록에서도 삭제돼요 나가기 취소 여행 이름에는 공백만 입력할 수 없어요