[Android] Eliminate the need for the ReportIME activity. We can just add a listener for the preference within InputPreferenceFragment.

This commit is contained in:
Lioncash 2013-10-15 10:28:02 -04:00
parent 3c3e90b0df
commit 9121aea91e
5 changed files with 29 additions and 44 deletions

View File

@ -25,8 +25,7 @@
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="tv.ouya.intent.category.GAME" />
</intent-filter>
</activity>
<activity android:name=".browser.ReportIME"/>
</activity>
<activity android:name=".browser.IMEActivity"/>
<activity android:name=".browser.HelpActivity"/>
<activity android:name=".browser.FileWrapper"/>

View File

@ -123,6 +123,7 @@
<string name="r2_button">R2 Button</string>
<string name="r3_button">R3 Button</string>
<string name="diagnostics">Diagnostics</string>
<string name="current_ime">Current IME</string>
<string name="report_ime">Report IME</string>
<string name="report_ime_desc">Reports the current IME (Input Method Editor) name.</string>

View File

@ -294,11 +294,9 @@
</PreferenceScreen>
</PreferenceCategory>
<PreferenceCategory android:title="@string/diagnostics" >
<Preference android:title="@string/report_ime"
android:summary="@string/report_ime_desc">
<intent
android:targetClass="org.retroarch.browser.ReportIME"
android:targetPackage="org.retroarch" />
</Preference>
<Preference
android:key="report_ime_pref"
android:title="@string/report_ime"
android:summary="@string/report_ime_desc"/>
</PreferenceCategory>
</PreferenceScreen>

View File

@ -1,36 +0,0 @@
package org.retroarch.browser;
import org.retroarch.R;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.provider.Settings;
public final 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);
AlertDialog.Builder dialog = new AlertDialog.Builder(this)
.setMessage(current_ime)
.setNeutralButton(R.string.close,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
}).setCancelable(true)
.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
finish();
}
});
dialog.show();
}
}

View File

@ -3,7 +3,11 @@ package org.retroarch.browser.preferences.fragments;
import org.retroarch.R;
import org.retroarch.browser.preferences.fragments.util.PreferenceListFragment;
import android.app.AlertDialog;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.provider.Settings;
/**
* A {@link PreferenceListFragment} responsible for handling the input preferences.
@ -17,5 +21,24 @@ public final class InputPreferenceFragment extends PreferenceListFragment
// Add input preferences from the XML.
addPreferencesFromResource(R.xml.input_preferences);
// Report IME preference
final Preference reportImePref = findPreference("report_ime_pref");
reportImePref.setOnPreferenceClickListener(new OnPreferenceClickListener()
{
@Override
public boolean onPreferenceClick(Preference preference)
{
final String currentIme = Settings.Secure.getString(getActivity().getContentResolver(),
Settings.Secure.DEFAULT_INPUT_METHOD);
AlertDialog.Builder reportImeDialog = new AlertDialog.Builder(getActivity());
reportImeDialog.setTitle(R.string.current_ime);
reportImeDialog.setMessage(currentIme);
reportImeDialog.setNegativeButton(R.string.close, null);
reportImeDialog.show();
return true;
}
});
}
}