From 7ee2abd332baf5ca971f20287cc26174d0592d61 Mon Sep 17 00:00:00 2001 From: HyeseonBaek Date: Sun, 3 Sep 2023 02:14:33 +0900 Subject: [PATCH 01/13] =?UTF-8?q?[add]=20#184=20=EC=83=81=EC=84=B8?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=9D=B4=EB=8F=99=EC=8B=9C=20?= =?UTF-8?q?=EC=96=B4=EB=8A=90=20=ED=94=BC=EB=93=9C=EB=A1=9C=EB=B6=80?= =?UTF-8?q?=ED=84=B0=EC=9D=B8=EC=A7=80=20bundle=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/main/feed/WineyFeedFragment.kt | 3 +++ .../main/mypage/myfeed/MyFeedFragment.kt | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt index c5d490fd..f54000cb 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt @@ -400,6 +400,7 @@ class WineyFeedFragment : val intent = Intent(requireContext(), DetailActivity::class.java) intent.putExtra(KEY_FEED_ID, wineyFeed.feedId) intent.putExtra(KEY_FEED_WRITER_ID, wineyFeed.userId) + intent.putExtra(KEY_PREV_SCREEN, WINEY_FEED_SCREEN) startActivity(intent) } @@ -442,5 +443,7 @@ class WineyFeedFragment : private const val KEY_FEED_ID = "feedId" private const val KEY_FEED_WRITER_ID = "feedWriterId" + private const val KEY_PREV_SCREEN = "PREV_SCREEN_NAME" + private const val WINEY_FEED_SCREEN = "WineyFeedFragment" } } diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/myfeed/MyFeedFragment.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/myfeed/MyFeedFragment.kt index 8d2dd317..e75716be 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/myfeed/MyFeedFragment.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/myfeed/MyFeedFragment.kt @@ -140,7 +140,11 @@ class MyFeedFragment : BindingFragment(R.layout.fragment_ viewModel.deleteMyFeedState.flowWithLifecycle(viewLifeCycle).onEach { state -> when (state) { is UiState.Success -> { - wineySnackbar(binding.root, true, stringOf(R.string.snackbar_feed_delete_success)) + wineySnackbar( + binding.root, + true, + stringOf(R.string.snackbar_feed_delete_success) + ) viewModel.initDeleteFeedState() } @@ -183,7 +187,8 @@ class MyFeedFragment : BindingFragment(R.layout.fragment_ is LoadState.NotLoading -> { binding.rvMyfeedPost.isVisible = myFeedAdapter.itemCount > 0 - binding.clMyfeedEmpty.isVisible = myFeedAdapter.itemCount == 0 + binding.clMyfeedEmpty.isVisible = + myFeedAdapter.itemCount == 0 restoreScrollPosition() } @@ -232,6 +237,7 @@ class MyFeedFragment : BindingFragment(R.layout.fragment_ val intent = Intent(requireContext(), DetailActivity::class.java) intent.putExtra(KEY_FEED_ID, wineyFeed.feedId) intent.putExtra(KEY_FEED_WRITER_ID, wineyFeed.userId) + intent.putExtra(KEY_PREV_SCREEN, MY_FEED_SCREEN) startActivity(intent) } @@ -246,8 +252,12 @@ class MyFeedFragment : BindingFragment(R.layout.fragment_ companion object { private const val KEY_FEED_ID = "feedId" private const val KEY_FEED_WRITER_ID = "feedWriterId" + private const val KEY_PREV_SCREEN = "PREV_SCREEN_NAME" + private const val POPUP_MENU_OFFSET = 65 private const val MSG_MYFEED_ERROR = "ERROR" private const val TAG_FEED_DELETE_DIALOG = "DELETE_DIALOG" + + private const val MY_FEED_SCREEN = "MyFeedFragment" } } From 6a68dc5628a5d102584390ecf8602c605ca8e487 Mon Sep 17 00:00:00 2001 From: HyeseonBaek Date: Sun, 3 Sep 2023 02:17:52 +0900 Subject: [PATCH 02/13] =?UTF-8?q?[feat]=20#184=20=EC=83=81=EC=84=B8?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=EB=A1=9C=20=EC=98=A8=20=EA=B2=BD?= =?UTF-8?q?=EB=A1=9C=EC=97=90=20=EB=94=B0=EB=9D=BC=20=ED=94=BC=EB=93=9C=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=EC=8B=9C=20=EC=8A=A4=EB=82=B5=EB=B0=94=20?= =?UTF-8?q?=EB=9C=A8=EB=8A=94=20=EC=9C=84=EC=B9=98=20=EB=8B=A4=EB=A5=B4?= =?UTF-8?q?=EA=B2=8C=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../go/sopt/winey/presentation/main/MainActivity.kt | 13 ++++++++++++- .../presentation/main/feed/detail/DetailActivity.kt | 9 +++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt index 5b308aaa..73f01da5 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt @@ -15,6 +15,7 @@ import org.go.sopt.winey.R import org.go.sopt.winey.databinding.ActivityMainBinding import org.go.sopt.winey.presentation.main.feed.WineyFeedFragment import org.go.sopt.winey.presentation.main.mypage.MyPageFragment +import org.go.sopt.winey.presentation.main.mypage.myfeed.MyFeedFragment import org.go.sopt.winey.presentation.main.recommend.RecommendFragment import org.go.sopt.winey.presentation.onboarding.login.LoginActivity import org.go.sopt.winey.util.binding.BindingActivity @@ -29,6 +30,7 @@ class MainActivity : BindingActivity(R.layout.activity_main private val isUploadSuccess by lazy { intent.extras?.getBoolean(EXTRA_UPLOAD_KEY, false) } private val isDeleteSuccess by lazy { intent.extras?.getBoolean(EXTRA_DELETE_KEY, false) } private val isReportSuccess by lazy { intent.extras?.getBoolean(EXTRA_REPORT_KEY, false) } + private val prevScreenName by lazy { intent.extras?.getString(KEY_PREV_SCREEN, "") } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -55,7 +57,11 @@ class MainActivity : BindingActivity(R.layout.activity_main transaction.commit() binding.bnvMain.selectedItemId = R.id.menu_mypage } else { - navigateTo() + if (prevScreenName == MY_FEED_SCREEN) { + navigateTo() + } else { + navigateTo() + } } } @@ -135,5 +141,10 @@ class MainActivity : BindingActivity(R.layout.activity_main private const val EXTRA_UPLOAD_KEY = "upload" private const val EXTRA_DELETE_KEY = "delete" private const val EXTRA_REPORT_KEY = "report" + + private const val KEY_PREV_SCREEN = "PREV_SCREEN_NAME" + + private const val WINEY_FEED_SCREEN = "WineyFeedFragment" + private const val MY_FEED_SCREEN = "MyFeedFragment" } } diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/detail/DetailActivity.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/detail/DetailActivity.kt index 042a4c80..0424aeee 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/detail/DetailActivity.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/detail/DetailActivity.kt @@ -43,6 +43,7 @@ class DetailActivity : BindingActivity(R.layout.activity_ private val feedId by lazy { intent.getIntExtra(KEY_FEED_ID, 0) } private val feedWriterId by lazy { intent.getIntExtra(KEY_FEED_WRITER_ID, 0) } + private val prevScreenName by lazy { intent.extras?.getString(KEY_PREV_SCREEN, "") } private var _detailFeedAdapter: DetailFeedAdapter? = null private val detailFeedAdapter get() = requireNotNull(_detailFeedAdapter) @@ -336,6 +337,7 @@ class DetailActivity : BindingActivity(R.layout.activity_ }.launchIn(lifecycleScope) } + private fun initPostCommentStateObserver() { viewModel.postCommentState.flowWithLifecycle(lifecycle) .onEach { state -> @@ -416,6 +418,7 @@ class DetailActivity : BindingActivity(R.layout.activity_ Intent(this, MainActivity::class.java).apply { addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) putExtra(extraKey, true) + putExtra(KEY_PREV_SCREEN, prevScreenName) startActivity(this) } } @@ -454,9 +457,15 @@ class DetailActivity : BindingActivity(R.layout.activity_ companion object { private const val KEY_FEED_ID = "feedId" private const val KEY_FEED_WRITER_ID = "feedWriterId" + private const val KEY_PREV_SCREEN = "PREV_SCREEN_NAME" + private const val TAG_FEED_DELETE_DIALOG = "FEED_DELETE_DIALOG" private const val TAG_COMMENT_DELETE_DIALOG = "COMMENT_DELETE_DIALOG" private const val TAG_REPORT_DIALOG = "REPORT_DIALOG" + + private const val MY_FEED_SCREEN = "MyFeedFragment" + private const val WINEY_FEED_SCREEN = "WineyFeedFragment" + private const val POPUP_MENU_POS_OFFSET = 65 private const val MSG_DETAIL_ERROR = "ERROR" private const val EXTRA_DELETE_KEY = "delete" From d7fa9a9d6568940ea969ba1697c4c5b2533e2585 Mon Sep 17 00:00:00 2001 From: HyeseonBaek Date: Sun, 3 Sep 2023 02:21:14 +0900 Subject: [PATCH 03/13] =?UTF-8?q?[chore]=20#184=20ktlint=20=EC=A0=9C?= =?UTF-8?q?=EC=95=88=EC=82=AC=ED=95=AD=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sopt/winey/presentation/main/feed/detail/DetailActivity.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/detail/DetailActivity.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/detail/DetailActivity.kt index 0424aeee..153db384 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/detail/DetailActivity.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/detail/DetailActivity.kt @@ -337,7 +337,6 @@ class DetailActivity : BindingActivity(R.layout.activity_ }.launchIn(lifecycleScope) } - private fun initPostCommentStateObserver() { viewModel.postCommentState.flowWithLifecycle(lifecycle) .onEach { state -> From 3f3a4901bdd569cbc6836910c86e8a518bf9dcbf Mon Sep 17 00:00:00 2001 From: HyeseonBaek Date: Tue, 5 Sep 2023 15:21:19 +0900 Subject: [PATCH 04/13] =?UTF-8?q?[add]=20#184=20=EB=A7=88=EC=9D=B4?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=EB=A1=9C=20=EB=B2=88=EB=93=A4=20?= =?UTF-8?q?=EB=84=98=EA=B8=B0=EB=A9=B0=20=ED=99=94=EB=A9=B4=20=EC=9D=B4?= =?UTF-8?q?=EB=8F=99=20=ED=95=A8=EC=88=98=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../winey/presentation/main/MainActivity.kt | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt index 73f01da5..038c9d6d 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt @@ -15,7 +15,6 @@ import org.go.sopt.winey.R import org.go.sopt.winey.databinding.ActivityMainBinding import org.go.sopt.winey.presentation.main.feed.WineyFeedFragment import org.go.sopt.winey.presentation.main.mypage.MyPageFragment -import org.go.sopt.winey.presentation.main.mypage.myfeed.MyFeedFragment import org.go.sopt.winey.presentation.main.recommend.RecommendFragment import org.go.sopt.winey.presentation.onboarding.login.LoginActivity import org.go.sopt.winey.util.binding.BindingActivity @@ -48,17 +47,10 @@ class MainActivity : BindingActivity(R.layout.activity_main private fun initFragment() { if (intent.getBooleanExtra("navigateMypage", false)) { - val bundle = Bundle() - bundle.putString("fromNoti", "true") - val myPageFragment = MyPageFragment() - myPageFragment.arguments = bundle - val transaction = supportFragmentManager.beginTransaction() - transaction.replace(R.id.fcv_main, myPageFragment) - transaction.commit() - binding.bnvMain.selectedItemId = R.id.menu_mypage + navigateToMyPageWithBundle("fromNoti","true") } else { if (prevScreenName == MY_FEED_SCREEN) { - navigateTo() + navigateToMyPageWithBundle("toMyFeed","true") } else { navigateTo() } @@ -137,6 +129,19 @@ class MainActivity : BindingActivity(R.layout.activity_main } } + private fun navigateToMyPageWithBundle(key:String, value: String) { + supportFragmentManager.commit { + val bundle = Bundle() + bundle.putString(key, value) + val myPageFragment = MyPageFragment() + myPageFragment.arguments = bundle + val transaction = supportFragmentManager.beginTransaction() + transaction.replace(R.id.fcv_main, myPageFragment) + transaction.commit() + binding.bnvMain.selectedItemId = R.id.menu_mypage + } + } + companion object { private const val EXTRA_UPLOAD_KEY = "upload" private const val EXTRA_DELETE_KEY = "delete" @@ -144,7 +149,6 @@ class MainActivity : BindingActivity(R.layout.activity_main private const val KEY_PREV_SCREEN = "PREV_SCREEN_NAME" - private const val WINEY_FEED_SCREEN = "WineyFeedFragment" private const val MY_FEED_SCREEN = "MyFeedFragment" } } From 2ec42198d64dfa54cc4aa047b44a0b5b73c67456 Mon Sep 17 00:00:00 2001 From: HyeseonBaek Date: Tue, 5 Sep 2023 15:22:59 +0900 Subject: [PATCH 05/13] =?UTF-8?q?[feat]=20#184=20=EB=A7=88=EC=9D=B4?= =?UTF-8?q?=ED=94=BC=EB=93=9C->=EC=83=81=EC=84=B8=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=EC=97=90=EC=84=9C=20=ED=94=BC=EB=93=9C=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=EC=8B=9C,=20=EB=A9=94=EC=9D=B8=EC=95=A1=ED=8B=B0?= =?UTF-8?q?=EB=B9=84=ED=8B=B0=20->=20=EB=A7=88=EC=9D=B4=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20->=20=EB=A7=88=EC=9D=B4=ED=94=BC=EB=93=9C=EB=A1=9C?= =?UTF-8?q?=20=EC=9D=B4=EB=8F=99=ED=95=98=EA=B2=8C=20=ED=95=B4=20=EB=B0=B1?= =?UTF-8?q?=EC=8A=A4=ED=83=9D=EC=97=90=20=EB=A7=88=EC=9D=B4=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=EB=82=A8=EA=B8=B0=EA=B3=A0=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=20=EC=8A=A4=EB=82=B5=EB=B0=94=20=EB=9C=A8=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../winey/presentation/main/mypage/MyPageFragment.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt index 09559145..4fc90484 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt @@ -50,7 +50,7 @@ class MyPageFragment : BindingFragment(R.layout.fragment_ override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) amplitudeUtils.logEvent("view_mypage") - + initNavigation() init1On1ButtonClickListener() initTermsButtonClickListener() initLevelHelpButtonClickListener() @@ -98,6 +98,15 @@ class MyPageFragment : BindingFragment(R.layout.fragment_ } } + private fun initNavigation(){ + val receivedBundle = arguments + if (receivedBundle != null) { + val value = receivedBundle.getString("toMyFeed") + if (value == "true") { + navigateAndBackStack() + } + } + } private fun init1On1ButtonClickListener() { binding.clMypageTo1on1.setOnClickListener { val url = ONE_ON_ONE_URL From 0ed397748a73a67d03ad1a346b807f689fb0fa68 Mon Sep 17 00:00:00 2001 From: HyeseonBaek Date: Tue, 5 Sep 2023 15:25:38 +0900 Subject: [PATCH 06/13] =?UTF-8?q?[chore]=20#184=20ktlint=20=EC=A0=9C?= =?UTF-8?q?=EC=95=88=EC=82=AC=ED=95=AD=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/go/sopt/winey/presentation/main/MainActivity.kt | 6 +++--- .../sopt/winey/presentation/main/mypage/MyPageFragment.kt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt index 038c9d6d..e35b4755 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt @@ -47,10 +47,10 @@ class MainActivity : BindingActivity(R.layout.activity_main private fun initFragment() { if (intent.getBooleanExtra("navigateMypage", false)) { - navigateToMyPageWithBundle("fromNoti","true") + navigateToMyPageWithBundle("fromNoti", "true") } else { if (prevScreenName == MY_FEED_SCREEN) { - navigateToMyPageWithBundle("toMyFeed","true") + navigateToMyPageWithBundle("toMyFeed", "true") } else { navigateTo() } @@ -129,7 +129,7 @@ class MainActivity : BindingActivity(R.layout.activity_main } } - private fun navigateToMyPageWithBundle(key:String, value: String) { + private fun navigateToMyPageWithBundle(key: String, value: String) { supportFragmentManager.commit { val bundle = Bundle() bundle.putString(key, value) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt index 4fc90484..56925e88 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt @@ -98,7 +98,7 @@ class MyPageFragment : BindingFragment(R.layout.fragment_ } } - private fun initNavigation(){ + private fun initNavigation() { val receivedBundle = arguments if (receivedBundle != null) { val value = receivedBundle.getString("toMyFeed") From 5a725d56af0b5a132bf7084450ff858c9a0d86ad Mon Sep 17 00:00:00 2001 From: HyeseonBaek Date: Fri, 8 Sep 2023 23:42:59 +0900 Subject: [PATCH 07/13] =?UTF-8?q?[chore]=20#184=20=EB=B6=88=ED=95=84?= =?UTF-8?q?=EC=9A=94=EC=BD=94=EB=93=9C=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sopt/winey/presentation/main/feed/detail/DetailActivity.kt | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/detail/DetailActivity.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/detail/DetailActivity.kt index 153db384..7256942f 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/detail/DetailActivity.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/detail/DetailActivity.kt @@ -462,9 +462,6 @@ class DetailActivity : BindingActivity(R.layout.activity_ private const val TAG_COMMENT_DELETE_DIALOG = "COMMENT_DELETE_DIALOG" private const val TAG_REPORT_DIALOG = "REPORT_DIALOG" - private const val MY_FEED_SCREEN = "MyFeedFragment" - private const val WINEY_FEED_SCREEN = "WineyFeedFragment" - private const val POPUP_MENU_POS_OFFSET = 65 private const val MSG_DETAIL_ERROR = "ERROR" private const val EXTRA_DELETE_KEY = "delete" From 8f829751cce59aea564c40e1440814008630fb75 Mon Sep 17 00:00:00 2001 From: HyeseonBaek Date: Sat, 9 Sep 2023 14:42:15 +0900 Subject: [PATCH 08/13] =?UTF-8?q?[fix]=20#184=20=EB=A7=88=EC=9D=B4?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20bundle=20argnuments=20=EC=B4=88?= =?UTF-8?q?=EA=B8=B0=ED=99=94=ED=95=B4=20=EB=B0=B1=EC=8A=A4=ED=83=9D=20?= =?UTF-8?q?=EC=A4=91=EB=B3=B5=20=EC=B6=94=EA=B0=80=20=EB=B0=A9=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../go/sopt/winey/presentation/main/mypage/MyPageFragment.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt index 56925e88..7f3b29db 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt @@ -104,9 +104,11 @@ class MyPageFragment : BindingFragment(R.layout.fragment_ val value = receivedBundle.getString("toMyFeed") if (value == "true") { navigateAndBackStack() + arguments = null } } } + private fun init1On1ButtonClickListener() { binding.clMypageTo1on1.setOnClickListener { val url = ONE_ON_ONE_URL From 012e269ae779ffaad442aabe8c6875b18fd95cf0 Mon Sep 17 00:00:00 2001 From: HyeseonBaek Date: Sat, 9 Sep 2023 15:02:24 +0900 Subject: [PATCH 09/13] =?UTF-8?q?[mod]=20#184=20fragment-ktx=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../winey/presentation/main/MainActivity.kt | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt index e35b4755..7a8bfe2d 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt @@ -130,16 +130,19 @@ class MainActivity : BindingActivity(R.layout.activity_main } private fun navigateToMyPageWithBundle(key: String, value: String) { + val bundle = Bundle().apply { + putString(key, value) + } + val myPageFragment = MyPageFragment().apply { + arguments = bundle + } supportFragmentManager.commit { - val bundle = Bundle() - bundle.putString(key, value) - val myPageFragment = MyPageFragment() - myPageFragment.arguments = bundle - val transaction = supportFragmentManager.beginTransaction() - transaction.replace(R.id.fcv_main, myPageFragment) - transaction.commit() - binding.bnvMain.selectedItemId = R.id.menu_mypage + replace(R.id.fcv_main, myPageFragment) + setReorderingAllowed(true) + addToBackStack(null) } + binding.bnvMain.selectedItemId = R.id.menu_mypage + } companion object { From 8080f6e343f2de22fe1bcad0321c8af6c179a699 Mon Sep 17 00:00:00 2001 From: HyeseonBaek Date: Sat, 9 Sep 2023 15:28:26 +0900 Subject: [PATCH 10/13] =?UTF-8?q?[mod]=20#184=20boolean=20=ED=83=80?= =?UTF-8?q?=EC=9E=85=EC=9C=BC=EB=A1=9C=20Bundle=20=EC=A3=BC=EA=B3=A0=20?= =?UTF-8?q?=EB=B0=9B=EA=B2=8C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../winey/presentation/main/MainActivity.kt | 25 ++++++++----------- .../main/mypage/MyPageFragment.kt | 9 ++++--- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt index 7a8bfe2d..83b10dd9 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt @@ -47,10 +47,10 @@ class MainActivity : BindingActivity(R.layout.activity_main private fun initFragment() { if (intent.getBooleanExtra("navigateMypage", false)) { - navigateToMyPageWithBundle("fromNoti", "true") + navigateToMyPageWithBundle("fromNoti", true) } else { if (prevScreenName == MY_FEED_SCREEN) { - navigateToMyPageWithBundle("toMyFeed", "true") + navigateToMyPageWithBundle("toMyFeed", true) } else { navigateTo() } @@ -129,20 +129,17 @@ class MainActivity : BindingActivity(R.layout.activity_main } } - private fun navigateToMyPageWithBundle(key: String, value: String) { - val bundle = Bundle().apply { - putString(key, value) - } - val myPageFragment = MyPageFragment().apply { - arguments = bundle - } + private fun navigateToMyPageWithBundle(key: String, value: Boolean) { supportFragmentManager.commit { - replace(R.id.fcv_main, myPageFragment) - setReorderingAllowed(true) - addToBackStack(null) + val bundle = Bundle() + bundle.putBoolean(key, value) + val myPageFragment = MyPageFragment() + myPageFragment.arguments = bundle + val transaction = supportFragmentManager.beginTransaction() + transaction.replace(R.id.fcv_main, myPageFragment) + transaction.commit() + binding.bnvMain.selectedItemId = R.id.menu_mypage } - binding.bnvMain.selectedItemId = R.id.menu_mypage - } companion object { diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt index 7f3b29db..00e18e5c 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt @@ -12,6 +12,7 @@ import androidx.fragment.app.replace import androidx.fragment.app.viewModels import androidx.lifecycle.flowWithLifecycle import androidx.lifecycle.lifecycleScope +import com.google.android.gms.common.config.GservicesValue.value import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.launchIn @@ -67,8 +68,8 @@ class MyPageFragment : BindingFragment(R.layout.fragment_ override fun handleOnBackPressed() { val receivedBundle = arguments if (receivedBundle != null) { - val value = receivedBundle.getString("fromNoti") - if (value == "true") { + val value = receivedBundle.getBoolean("fromNoti") + if (value) { val intent = Intent(requireContext(), NotificationActivity::class.java) startActivity(intent) requireActivity().finish() @@ -101,8 +102,8 @@ class MyPageFragment : BindingFragment(R.layout.fragment_ private fun initNavigation() { val receivedBundle = arguments if (receivedBundle != null) { - val value = receivedBundle.getString("toMyFeed") - if (value == "true") { + val value = receivedBundle.getBoolean("toMyFeed") + if (value) { navigateAndBackStack() arguments = null } From 113ad14d9e4d5a846e5cfa50f8f509a29c15bdce Mon Sep 17 00:00:00 2001 From: HyeseonBaek Date: Sat, 9 Sep 2023 15:31:38 +0900 Subject: [PATCH 11/13] =?UTF-8?q?[chore]=20#184=20bundle=20=ED=82=A4?= =?UTF-8?q?=EA=B0=92=20=EC=83=81=EC=88=98=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/go/sopt/winey/presentation/main/MainActivity.kt | 9 ++++++--- .../winey/presentation/main/mypage/MyPageFragment.kt | 8 +++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt index 83b10dd9..adfaa904 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt @@ -46,11 +46,11 @@ class MainActivity : BindingActivity(R.layout.activity_main } private fun initFragment() { - if (intent.getBooleanExtra("navigateMypage", false)) { - navigateToMyPageWithBundle("fromNoti", true) + if (intent.getBooleanExtra(KEY_TO_MYPAGE, false)) { + navigateToMyPageWithBundle(KEY_FROM_NOTI, true) } else { if (prevScreenName == MY_FEED_SCREEN) { - navigateToMyPageWithBundle("toMyFeed", true) + navigateToMyPageWithBundle(KEY_TO_MYFEED, true) } else { navigateTo() } @@ -148,6 +148,9 @@ class MainActivity : BindingActivity(R.layout.activity_main private const val EXTRA_REPORT_KEY = "report" private const val KEY_PREV_SCREEN = "PREV_SCREEN_NAME" + private const val KEY_FROM_NOTI = "fromNoti" + private const val KEY_TO_MYFEED = "toMyFeed" + private const val KEY_TO_MYPAGE = "navigateMypage" private const val MY_FEED_SCREEN = "MyFeedFragment" } diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt index 00e18e5c..d7bc08ad 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt @@ -12,7 +12,6 @@ import androidx.fragment.app.replace import androidx.fragment.app.viewModels import androidx.lifecycle.flowWithLifecycle import androidx.lifecycle.lifecycleScope -import com.google.android.gms.common.config.GservicesValue.value import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.launchIn @@ -68,7 +67,7 @@ class MyPageFragment : BindingFragment(R.layout.fragment_ override fun handleOnBackPressed() { val receivedBundle = arguments if (receivedBundle != null) { - val value = receivedBundle.getBoolean("fromNoti") + val value = receivedBundle.getBoolean(KEY_FROM_NOTI) if (value) { val intent = Intent(requireContext(), NotificationActivity::class.java) startActivity(intent) @@ -102,7 +101,7 @@ class MyPageFragment : BindingFragment(R.layout.fragment_ private fun initNavigation() { val receivedBundle = arguments if (receivedBundle != null) { - val value = receivedBundle.getBoolean("toMyFeed") + val value = receivedBundle.getBoolean(KEY_TO_MYFEED) if (value) { navigateAndBackStack() arguments = null @@ -294,5 +293,8 @@ class MyPageFragment : BindingFragment(R.layout.fragment_ private const val EXTRA_VALUE = "MyPageFragment" private const val TAG_LOGOUT_DIALOG = "LOGOUT_DIALOG" private const val TAGE_WITHDRAW_DIALOG = "WITHDRAW_DIALOG" + + private const val KEY_FROM_NOTI = "fromNoti" + private const val KEY_TO_MYFEED = "toMyFeed" } } From 208cc7b73e75506e0ce33e30f1cdcac0dde48262 Mon Sep 17 00:00:00 2001 From: HyeseonBaek Date: Sat, 9 Sep 2023 15:35:33 +0900 Subject: [PATCH 12/13] =?UTF-8?q?[mod]=20#184=20=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EB=82=B4=EB=B6=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/go/sopt/winey/presentation/main/MainActivity.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt index adfaa904..cf64e383 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt @@ -135,9 +135,7 @@ class MainActivity : BindingActivity(R.layout.activity_main bundle.putBoolean(key, value) val myPageFragment = MyPageFragment() myPageFragment.arguments = bundle - val transaction = supportFragmentManager.beginTransaction() - transaction.replace(R.id.fcv_main, myPageFragment) - transaction.commit() + replace(R.id.fcv_main, myPageFragment) binding.bnvMain.selectedItemId = R.id.menu_mypage } } From aaab924357278a5141390f36cfb96b2d74d13cfa Mon Sep 17 00:00:00 2001 From: HyeseonBaek Date: Sat, 9 Sep 2023 16:13:28 +0900 Subject: [PATCH 13/13] =?UTF-8?q?[mod]=20#184=20null=20=EB=8C=80=EC=9E=85?= =?UTF-8?q?=20=EB=8C=80=EC=8B=A0=20arguments.clear=20=EC=82=AC=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../go/sopt/winey/presentation/main/mypage/MyPageFragment.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt index d7bc08ad..8347b4ec 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt @@ -104,7 +104,7 @@ class MyPageFragment : BindingFragment(R.layout.fragment_ val value = receivedBundle.getBoolean(KEY_TO_MYFEED) if (value) { navigateAndBackStack() - arguments = null + arguments?.clear() } } }