Display on-screen keyboard when input field is selected on Android
This commit is contained in:
parent
8e1bf2b628
commit
d3b85a607b
2 changed files with 30 additions and 1 deletions
|
@ -1,3 +1,6 @@
|
|||
1.3.3:
|
||||
- Display on-screen keyboard when input field is selected on Android
|
||||
|
||||
1.3.2:
|
||||
- Allow translating server messages
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
"bufio"
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
|
@ -22,11 +23,32 @@ const (
|
|||
ShowServerSettings = true
|
||||
)
|
||||
|
||||
var keyboardConn net.Conn
|
||||
|
||||
func init() {
|
||||
log.SetOutput(os.Stdout)
|
||||
|
||||
AutoEnableTouchInput = true
|
||||
|
||||
t := time.Now()
|
||||
for i := 0; i < 12; i++ {
|
||||
if i > 0 && time.Since(t) < 2*time.Second {
|
||||
i = 0
|
||||
}
|
||||
port := 1337
|
||||
if i > 0 {
|
||||
port = 1337 + port - 1
|
||||
}
|
||||
var err error
|
||||
keyboardConn, err = net.Dial("tcp", fmt.Sprintf("localhost:%d", port))
|
||||
if err == nil {
|
||||
scanner := bufio.NewScanner(keyboardConn)
|
||||
if scanner.Scan() && scanner.Text() == "boxcars" {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Detect timezone.
|
||||
out, err := exec.Command("/system/bin/getprop", "persist.sys.timezone").Output()
|
||||
if err != nil {
|
||||
|
@ -99,5 +121,9 @@ func saveReplay(id int, content []byte) error {
|
|||
}
|
||||
|
||||
func showKeyboard() {
|
||||
game.keyboardHintVisible = true
|
||||
if keyboardConn == nil {
|
||||
game.keyboardHintVisible = true
|
||||
return
|
||||
}
|
||||
keyboardConn.Write([]byte("1\n"))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue