1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-22 22:13:35 +02:00

Remove no longer used methods from Java wrapper

This commit is contained in:
Ivan Savenko 2024-02-11 20:16:44 +02:00
parent 19ccef7131
commit 30d677724b
2 changed files with 0 additions and 86 deletions

View File

@ -36,12 +36,6 @@ public class NativeMethods
public static native void initClassloader();
public static native void createServer();
public static native void notifyServerReady();
public static native void notifyServerClosed();
public static native boolean tryToSaveTheGame();
public static void setupMsg(final Messenger msg)
@ -77,62 +71,6 @@ public class NativeMethods
return ctx.getApplicationInfo().nativeLibraryDir;
}
@SuppressWarnings(Const.JNI_METHOD_SUPPRESS)
public static void startServer()
{
Log.i("Got server create request");
final Context ctx = SDL.getContext();
if (!(ctx instanceof VcmiSDLActivity))
{
Log.e("Unexpected context... " + ctx);
return;
}
Intent intent = new Intent(ctx, SDLActivity.class);
intent.setAction(VcmiSDLActivity.NATIVE_ACTION_CREATE_SERVER);
// I probably do something incorrectly, but sending new intent to the activity "normally" breaks SDL events handling (probably detaches jnienv?)
// so instead let's call onNewIntent directly, as out context SHOULD be SDLActivity anyway
((VcmiSDLActivity) ctx).hackCallNewIntentDirectly(intent);
// ctx.startActivity(intent);
}
@SuppressWarnings(Const.JNI_METHOD_SUPPRESS)
public static void killServer()
{
Log.i("Got server close request");
final Context ctx = SDL.getContext();
ctx.stopService(new Intent(ctx, ServerService.class));
Messenger messenger = requireServerMessenger();
try
{
// we need to actually inform client about killing the server, beacuse it needs to unbind service connection before server gets destroyed
messenger.send(Message.obtain(null, VcmiSDLActivity.SERVER_MESSAGE_SERVER_KILLED));
}
catch (RemoteException e)
{
Log.w("Connection with client process broken?");
}
}
@SuppressWarnings(Const.JNI_METHOD_SUPPRESS)
public static void onServerReady()
{
Log.i("Got server ready msg");
Messenger messenger = requireServerMessenger();
try
{
messenger.send(Message.obtain(null, VcmiSDLActivity.SERVER_MESSAGE_SERVER_READY));
}
catch (RemoteException e)
{
Log.w("Connection with client process broken?");
}
}
@SuppressWarnings(Const.JNI_METHOD_SUPPRESS)
public static void showProgress()
{

View File

@ -20,9 +20,6 @@ import eu.vcmi.vcmi.util.Log;
public class VcmiSDLActivity extends SDLActivity
{
public static final int SERVER_MESSAGE_SERVER_READY = 1000;
public static final int SERVER_MESSAGE_SERVER_KILLED = 1001;
public static final String NATIVE_ACTION_CREATE_SERVER = "SDLActivity.Action.CreateServer";
protected static final int COMMAND_USER = 0x8000;
final Messenger mClientMessenger = new Messenger(
@ -188,26 +185,5 @@ public class VcmiSDLActivity extends SDLActivity
{
mCallback = callback;
}
@Override
public void handleMessage(Message msg)
{
Log.i(this, "Got server msg " + msg);
switch (msg.what)
{
case SERVER_MESSAGE_SERVER_READY:
NativeMethods.notifyServerReady();
break;
case SERVER_MESSAGE_SERVER_KILLED:
if (mCallback != null)
{
mCallback.unbindServer();
}
NativeMethods.notifyServerClosed();
break;
default:
super.handleMessage(msg);
}
}
}
}