Skip to content

Commit

Permalink
Merge pull request #222 from team-winey/feature/fix-detail-comment-toโ€ฆ
Browse files Browse the repository at this point in the history
โ€ฆuch-event

[fix] ์ƒ์„ธ ํ”ผ๋“œ / ๋Œ“๊ธ€ ์ž…๋ ฅ์ฐฝ ๋ฐ”๊นฅ์„ ํ„ฐ์น˜ํ–ˆ์„ ๋•Œ๋งŒ ํ‚ค๋ณด๋“œ๊ฐ€ ๋‚ด๋ ค๊ฐ€๋„๋ก
  • Loading branch information
leeeha authored Nov 5, 2023
2 parents 1af2ee2 + 63b5699 commit 12db817
Showing 1 changed file with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package org.go.sopt.winey.presentation.main.feed.detail

import android.content.Intent
import android.graphics.Rect
import android.os.Bundle
import android.view.Gravity
import android.view.MotionEvent
import android.view.View
import android.widget.EditText
import androidx.activity.viewModels
import androidx.lifecycle.flowWithLifecycle
import androidx.lifecycle.lifecycleScope
Expand Down Expand Up @@ -89,9 +91,23 @@ class DetailActivity : BindingActivity<ActivityDetailBinding>(R.layout.activity_
}
}

override fun dispatchTouchEvent(event: MotionEvent?): Boolean {
hideKeyboard()
binding.etComment.clearFocus()
override fun dispatchTouchEvent(event: MotionEvent): Boolean {
if (event.action == MotionEvent.ACTION_DOWN) {
currentFocus?.let { view ->
if (view is EditText) {
val focusView = Rect()
view.getGlobalVisibleRect(focusView)

val touchedX = event.x.toInt()
val touchedY = event.y.toInt()

if (!focusView.contains(touchedX, touchedY)) {
hideKeyboard()
binding.etComment.clearFocus()
}
}
}
}
return super.dispatchTouchEvent(event)
}

Expand Down

0 comments on commit 12db817

Please sign in to comment.