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

snack bar 확장함수 추가, 캘린더 버그 수정 및 연도 표시 추가 #88

Merged
merged 2 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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