From 79dca9b620f38f1d74d779b10af98947d6f21ec8 Mon Sep 17 00:00:00 2001 From: leeeha Date: Sun, 5 Nov 2023 14:08:36 +0900 Subject: [PATCH] =?UTF-8?q?[CHORE]=20#270=20=EB=9F=AC=EB=8B=9D=EA=B8=B0?= =?UTF-8?q?=EB=A1=9D=20=EC=A0=9C=EB=AA=A9=20=EC=88=98=EC=A0=95=20=EC=8B=9C?= =?UTF-8?q?,=20=ED=82=A4=EB=B3=B4=EB=93=9C=20=EC=99=84=EB=A3=8C=20?= =?UTF-8?q?=EB=B2=84=ED=8A=BC=20=EB=88=84=EB=A5=B4=EB=A9=B4=20=EB=B0=94?= =?UTF-8?q?=EB=A1=9C=20=EC=88=98=EC=A0=95=EB=90=98=EB=8F=84=EB=A1=9D=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 --- .../runnect/data/service/UserService.kt | 10 +++---- .../history/detail/MyHistoryDetailActivity.kt | 28 +++++++++++++++++++ .../res/layout/activity_my_history_detail.xml | 3 -- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/runnect/runnect/data/service/UserService.kt b/app/src/main/java/com/runnect/runnect/data/service/UserService.kt index 73e22a42c..b23f908fe 100644 --- a/app/src/main/java/com/runnect/runnect/data/service/UserService.kt +++ b/app/src/main/java/com/runnect/runnect/data/service/UserService.kt @@ -30,16 +30,16 @@ interface UserService { suspend fun getUserUploadCourse( ): ResponseUserUploadCourse - @PUT("api/record") - suspend fun putDeleteHistory( - @Body requestDeleteHistoryDto: RequestDeleteHistoryDto - ): BaseResponse - @PUT("api/public-course") suspend fun putDeleteUploadCourse( @Body requestDeleteUploadCourse: RequestDeleteUploadCourse ): ResponseDeleteUploadCourse + @PUT("api/record") + suspend fun putDeleteHistory( + @Body requestDeleteHistoryDto: RequestDeleteHistoryDto + ): BaseResponse + @PATCH("api/record/{recordId}") suspend fun patchHistoryTitle( @Path("recordId") historyId: Int, diff --git a/app/src/main/java/com/runnect/runnect/presentation/mypage/history/detail/MyHistoryDetailActivity.kt b/app/src/main/java/com/runnect/runnect/presentation/mypage/history/detail/MyHistoryDetailActivity.kt index 5ed2e7f85..0a7572a0e 100644 --- a/app/src/main/java/com/runnect/runnect/presentation/mypage/history/detail/MyHistoryDetailActivity.kt +++ b/app/src/main/java/com/runnect/runnect/presentation/mypage/history/detail/MyHistoryDetailActivity.kt @@ -4,7 +4,10 @@ import android.content.Intent import android.os.Bundle import android.text.InputType import android.view.Gravity +import android.view.KeyEvent import android.view.View +import android.view.inputmethod.EditorInfo +import android.widget.TextView import androidx.activity.OnBackPressedCallback import androidx.activity.viewModels import androidx.constraintlayout.widget.ConstraintSet @@ -19,6 +22,7 @@ import com.runnect.runnect.util.custom.CommonDialogFragment import com.runnect.runnect.util.custom.PopupItem import com.runnect.runnect.util.custom.RunnectPopupMenu import com.runnect.runnect.util.extension.getCompatibleSerializableExtra +import com.runnect.runnect.util.extension.hideKeyboard import com.runnect.runnect.util.extension.setFocusAndShowKeyboard import com.runnect.runnect.util.extension.showToast import com.runnect.runnect.util.extension.snackBar @@ -82,19 +86,43 @@ class MyHistoryDetailActivity : } private fun addListener() { + initBackButtonClickListener() + initShowMoreButtonClickListener() + initEditFinishButtonClickListener() + initTitleEditorActionDoneListener() + } + + private fun initBackButtonClickListener() { binding.ivBackBtn.setOnClickListener { handleBackButtonByCurrentScreenMode() } + } + private fun initShowMoreButtonClickListener() { binding.ivShowMore.setOnClickListener { view -> showPopupMenu(view) } + } + private fun initEditFinishButtonClickListener() { binding.btnMyHistoryDetailEditFinish.setOnClickListener { viewModel.patchHistoryTitle() } } + private fun initTitleEditorActionDoneListener() { + binding.etCourseTitle.setOnEditorActionListener(object : TextView.OnEditorActionListener { + override fun onEditorAction(view: TextView?, actionId: Int, event: KeyEvent?): Boolean { + if (actionId == EditorInfo.IME_ACTION_DONE) { + viewModel.patchHistoryTitle() + hideKeyboard(currentFocus ?: View(this@MyHistoryDetailActivity)) + return true + } + return false + } + }) + } + private fun registerBackPressedCallback() { val callback = object : OnBackPressedCallback(true) { override fun handleOnBackPressed() { diff --git a/app/src/main/res/layout/activity_my_history_detail.xml b/app/src/main/res/layout/activity_my_history_detail.xml index d5734fc05..4d30783f2 100644 --- a/app/src/main/res/layout/activity_my_history_detail.xml +++ b/app/src/main/res/layout/activity_my_history_detail.xml @@ -258,7 +258,6 @@ app:layout_constraintEnd_toEndOf="@id/view_1" app:layout_constraintTop_toTopOf="@id/tv_total_distance" /> - - -