@tamer4lynx/tamer-host 0.0.1 → 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 ->
|
|
@@ -99,6 +76,7 @@ class MainActivity : AppCompatActivity() {
|
|
|
99
76
|
private fun buildLynxView(): LynxView {
|
|
100
77
|
val viewBuilder = LynxViewBuilder()
|
|
101
78
|
viewBuilder.setTemplateProvider(TemplateProvider(this))
|
|
79
|
+
GeneratedLynxExtensions.configureViewBuilder(viewBuilder)
|
|
102
80
|
return viewBuilder.build(this)
|
|
103
81
|
}
|
|
104
82
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamer4lynx/tamer-host",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"publishConfig": {
|
|
3
|
+
"version": "0.0.3",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public",
|
|
6
|
+
"tag": "prerelease"
|
|
7
|
+
},
|
|
5
8
|
"type": "module",
|
|
6
9
|
"description": "Production Lynx host templates for injecting LynxView into existing apps",
|
|
7
|
-
"files": [
|
|
10
|
+
"files": [
|
|
11
|
+
"android/templates",
|
|
12
|
+
"ios",
|
|
13
|
+
"lynx.ext.json"
|
|
14
|
+
],
|
|
8
15
|
"repository": {
|
|
9
16
|
"type": "git",
|
|
10
17
|
"url": "https://github.com/tamer4lynx/tamer-host.git"
|