Android: Some basic clean up

This commit is contained in:
zilmar 2022-07-18 18:05:29 +09:30
parent 7f3b8e3601
commit 14d492e928
15 changed files with 130 additions and 61 deletions

View File

@ -6,6 +6,8 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-feature android:name="android.software.leanback" android:required="false" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
<application
android:name="emu.project64.Project64Application"

View File

@ -15,10 +15,11 @@ import emu.project64.jni.UISettingID;
import emu.project64.settings.GameSettingsActivity;
import emu.project64.settings.SettingsActivity;
import emu.project64.util.Strings;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import androidx.appcompat.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Color;
@ -39,7 +40,6 @@ import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.view.ContextThemeWrapper;
import androidx.appcompat.view.menu.MenuBuilder;
@ -163,6 +163,7 @@ public class GalleryActivity extends AppCompatActivity
super.onConfigurationChanged( newConfig );
}
@SuppressLint("RestrictedApi")
@Override
public boolean onCreateOptionsMenu( Menu menu )
{
@ -400,6 +401,8 @@ public class GalleryActivity extends AppCompatActivity
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
Log.d("GalleryActivity", "onActivityResult(" + requestCode + "," + resultCode + "," + data);
// Check which request we're responding to

View File

@ -40,7 +40,7 @@ public class MenuListView extends ExpandableListView
public void setMenuResource( int menuResource )
{
Context context = getContext();
Menu menu = new MenuBuilder( context );
@SuppressLint("RestrictedApi") Menu menu = new MenuBuilder( context );
Activity activity = (Activity) context;
activity.getMenuInflater().inflate( menuResource, menu );
setMenu( menu );

View File

@ -91,6 +91,7 @@ public class GameActivity extends AppCompatActivity
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == GameLifecycleHandler.RC_SETTINGS)
{
mLifecycleHandler.onSettingDone();

View File

@ -163,7 +163,7 @@ public class GameOverlay extends View implements TouchController.OnStateChangedL
Typeface.BOLD_ITALIC);
mPaint.setTypeface(typeface);
mPaint.getTextBounds(txt, 0, txt.length(), mRectangle);
canvas.drawText(txt, Math.abs(canvas.getWidth() / 2), Math.abs((int) (canvas.getHeight() * 0.95)) - Math.abs(mRectangle.height()), mPaint);
canvas.drawText(txt, Math.abs(getWidth() / 2), Math.abs((int) (getHeight() * 0.95)) - Math.abs(mRectangle.height()), mPaint);
}
}
}

View File

@ -76,7 +76,7 @@ public class MogaHack
// Start the service explicitly
context.startService( intent );
context.bindService( intent, mServiceConnection, 1 );
context.bindService( intent, mServiceConnection, Context.BIND_AUTO_CREATE );
try
{
fIsBound.setBoolean( controller, true );

View File

@ -303,7 +303,7 @@ public abstract class AbstractProvider
{
return getInputName( inputCode ) + ( inputCode == 0
? ""
: String.format( " %4.2f", strength ) );
: String.format( java.util.Locale.US, " %4.2f", strength ) );
}
/**

View File

@ -62,7 +62,7 @@ public class ListPreference extends Preference {
TextView DlgTitle = (TextView)layout.findViewById(R.id.dlg_title);
DlgTitle.setText(mTitle);
ListView ListOptions = (ListView)layout.findViewById(R.id.list_options);
ListAdapter adapter = new ArrayAdapter<String>(getContext(), android.R.layout.simple_list_item_single_choice,mEntriesString);
ListAdapter adapter = new ArrayAdapter<String>(getContext(), R.layout.simple_list_item_single_choice,mEntriesString);
ListOptions.setAdapter(adapter);
ListOptions.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
ListOptions.setItemChecked(mValueIndex,true);
@ -84,7 +84,7 @@ public class ListPreference extends Preference {
private void updateSummary()
{
if (mValueIndex < 0)
if (mValueIndex < 0 && mValueIndex < mEntries.length)
{
return;
}

View File

@ -3,7 +3,8 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent" >
android:layout_height="match_parent"
android:orientation="vertical" >
<WebView
android:id="@+id/screen_wait"

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeightSmall"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:gravity="center_vertical"
android:checkMark="@null"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:drawableLeft="?android:attr/listChoiceIndicatorSingle"
android:drawablePadding="12dip"
android:paddingLeft="4dip"
android:paddingRight="4dip" />

View File

@ -6,14 +6,17 @@
android:id="@+id/menuItem_GameDir"
android:icon="@drawable/ic_folder"
app:showAsAction="ifRoom|collapseActionView"
/>
android:title="Game Dir" />
<item
android:id="@+id/menuItem_settings"
android:icon="@drawable/ic_settings"/>
android:icon="@drawable/ic_settings"
android:title="Settings" />
<item
android:id="@+id/menuItem_discord"
android:icon="@drawable/ic_discord" />
android:icon="@drawable/ic_discord"
android:title="Discord" />
<item
android:id="@+id/menuItem_about"
android:icon="@drawable/ic_about" />
android:icon="@drawable/ic_about"
android:title="About" />
</menu>

View File

@ -1,35 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" >
<item android:id="@+id/menuItem_SaveState"/>
<item android:id="@+id/menuItem_LoadState"/>
<item android:id="@+id/menuItem_CurrentSaveState" >
<item android:id="@+id/menuItem_SaveState" android:title="Save State" />
<item android:id="@+id/menuItem_LoadState" android:title="Load State" />
<item android:id="@+id/menuItem_CurrentSaveState" android:title="Current Save State">
<menu>
<group android:checkableBehavior="single">
<item android:id="@+id/menuItem_CurrentSaveAuto"/>
<item android:id="@+id/menuItem_CurrentSave1"/>
<item android:id="@+id/menuItem_CurrentSave2"/>
<item android:id="@+id/menuItem_CurrentSave3"/>
<item android:id="@+id/menuItem_CurrentSave4"/>
<item android:id="@+id/menuItem_CurrentSave5"/>
<item android:id="@+id/menuItem_CurrentSave6"/>
<item android:id="@+id/menuItem_CurrentSave7"/>
<item android:id="@+id/menuItem_CurrentSave8"/>
<item android:id="@+id/menuItem_CurrentSave9"/>
<item android:id="@+id/menuItem_CurrentSave10"/>
<item android:id="@+id/menuItem_CurrentSaveAuto" android:title="Current Save Auto" />
<item android:id="@+id/menuItem_CurrentSave1" android:title="Current Save 1" />
<item android:id="@+id/menuItem_CurrentSave2" android:title="Current Save 2" />
<item android:id="@+id/menuItem_CurrentSave3" android:title="Current Save 3" />
<item android:id="@+id/menuItem_CurrentSave4" android:title="Current Save 4" />
<item android:id="@+id/menuItem_CurrentSave5" android:title="Current Save 5" />
<item android:id="@+id/menuItem_CurrentSave6" android:title="Current Save 6" />
<item android:id="@+id/menuItem_CurrentSave7" android:title="Current Save 7" />
<item android:id="@+id/menuItem_CurrentSave8" android:title="Current Save 8" />
<item android:id="@+id/menuItem_CurrentSave9" android:title="Current Save 9" />
<item android:id="@+id/menuItem_CurrentSave10" android:title="Current Save 10" />
</group>
</menu>
</item>
<item android:id="@+id/menuItem_GameSpeed" />
<item android:id="@+id/menuItem_settings" />
<item android:id="@+id/menuItem_DebuggingMenu" >
<item android:id="@+id/menuItem_GameSpeed" android:title="Game Speed" />
<item android:id="@+id/menuItem_settings" android:title="Settings" />
<item android:id="@+id/menuItem_DebuggingMenu" android:title="Debugging Menu">
<menu>
<item android:id="@+id/menuItem_ResetFunctionTimes" />
<item android:id="@+id/menuItem_DumpFunctionTimes" />
<item android:id="@+id/menuItem_ResetFunctionTimes" android:title="Reset Function Times" />
<item android:id="@+id/menuItem_DumpFunctionTimes" android:title="Dump Function Times" />
</menu>
</item>
<item android:id="@+id/menuItem_pause" />
<item android:id="@+id/menuItem_resume" />
<item android:id="@+id/menuItem_HardReset" />
<item android:id="@+id/menuItem_EndEmulation" />
<item android:id="@+id/menuItem_pause" android:title="pause" />
<item android:id="@+id/menuItem_resume" android:title="resume" />
<item android:id="@+id/menuItem_HardReset" android:title="HardReset" />
<item android:id="@+id/menuItem_EndEmulation" android:title="EndEmulation" />
</menu>

View File

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

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:project64="http://schemas.android.com/apk/res/emu.project64"
xmlns:project64="http://schemas.android.com/apk/res-auto"
android:key="screenRoot" >
<emu.project64.settings.SeekBarPreference

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:project64="http://schemas.android.com/apk/res/emu.project64"
xmlns:project64="http://schemas.android.com/apk/res-auto"
android:key="screenRoot" >
<emu.project64.settings.SeekBarPreference