Android minor changes

This commit is contained in:
weihuoya 2019-01-21 10:30:19 +08:00
parent 3397824601
commit bddd0fb44e
7 changed files with 23 additions and 30 deletions

View File

@ -1,13 +0,0 @@
package org.dolphinemu.dolphinemu;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}

View File

@ -262,6 +262,9 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
SingleChoiceSetting scSetting = (SingleChoiceSetting) mClickedItem; SingleChoiceSetting scSetting = (SingleChoiceSetting) mClickedItem;
int value = getValueForSingleChoiceSelection(scSetting, which); int value = getValueForSingleChoiceSelection(scSetting, which);
if (scSetting.getSelectedValue() != value)
mView.onSettingChanged();
MenuTag menuTag = scSetting.getMenuTag(); MenuTag menuTag = scSetting.getMenuTag();
if (menuTag != null) if (menuTag != null)
{ {
@ -313,6 +316,9 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
{ {
StringSingleChoiceSetting scSetting = (StringSingleChoiceSetting) mClickedItem; StringSingleChoiceSetting scSetting = (StringSingleChoiceSetting) mClickedItem;
String value = scSetting.getValueAt(which); String value = scSetting.getValueAt(which);
if (!scSetting.getSelectedValue().equals(value))
mView.onSettingChanged();
StringSetting setting = scSetting.setSelectedValue(value); StringSetting setting = scSetting.setSelectedValue(value);
if (setting != null) if (setting != null)
{ {
@ -324,6 +330,9 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
else if (mClickedItem instanceof SliderSetting) else if (mClickedItem instanceof SliderSetting)
{ {
SliderSetting sliderSetting = (SliderSetting) mClickedItem; SliderSetting sliderSetting = (SliderSetting) mClickedItem;
if (sliderSetting.getSelectedValue() != mSeekbarProgress)
mView.onSettingChanged();
if (sliderSetting.isPercentSetting() || sliderSetting.getSetting() instanceof FloatSetting) if (sliderSetting.isPercentSetting() || sliderSetting.getSetting() instanceof FloatSetting)
{ {
float value; float value;
@ -355,7 +364,6 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
closeDialog(); closeDialog();
} }
mView.onSettingChanged();
mClickedItem = null; mClickedItem = null;
mSeekbarProgress = -1; mSeekbarProgress = -1;
} }

View File

@ -453,7 +453,7 @@ public final class SettingsFragmentPresenter
R.string.internal_resolution, R.string.internal_resolution_description, R.string.internal_resolution, R.string.internal_resolution_description,
R.array.internalResolutionEntries, R.array.internalResolutionValues, 1, resolution)); R.array.internalResolutionEntries, R.array.internalResolutionValues, 1, resolution));
sl.add(new SingleChoiceSetting(SettingsFile.KEY_FSAA, Settings.SECTION_GFX_SETTINGS, sl.add(new SingleChoiceSetting(SettingsFile.KEY_FSAA, Settings.SECTION_GFX_SETTINGS,
R.string.FSAA, R.string.FSAA_description, R.array.FSAAEntries, R.array.FSAAValues, 0, R.string.FSAA, R.string.FSAA_description, R.array.FSAAEntries, R.array.FSAAValues, 1,
fsaa)); fsaa));
sl.add(new SingleChoiceSetting(SettingsFile.KEY_ANISOTROPY, Settings.SECTION_GFX_ENHANCEMENTS, sl.add(new SingleChoiceSetting(SettingsFile.KEY_ANISOTROPY, Settings.SECTION_GFX_ENHANCEMENTS,
R.string.anisotropic_filtering, R.string.anisotropic_filtering_description, R.string.anisotropic_filtering, R.string.anisotropic_filtering_description,
@ -530,7 +530,7 @@ public final class SettingsFragmentPresenter
if (shaderFiles != null) if (shaderFiles != null)
{ {
String[] result = new String[shaderFiles.length + 1]; String[] result = new String[shaderFiles.length + 1];
result[0] = "Off"; result[0] = mView.getActivity().getString(R.string.off);
for (int i = 0; i < shaderFiles.length; i++) for (int i = 0; i < shaderFiles.length; i++)
{ {
String name = shaderFiles[i].getName(); String name = shaderFiles[i].getName();

View File

@ -1,6 +1,7 @@
package org.dolphinemu.dolphinemu.features.settings.utils; package org.dolphinemu.dolphinemu.features.settings.utils;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.text.TextUtils;
import org.dolphinemu.dolphinemu.NativeLibrary; import org.dolphinemu.dolphinemu.NativeLibrary;
import org.dolphinemu.dolphinemu.features.settings.model.BooleanSetting; import org.dolphinemu.dolphinemu.features.settings.model.BooleanSetting;
@ -715,9 +716,11 @@ public final class SettingsFile
for (String key : sortedKeySet) for (String key : sortedKeySet)
{ {
Setting setting = settings.get(key); Setting setting = settings.get(key);
String settingString = settingAsString(setting); String valueAsString = setting.getValueAsString();
if (!TextUtils.isEmpty(valueAsString))
writer.println(settingString); {
writer.println(setting.getKey() + " = " + valueAsString);
}
} }
} }
@ -726,11 +729,6 @@ public final class SettingsFile
return "[" + section.getName() + "]"; return "[" + section.getName() + "]";
} }
private static String settingAsString(Setting setting)
{
return setting.getKey() + " = " + setting.getValueAsString();
}
private static String customWiimoteExtSettingAsString(Setting setting) private static String customWiimoteExtSettingAsString(Setting setting)
{ {
return setting.getKey().substring(0, setting.getKey().length() - 1) + " = " + return setting.getKey().substring(0, setting.getKey().length() - 1) + " = " +

View File

@ -6,9 +6,6 @@
<android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView
android:id="@+id/list_settings" android:id="@+id/list_settings"
android:background="@android:color/white" android:background="@android:color/white"
android:elevation="@dimen/elevation_high"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"/> android:layout_height="match_parent"/>

View File

@ -143,14 +143,16 @@
<!-- FSAA Preference --> <!-- FSAA Preference -->
<string-array name="FSAAEntries" translatable="false"> <string-array name="FSAAEntries" translatable="false">
<item>1x</item> <item>Off</item>
<item>2x</item> <item>2x</item>
<item>4x</item> <item>4x</item>
<item>8x</item>
</string-array> </string-array>
<integer-array name="FSAAValues" translatable="false"> <integer-array name="FSAAValues" translatable="false">
<item>0</item>
<item>1</item> <item>1</item>
<item>2</item> <item>2</item>
<item>4</item>
<item>8</item>
</integer-array> </integer-array>
<!-- Anisotropic Filtering Preference --> <!-- Anisotropic Filtering Preference -->

View File

@ -248,6 +248,7 @@
<string name="yes">Yes</string> <string name="yes">Yes</string>
<string name="no">No</string> <string name="no">No</string>
<string name="ok">OK</string> <string name="ok">OK</string>
<string name="off">Off</string>
<string name="cancel">Cancel</string> <string name="cancel">Cancel</string>
<string name="clear">Clear</string> <string name="clear">Clear</string>
<string name="disabled">Disabled</string> <string name="disabled">Disabled</string>