[Android] Update log level display

This commit is contained in:
zilmar 2016-12-09 17:41:50 +11:00
parent 6bf14b7081
commit 82247b9f69
3 changed files with 43 additions and 93 deletions

View File

@ -1,14 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<emu.project64.settings.LogLevelPreference
<ListPreference
android:entries="@array/trace_severity_list"
android:entryValues="@array/trace_severity_values"
android:key="Debugger_TraceAudioInitShutdown" android:key="Debugger_TraceAudioInitShutdown"
android:title="@string/TraceAudioInitShutdown" /> android:title="@string/TraceAudioInitShutdown" />
<ListPreference <emu.project64.settings.LogLevelPreference
android:entries="@array/trace_severity_list"
android:entryValues="@array/trace_severity_values"
android:key="Debugger_TraceAudioAudioInterface" android:key="Debugger_TraceAudioAudioInterface"
android:title="@string/TraceAudioAudioInterface" /> android:title="@string/TraceAudioAudioInterface" />
</PreferenceScreen> </PreferenceScreen>

View File

@ -1,114 +1,69 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<emu.project64.settings.LogLevelPreference
<ListPreference
android:entries="@array/trace_severity_list"
android:entryValues="@array/trace_severity_values"
android:key="Debugger_TraceMD5" android:key="Debugger_TraceMD5"
android:title="@string/TraceMD5" /> android:title="@string/TraceMD5" />
<ListPreference <emu.project64.settings.LogLevelPreference
android:entries="@array/trace_severity_list"
android:entryValues="@array/trace_severity_values"
android:key="Debugger_TraceThread" android:key="Debugger_TraceThread"
android:title="@string/TraceThread" /> android:title="@string/TraceThread" />
<ListPreference <emu.project64.settings.LogLevelPreference
android:entries="@array/trace_severity_list"
android:entryValues="@array/trace_severity_values"
android:key="Debugger_TracePath" android:key="Debugger_TracePath"
android:title="@string/TracePath" /> android:title="@string/TracePath" />
<ListPreference <emu.project64.settings.LogLevelPreference
android:entries="@array/trace_severity_list"
android:entryValues="@array/trace_severity_values"
android:key="Debugger_TraceSettings" android:key="Debugger_TraceSettings"
android:title="@string/TraceSettings" /> android:title="@string/TraceSettings" />
<ListPreference <emu.project64.settings.LogLevelPreference
android:entries="@array/trace_severity_list"
android:entryValues="@array/trace_severity_values"
android:key="Debugger_TraceUnknown" android:key="Debugger_TraceUnknown"
android:title="@string/TraceUnknown" /> android:title="@string/TraceUnknown" />
<ListPreference <emu.project64.settings.LogLevelPreference
android:entries="@array/trace_severity_list"
android:entryValues="@array/trace_severity_values"
android:key="Debugger_TraceAppInit" android:key="Debugger_TraceAppInit"
android:title="@string/TraceAppInit" /> android:title="@string/TraceAppInit" />
<ListPreference <emu.project64.settings.LogLevelPreference
android:entries="@array/trace_severity_list"
android:entryValues="@array/trace_severity_values"
android:key="Debugger_TraceAppCleanup" android:key="Debugger_TraceAppCleanup"
android:title="@string/TraceAppCleanup" /> android:title="@string/TraceAppCleanup" />
<ListPreference <emu.project64.settings.LogLevelPreference
android:entries="@array/trace_severity_list"
android:entryValues="@array/trace_severity_values"
android:key="Debugger_TraceN64System" android:key="Debugger_TraceN64System"
android:title="@string/TraceN64System" /> android:title="@string/TraceN64System" />
<ListPreference <emu.project64.settings.LogLevelPreference
android:entries="@array/trace_severity_list"
android:entryValues="@array/trace_severity_values"
android:key="Debugger_TracePlugins" android:key="Debugger_TracePlugins"
android:title="@string/TracePlugins" /> android:title="@string/TracePlugins" />
<ListPreference <emu.project64.settings.LogLevelPreference
android:entries="@array/trace_severity_list"
android:entryValues="@array/trace_severity_values"
android:key="Debugger_TraceGFXPlugin" android:key="Debugger_TraceGFXPlugin"
android:title="@string/TraceGFXPlugin" /> android:title="@string/TraceGFXPlugin" />
<ListPreference <emu.project64.settings.LogLevelPreference
android:entries="@array/trace_severity_list"
android:entryValues="@array/trace_severity_values"
android:key="Debugger_TraceAudioPlugin" android:key="Debugger_TraceAudioPlugin"
android:title="@string/TraceAudioPlugin" /> android:title="@string/TraceAudioPlugin" />
<ListPreference <emu.project64.settings.LogLevelPreference
android:entries="@array/trace_severity_list"
android:entryValues="@array/trace_severity_values"
android:key="Debugger_TraceControllerPlugin" android:key="Debugger_TraceControllerPlugin"
android:title="@string/TraceControllerPlugin" /> android:title="@string/TraceControllerPlugin" />
<ListPreference <emu.project64.settings.LogLevelPreference
android:entries="@array/trace_severity_list"
android:entryValues="@array/trace_severity_values"
android:key="Debugger_TraceRSPPlugin" android:key="Debugger_TraceRSPPlugin"
android:title="@string/TraceRSPPlugin" /> android:title="@string/TraceRSPPlugin" />
<ListPreference <emu.project64.settings.LogLevelPreference
android:entries="@array/trace_severity_list"
android:entryValues="@array/trace_severity_values"
android:key="Debugger_TraceRSP" android:key="Debugger_TraceRSP"
android:title="@string/TraceRSP" /> android:title="@string/TraceRSP" />
<ListPreference <emu.project64.settings.LogLevelPreference
android:entries="@array/trace_severity_list"
android:entryValues="@array/trace_severity_values"
android:key="Debugger_TraceAudio" android:key="Debugger_TraceAudio"
android:title="@string/TraceAudio" /> android:title="@string/TraceAudio" />
<ListPreference <emu.project64.settings.LogLevelPreference
android:entries="@array/trace_severity_list"
android:entryValues="@array/trace_severity_values"
android:key="Debugger_TraceRegisterCache" android:key="Debugger_TraceRegisterCache"
android:title="@string/TraceRegisterCache" /> android:title="@string/TraceRegisterCache" />
<ListPreference <emu.project64.settings.LogLevelPreference
android:entries="@array/trace_severity_list"
android:entryValues="@array/trace_severity_values"
android:key="Debugger_TraceRecompiler" android:key="Debugger_TraceRecompiler"
android:title="@string/TraceRecompiler" /> android:title="@string/TraceRecompiler" />
<ListPreference <emu.project64.settings.LogLevelPreference
android:entries="@array/trace_severity_list"
android:entryValues="@array/trace_severity_values"
android:key="Debugger_TraceTLB" android:key="Debugger_TraceTLB"
android:title="@string/TraceTLB" /> android:title="@string/TraceTLB" />
<ListPreference <emu.project64.settings.LogLevelPreference
android:entries="@array/trace_severity_list"
android:entryValues="@array/trace_severity_values"
android:key="Debugger_TraceProtectedMEM" android:key="Debugger_TraceProtectedMEM"
android:title="@string/TraceProtectedMem" /> android:title="@string/TraceProtectedMem" />
<ListPreference <emu.project64.settings.LogLevelPreference
android:entries="@array/trace_severity_list"
android:entryValues="@array/trace_severity_values"
android:key="Debugger_TraceUserInterface" android:key="Debugger_TraceUserInterface"
android:title="@string/TraceUserInterface" /> android:title="@string/TraceUserInterface" />
<ListPreference <emu.project64.settings.LogLevelPreference
android:entries="@array/trace_severity_list"
android:entryValues="@array/trace_severity_values"
android:key="Debugger_TraceRomList" android:key="Debugger_TraceRomList"
android:title="@string/TraceRomList" /> android:title="@string/TraceRomList" />
<ListPreference <emu.project64.settings.LogLevelPreference
android:entries="@array/trace_severity_list"
android:entryValues="@array/trace_severity_values"
android:key="Debugger_TraceExceptionHandler" android:key="Debugger_TraceExceptionHandler"
android:title="@string/TraceExceptionHandler" /> android:title="@string/TraceExceptionHandler" />
</PreferenceScreen> </PreferenceScreen>

View File

@ -41,8 +41,8 @@ public class TwoLinesListPreference extends ListPreference
@Override @Override
public void setValue(String value) public void setValue(String value)
{ {
super.setValue(value); super.setValue(value);
mValueIndex = getValueIndex(); mValueIndex = getValueIndex();
updateSummary(); updateSummary();
} }
/** /**
@ -53,7 +53,7 @@ public class TwoLinesListPreference extends ListPreference
*/ */
public int findIndexOfValue(String value) public int findIndexOfValue(String value)
{ {
CharSequence[] EntryValues = getEntryValues(); CharSequence[] EntryValues = getEntryValues();
if (value != null && EntryValues != null) if (value != null && EntryValues != null)
{ {
for (int i = EntryValues.length - 1; i >= 0; i--) for (int i = EntryValues.length - 1; i >= 0; i--)
@ -80,14 +80,14 @@ public class TwoLinesListPreference extends ListPreference
@Override @Override
public void setEntries(CharSequence[] Entries) public void setEntries(CharSequence[] Entries)
{ {
super.setEntries(Entries); super.setEntries(Entries);
updateSummary(); updateSummary();
} }
@Override @Override
public void setEntryValues(CharSequence[] EntryValues) public void setEntryValues(CharSequence[] EntryValues)
{ {
super.setEntryValues(EntryValues); super.setEntryValues(EntryValues);
mValueIndex = getValueIndex(); mValueIndex = getValueIndex();
updateSummary(); updateSummary();
} }
@ -100,20 +100,20 @@ public class TwoLinesListPreference extends ListPreference
private void updateSummary() private void updateSummary()
{ {
if (mValueIndex < 0) if (mValueIndex < 0)
{ {
return; return;
} }
CharSequence[] Entries = getEntries(); CharSequence[] Entries = getEntries();
String summary = Entries[mValueIndex].toString(); String summary = Entries[mValueIndex].toString();
if (mEntriesSubtitles != null && mEntriesSubtitles.length > mValueIndex) if (mEntriesSubtitles != null && mEntriesSubtitles.length > mValueIndex)
{ {
String subtitle = mEntriesSubtitles[mValueIndex].toString(); String subtitle = mEntriesSubtitles[mValueIndex].toString();
if (summary.length() > 0 && subtitle.length() > 0) if (summary.length() > 0 && subtitle.length() > 0)
{ {
summary += " - " + subtitle; summary += " - " + subtitle;
} }
} }
setSummary( summary ); setSummary( summary );
} }
} }