From 91fd4ff1a59f6546ef385bac1bcb8f8ba0a06515 Mon Sep 17 00:00:00 2001 From: Leekangmin Date: Thu, 25 Jan 2024 17:44:12 +0900 Subject: [PATCH] =?UTF-8?q?[feat/#45]=20toast=20->=20defaultToast=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../teumteum/presentation/home/HomeFragment.kt | 4 ++-- .../teumteum/presentation/moim/MoimConfirm.kt | 15 ++++++--------- .../teumteum/presentation/moim/MoimFragment.kt | 12 ++++-------- .../mypage/editCard/EditCardFragment.kt | 17 +++-------------- .../mypage/setting/fragment/SettingFragment.kt | 4 ++-- 5 files changed, 17 insertions(+), 35 deletions(-) diff --git a/app/src/main/java/com/teumteum/teumteum/presentation/home/HomeFragment.kt b/app/src/main/java/com/teumteum/teumteum/presentation/home/HomeFragment.kt index d4e1fd0b..f1e6004d 100644 --- a/app/src/main/java/com/teumteum/teumteum/presentation/home/HomeFragment.kt +++ b/app/src/main/java/com/teumteum/teumteum/presentation/home/HomeFragment.kt @@ -13,7 +13,7 @@ import com.teumteum.base.BindingFragment import com.teumteum.base.component.appbar.AppBarLayout import com.teumteum.base.component.appbar.AppBarMenu import com.teumteum.base.databinding.LayoutCommonAppbarBinding -import com.teumteum.base.util.extension.toast +import com.teumteum.base.util.extension.defaultToast import com.teumteum.domain.enumSet.EnumTopic import com.teumteum.teumteum.R import com.teumteum.teumteum.databinding.FragmentHomeBinding @@ -121,7 +121,7 @@ class HomeFragment : } is GroupListUiState.Failure -> { - requireActivity().toast(it.msg) + requireActivity().defaultToast(it.msg) } else -> {} diff --git a/app/src/main/java/com/teumteum/teumteum/presentation/moim/MoimConfirm.kt b/app/src/main/java/com/teumteum/teumteum/presentation/moim/MoimConfirm.kt index 41434c63..e9bc82a2 100644 --- a/app/src/main/java/com/teumteum/teumteum/presentation/moim/MoimConfirm.kt +++ b/app/src/main/java/com/teumteum/teumteum/presentation/moim/MoimConfirm.kt @@ -28,24 +28,24 @@ import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ButtonDefaults -import com.google.accompanist.pager.HorizontalPager -import androidx.compose.runtime.Composable import androidx.compose.material3.Text +import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect -import androidx.compose.ui.Modifier -import androidx.compose.ui.res.painterResource -import androidx.compose.ui.res.stringResource -import androidx.compose.ui.unit.dp import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clipToBounds import androidx.compose.ui.layout.ContentScale +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp import coil.compose.rememberAsyncImagePainter import com.google.accompanist.pager.ExperimentalPagerApi +import com.google.accompanist.pager.HorizontalPager import com.google.accompanist.pager.rememberPagerState import com.teumteum.base.BindingActivity import com.teumteum.base.component.compose.TeumDivider @@ -58,17 +58,14 @@ import com.teumteum.base.component.compose.TmMarginVerticalSpacer import com.teumteum.base.component.compose.TmScaffold import com.teumteum.base.component.compose.theme.TmTypo import com.teumteum.base.component.compose.theme.TmtmColorPalette -import com.teumteum.base.util.extension.toast import com.teumteum.domain.entity.Friend import com.teumteum.teumteum.R -import com.teumteum.teumteum.presentation.MainActivity import com.teumteum.teumteum.presentation.group.join.JoinFriendListActivity import com.teumteum.teumteum.presentation.group.join.check.GroupMeetCheckActivity import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json - @OptIn(ExperimentalPagerApi::class) @Composable fun MoimConfirm( diff --git a/app/src/main/java/com/teumteum/teumteum/presentation/moim/MoimFragment.kt b/app/src/main/java/com/teumteum/teumteum/presentation/moim/MoimFragment.kt index 5040d4ee..2d2d4f5e 100644 --- a/app/src/main/java/com/teumteum/teumteum/presentation/moim/MoimFragment.kt +++ b/app/src/main/java/com/teumteum/teumteum/presentation/moim/MoimFragment.kt @@ -4,7 +4,6 @@ import android.animation.ObjectAnimator import android.os.Bundle import android.util.Log import android.view.View -import android.widget.Toast import androidx.activity.OnBackPressedCallback import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue @@ -13,15 +12,12 @@ import androidx.lifecycle.flowWithLifecycle import androidx.lifecycle.lifecycleScope import androidx.navigation.fragment.findNavController import com.teumteum.base.BindingFragment -import com.teumteum.base.component.compose.theme.TeumTeumTheme -import com.teumteum.base.util.extension.toast +import com.teumteum.base.util.extension.defaultToast import com.teumteum.teumteum.R import com.teumteum.teumteum.databinding.FragmentMoimBinding import com.teumteum.teumteum.presentation.MainActivity import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach -import kotlinx.coroutines.launch - class MoimFragment : BindingFragment(R.layout.fragment_moim) { @@ -116,13 +112,13 @@ class MoimFragment : viewModel.screenState.flowWithLifecycle(lifecycle) .onEach { when(it) { - ScreenState.Failure -> { context?.toast("모임 신청에 오류가 발생했습니다") } - ScreenState.Server -> { context?.toast("서버 통신에 실패했습니다") } + ScreenState.Failure -> { context?.defaultToast("모임 신청에 오류가 발생했습니다") } + ScreenState.Server -> { context?.defaultToast("서버 통신에 실패했습니다") } ScreenState.Create -> { viewModel.getUserId() } ScreenState.CancelSuccess -> { - context?.toast("모임 취소를 완료했습니다") + context?.defaultToast("모임 취소를 완료했습니다") val navController = findNavController() navController.popBackStack() viewModel.initializeState() diff --git a/app/src/main/java/com/teumteum/teumteum/presentation/mypage/editCard/EditCardFragment.kt b/app/src/main/java/com/teumteum/teumteum/presentation/mypage/editCard/EditCardFragment.kt index 8a35805c..f072e868 100644 --- a/app/src/main/java/com/teumteum/teumteum/presentation/mypage/editCard/EditCardFragment.kt +++ b/app/src/main/java/com/teumteum/teumteum/presentation/mypage/editCard/EditCardFragment.kt @@ -1,28 +1,20 @@ package com.teumteum.teumteum.presentation.mypage.editCard import android.app.Activity -import android.app.ProgressDialog.show -import android.content.Context import android.content.Intent import android.os.Bundle -import android.os.Handler -import android.os.Looper -import android.util.Log import android.view.View import androidx.activity.OnBackPressedCallback import androidx.activity.result.ActivityResultLauncher import androidx.activity.result.contract.ActivityResultContracts -import androidx.compose.runtime.collectAsState -import androidx.compose.runtime.getValue import androidx.fragment.app.activityViewModels import androidx.lifecycle.lifecycleScope import androidx.navigation.fragment.findNavController import com.teumteum.base.BindingFragment -import com.teumteum.base.util.extension.toast +import com.teumteum.base.util.extension.defaultToast import com.teumteum.teumteum.R import com.teumteum.teumteum.databinding.FragmentEditCardBinding import com.teumteum.teumteum.presentation.MainActivity -import com.teumteum.teumteum.presentation.moim.MoimViewModel import com.teumteum.teumteum.presentation.mypage.setting.viewModel.EditCardViewModel import com.teumteum.teumteum.presentation.mypage.setting.viewModel.MyPageViewModel import com.teumteum.teumteum.presentation.mypage.setting.viewModel.SheetEvent @@ -31,12 +23,9 @@ import com.teumteum.teumteum.presentation.signup.area.PreferredAreaFragment import com.teumteum.teumteum.presentation.signup.community.CommunityFragment import com.teumteum.teumteum.presentation.signup.job.CurrentJobFragment import com.teumteum.teumteum.presentation.signup.job.ReadyJobFragment -import com.teumteum.teumteum.presentation.signup.mbti.GetMbtiFragment import com.teumteum.teumteum.presentation.signup.modal.AreaModalBottomSheet import com.teumteum.teumteum.presentation.signup.modal.MbtiModalBottomSheet -import com.teumteum.teumteum.presentation.signup.modal.SingleModalAdapter import com.teumteum.teumteum.presentation.signup.modal.SingleModalBottomSheet -import com.teumteum.teumteum.util.SignupUtils import com.teumteum.teumteum.util.SignupUtils.JOB_DESIGN import com.teumteum.teumteum.util.SignupUtils.JOB_DESIGN_LIST import com.teumteum.teumteum.util.SignupUtils.JOB_DEVELOPMENT @@ -129,8 +118,8 @@ class EditCardFragment: BindingFragment(R.layout.fragme } resultLauncher.launch(intent) } - SheetEvent.Error -> { context?.toast("서버 통신에 오류가 발생했습니다") } - SheetEvent.Success -> {context?.toast("정보 수정이 완료되었습니다")} + SheetEvent.Error -> { context?.defaultToast("서버 통신에 오류가 발생했습니다") } + SheetEvent.Success -> {context?.defaultToast("정보 수정이 완료되었습니다")} else -> {} } } diff --git a/app/src/main/java/com/teumteum/teumteum/presentation/mypage/setting/fragment/SettingFragment.kt b/app/src/main/java/com/teumteum/teumteum/presentation/mypage/setting/fragment/SettingFragment.kt index 0b0b6760..afadf02c 100644 --- a/app/src/main/java/com/teumteum/teumteum/presentation/mypage/setting/fragment/SettingFragment.kt +++ b/app/src/main/java/com/teumteum/teumteum/presentation/mypage/setting/fragment/SettingFragment.kt @@ -8,7 +8,7 @@ import androidx.fragment.app.activityViewModels import androidx.lifecycle.lifecycleScope import androidx.navigation.fragment.findNavController import com.teumteum.base.BindingFragment -import com.teumteum.base.util.extension.toast +import com.teumteum.base.util.extension.defaultToast import com.teumteum.teumteum.R import com.teumteum.teumteum.databinding.FragmentSettingBinding import com.teumteum.teumteum.presentation.MainActivity @@ -61,7 +61,7 @@ class SettingFragment: BindingFragment(R.layout.fragment viewModel.updateSettingStatus(SettingStatus.DEFAULT) } SettingStatus.ERROR -> { - requireActivity().toast("서버 통신 에러") + requireActivity().defaultToast("서버 통신 에러") } else -> {} }