Android: Replace log type names map with array

Storing the log type names in a map results in them getting re-sorted by
their keys, which doesn't quite give us the sorting we want. In
particular, the Achievements category ended up being sorted at R (for
RetroAchivements) instead of at A. Every use of the map is just
iterating through it, so there's no real reason why it has to be a map
anyway.
This commit is contained in:
JosJuice
2024-06-15 20:02:10 +02:00
parent 04c246d11f
commit ea7928b3cd
7 changed files with 49 additions and 57 deletions

View File

@ -12,6 +12,7 @@ import android.view.Surface;
import android.widget.Toast;
import androidx.annotation.Keep;
import androidx.core.util.Pair;
import androidx.fragment.app.FragmentManager;
import org.dolphinemu.dolphinemu.activities.EmulationActivity;
@ -20,7 +21,6 @@ import org.dolphinemu.dolphinemu.utils.CompressCallback;
import org.dolphinemu.dolphinemu.utils.Log;
import java.lang.ref.WeakReference;
import java.util.LinkedHashMap;
import java.util.concurrent.Semaphore;
/**
@ -400,7 +400,7 @@ public final class NativeLibrary
*/
public static native void RefreshWiimotes();
public static native LinkedHashMap<String, String> GetLogTypeNames();
public static native Pair<String, String>[] GetLogTypeNames();
public static native void ReloadLoggerConfig();

View File

@ -1946,8 +1946,8 @@ class SettingsFragmentPresenter(
) { SettingsAdapter.clearLog() })
sl.add(HeaderSetting(context, R.string.log_types, 0))
for ((key, value) in LOG_TYPE_NAMES) {
sl.add(LogSwitchSetting(key, value, ""))
for (logType in LOG_TYPE_NAMES) {
sl.add(LogSwitchSetting(logType.first, logType.second, ""))
}
}
@ -2468,11 +2468,11 @@ class SettingsFragmentPresenter(
fun setAllLogTypes(value: Boolean) {
val settings = fragmentView.settings
for ((key) in LOG_TYPE_NAMES) {
for (logType in LOG_TYPE_NAMES) {
AdHocBooleanSetting(
Settings.FILE_LOGGER,
Settings.SECTION_LOGGER_LOGS,
key,
logType.first,
false
).setBoolean(settings!!, value)
}