@tamer4lynx/tamer-host 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
package {{PACKAGE_NAME}}
|
|
2
2
|
|
|
3
3
|
import android.os.Bundle
|
|
4
|
-
import android.view.MotionEvent
|
|
5
|
-
import android.view.inputmethod.InputMethodManager
|
|
6
|
-
import android.widget.EditText
|
|
7
4
|
import androidx.appcompat.app.AppCompatActivity
|
|
8
5
|
import androidx.core.view.WindowCompat
|
|
9
6
|
import androidx.core.view.WindowInsetsCompat
|
|
@@ -59,26 +56,6 @@ class MainActivity : AppCompatActivity() {
|
|
|
59
56
|
GeneratedActivityLifecycle.onResume()
|
|
60
57
|
}
|
|
61
58
|
|
|
62
|
-
override fun dispatchTouchEvent(ev: MotionEvent): Boolean {
|
|
63
|
-
if (ev.action == MotionEvent.ACTION_DOWN) maybeClearFocusedInput(ev)
|
|
64
|
-
return super.dispatchTouchEvent(ev)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
private fun maybeClearFocusedInput(ev: MotionEvent) {
|
|
68
|
-
val focused = currentFocus
|
|
69
|
-
if (focused is EditText) {
|
|
70
|
-
val loc = IntArray(2)
|
|
71
|
-
focused.getLocationOnScreen(loc)
|
|
72
|
-
val x = ev.rawX.toInt()
|
|
73
|
-
val y = ev.rawY.toInt()
|
|
74
|
-
if (x < loc[0] || x > loc[0] + focused.width || y < loc[1] || y > loc[1] + focused.height) {
|
|
75
|
-
focused.clearFocus()
|
|
76
|
-
(getSystemService(INPUT_METHOD_SERVICE) as? InputMethodManager)
|
|
77
|
-
?.hideSoftInputFromWindow(focused.windowToken, 0)
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
59
|
@Deprecated("Deprecated in Java")
|
|
83
60
|
override fun onBackPressed() {
|
|
84
61
|
GeneratedActivityLifecycle.onBackPressed { consumed ->
|