Add focus on resume, duck icon, log result
This commit is contained in:
parent
7349e4ef0c
commit
1b409ea9a7
3 changed files with 25 additions and 14 deletions
|
|
@ -96,14 +96,11 @@ class MainActivity : AppCompatActivity() {
|
||||||
view?.evaluateJavascript(
|
view?.evaluateJavascript(
|
||||||
"(function() {" +
|
"(function() {" +
|
||||||
" const selectors = [" +
|
" const selectors = [" +
|
||||||
" 'textarea[name=\"user-prompt\"]'," +
|
|
||||||
" 'textarea[placeholder=\"Ask privately\"]'," +
|
" 'textarea[placeholder=\"Ask privately\"]'," +
|
||||||
|
" 'textarea[name=\"user-prompt\"]'," +
|
||||||
" 'textarea.JRDRiEf5NPKWK43sArdC'," +
|
" 'textarea.JRDRiEf5NPKWK43sArdC'," +
|
||||||
" 'textarea[id*=\"message\"]'," +
|
" 'textarea[id*=\"message\"]'," +
|
||||||
" 'textarea[name*=\"message\"]'," +
|
" 'textarea[name*=\"message\"]'," +
|
||||||
" 'textarea[placeholder*=\"Сообщ\"]'," +
|
|
||||||
" 'textarea[placeholder*=\"Message\"]'," +
|
|
||||||
" 'textarea[data-id]'," +
|
|
||||||
" 'div[contenteditable=\"true\"]'," +
|
" 'div[contenteditable=\"true\"]'," +
|
||||||
" 'div[role=\"textbox\"]'" +
|
" 'div[role=\"textbox\"]'" +
|
||||||
" ];" +
|
" ];" +
|
||||||
|
|
@ -136,8 +133,9 @@ class MainActivity : AppCompatActivity() {
|
||||||
" return 'NOT FOUND';" +
|
" return 'NOT FOUND';" +
|
||||||
"})();"
|
"})();"
|
||||||
) { result ->
|
) { result ->
|
||||||
|
android.util.Log.d("DuckAI", "Focus result: " + result)
|
||||||
if (result?.contains("NOT FOUND") == true) {
|
if (result?.contains("NOT FOUND") == true) {
|
||||||
android.util.Log.d("DuckAI", "Focus result: $result")
|
view?.postDelayed({ tryFocusInput(view) }, 1000)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -224,9 +222,17 @@ class MainActivity : AppCompatActivity() {
|
||||||
super.onPause()
|
super.onPause()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
webView.onResume()
|
webView.onResume()
|
||||||
super.onResume()
|
super.onResume()
|
||||||
|
webView.postDelayed({
|
||||||
|
tryFocusInput(webView)
|
||||||
|
showKeyboard()
|
||||||
|
}, 500)
|
||||||
|
webView.postDelayed({
|
||||||
|
tryFocusInput(webView)
|
||||||
|
showKeyboard()
|
||||||
|
}, 1500)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onNewIntent(intent: Intent?) {
|
override fun onNewIntent(intent: Intent?) {
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,18 @@
|
||||||
android:viewportWidth="108"
|
android:viewportWidth="108"
|
||||||
android:viewportHeight="108">
|
android:viewportHeight="108">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFF"
|
android:fillColor="#DE5833"
|
||||||
android:pathData="M54,30 L54,78 M30,54 L78,54"
|
android:pathData="M54,0C24.18,0,0,24.18,0,54s24.18,54,54,54s54-24.18,54-54S83.82,0,54,0z"/>
|
||||||
android:strokeWidth="8"
|
|
||||||
android:strokeColor="#FFFFFF"/>
|
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFF"
|
android:fillColor="#FFFFFF"
|
||||||
android:pathData="M54,40 A14,14 0 1,1 54,68 A14,14 0 1,1 54,40"
|
android:pathData="M54,27c-14.91,0-27,12.09-27,27s12.09,27,27,27s27-12.09,27-27S68.91,27,54,27z"/>
|
||||||
android:strokeWidth="4"
|
<path
|
||||||
android:strokeColor="#FFFFFF"/>
|
android:fillColor="#1A1A2E"
|
||||||
|
android:pathData="M54,35c-10.55,0-19,8.45-19,19s8.45,19,19,19s19-8.45,19-19S64.55,35,54,35z"/>
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:pathData="M48,42c0,3.31-2.69,6-6,6s-6-2.69-6-6s2.69-6,6-6S48,38.69,48,42z"/>
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF9F1C"
|
||||||
|
android:pathData="M45,51l18,5l-18,5z"/>
|
||||||
</vector>
|
</vector>
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<color name="ic_launcher_background">#6750A4</color>
|
<color name="ic_launcher_background">#1A1A2E</color>
|
||||||
</resources>
|
</resources>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue