Skip to content

Commit

Permalink
πŸ”€ #88 from boostcampwm-2022/fix/my_run_calendar
Browse files Browse the repository at this point in the history
snack bar ν™•μž₯ν•¨μˆ˜ μΆ”κ°€, μΊ˜λ¦°λ” 버그 μˆ˜μ • 및 연도 ν‘œμ‹œ μΆ”κ°€
  • Loading branch information
peter-j0y authored Dec 9, 2022
2 parents 6ad645e + 2ae0d0e commit a26b243
Show file tree
Hide file tree
Showing 13 changed files with 69 additions and 205 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import androidx.fragment.app.activityViewModels
import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.findNavController
import androidx.paging.LoadState
import com.google.android.material.snackbar.Snackbar
import com.whyranoid.presentation.R
import com.whyranoid.presentation.base.BaseFragment
import com.whyranoid.presentation.databinding.FragmentCommunityItemBinding
import com.whyranoid.presentation.util.getSerializableData
import com.whyranoid.presentation.util.makeSnackBar
import com.whyranoid.presentation.util.repeatWhenUiStarted
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.collectLatest
Expand Down Expand Up @@ -73,34 +73,20 @@ internal class CommunityItemFragment :
is Event.JoinGroup -> {
if (category == CommunityCategory.BOARD) {
if (event.isSuccess) {
Snackbar.make(
binding.root,
getString(R.string.text_join_group_success),
Snackbar.LENGTH_SHORT
).show()
binding.root.makeSnackBar(getString(R.string.text_join_group_success))
.show()
} else {
Snackbar.make(
binding.root,
getString(R.string.text_join_group_fail),
Snackbar.LENGTH_SHORT
).show()
binding.root.makeSnackBar(getString(R.string.text_join_group_fail)).show()
}
}
}
is Event.DeletePost -> {
if (category == CommunityCategory.MY_POST) {
if (event.isSuccess) {
Snackbar.make(
binding.root,
getString(R.string.text_delete_post_success),
Snackbar.LENGTH_SHORT
).show()
binding.root.makeSnackBar(getString(R.string.text_delete_post_success))
.show()
} else {
Snackbar.make(
binding.root,
getString(R.string.text_delete_post_fail),
Snackbar.LENGTH_SHORT
).show()
binding.root.makeSnackBar(getString(R.string.text_delete_post_fail)).show()
}
}
}
Expand Down Expand Up @@ -168,13 +154,10 @@ internal class CommunityItemFragment :
val postAdapter = PostAdapter(
isMyPost = true,
itemLongClickListener = { postId ->
Snackbar.make(
binding.root,
getString(R.string.text_check_delete_post),
Snackbar.LENGTH_SHORT
).setAction(R.string.text_delete) {
viewModel.deletePost(postId)
}.show()
binding.root.makeSnackBar(getString(R.string.text_check_delete_post))
.setAction(R.string.text_delete) {
viewModel.deletePost(postId)
}.show()
}
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import androidx.compose.ui.platform.ViewCompositionStrategy
import androidx.fragment.app.viewModels
import androidx.navigation.fragment.findNavController
import com.google.android.material.chip.Chip
import com.google.android.material.snackbar.Snackbar
import com.whyranoid.presentation.R
import com.whyranoid.presentation.base.BaseFragment
import com.whyranoid.presentation.compose.RulePicker
import com.whyranoid.presentation.databinding.FragmentCreateGroupBinding
import com.whyranoid.presentation.util.makeSnackBar
import com.whyranoid.presentation.util.repeatWhenUiStarted
import dagger.hilt.android.AndroidEntryPoint

Expand Down Expand Up @@ -79,42 +79,22 @@ internal class CreateGroupFragment :
when (event) {
is Event.CreateGroupButtonClick -> {
if (event.isSuccess) {
Snackbar.make(
binding.root,
getString(R.string.text_create_group_success),
Snackbar.LENGTH_SHORT
).show()
binding.root.makeSnackBar(getString(R.string.text_create_group_success)).show()
findNavController().popBackStack()
} else {
Snackbar.make(
binding.root,
getString(R.string.text_create_group_fail),
Snackbar.LENGTH_SHORT
).show()
binding.root.makeSnackBar(getString(R.string.text_create_group_fail)).show()
}
}
is Event.DuplicateCheckButtonClick -> {
if (event.isDuplicatedGroupName) {
Snackbar.make(
binding.root,
getString(R.string.text_duplicated_group_name),
Snackbar.LENGTH_SHORT
).show()
binding.root.makeSnackBar(getString(R.string.text_duplicated_group_name)).show()
} else {
Snackbar.make(
binding.root,
getString(R.string.text_un_duplicated_group_name),
Snackbar.LENGTH_SHORT
).show()
binding.root.makeSnackBar(getString(R.string.text_un_duplicated_group_name)).show()
binding.etGroupName.isEnabled = false
}
}
is Event.WarningButtonClick -> {
Snackbar.make(
binding.root,
getString(R.string.text_warning_create_group),
Snackbar.LENGTH_SHORT
).show()
binding.root.makeSnackBar(getString(R.string.text_warning_create_group)).show()
}
is Event.AddRuleButtonClick -> {
binding.composeView.apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import androidx.fragment.app.viewModels
import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs
import com.google.android.material.snackbar.Snackbar
import com.whyranoid.presentation.R
import com.whyranoid.presentation.base.BaseFragment
import com.whyranoid.presentation.databinding.FragmentGroupDetailBinding
import com.whyranoid.presentation.util.makeSnackBar
import com.whyranoid.presentation.util.repeatWhenUiStarted
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.collectLatest
Expand Down Expand Up @@ -93,52 +93,30 @@ internal class GroupDetailFragment :
private fun handleEvent(event: Event) {
when (event) {
Event.RecruitButtonClick -> {
Snackbar.make(
binding.root,
getString(R.string.text_check_recruit),
Snackbar.LENGTH_SHORT
).setAction(R.string.text_recruit) {
viewModel.onRecruitSnackBarButtonClick()
}.show()
binding.root.makeSnackBar(getString(R.string.text_check_recruit))
.setAction(R.string.text_recruit) {
viewModel.onRecruitSnackBarButtonClick()
}.show()
}
is Event.RecruitSnackBarButtonClick -> {
if (event.isSuccess) {
Snackbar.make(
binding.root,
getString(R.string.text_recruit_success),
Snackbar.LENGTH_SHORT
).show()
binding.root.makeSnackBar(getString(R.string.text_recruit_success)).show()
} else {
Snackbar.make(
binding.root,
getString(R.string.text_recruit_fail),
Snackbar.LENGTH_SHORT
).show()
binding.root.makeSnackBar(getString(R.string.text_recruit_fail)).show()
}
}
Event.ExitGroupButtonClick -> {
Snackbar.make(
binding.root,
getString(R.string.text_check_exit_group),
Snackbar.LENGTH_SHORT
).setAction(getString(R.string.text_exit_group)) {
viewModel.onExitGroupSnackBarButtonClick()
}.show()
binding.root.makeSnackBar(getString(R.string.text_check_exit_group))
.setAction(getString(R.string.text_exit_group)) {
viewModel.onExitGroupSnackBarButtonClick()
}.show()
}
is Event.ExitGroupSnackBarButtonClick -> {
if (event.isSuccess) {
Snackbar.make(
binding.root,
getString(R.string.text_exit_group_success),
Snackbar.LENGTH_SHORT
).show()
binding.root.makeSnackBar(getString(R.string.text_exit_group_success)).show()
findNavController().popBackStack()
} else {
Snackbar.make(
binding.root,
getString(R.string.text_exit_group_fail),
Snackbar.LENGTH_SHORT
).show()
binding.root.makeSnackBar(getString(R.string.text_exit_group_fail)).show()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import android.view.View
import androidx.fragment.app.viewModels
import androidx.navigation.fragment.findNavController
import com.google.android.material.chip.Chip
import com.google.android.material.snackbar.Snackbar
import com.whyranoid.presentation.R
import com.whyranoid.presentation.base.BaseFragment
import com.whyranoid.presentation.databinding.FragmentEditGroupBinding
import com.whyranoid.presentation.util.makeSnackBar
import com.whyranoid.presentation.util.repeatWhenUiStarted
import dagger.hilt.android.AndroidEntryPoint

Expand All @@ -33,22 +33,14 @@ internal class EditGroupFragment :
when (event) {
// TODO : λ‹€μ΄μ–΄λ‘œκ·Έλ‘œ 그룹을 μˆ˜μ •ν•  수 μžˆλ„λ‘ λ³€κ²½
is Event.AddRuleButtonClick -> {
Snackbar.make(binding.root, "λ£° μΆ”κ°€ 클릭", Snackbar.LENGTH_SHORT).show()
binding.root.makeSnackBar(getString(R.string.community_click_add_rule)).show()
}
is Event.EditGroupButtonClick -> {
if (event.isSuccess) {
Snackbar.make(
binding.root,
getString(R.string.text_edit_group_success),
Snackbar.LENGTH_SHORT
).show()
binding.root.makeSnackBar(getString(R.string.text_edit_group_success)).show()
findNavController().popBackStack()
} else {
Snackbar.make(
binding.root,
getString(R.string.text_edit_group_fail),
Snackbar.LENGTH_SHORT
).show()
binding.root.makeSnackBar(getString(R.string.text_edit_group_fail)).show()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import android.os.Bundle
import android.view.View
import androidx.fragment.app.viewModels
import androidx.navigation.fragment.findNavController
import com.google.android.material.snackbar.Snackbar
import com.whyranoid.presentation.R
import com.whyranoid.presentation.base.BaseFragment
import com.whyranoid.presentation.databinding.FragmentCreateRunningPostBinding
import com.whyranoid.presentation.model.UiState
import com.whyranoid.presentation.util.makeSnackBar
import com.whyranoid.presentation.util.repeatWhenUiStarted
import dagger.hilt.android.AndroidEntryPoint

Expand Down Expand Up @@ -74,12 +74,7 @@ internal class CreateRunningPostFragment :
true
}
R.id.warning_about_create_running_post_button -> {
Snackbar.make(
binding.root,
getString(R.string.community_warning_running_post),
Snackbar.LENGTH_SHORT
)
.show()
binding.root.makeSnackBar(getString(R.string.community_warning_running_post))
true
}
else -> {
Expand All @@ -95,21 +90,10 @@ internal class CreateRunningPostFragment :
val action =
CreateRunningPostFragmentDirections.actionCreateRunningPostFragmentToCommunityFragment()

Snackbar.make(
requireView(),
getString(R.string.community_success_create_running_post),
Snackbar.LENGTH_SHORT
)
.show()

requireView().makeSnackBar(getString(R.string.community_success_create_running_post))
findNavController().navigate(action)
} else {
Snackbar.make(
requireView(),
getString(R.string.community_fail_create_running_post),
Snackbar.LENGTH_SHORT
)
.show()
requireView().makeSnackBar(getString(R.string.community_fail_create_running_post))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import android.os.Bundle
import android.view.View
import androidx.fragment.app.viewModels
import androidx.navigation.fragment.findNavController
import com.google.android.material.snackbar.Snackbar
import com.whyranoid.presentation.R
import com.whyranoid.presentation.base.BaseFragment
import com.whyranoid.presentation.databinding.FragmentSelectRunningHistoryBinding
import com.whyranoid.presentation.model.RunningHistoryUiModel
import com.whyranoid.presentation.model.UiState
import com.whyranoid.presentation.util.makeSnackBar
import com.whyranoid.presentation.util.repeatWhenUiStarted
import dagger.hilt.android.AndroidEntryPoint

Expand Down Expand Up @@ -96,11 +96,8 @@ internal class SelectRunningHistoryFragment :
true
}
R.id.warning_select_running_history_button -> {
Snackbar.make(
binding.root,
getString(R.string.community_select_running_history_snack_bar),
Snackbar.LENGTH_SHORT
).show()
binding.root.makeSnackBar(getString(R.string.community_select_running_history_snack_bar))
.show()
true
}
else -> {
Expand Down
Loading

0 comments on commit a26b243

Please sign in to comment.