mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Implement basic framework for new Settings UI
This commit is contained in:
@@ -56,7 +56,7 @@
|
||||
android:label="@string/add_directory_title"/>
|
||||
|
||||
<activity
|
||||
android:name=".activities.SettingsActivity"
|
||||
android:name=".ui.settings.SettingsActivity"
|
||||
android:theme="@style/DolphinSettingsGamecube"
|
||||
android:label="@string/grid_menu_settings"/>
|
||||
|
||||
@@ -71,8 +71,6 @@
|
||||
|
||||
<service android:name=".services.AssetCopyService"/>
|
||||
|
||||
<service android:name=".services.SettingsSaveService"/>
|
||||
|
||||
<provider
|
||||
android:name=".model.GameProvider"
|
||||
android:authorities="${applicationId}.provider"
|
||||
|
||||
-48
@@ -1,48 +0,0 @@
|
||||
package org.dolphinemu.dolphinemu.activities;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
||||
import org.dolphinemu.dolphinemu.fragments.SettingsFragment;
|
||||
import org.dolphinemu.dolphinemu.services.SettingsSaveService;
|
||||
import org.dolphinemu.dolphinemu.utils.Log;
|
||||
|
||||
public final class SettingsActivity extends AppCompatActivity
|
||||
{
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// Display the fragment as the main content.
|
||||
getFragmentManager().beginTransaction()
|
||||
.replace(android.R.id.content, new SettingsFragment(), "settings_fragment")
|
||||
.commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* If this is called, the user has left the settings screen (potentially through the
|
||||
* home button) and will expect their changes to be persisted. So we kick off an
|
||||
* IntentService which will do so on a background thread.
|
||||
*/
|
||||
@Override
|
||||
protected void onStop()
|
||||
{
|
||||
super.onStop();
|
||||
|
||||
Log.debug("[SettingsActivity] Settings activity stopping. Saving settings to INI...");
|
||||
|
||||
// Copy assets into appropriate locations.
|
||||
Intent settingsSaver = new Intent(this, SettingsSaveService.class);
|
||||
startService(settingsSaver);
|
||||
}
|
||||
|
||||
public static void launch(Context context)
|
||||
{
|
||||
Intent settings = new Intent(context, SettingsActivity.class);
|
||||
context.startActivity(settings);
|
||||
}
|
||||
}
|
||||
-155
@@ -1,155 +0,0 @@
|
||||
package org.dolphinemu.dolphinemu.fragments;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import org.dolphinemu.dolphinemu.R;
|
||||
import org.dolphinemu.dolphinemu.utils.EGLHelper;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
|
||||
public final class SettingsFragment extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener
|
||||
{
|
||||
private SharedPreferences mPreferences;
|
||||
private ListPreference mVideoBackendPreference;
|
||||
|
||||
private final EGLHelper mEglHelper = new EGLHelper(EGLHelper.EGL_OPENGL_ES2_BIT);
|
||||
private final String mVendor = mEglHelper.getGL().glGetString(GL10.GL_VENDOR);
|
||||
|
||||
private final String mVersion = mEglHelper.getGL().glGetString(GL10.GL_VERSION);
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// Load the preferences from an XML resource
|
||||
addPreferencesFromResource(R.xml.preferences);
|
||||
|
||||
// TODO Below here is effectively ported from the old VideoSettingsFragment. There is
|
||||
// TODO probably a simpler way to do this, but potentially could require UI discussion/feedback.
|
||||
|
||||
// Setting valid video backends.
|
||||
mVideoBackendPreference = (ListPreference) findPreference("gpuPref");
|
||||
final boolean deviceSupportsGL = mEglHelper.supportsOpenGL();
|
||||
final boolean deviceSupportsGLES3 = mEglHelper.supportsGLES3();
|
||||
|
||||
if (deviceSupportsGL)
|
||||
{
|
||||
mVideoBackendPreference.setEntries(R.array.videoBackendEntriesGL);
|
||||
mVideoBackendPreference.setEntryValues(R.array.videoBackendValuesGL);
|
||||
}
|
||||
else if (deviceSupportsGLES3)
|
||||
{
|
||||
mVideoBackendPreference.setEntries(R.array.videoBackendEntriesGLES3);
|
||||
mVideoBackendPreference.setEntryValues(R.array.videoBackendValuesGLES3);
|
||||
}
|
||||
else
|
||||
{
|
||||
mVideoBackendPreference.setEntries(R.array.videoBackendEntriesNoGLES3);
|
||||
mVideoBackendPreference.setEntryValues(R.array.videoBackendValuesNoGLES3);
|
||||
}
|
||||
|
||||
//
|
||||
// Set available post processing shaders
|
||||
//
|
||||
|
||||
List<CharSequence> shader_names = new ArrayList<CharSequence>();
|
||||
List<CharSequence> shader_values = new ArrayList<CharSequence>();
|
||||
|
||||
// Disabled option
|
||||
shader_names.add("Disabled");
|
||||
shader_values.add("");
|
||||
|
||||
// TODO Since shaders are included with the APK, we know what they are at build-time. We should
|
||||
// TODO be able to run this logic somehow at build-time and not rely on the device doing it.
|
||||
|
||||
File shaders_folder = new File(Environment.getExternalStorageDirectory() + File.separator + "dolphin-emu" + File.separator + "Shaders");
|
||||
if (shaders_folder.exists())
|
||||
{
|
||||
File[] shaders = shaders_folder.listFiles();
|
||||
for (File file : shaders)
|
||||
{
|
||||
if (file.isFile())
|
||||
{
|
||||
String filename = file.getName();
|
||||
if (filename.endsWith(".glsl"))
|
||||
{
|
||||
// Strip the extension and put it in to the list
|
||||
shader_names.add(filename.substring(0, filename.lastIndexOf('.')));
|
||||
shader_values.add(filename.substring(0, filename.lastIndexOf('.')));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final ListPreference shader_preference = (ListPreference) findPreference("postProcessingShader");
|
||||
shader_preference.setEntries(shader_names.toArray(new CharSequence[shader_names.size()]));
|
||||
shader_preference.setEntryValues(shader_values.toArray(new CharSequence[shader_values.size()]));
|
||||
|
||||
//
|
||||
// Disable all options if Software Rendering is used.
|
||||
//
|
||||
// Note that the numeric value in 'getPreference()'
|
||||
// denotes the placement on the UI. So if more elements are
|
||||
// added to the video settings, these may need to change.
|
||||
//
|
||||
mPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
||||
|
||||
if (mVideoBackendPreference.getValue().equals("Software Renderer"))
|
||||
{
|
||||
findPreference("enhancements").setEnabled(false);
|
||||
findPreference("hacks").setEnabled(false);
|
||||
findPreference("showFPS").setEnabled(false);
|
||||
}
|
||||
else if (mVideoBackendPreference.getValue().equals("OGL"))
|
||||
{
|
||||
findPreference("enhancements").setEnabled(true);
|
||||
findPreference("hacks").setEnabled(true);
|
||||
findPreference("showFPS").setEnabled(true);
|
||||
|
||||
// Check if we support stereo
|
||||
// If we support desktop GL then we must support at least OpenGL 3.2
|
||||
// If we only support OpenGLES then we need both OpenGLES 3.1 and AEP
|
||||
if ((mEglHelper.supportsOpenGL() && mEglHelper.GetVersion() >= 320) ||
|
||||
(mEglHelper.supportsGLES3() && mEglHelper.GetVersion() >= 310 && mEglHelper.SupportsExtension("GL_ANDROID_extension_pack_es31a")))
|
||||
findPreference("StereoscopyScreen").setEnabled(true);
|
||||
else
|
||||
findPreference("StereoscopyScreen").setEnabled(false);
|
||||
}
|
||||
|
||||
// Also set a listener, so that if someone changes the video backend, it will disable
|
||||
// the video settings, upon the user choosing "Software Rendering".
|
||||
mPreferences.registerOnSharedPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences preferences, String key)
|
||||
{
|
||||
if (key.equals("gpuPref"))
|
||||
{
|
||||
if (preferences.getString(key, "Software Renderer").equals("Software Renderer"))
|
||||
{
|
||||
findPreference("enhancements").setEnabled(false);
|
||||
findPreference("hacks").setEnabled(false);
|
||||
findPreference("showFPS").setEnabled(false);
|
||||
}
|
||||
else if (preferences.getString(key, "Software Renderer").equals("OGL"))
|
||||
{
|
||||
findPreference("enhancements").setEnabled(true);
|
||||
findPreference("hacks").setEnabled(true);
|
||||
findPreference("showFPS").setEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package org.dolphinemu.dolphinemu.model.settings.view;
|
||||
|
||||
|
||||
import org.dolphinemu.dolphinemu.model.settings.BooleanSetting;
|
||||
import org.dolphinemu.dolphinemu.model.settings.Setting;
|
||||
|
||||
public class CheckBoxSetting extends SettingsItem
|
||||
{
|
||||
public CheckBoxSetting(String key, Setting setting, int titleId, int descriptionId)
|
||||
{
|
||||
super(key, setting, titleId, descriptionId);
|
||||
}
|
||||
|
||||
public boolean isChecked()
|
||||
{
|
||||
BooleanSetting setting = (BooleanSetting) getSetting();
|
||||
return setting.getValue();
|
||||
}
|
||||
|
||||
public void setChecked(boolean checked)
|
||||
{
|
||||
BooleanSetting setting = (BooleanSetting) getSetting();
|
||||
setting.setValue(checked);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType()
|
||||
{
|
||||
return TYPE_CHECKBOX;
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package org.dolphinemu.dolphinemu.model.settings.view;
|
||||
|
||||
|
||||
import org.dolphinemu.dolphinemu.model.settings.Setting;
|
||||
|
||||
public class HeaderSetting extends SettingsItem
|
||||
{
|
||||
public HeaderSetting(String key, Setting setting, int titleId, int descriptionId)
|
||||
{
|
||||
super(key, setting, titleId, descriptionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType()
|
||||
{
|
||||
return SettingsItem.TYPE_HEADER;
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package org.dolphinemu.dolphinemu.model.settings.view;
|
||||
|
||||
import org.dolphinemu.dolphinemu.model.settings.Setting;
|
||||
|
||||
public abstract class SettingsItem
|
||||
{
|
||||
public static final int TYPE_HEADER = 0;
|
||||
public static final int TYPE_CHECKBOX = 1;
|
||||
public static final int TYPE_SINGLE_CHOICE = 2;
|
||||
public static final int TYPE_SLIDER = 3;
|
||||
public static final int TYPE_SUBMENU = 4;
|
||||
|
||||
private String mKey;
|
||||
private Setting mSetting;
|
||||
|
||||
private int mTitleId;
|
||||
private int mDescriptionId;
|
||||
|
||||
public SettingsItem(String key, Setting setting, int titleId, int descriptionId)
|
||||
{
|
||||
mKey = key;
|
||||
mSetting = setting;
|
||||
mTitleId = titleId;
|
||||
mDescriptionId = descriptionId;
|
||||
}
|
||||
|
||||
public String getKey()
|
||||
{
|
||||
return mKey;
|
||||
}
|
||||
|
||||
public Setting getSetting()
|
||||
{
|
||||
return mSetting;
|
||||
}
|
||||
|
||||
public int getNameId()
|
||||
{
|
||||
return mTitleId;
|
||||
}
|
||||
|
||||
public int getDescriptionId()
|
||||
{
|
||||
return mDescriptionId;
|
||||
}
|
||||
|
||||
public abstract int getType();
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package org.dolphinemu.dolphinemu.model.settings.view;
|
||||
|
||||
import org.dolphinemu.dolphinemu.model.settings.IntSetting;
|
||||
import org.dolphinemu.dolphinemu.model.settings.Setting;
|
||||
|
||||
public class SingleChoiceSetting extends SettingsItem
|
||||
{
|
||||
private int mChoicesId;
|
||||
private int mValuesId;
|
||||
|
||||
public SingleChoiceSetting(String key, Setting setting, int titleId, int descriptionId, int choicesId, int valuesId)
|
||||
{
|
||||
super(key, setting, titleId, descriptionId);
|
||||
mChoicesId = choicesId;
|
||||
mValuesId = valuesId;
|
||||
}
|
||||
|
||||
public int getChoicesId()
|
||||
{
|
||||
return mChoicesId;
|
||||
}
|
||||
|
||||
public int getValuesId()
|
||||
{
|
||||
return mValuesId;
|
||||
}
|
||||
|
||||
public int getSelectedValue()
|
||||
{
|
||||
IntSetting setting = (IntSetting) getSetting();
|
||||
return setting.getValue();
|
||||
}
|
||||
|
||||
public void setSelectedValue(int selection)
|
||||
{
|
||||
IntSetting setting = (IntSetting) getSetting();
|
||||
setting.setValue(selection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType()
|
||||
{
|
||||
return TYPE_SINGLE_CHOICE;
|
||||
}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package org.dolphinemu.dolphinemu.model.settings.view;
|
||||
|
||||
import org.dolphinemu.dolphinemu.model.settings.FloatSetting;
|
||||
import org.dolphinemu.dolphinemu.model.settings.IntSetting;
|
||||
import org.dolphinemu.dolphinemu.model.settings.Setting;
|
||||
import org.dolphinemu.dolphinemu.utils.Log;
|
||||
|
||||
public class SliderSetting extends SettingsItem
|
||||
{
|
||||
private int mMax;
|
||||
|
||||
public SliderSetting(String key, Setting setting, int titleId, int descriptionId, int max)
|
||||
{
|
||||
super(key, setting, titleId, descriptionId);
|
||||
mMax = max;
|
||||
}
|
||||
|
||||
public int getMax()
|
||||
{
|
||||
return mMax;
|
||||
}
|
||||
|
||||
public int getSelectedValue()
|
||||
{
|
||||
Setting setting = getSetting();
|
||||
|
||||
if (setting instanceof IntSetting)
|
||||
{
|
||||
IntSetting intSetting = (IntSetting) setting;
|
||||
return intSetting.getValue();
|
||||
}
|
||||
else if (setting instanceof FloatSetting)
|
||||
{
|
||||
FloatSetting floatSetting = (FloatSetting) setting;
|
||||
return Math.round(floatSetting.getValue());
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.error("[SliderSetting] Error casting setting type.");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public void setSelectedValue(int selection)
|
||||
{
|
||||
IntSetting setting = (IntSetting) getSetting();
|
||||
setting.setValue(selection);
|
||||
}
|
||||
|
||||
public void setSelectedValue(float selection)
|
||||
{
|
||||
FloatSetting setting = (FloatSetting) getSetting();
|
||||
setting.setValue(selection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType()
|
||||
{
|
||||
return TYPE_SLIDER;
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package org.dolphinemu.dolphinemu.model.settings.view;
|
||||
|
||||
import org.dolphinemu.dolphinemu.model.settings.Setting;
|
||||
|
||||
public class SubmenuSetting extends SettingsItem
|
||||
{
|
||||
private String mMenuKey;
|
||||
|
||||
public SubmenuSetting(String key, Setting setting, int titleId, int descriptionId, String menuKey)
|
||||
{
|
||||
super(key, setting, titleId, descriptionId);
|
||||
mMenuKey = menuKey;
|
||||
}
|
||||
|
||||
public String getMenuKey()
|
||||
{
|
||||
return mMenuKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType()
|
||||
{
|
||||
return TYPE_SUBMENU;
|
||||
}
|
||||
}
|
||||
-5
@@ -13,7 +13,6 @@ import android.preference.PreferenceManager;
|
||||
|
||||
import org.dolphinemu.dolphinemu.NativeLibrary;
|
||||
import org.dolphinemu.dolphinemu.utils.Log;
|
||||
import org.dolphinemu.dolphinemu.utils.UserPreferences;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
@@ -61,10 +60,6 @@ public final class AssetCopyService extends IntentService
|
||||
copyAsset("GCPadNew.ini", ConfigDir + File.separator + "GCPadNew.ini");
|
||||
copyAsset("WiimoteNew.ini", ConfigDir + File.separator + "WiimoteNew.ini");
|
||||
|
||||
// Load the configuration keys set in the Dolphin ini and gfx ini files
|
||||
// into the application's shared preferences.
|
||||
UserPreferences.LoadIniToPrefs(this);
|
||||
|
||||
// Record the fact that we've done this before, so we don't do it on every launch.
|
||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
|
||||
-28
@@ -1,28 +0,0 @@
|
||||
package org.dolphinemu.dolphinemu.services;
|
||||
|
||||
import android.app.IntentService;
|
||||
import android.content.Intent;
|
||||
|
||||
import org.dolphinemu.dolphinemu.utils.Log;
|
||||
import org.dolphinemu.dolphinemu.utils.UserPreferences;
|
||||
|
||||
/**
|
||||
* IntentServices, unlike regular services, inherently run on a background thread.
|
||||
* This IntentService saves all the options the user set in the Java-based UI into
|
||||
* INI files the native code can read.
|
||||
*/
|
||||
public final class SettingsSaveService extends IntentService
|
||||
{
|
||||
public SettingsSaveService()
|
||||
{
|
||||
super("SettingsSaveService");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onHandleIntent(Intent intent)
|
||||
{
|
||||
Log.verbose("[SettingsSaveService] Saving settings to INI files...");
|
||||
UserPreferences.SavePrefsToIni(this);
|
||||
Log.verbose("[SettingsSaveService] Save successful.");
|
||||
}
|
||||
}
|
||||
+157
@@ -0,0 +1,157 @@
|
||||
package org.dolphinemu.dolphinemu.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
/**
|
||||
* Implementation from:
|
||||
* https://gist.github.com/lapastillaroja/858caf1a82791b6c1a36
|
||||
*/
|
||||
public class DividerItemDecoration extends RecyclerView.ItemDecoration
|
||||
{
|
||||
|
||||
private Drawable mDivider;
|
||||
private boolean mShowFirstDivider = false;
|
||||
private boolean mShowLastDivider = false;
|
||||
|
||||
|
||||
public DividerItemDecoration(Context context, AttributeSet attrs)
|
||||
{
|
||||
final TypedArray a = context
|
||||
.obtainStyledAttributes(attrs, new int[]{android.R.attr.listDivider});
|
||||
mDivider = a.getDrawable(0);
|
||||
a.recycle();
|
||||
}
|
||||
|
||||
public DividerItemDecoration(Context context, AttributeSet attrs, boolean showFirstDivider,
|
||||
boolean showLastDivider)
|
||||
{
|
||||
this(context, attrs);
|
||||
mShowFirstDivider = showFirstDivider;
|
||||
mShowLastDivider = showLastDivider;
|
||||
}
|
||||
|
||||
public DividerItemDecoration(Drawable divider)
|
||||
{
|
||||
mDivider = divider;
|
||||
}
|
||||
|
||||
public DividerItemDecoration(Drawable divider, boolean showFirstDivider,
|
||||
boolean showLastDivider)
|
||||
{
|
||||
this(divider);
|
||||
mShowFirstDivider = showFirstDivider;
|
||||
mShowLastDivider = showLastDivider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getItemOffsets(Rect outRect, View view, RecyclerView parent,
|
||||
RecyclerView.State state)
|
||||
{
|
||||
super.getItemOffsets(outRect, view, parent, state);
|
||||
if (mDivider == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (parent.getChildPosition(view) < 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (getOrientation(parent) == LinearLayoutManager.VERTICAL)
|
||||
{
|
||||
outRect.top = mDivider.getIntrinsicHeight();
|
||||
}
|
||||
else
|
||||
{
|
||||
outRect.left = mDivider.getIntrinsicWidth();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state)
|
||||
{
|
||||
if (mDivider == null)
|
||||
{
|
||||
super.onDrawOver(c, parent, state);
|
||||
return;
|
||||
}
|
||||
|
||||
// Initialization needed to avoid compiler warning
|
||||
int left = 0, right = 0, top = 0, bottom = 0, size;
|
||||
int orientation = getOrientation(parent);
|
||||
int childCount = parent.getChildCount();
|
||||
|
||||
if (orientation == LinearLayoutManager.VERTICAL)
|
||||
{
|
||||
size = mDivider.getIntrinsicHeight();
|
||||
left = parent.getPaddingLeft();
|
||||
right = parent.getWidth() - parent.getPaddingRight();
|
||||
}
|
||||
else
|
||||
{ //horizontal
|
||||
size = mDivider.getIntrinsicWidth();
|
||||
top = parent.getPaddingTop();
|
||||
bottom = parent.getHeight() - parent.getPaddingBottom();
|
||||
}
|
||||
|
||||
for (int i = mShowFirstDivider ? 0 : 1; i < childCount; i++)
|
||||
{
|
||||
View child = parent.getChildAt(i);
|
||||
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
|
||||
|
||||
if (orientation == LinearLayoutManager.VERTICAL)
|
||||
{
|
||||
top = child.getTop() - params.topMargin;
|
||||
bottom = top + size;
|
||||
}
|
||||
else
|
||||
{ //horizontal
|
||||
left = child.getLeft() - params.leftMargin;
|
||||
right = left + size;
|
||||
}
|
||||
mDivider.setBounds(left, top, right, bottom);
|
||||
mDivider.draw(c);
|
||||
}
|
||||
|
||||
// show last divider
|
||||
if (mShowLastDivider && childCount > 0)
|
||||
{
|
||||
View child = parent.getChildAt(childCount - 1);
|
||||
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
|
||||
if (orientation == LinearLayoutManager.VERTICAL)
|
||||
{
|
||||
top = child.getBottom() + params.bottomMargin;
|
||||
bottom = top + size;
|
||||
}
|
||||
else
|
||||
{ // horizontal
|
||||
left = child.getRight() + params.rightMargin;
|
||||
right = left + size;
|
||||
}
|
||||
mDivider.setBounds(left, top, right, bottom);
|
||||
mDivider.draw(c);
|
||||
}
|
||||
}
|
||||
|
||||
private int getOrientation(RecyclerView parent)
|
||||
{
|
||||
if (parent.getLayoutManager() instanceof LinearLayoutManager)
|
||||
{
|
||||
LinearLayoutManager layoutManager = (LinearLayoutManager) parent.getLayoutManager();
|
||||
return layoutManager.getOrientation();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalStateException(
|
||||
"DividerItemDecoration can only be used with a LinearLayoutManager.");
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-2
@@ -16,10 +16,11 @@ import android.view.View;
|
||||
|
||||
import org.dolphinemu.dolphinemu.R;
|
||||
import org.dolphinemu.dolphinemu.activities.AddDirectoryActivity;
|
||||
import org.dolphinemu.dolphinemu.activities.SettingsActivity;
|
||||
import org.dolphinemu.dolphinemu.adapters.PlatformPagerAdapter;
|
||||
import org.dolphinemu.dolphinemu.model.GameProvider;
|
||||
import org.dolphinemu.dolphinemu.ui.platform.PlatformGamesView;
|
||||
import org.dolphinemu.dolphinemu.ui.settings.SettingsActivity;
|
||||
import org.dolphinemu.dolphinemu.utils.SettingsFile;
|
||||
import org.dolphinemu.dolphinemu.utils.StartupHandler;
|
||||
|
||||
/**
|
||||
@@ -117,7 +118,7 @@ public final class MainActivity extends AppCompatActivity implements MainView
|
||||
@Override
|
||||
public void launchSettingsActivity()
|
||||
{
|
||||
SettingsActivity.launch(this);
|
||||
SettingsActivity.launch(this, SettingsFile.FILE_NAME_DOLPHIN);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+3
-2
@@ -20,11 +20,12 @@ import android.support.v17.leanback.widget.RowPresenter;
|
||||
import org.dolphinemu.dolphinemu.R;
|
||||
import org.dolphinemu.dolphinemu.activities.AddDirectoryActivity;
|
||||
import org.dolphinemu.dolphinemu.activities.EmulationActivity;
|
||||
import org.dolphinemu.dolphinemu.activities.SettingsActivity;
|
||||
import org.dolphinemu.dolphinemu.adapters.GameRowPresenter;
|
||||
import org.dolphinemu.dolphinemu.adapters.SettingsRowPresenter;
|
||||
import org.dolphinemu.dolphinemu.model.Game;
|
||||
import org.dolphinemu.dolphinemu.model.TvSettingsItem;
|
||||
import org.dolphinemu.dolphinemu.ui.settings.SettingsActivity;
|
||||
import org.dolphinemu.dolphinemu.utils.SettingsFile;
|
||||
import org.dolphinemu.dolphinemu.utils.StartupHandler;
|
||||
import org.dolphinemu.dolphinemu.viewholders.TvGameViewHolder;
|
||||
|
||||
@@ -114,7 +115,7 @@ public final class TvMainActivity extends Activity implements MainView
|
||||
@Override
|
||||
public void launchSettingsActivity()
|
||||
{
|
||||
SettingsActivity.launch(this);
|
||||
SettingsActivity.launch(this, SettingsFile.FILE_NAME_DOLPHIN);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
package org.dolphinemu.dolphinemu.ui.settings;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.dolphinemu.dolphinemu.BuildConfig;
|
||||
import org.dolphinemu.dolphinemu.R;
|
||||
import org.dolphinemu.dolphinemu.model.settings.SettingSection;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public final class SettingsActivity extends AppCompatActivity implements SettingsActivityView
|
||||
{
|
||||
private SettingsActivityPresenter mPresenter = new SettingsActivityPresenter(this);
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_settings);
|
||||
|
||||
Intent launcher = getIntent();
|
||||
String filename = launcher.getStringExtra(ARGUMENT_FILE_NAME);
|
||||
|
||||
mPresenter.onCreate(savedInstanceState, filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* If this is called, the user has left the settings screen (potentially through the
|
||||
* home button) and will expect their changes to be persisted. So we kick off an
|
||||
* IntentService which will do so on a background thread.
|
||||
*/
|
||||
@Override
|
||||
protected void onStop()
|
||||
{
|
||||
super.onStop();
|
||||
|
||||
mPresenter.onStop(isFinishing());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showSettingsFragment(String menuTag, boolean addToStack)
|
||||
{
|
||||
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction()
|
||||
.replace(R.id.frame_content, SettingsFragment.newInstance(menuTag), SettingsFragment.FRAGMENT_TAG);
|
||||
|
||||
if (addToStack)
|
||||
{
|
||||
transaction.addToBackStack(null);
|
||||
}
|
||||
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<String, SettingSection> getSettings()
|
||||
{
|
||||
return mPresenter.getSettings();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSettings(HashMap<String, SettingSection> settings)
|
||||
{
|
||||
mPresenter.setSettings(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSettingsFileLoaded(HashMap<String, SettingSection> settings)
|
||||
{
|
||||
SettingsFragmentView fragment = getFragment();
|
||||
|
||||
if (fragment != null)
|
||||
{
|
||||
fragment.onSettingsFileLoaded(settings);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showToastMessage(String message)
|
||||
{
|
||||
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
private SettingsFragment getFragment()
|
||||
{
|
||||
return (SettingsFragment) getSupportFragmentManager().findFragmentByTag(SettingsFragment.FRAGMENT_TAG);
|
||||
}
|
||||
|
||||
public static final String ARGUMENT_FILE_NAME = BuildConfig.APPLICATION_ID + ".file_name";
|
||||
|
||||
public static void launch(Context context, String menuTag)
|
||||
{
|
||||
Intent settings = new Intent(context, SettingsActivity.class);
|
||||
|
||||
settings.putExtra(ARGUMENT_FILE_NAME, menuTag);
|
||||
|
||||
context.startActivity(settings);
|
||||
}
|
||||
}
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
package org.dolphinemu.dolphinemu.ui.settings;
|
||||
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.dolphinemu.dolphinemu.model.settings.SettingSection;
|
||||
import org.dolphinemu.dolphinemu.utils.Log;
|
||||
import org.dolphinemu.dolphinemu.utils.SettingsFile;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.functions.Action1;
|
||||
import rx.schedulers.Schedulers;
|
||||
|
||||
public class SettingsActivityPresenter
|
||||
{
|
||||
private SettingsActivityView mView;
|
||||
|
||||
private String mFileName;
|
||||
private HashMap<String, SettingSection> mSettingsBySection;
|
||||
|
||||
public SettingsActivityPresenter(SettingsActivityView view)
|
||||
{
|
||||
mView = view;
|
||||
}
|
||||
|
||||
public void onCreate(Bundle savedInstanceState, String filename)
|
||||
{
|
||||
mFileName = filename;
|
||||
|
||||
if (savedInstanceState == null)
|
||||
{
|
||||
SettingsFile.readFile(mFileName)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Action1<HashMap<String, SettingSection>>()
|
||||
{
|
||||
@Override
|
||||
public void call(HashMap<String, SettingSection> settingsBySection)
|
||||
{
|
||||
mSettingsBySection = settingsBySection;
|
||||
mView.onSettingsFileLoaded(settingsBySection);
|
||||
}
|
||||
});
|
||||
|
||||
mView.showSettingsFragment(mFileName, false);
|
||||
}
|
||||
}
|
||||
|
||||
public void setSettings(HashMap<String, SettingSection> settings)
|
||||
{
|
||||
mSettingsBySection = settings;
|
||||
}
|
||||
|
||||
public HashMap<String, SettingSection> getSettings()
|
||||
{
|
||||
return mSettingsBySection;
|
||||
}
|
||||
|
||||
public void onStop(boolean finishing)
|
||||
{
|
||||
if (mSettingsBySection != null && finishing)
|
||||
{
|
||||
Log.debug("[SettingsActivity] Settings activity stopping. Saving settings to INI...");
|
||||
SettingsFile.saveFile(mFileName, mSettingsBySection)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
new Action1<Boolean>()
|
||||
{
|
||||
@Override
|
||||
public void call(Boolean aBoolean)
|
||||
{
|
||||
mView.showToastMessage("Saved successfully to " + mFileName + ".ini");
|
||||
}
|
||||
},
|
||||
new Action1<Throwable>()
|
||||
{
|
||||
@Override
|
||||
public void call(Throwable throwable)
|
||||
{
|
||||
mView.showToastMessage("Error saving " + mFileName + ".ini: " + throwable.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package org.dolphinemu.dolphinemu.ui.settings;
|
||||
|
||||
import org.dolphinemu.dolphinemu.model.settings.SettingSection;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public interface SettingsActivityView
|
||||
{
|
||||
void showSettingsFragment(String menuTag, boolean addToStack);
|
||||
|
||||
HashMap<String, SettingSection> getSettings();
|
||||
|
||||
void setSettings(HashMap<String, SettingSection> settings);
|
||||
|
||||
void onSettingsFileLoaded(HashMap<String, SettingSection> settings);
|
||||
|
||||
void showToastMessage(String message);
|
||||
}
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
package org.dolphinemu.dolphinemu.ui.settings;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.dolphinemu.dolphinemu.R;
|
||||
import org.dolphinemu.dolphinemu.model.settings.view.SettingsItem;
|
||||
import org.dolphinemu.dolphinemu.model.settings.view.SingleChoiceSetting;
|
||||
import org.dolphinemu.dolphinemu.model.settings.view.SliderSetting;
|
||||
import org.dolphinemu.dolphinemu.model.settings.view.SubmenuSetting;
|
||||
import org.dolphinemu.dolphinemu.ui.settings.viewholder.CheckBoxSettingViewHolder;
|
||||
import org.dolphinemu.dolphinemu.ui.settings.viewholder.HeaderViewHolder;
|
||||
import org.dolphinemu.dolphinemu.ui.settings.viewholder.SettingViewHolder;
|
||||
import org.dolphinemu.dolphinemu.ui.settings.viewholder.SingleChoiceViewHolder;
|
||||
import org.dolphinemu.dolphinemu.ui.settings.viewholder.SliderViewHolder;
|
||||
import org.dolphinemu.dolphinemu.ui.settings.viewholder.SubmenuViewHolder;
|
||||
import org.dolphinemu.dolphinemu.utils.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolder>
|
||||
{
|
||||
private SettingsFragmentView mView;
|
||||
private Context mContext;
|
||||
private ArrayList<SettingsItem> mSettings;
|
||||
|
||||
public SettingsAdapter(SettingsFragmentView view, Context context)
|
||||
{
|
||||
mView = view;
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SettingViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
|
||||
{
|
||||
View view;
|
||||
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
|
||||
|
||||
switch (viewType)
|
||||
{
|
||||
case SettingsItem.TYPE_HEADER:
|
||||
view = inflater.inflate(R.layout.list_item_settings_header, parent, false);
|
||||
return new HeaderViewHolder(view, this);
|
||||
|
||||
case SettingsItem.TYPE_CHECKBOX:
|
||||
view = inflater.inflate(R.layout.list_item_setting_checkbox, parent, false);
|
||||
return new CheckBoxSettingViewHolder(view, this);
|
||||
|
||||
case SettingsItem.TYPE_SINGLE_CHOICE:
|
||||
view = inflater.inflate(R.layout.list_item_setting, parent, false);
|
||||
return new SingleChoiceViewHolder(view, this);
|
||||
|
||||
case SettingsItem.TYPE_SLIDER:
|
||||
view = inflater.inflate(R.layout.list_item_setting, parent, false);
|
||||
return new SliderViewHolder(view, this);
|
||||
|
||||
case SettingsItem.TYPE_SUBMENU:
|
||||
view = inflater.inflate(R.layout.list_item_setting, parent, false);
|
||||
return new SubmenuViewHolder(view, this);
|
||||
|
||||
default:
|
||||
Log.error("[SettingsAdapter] Invalid view type: " + viewType);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(SettingViewHolder holder, int position)
|
||||
{
|
||||
holder.bind(getItem(position));
|
||||
}
|
||||
|
||||
private SettingsItem getItem(int position)
|
||||
{
|
||||
return mSettings.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount()
|
||||
{
|
||||
if (mSettings != null)
|
||||
{
|
||||
return mSettings.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position)
|
||||
{
|
||||
return getItem(position).getType();
|
||||
}
|
||||
|
||||
public void setSettings(ArrayList<SettingsItem> settings)
|
||||
{
|
||||
mSettings = settings;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void onSingleChoiceClick(SingleChoiceSetting item)
|
||||
{
|
||||
Toast.makeText(mContext, "Single choice item clicked", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
public void onSliderClick(SliderSetting item)
|
||||
{
|
||||
Toast.makeText(mContext, "Slider item clicked", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
public void onSubmenuClick(SubmenuSetting item)
|
||||
{
|
||||
Toast.makeText(mContext, "Submenu item clicked", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
package org.dolphinemu.dolphinemu.ui.settings;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import org.dolphinemu.dolphinemu.BuildConfig;
|
||||
import org.dolphinemu.dolphinemu.R;
|
||||
import org.dolphinemu.dolphinemu.model.settings.SettingSection;
|
||||
import org.dolphinemu.dolphinemu.model.settings.view.SettingsItem;
|
||||
import org.dolphinemu.dolphinemu.ui.DividerItemDecoration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
public final class SettingsFragment extends Fragment implements SettingsFragmentView
|
||||
{
|
||||
private SettingsFragmentPresenter mPresenter = new SettingsFragmentPresenter(this);
|
||||
private SettingsActivityView mView;
|
||||
|
||||
private SettingsAdapter mAdapter;
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context)
|
||||
{
|
||||
super.onAttach(context);
|
||||
|
||||
mView = (SettingsActivityView) context;
|
||||
mPresenter.onAttach();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setRetainInstance(true);
|
||||
String menuTag = getArguments().getString(ARGUMENT_MENU_TAG);
|
||||
|
||||
mAdapter = new SettingsAdapter(this, getActivity());
|
||||
|
||||
mPresenter.onCreate(menuTag);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
|
||||
{
|
||||
return inflater.inflate(R.layout.fragment_settings, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState)
|
||||
{
|
||||
LinearLayoutManager manager = new LinearLayoutManager(getActivity());
|
||||
|
||||
RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.list_settings);
|
||||
|
||||
recyclerView.setAdapter(mAdapter);
|
||||
recyclerView.setLayoutManager(manager);
|
||||
recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), null));
|
||||
|
||||
SettingsActivityView activity = (SettingsActivityView) getActivity();
|
||||
HashMap<String, SettingSection> settings = activity.getSettings();
|
||||
|
||||
mPresenter.onViewCreated(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetach()
|
||||
{
|
||||
super.onDetach();
|
||||
mView = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSettingsFileLoaded(HashMap<String, SettingSection> settings)
|
||||
{
|
||||
mPresenter.setSettings(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void passOptionsToActivity(HashMap<String, SettingSection> settings)
|
||||
{
|
||||
if (mView != null)
|
||||
{
|
||||
mView.setSettings(settings);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showSettingsList(ArrayList<SettingsItem> settingsList)
|
||||
{
|
||||
mAdapter.setSettings(settingsList);
|
||||
}
|
||||
|
||||
public static final String FRAGMENT_TAG = BuildConfig.APPLICATION_ID + ".fragment.settings";
|
||||
|
||||
public static final String ARGUMENT_MENU_TAG = FRAGMENT_TAG + ".menu_tag";
|
||||
|
||||
public static Fragment newInstance(String menuTag)
|
||||
{
|
||||
SettingsFragment fragment = new SettingsFragment();
|
||||
|
||||
Bundle arguments = new Bundle();
|
||||
arguments.putString(ARGUMENT_MENU_TAG, menuTag);
|
||||
|
||||
fragment.setArguments(arguments);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
}
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
package org.dolphinemu.dolphinemu.ui.settings;
|
||||
|
||||
import org.dolphinemu.dolphinemu.R;
|
||||
import org.dolphinemu.dolphinemu.model.settings.Setting;
|
||||
import org.dolphinemu.dolphinemu.model.settings.SettingSection;
|
||||
import org.dolphinemu.dolphinemu.model.settings.view.CheckBoxSetting;
|
||||
import org.dolphinemu.dolphinemu.model.settings.view.SettingsItem;
|
||||
import org.dolphinemu.dolphinemu.model.settings.view.SingleChoiceSetting;
|
||||
import org.dolphinemu.dolphinemu.model.settings.view.SliderSetting;
|
||||
import org.dolphinemu.dolphinemu.utils.SettingsFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class SettingsFragmentPresenter
|
||||
{
|
||||
private SettingsFragmentView mView;
|
||||
|
||||
private String mMenuTag;
|
||||
|
||||
private HashMap<String, SettingSection> mSettings;
|
||||
private ArrayList<SettingsItem> mSettingsList;
|
||||
|
||||
public SettingsFragmentPresenter(SettingsFragmentView view)
|
||||
{
|
||||
mView = view;
|
||||
}
|
||||
|
||||
public void onCreate(String menuTag)
|
||||
{
|
||||
mMenuTag = menuTag;
|
||||
}
|
||||
|
||||
public void onViewCreated(HashMap<String, SettingSection> settings)
|
||||
{
|
||||
setSettings(settings);
|
||||
}
|
||||
|
||||
/**
|
||||
* If the screen is rotated, the Activity will forget the settings map. This fragment
|
||||
* won't, though; so rather than have the Activity reload from disk, have the fragment pass
|
||||
* the settings map back to the Activity.
|
||||
*/
|
||||
public void onAttach()
|
||||
{
|
||||
if (mSettings != null)
|
||||
{
|
||||
mView.passOptionsToActivity(mSettings);
|
||||
}
|
||||
}
|
||||
|
||||
public void setSettings(HashMap<String, SettingSection> settings)
|
||||
{
|
||||
if (mSettingsList == null)
|
||||
{
|
||||
if (settings != null)
|
||||
{
|
||||
mSettings = settings;
|
||||
}
|
||||
|
||||
if (mSettings != null)
|
||||
{
|
||||
loadSettingsList();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mView.showSettingsList(mSettingsList);
|
||||
}
|
||||
}
|
||||
|
||||
private void loadSettingsList()
|
||||
{
|
||||
ArrayList<SettingsItem> sl = new ArrayList<>();
|
||||
|
||||
switch (mMenuTag)
|
||||
{
|
||||
case SettingsFile.FILE_NAME_DOLPHIN:
|
||||
addCoreSettings(sl);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
mSettingsList = sl;
|
||||
mView.showSettingsList(mSettingsList);
|
||||
}
|
||||
|
||||
private void addCoreSettings(ArrayList<SettingsItem> sl)
|
||||
{
|
||||
Setting cpuCore = mSettings.get(SettingsFile.SECTION_CORE).getSetting(SettingsFile.KEY_CPU_CORE);
|
||||
sl.add(new SingleChoiceSetting(cpuCore.getKey(), cpuCore, R.string.cpu_core, 0, R.array.string_emu_cores, R.array.int_emu_cores));
|
||||
|
||||
Setting dualCore = mSettings.get(SettingsFile.SECTION_CORE).getSetting(SettingsFile.KEY_DUAL_CORE);
|
||||
sl.add(new CheckBoxSetting(dualCore.getKey(), dualCore, R.string.dual_core, R.string.dual_core_descrip));
|
||||
|
||||
Setting overclockEnable = mSettings.get(SettingsFile.SECTION_CORE).getSetting(SettingsFile.KEY_OVERCLOCK_ENABLE);
|
||||
sl.add(new CheckBoxSetting(overclockEnable.getKey(), overclockEnable, R.string.overclock_enable, R.string.overclock_enable_description));
|
||||
|
||||
Setting overclock = mSettings.get(SettingsFile.SECTION_CORE).getSetting(SettingsFile.KEY_OVERCLOCK_PERCENT);
|
||||
sl.add(new SliderSetting(overclock.getKey(), overclock, R.string.overclock_title, 0, 400));
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user