mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-15 14:59:37 +00:00
(Android) Can now grab current IME string from Java and pass it to
native
This commit is contained in:
parent
ef42f6b58c
commit
7855a25502
@ -249,6 +249,7 @@ static int android_app_set_argv(char** argv)
|
||||
char rom_path[PATH_MAX];
|
||||
char libretro_path[PATH_MAX];
|
||||
char config_file[PATH_MAX];
|
||||
char current_ime[PATH_MAX];
|
||||
|
||||
struct jni_params in_params;
|
||||
struct jni_out_params_char out_args;
|
||||
@ -289,6 +290,12 @@ static int android_app_set_argv(char** argv)
|
||||
strlcpy(out_args.in, "CONFIGFILE", sizeof(out_args.in));
|
||||
jni_get(&in_params, &out_args);
|
||||
|
||||
// Current IME
|
||||
out_args.out = current_ime;
|
||||
out_args.out_sizeof = sizeof(current_ime);
|
||||
strlcpy(out_args.in, "IME", sizeof(out_args.in));
|
||||
jni_get(&in_params, &out_args);
|
||||
|
||||
|
||||
(*in_params.java_vm)->DetachCurrentThread(in_params.java_vm);
|
||||
|
||||
@ -297,6 +304,7 @@ static int android_app_set_argv(char** argv)
|
||||
RARCH_LOG("Libretro path: [%s].\n", libretro_path);
|
||||
RARCH_LOG("Display Refresh rate: %.2f Hz.\n", refreshrate);
|
||||
RARCH_LOG("Config file: [%s].\n", config_file);
|
||||
RARCH_LOG("Current IME: [%s].\n", current_ime);
|
||||
|
||||
int argc = 0;
|
||||
|
||||
|
@ -7,6 +7,7 @@ import java.io.*;
|
||||
import android.content.*;
|
||||
import android.app.*;
|
||||
import android.os.*;
|
||||
import android.provider.Settings;
|
||||
import android.widget.*;
|
||||
import android.view.*;
|
||||
import android.view.inputmethod.*;
|
||||
@ -48,7 +49,7 @@ public class ModuleActivity extends Activity implements AdapterView.OnItemClickL
|
||||
static private final int ACTIVITY_LOAD_ROM = 0;
|
||||
static private String libretro_path;
|
||||
|
||||
public float getRefreshRate()
|
||||
private final float getRefreshRate()
|
||||
{
|
||||
final WindowManager wm = (WindowManager)getSystemService(Context.WINDOW_SERVICE);
|
||||
final Display display = wm.getDefaultDisplay();
|
||||
@ -107,12 +108,14 @@ public class ModuleActivity extends Activity implements AdapterView.OnItemClickL
|
||||
case ACTIVITY_LOAD_ROM:
|
||||
if(data.getStringExtra("PATH") != null)
|
||||
{
|
||||
String current_ime = Settings.Secure.getString(getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
|
||||
Toast.makeText(this, "Loading: ["+ data.getStringExtra("PATH") + "]...", Toast.LENGTH_SHORT).show();
|
||||
myIntent = new Intent(this, NativeActivity.class);
|
||||
myIntent.putExtra("ROM", data.getStringExtra("PATH"));
|
||||
myIntent.putExtra("LIBRETRO", libretro_path);
|
||||
myIntent.putExtra("REFRESHRATE", Float.toString(getRefreshRate()));
|
||||
myIntent.putExtra("CONFIGFILE", "");
|
||||
myIntent.putExtra("IME", current_ime);
|
||||
startActivity(myIntent);
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user