IME config fixups.

This commit is contained in:
Themaister 2013-08-24 12:52:47 +02:00
parent 73cb566620
commit ae5221947a
5 changed files with 72 additions and 19 deletions

View File

@ -29,6 +29,7 @@
<activity android:name=".browser.LazyPopupMenu"></activity>
<activity android:name=".browser.PopupMenuAbstract"></activity>
<activity android:name=".browser.ReportIME"></activity>
<activity android:name=".browser.IMEActivity"></activity>
<activity android:name=".browser.HelpActivity"></activity>
<activity android:name=".browser.FileWrapper"></activity>
<activity android:name=".browser.DirectoryActivity"></activity>

View File

@ -123,10 +123,6 @@
</PreferenceScreen>
<PreferenceScreen android:title="Input Options" >
<PreferenceCategory android:title="General" >
<CheckBoxPreference android:title="Enable global configuration"
android:summary="Enable global settings for all cores. Leave disabled if you want per-core settings."
android:key="global_config_enable"
android:defaultValue="true"/>
<ListPreference
android:entries="@array/back_options"
android:entryValues="@array/back_options_values"
@ -134,6 +130,17 @@
android:summary="Select how you want the Back button to behave."
android:title="Back behavior" />
</PreferenceCategory>
<PreferenceCategory android:title="IME" >
<Preference
android:summary="Sets IME to be used in-game."
android:title="Set Input Method" >
<intent
android:targetClass="org.retroarch.browser.IMEActivity"
android:targetPackage="org.retroarch" />
</Preference>
</PreferenceCategory>
<PreferenceCategory android:title="Configuration Autodetect" >
<CheckBoxPreference
android:defaultValue="true"
@ -468,6 +475,14 @@
</PreferenceCategory>
</PreferenceScreen>
<PreferenceScreen android:title="Settings" >
<PreferenceCategory android:title="Configuration style" >
<CheckBoxPreference
android:defaultValue="true"
android:key="global_config_enable"
android:summary="Enable global settings for all cores. Leave disabled if you want per-core settings."
android:title="Enable global configuration" />
</PreferenceCategory>
<PreferenceCategory android:title="General" >
<CheckBoxPreference
android:defaultValue="true"

View File

@ -0,0 +1,16 @@
package org.retroarch.browser;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.inputmethod.InputMethodManager;
public class IMEActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showInputMethodPicker();
finish();
}
}

View File

@ -83,7 +83,7 @@ public class MainMenuActivity extends PreferenceActivity {
setCoreTitle(libretro_name);
}
} else {
libretro_path = MainMenuActivity.getInstance().getApplicationInfo().nativeLibraryDir;
libretro_path = getInstance().getApplicationInfo().nativeLibraryDir;
libretro_name = "No core";
setCoreTitle("No core");
}
@ -121,7 +121,7 @@ public class MainMenuActivity extends PreferenceActivity {
public static final double getRefreshRate() {
double rate = 0;
SharedPreferences prefs = PreferenceManager
.getDefaultSharedPreferences(MainMenuActivity.getInstance()
.getDefaultSharedPreferences(getInstance()
.getBaseContext());
String refresh_rate = prefs.getString("video_refresh_rate", "");
if (!refresh_rate.isEmpty()) {
@ -129,10 +129,10 @@ public class MainMenuActivity extends PreferenceActivity {
rate = Double.parseDouble(refresh_rate);
} catch (NumberFormatException e) {
Log.e(TAG, "Cannot parse: " + refresh_rate + " as a double!");
rate = MainMenuActivity.getInstance().getDisplayRefreshRate();
rate = getInstance().getDisplayRefreshRate();
}
} else {
rate = MainMenuActivity.getInstance().getDisplayRefreshRate();
rate = getInstance().getDisplayRefreshRate();
}
Log.i(TAG, "Using refresh rate: " + rate + " Hz.");
@ -199,13 +199,13 @@ public class MainMenuActivity extends PreferenceActivity {
String external = System.getenv("EXTERNAL_STORAGE");
SharedPreferences prefs = PreferenceManager
.getDefaultSharedPreferences(MainMenuActivity.getInstance()
.getDefaultSharedPreferences(getInstance()
.getBaseContext());
boolean global_config_enable = prefs.getBoolean("global_config_enable",
true);
boolean config_same_as_native_lib_dir = libretro_path
.equals(MainMenuActivity.getInstance().getApplicationInfo().nativeLibraryDir);
.equals(getInstance().getApplicationInfo().nativeLibraryDir);
String append_path;
if (!global_config_enable && (config_same_as_native_lib_dir == false)) {
String sanitized_name = libretro_path.substring(
@ -237,8 +237,8 @@ public class MainMenuActivity extends PreferenceActivity {
else if (external != null
&& new File(internal + append_path).canWrite())
return external + append_path;
else if ((MainMenuActivity.getInstance().getApplicationInfo().dataDir) != null)
return (MainMenuActivity.getInstance().getApplicationInfo().dataDir)
else if ((getInstance().getApplicationInfo().dataDir) != null)
return (getInstance().getApplicationInfo().dataDir)
+ append_path;
else
// emergency fallback, all else failed
@ -254,7 +254,7 @@ public class MainMenuActivity extends PreferenceActivity {
}
SharedPreferences prefs = PreferenceManager
.getDefaultSharedPreferences(MainMenuActivity.getInstance()
.getDefaultSharedPreferences(getInstance()
.getBaseContext());
config.setString("libretro_path", libretro_path);
@ -323,7 +323,7 @@ public class MainMenuActivity extends PreferenceActivity {
"0")));
config.setDouble("video_refresh_rate",
MainMenuActivity.getRefreshRate());
getRefreshRate());
config.setBoolean("video_threaded",
prefs.getBoolean("video_threaded", true));
@ -356,7 +356,7 @@ public class MainMenuActivity extends PreferenceActivity {
boolean useOverlay = prefs.getBoolean("input_overlay_enable", true);
if (useOverlay) {
String overlayPath = prefs
.getString("input_overlay", (MainMenuActivity.getInstance()
.getString("input_overlay", (getInstance()
.getApplicationInfo().dataDir)
+ "/overlays/snes-landscape.cfg");
config.setString("input_overlay", overlayPath);
@ -382,7 +382,7 @@ public class MainMenuActivity extends PreferenceActivity {
config.setBoolean("video_font_enable",
prefs.getBoolean("video_font_enable", true));
config.setString("game_history_path", MainMenuActivity.getInstance()
config.setString("game_history_path", getInstance()
.getApplicationInfo().dataDir + "/retroarch-history.txt");
for (int i = 1; i <= 4; i++) {
@ -705,7 +705,7 @@ public class MainMenuActivity extends PreferenceActivity {
myIntent.putExtra("ROM", data.getStringExtra("PATH"));
myIntent.putExtra("LIBRETRO", libretro_path);
myIntent.putExtra("CONFIGFILE",
MainMenuActivity.getDefaultConfigPath());
getDefaultConfigPath());
myIntent.putExtra("IME", current_ime);
startActivity(myIntent);
}

View File

@ -2,6 +2,7 @@ package org.retroarch.browser;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.provider.Settings;
@ -9,7 +10,27 @@ public class ReportIME extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String current_ime = Settings.Secure.getString(getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
new AlertDialog.Builder(this).setMessage(current_ime).setNeutralButton("Close", null).show();
String current_ime = Settings.Secure.getString(getContentResolver(),
Settings.Secure.DEFAULT_INPUT_METHOD);
final Activity ctx = this;
AlertDialog.Builder dialog = new AlertDialog.Builder(this)
.setMessage(current_ime)
.setNeutralButton("Close",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int which) {
ctx.finish();
}
}).setCancelable(true)
.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
ctx.finish();
}
});
dialog.show();
}
}