Release Boxcars v1.3.5 for Android
This commit is contained in:
parent
7f8e822b96
commit
ec1a881701
3 changed files with 7 additions and 92 deletions
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
LOCK_BIND=09dbf07665ed261ce09d387a5a9aea3e9c29069c
|
||||
LOCK_EBITENGINE=f20fb3998c49877e8707cc2d5abe0e2216515bd2
|
||||
LOCK_EBITENGINE=ec9b0882ab670437c5a85f35fd442bb347ee6f4c
|
||||
|
||||
export PROJECTPATH=$PWD
|
||||
export GOPATH="$PROJECTPATH/go"
|
||||
|
|
|
@ -3,7 +3,7 @@ plugins {
|
|||
}
|
||||
|
||||
project.ext {
|
||||
boxcarsVersion = "v1.3.4" // https://code.rocket9labs.com/tslocum/boxcars/tags
|
||||
boxcarsVersion = "v1.3.5" // https://code.rocket9labs.com/tslocum/boxcars/tags
|
||||
}
|
||||
|
||||
android {
|
||||
|
@ -17,8 +17,8 @@ android {
|
|||
applicationId "com.rocket9labs.boxcars"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 34
|
||||
versionCode 103040
|
||||
versionName "1.3.4"
|
||||
versionCode 103050
|
||||
versionName "1.3.5"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
|
|
@ -4,26 +4,14 @@ import android.app.Activity;
|
|||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.inputmethod.BaseInputConnection;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
import com.rocket9labs.boxcars.mobile.EbitenView;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.InetAddress;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
|
||||
import go.Seq;
|
||||
|
||||
public class MainActivity extends Activity {
|
||||
private static final int backButtonLongPress = 2000; // Milliseconds.
|
||||
private long backButtonPressed;
|
||||
private long keyPressed;
|
||||
private Handler handler = new Handler();
|
||||
private final Runnable exitRunnable = new Runnable() {
|
||||
@Override
|
||||
|
@ -32,24 +20,6 @@ public class MainActivity extends Activity {
|
|||
}
|
||||
};
|
||||
|
||||
private final Runnable showKeyboard = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||
imm.toggleSoftInputFromWindow(getEbitenView().getWindowToken(), 0, InputMethodManager.HIDE_IMPLICIT_ONLY);
|
||||
getEbitenView().requestFocus();
|
||||
}
|
||||
};
|
||||
|
||||
private final Runnable hideKeyboard = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(getEbitenView().getWindowToken(), 0);
|
||||
getEbitenView().requestFocus();
|
||||
}
|
||||
};
|
||||
|
||||
private EbitenView getEbitenView() {
|
||||
return this.findViewById(R.id.ebitenView);
|
||||
}
|
||||
|
@ -57,32 +27,6 @@ public class MainActivity extends Activity {
|
|||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
Thread thread = new Thread(new Runnable(){
|
||||
@Override
|
||||
public void run(){
|
||||
try {
|
||||
ServerSocket serverSocket = new ServerSocket(1337, 0, InetAddress.getByName("localhost"));
|
||||
Socket socket = serverSocket.accept();
|
||||
InputStream input = socket.getInputStream();
|
||||
PrintWriter writer = new PrintWriter(socket.getOutputStream());
|
||||
writer.write("boxcars\n");
|
||||
writer.flush();
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(input));
|
||||
while (true) {
|
||||
String line = reader.readLine();
|
||||
if (line.equals("1")) {
|
||||
runOnUiThread(showKeyboard);
|
||||
} else if (line.equals("0")) {
|
||||
runOnUiThread(hideKeyboard);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
thread.start();
|
||||
Seq.setContext(getApplicationContext());
|
||||
setContentView(R.layout.activity_main);
|
||||
getEbitenView().requestFocus();
|
||||
|
@ -121,42 +65,13 @@ public class MainActivity extends Activity {
|
|||
if (System.currentTimeMillis() - backButtonPressed >= backButtonLongPress) {
|
||||
finishAndRemoveTask();
|
||||
System.exit(0);
|
||||
return true;
|
||||
} else {
|
||||
getEbitenView().requestFocus();
|
||||
}
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||
imm.toggleSoftInputFromWindow(getEbitenView().getWindowToken(), 0, 0);
|
||||
getEbitenView().requestFocus();
|
||||
return true;
|
||||
}
|
||||
boolean handled = super.onKeyDown(keyCode, event);
|
||||
getEbitenView().requestFocus();
|
||||
return handled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
int keycode = event.getKeyCode();
|
||||
if (keycode == 66 || keycode == 67 || (keycode >= 7 && keycode <= 16 && !event.isShiftPressed())) {
|
||||
long now = System.currentTimeMillis();
|
||||
if (now - keyPressed >= 100) {
|
||||
super.dispatchKeyEvent(event);
|
||||
BaseInputConnection mInputConnection = new BaseInputConnection((EbitenView) findViewById(R.id.ebitenView), false);
|
||||
if (keycode == 66) {
|
||||
mInputConnection.commitText(Character.toString((char) 199), 1);
|
||||
} else if (keycode == 67) {
|
||||
mInputConnection.commitText(Character.toString((char) 231), 1);
|
||||
} else {
|
||||
mInputConnection.commitText(Character.toString((char) (48 + (keycode - 7))), 1);
|
||||
}
|
||||
keyPressed = now;
|
||||
getEbitenView().requestFocus();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
boolean handled = super.dispatchKeyEvent(event);
|
||||
getEbitenView().requestFocus();
|
||||
return handled;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue