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

[CHORE] 마이페이지 러닝기록 / 제목 수정 시, 키보드 완료 버튼 누르면 바로 수정되도록 변경 #271

Merged
merged 1 commit into from
Nov 5, 2023
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 @@ -30,16 +30,16 @@ interface UserService {
suspend fun getUserUploadCourse(
): ResponseUserUploadCourse

@PUT("api/record")
suspend fun putDeleteHistory(
@Body requestDeleteHistoryDto: RequestDeleteHistoryDto
): BaseResponse<ResponseDeleteHistoryDto>

@PUT("api/public-course")
suspend fun putDeleteUploadCourse(
@Body requestDeleteUploadCourse: RequestDeleteUploadCourse
): ResponseDeleteUploadCourse

@PUT("api/record")
suspend fun putDeleteHistory(
@Body requestDeleteHistoryDto: RequestDeleteHistoryDto
): BaseResponse<ResponseDeleteHistoryDto>

@PATCH("api/record/{recordId}")
suspend fun patchHistoryTitle(
@Path("recordId") historyId: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -82,19 +86,43 @@ class MyHistoryDetailActivity :
}

private fun addListener() {
initBackButtonClickListener()
initShowMoreButtonClickListener()
initEditFinishButtonClickListener()
initTitleEditorActionDoneListener()
}
Comment on lines 88 to +93
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addListener에 포함되는 함수들을 아래에 순서대로 배치해주신 것 좋았습니다~!


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() {
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/layout/activity_my_history_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@
app:layout_constraintEnd_toEndOf="@id/view_1"
app:layout_constraintTop_toTopOf="@id/tv_total_distance" />


<!--이동시간-->

<View
Expand All @@ -271,7 +270,6 @@
app:layout_constraintStart_toEndOf="@id/view_1"
app:layout_constraintTop_toTopOf="@id/view_1" />


<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_time"
android:layout_width="wrap_content"
Expand Down Expand Up @@ -318,7 +316,6 @@
app:layout_constraintStart_toEndOf="@id/view_2"
app:layout_constraintTop_toTopOf="@id/view_2" />


<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_pace"
android:layout_width="wrap_content"
Expand Down
Loading