Start adding setting dialogs.

This commit is contained in:
Themaister 2012-12-31 16:04:37 +01:00
parent 925a55c9e1
commit 0270c106c5
4 changed files with 78 additions and 30 deletions

View File

@ -13,15 +13,16 @@
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity android:name=".browser.ModuleActivity">
<activity android:name="org.retroarch.browser.ModuleActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".browser.DirectoryActivity"></activity>
<activity android:name="org.retroarch.browser.SettingsActivity"></activity>
<activity android:name="org.retroarch.browser.DirectoryActivity"></activity>
<activity android:name="android.app.NativeActivity" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale">
<meta-data android:name="android.app.lib_name" android:value="retroarch-activity" />
<meta-data android:name="android.app.func_name" android:value="ANativeActivity_onCreate" />

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
<CheckBoxPreference
android:key="foo"
android:title="Check me!"
android:summary="Check me if you can!"
android:defaultValue="true" />
</PreferenceScreen>

View File

@ -42,7 +42,7 @@ class ModuleWrapper implements IconAdapterItem {
}
public class ModuleActivity extends Activity implements
AdapterView.OnItemClickListener {
AdapterView.OnItemClickListener, PopupMenu.OnMenuItemClickListener {
private IconAdapter<ModuleWrapper> adapter;
static private final int ACTIVITY_LOAD_ROM = 0;
static private String libretro_path;
@ -161,31 +161,7 @@ public class ModuleActivity extends Activity implements
PopupMenu menu = new PopupMenu(this, v);
MenuInflater inflater = menu.getMenuInflater();
inflater.inflate(R.menu.context_menu, menu.getMenu());
menu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.input_method_select:
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showInputMethodPicker();
return true;
case R.id.video_settings:
Log.i(TAG, "Video settings clicked!");
return true;
case R.id.audio_settings:
Log.i(TAG, "Audio settings clicked!");
return true;
case R.id.general_settings:
Log.i(TAG, "General settings clicked!");
return true;
default:
return false;
}
}
});
menu.setOnMenuItemClickListener(this);
menu.show();
}
@ -201,4 +177,38 @@ public class ModuleActivity extends Activity implements
return super.onOptionsItemSelected(aItem);
}
}
}
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.input_method_select:
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showInputMethodPicker();
return true;
case R.id.video_settings:
Log.i(TAG, "Video settings clicked!");
Intent vset = new Intent(this, SettingsActivity.class);
vset.putExtra("TITLE", "Video Config");
startActivity(vset);
return true;
case R.id.audio_settings:
Log.i(TAG, "Audio settings clicked!");
Intent aset = new Intent(this, SettingsActivity.class);
aset.putExtra("TITLE", "Audio Config");
startActivity(aset);
return true;
case R.id.general_settings:
Log.i(TAG, "General settings clicked!");
Intent gset = new Intent(this, SettingsActivity.class);
gset.putExtra("TITLE", "General Config");
startActivity(gset);
return true;
default:
return false;
}
}
}

View File

@ -0,0 +1,29 @@
package org.retroarch.browser;
import org.retroarch.R;
import android.app.Activity;
import android.os.Bundle;
import android.preference.PreferenceFragment;
class SettingsFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Load the preferences from an XML resource
addPreferencesFromResource(R.xml.prefs);
}
}
public class SettingsActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTitle(getIntent().getStringExtra("TITLE"));
getFragmentManager().beginTransaction().
replace(android.R.id.content, new SettingsFragment()).commit();
}
}