Compare commits

...

9 Commits

Author SHA1 Message Date
James Sanford
e64a50d735 Use Android Studio 2022-07-05 13:17:08 -07:00
James Sanford
a70b380255 Maybe fix DownloadDialogFragment onCancel() 2022-07-05 13:04:10 -07:00
James Sanford
efc2a8dcac Add gradle 2022-07-05 13:04:10 -07:00
James Sanford
32e5546ff1 Update to Android Studio 2022-07-05 13:04:10 -07:00
James Sanford
d7029b1943 Move JNI folder for Android Studio 2022-07-05 13:04:10 -07:00
James Sanford
d9f8a84ff8 Remove old values-v11 2022-07-05 13:04:07 -07:00
James Sanford
e5689a59a6 Move folders for Android Studio 2022-07-05 12:39:07 -07:00
James Sanford
0fed780320 Remove gitmodules 2022-07-05 12:39:07 -07:00
James Sanford
ecd78dedfc Switch to Android Studio 2022-07-05 12:08:26 -07:00
128 changed files with 499 additions and 200 deletions

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "ActionBarSherlock"]
path = ActionBarSherlock
url = git://github.com/JakeWharton/ActionBarSherlock.git

@ -1 +0,0 @@
Subproject commit 90939dc3925ffaaa0de269bbbe1b35e274968ea1

View File

@ -1,77 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.froop.app.kegs"
android:versionCode="9"
android:versionName="0.8beta"
android:installLocation="auto">
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-feature android:name="android.hardware.touchscreen.multitouch.distinct" android:required="false"/>
<application android:icon="@drawable/icon" android:label="@string/app_name" android:description="@string/app_description" android:hardwareAccelerated="true">
<activity android:name="KegsMain" android:launchMode="singleInstance" android:configChanges="orientation|keyboard|keyboardHidden|screenSize" android:theme="@style/Theme.BlackBackground">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="file" android:host="*" android:mimeType="application/zip" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Yeah, this is pretty much awful. Blame PatternMatcher -->
<data android:scheme="file" android:host="*" android:pathPattern=".*2mg" />
<data android:scheme="file" android:host="*" android:pathPattern=".*dsk" />
<data android:scheme="file" android:host="*" android:pathPattern=".*nib" />
<data android:scheme="file" android:host="*" android:pathPattern=".*hdv" />
<data android:scheme="file" android:host="*" android:pathPattern=".*po" />
<data android:scheme="file" android:host="*" android:pathPattern=".*do" />
<data android:scheme="file" android:host="*" android:pathPattern=".*2MG" />
<data android:scheme="file" android:host="*" android:pathPattern=".*DSK" />
<data android:scheme="file" android:host="*" android:pathPattern=".*NIB" />
<data android:scheme="file" android:host="*" android:pathPattern=".*HDV" />
<data android:scheme="file" android:host="*" android:pathPattern=".*PO" />
<data android:scheme="file" android:host="*" android:pathPattern=".*DO" />
<data android:scheme="file" android:host="*" android:pathPattern=".*2mg.gz" />
<data android:scheme="file" android:host="*" android:pathPattern=".*dsk.gz" />
<data android:scheme="file" android:host="*" android:pathPattern=".*nib.gz" />
<data android:scheme="file" android:host="*" android:pathPattern=".*hdv.gz" />
<data android:scheme="file" android:host="*" android:pathPattern=".*po.gz" />
<data android:scheme="file" android:host="*" android:pathPattern=".*do.gz" />
<data android:scheme="file" android:host="*" android:pathPattern=".*2MG.gz" />
<data android:scheme="file" android:host="*" android:pathPattern=".*DSK.gz" />
<data android:scheme="file" android:host="*" android:pathPattern=".*NIB.gz" />
<data android:scheme="file" android:host="*" android:pathPattern=".*HDV.gz" />
<data android:scheme="file" android:host="*" android:pathPattern=".*PO.gz" />
<data android:scheme="file" android:host="*" android:pathPattern=".*DO.gz" />
<data android:scheme="file" android:host="*" android:pathPattern=".*2MG.GZ" />
<data android:scheme="file" android:host="*" android:pathPattern=".*DSK.GZ" />
<data android:scheme="file" android:host="*" android:pathPattern=".*NIB.GZ" />
<data android:scheme="file" android:host="*" android:pathPattern=".*HDV.GZ" />
<data android:scheme="file" android:host="*" android:pathPattern=".*PO.GZ" />
<data android:scheme="file" android:host="*" android:pathPattern=".*DO.GZ" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@ -27,15 +27,7 @@ Usability notes:
Source code: Source code:
https://github.com/jamessanford/kegs/ https://github.com/jamessanford/kegs/
To build from source: To build from source, open this project in Android Studio.
<pre>
(git submodule init && git submodule update)
android update project -p ActionBarSherlock/library -s
android update project -p . -s
ndk-build
ant debug install
</pre>
Changes made to KEGS: Changes made to KEGS:
- Various ifdefs for \_\_ANDROID\_\_ in the kegs 'core' - Various ifdefs for \_\_ANDROID\_\_ in the kegs 'core'

1
app/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build

38
app/build.gradle Normal file
View File

@ -0,0 +1,38 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 31
defaultConfig {
applicationId "com.froop.app.kegs"
minSdkVersion 19
targetSdkVersion 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
ndkBuild {
path file('jni/Android.mk')
}
}
ndkVersion '23.1.7779620'
buildToolsVersion '31.0.0'
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.4.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

View File

@ -2,6 +2,7 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS) include $(CLEAR_VARS)
# FIXME: Use _BYTE_ORDER instead of KEGS_LITTLE_ENDIAN
LOCAL_CFLAGS := -DNDEBUG -DKEGS_LITTLE_ENDIAN -O2 -I. LOCAL_CFLAGS := -DNDEBUG -DKEGS_LITTLE_ENDIAN -O2 -I.
LOCAL_MODULE := kegs LOCAL_MODULE := kegs
LOCAL_SRC_FILES := adb.c clock.c config_generic.c config_kegs.c \ LOCAL_SRC_FILES := adb.c clock.c config_generic.c config_kegs.c \

2
app/jni/Application.mk Normal file
View File

@ -0,0 +1,2 @@
APP_ABI := armeabi armeabi-v7a arm64-v8a x86 x86_64
APP_PLATFORM := android-10

View File

@ -22,6 +22,11 @@
#include "defc.h" #include "defc.h"
// FIXME: See note about KEGS_LITTLE_ENDIAN in Android.mk
#if _BYTE_ORDER != _LITTLE_ENDIAN
#error Refactor Android.mk to set KEGS_LITTLE_ENDIAN based on _BYTE_ORDER
#endif
// KegsViewGL, when defined lock pixels only once per mainLoop. // KegsViewGL, when defined lock pixels only once per mainLoop.
#define ANDROID_GL #define ANDROID_GL

View File

@ -1,6 +1,8 @@
// Lots of boilerplate OpenSLES code from the Android NDK 'native-audio' sample. // Lots of boilerplate OpenSLES code from the Android NDK 'native-audio' sample.
// Hooked up to a copy of the KEGS Mac sound driver. // Hooked up to a copy of the KEGS Mac sound driver.
// FIXME: Consider switching to https://github.com/google/oboe
#include <assert.h> #include <assert.h>
#include <jni.h> #include <jni.h>
#include <android/log.h> #include <android/log.h>

21
app/proguard-rules.pro vendored Normal file
View File

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@ -0,0 +1,21 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.froop.app.kegs"
android:installLocation="auto">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application android:theme="@style/Theme.BlackBackground" android:icon="@drawable/icon"
android:label="@string/app_name" android:description="@string/app_description" android:allowBackup="true">
<activity android:name="KegsMain" android:launchMode="singleInstance" android:configChanges="orientation|keyboard|keyboardHidden|screenSize" android:theme="@style/Theme.BlackBackground" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@ -1,6 +1,5 @@
package com.froop.app.kegs; package com.froop.app.kegs;
import android.util.Log;
import android.os.AsyncTask; import android.os.AsyncTask;
import java.io.File; import java.io.File;

View File

@ -13,13 +13,13 @@ import android.widget.BaseAdapter;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.actionbarsherlock.app.SherlockDialogFragment; import android.app.DialogFragment;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
public class DiskImageFragment extends SherlockDialogFragment { public class DiskImageFragment extends DialogFragment {
private ArrayList<DiskImage> mFoundImages = new ArrayList<DiskImage>(); private ArrayList<DiskImage> mFoundImages = new ArrayList<DiskImage>();
// TODO: This should be the title name, and then we should index to it. // TODO: This should be the title name, and then we should index to it.
@ -87,12 +87,14 @@ public class DiskImageFragment extends SherlockDialogFragment {
} }
} }
}); });
/* Seems strange to have a Cancel button. Disable.
builder.setNegativeButton(R.string.dialog_cancel, builder.setNegativeButton(R.string.dialog_cancel,
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int button) { public void onClick(DialogInterface dialog, int button) {
dismiss(); dismiss();
} }
}); });
*/
final AlertDialog dialog = builder.create(); final AlertDialog dialog = builder.create();
return dialog; return dialog;
} }

View File

@ -41,7 +41,8 @@ class DiskLoader extends AsyncTask<Void, Void, Boolean> {
mDestPath = config.getImagePath(); mDestPath = config.getImagePath();
final File local_copy = new File(mDestPath, image.filename); final File local_copy = new File(mDestPath, image.filename);
if (local_copy != null && local_copy.exists()) { // TODO: check local_copy errors?
if (local_copy.exists()) {
// Assume whatever is there will work. // Assume whatever is there will work.
mSlow = false; mSlow = false;
} }
@ -85,7 +86,7 @@ class DiskLoader extends AsyncTask<Void, Void, Boolean> {
return true; return true;
} else { } else {
return new DownloadHelper().save( return new DownloadHelper().save(
"http://jsan.co/KEGS/images/" + mImage.filename, "https://jsan.co/KEGS/images/" + mImage.filename,
local_copy.getPath()); local_copy.getPath());
} }
} }

View File

@ -7,21 +7,21 @@ import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.HttpURLConnection; import javax.net.ssl.HttpsURLConnection;
import java.net.URL; import java.net.URL;
// Ick. Look elsewhere. // Ick. Look elsewhere.
public class DownloadHelper { public class DownloadHelper {
private URL mURL; private URL mURL;
private HttpURLConnection mConnection; private HttpsURLConnection mConnection;
private InputStream mStream; private InputStream mStream;
private boolean openInputStream() { private boolean openInputStream() {
try { try {
mConnection = (HttpURLConnection)mURL.openConnection(); mConnection = (HttpsURLConnection)mURL.openConnection();
mConnection.connect(); mConnection.connect();
if (mConnection.getResponseCode() != HttpURLConnection.HTTP_OK) { if (mConnection.getResponseCode() != HttpsURLConnection.HTTP_OK) {
mConnection.disconnect(); mConnection.disconnect();
Log.e("kegs", "HTTP ERROR " + mConnection.getResponseCode()); Log.e("kegs", "HTTP ERROR " + mConnection.getResponseCode());
return false; return false;

View File

@ -6,9 +6,9 @@ import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import com.actionbarsherlock.app.SherlockDialogFragment; import android.app.DialogFragment;
class ErrorDialogFragment extends SherlockDialogFragment { public class ErrorDialogFragment extends DialogFragment {
private int mMessage; private int mMessage;
private Runnable mRunnable; private Runnable mRunnable;

View File

@ -21,15 +21,15 @@ import android.view.View.OnTouchListener;
import android.widget.Button; import android.widget.Button;
import android.widget.ToggleButton; import android.widget.ToggleButton;
import com.actionbarsherlock.app.ActionBar; import android.app.ActionBar;
import com.actionbarsherlock.app.SherlockFragmentActivity; import android.app.Activity;
import com.actionbarsherlock.app.SherlockDialogFragment; import android.app.DialogFragment;
import com.actionbarsherlock.view.Menu; import android.view.Menu;
import com.actionbarsherlock.view.MenuItem; import android.view.MenuItem;
import java.util.ArrayDeque; import java.util.ArrayDeque;
public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.StickyReset, AssetImages.AssetsReady, DiskLoader.ImageReady { public class KegsMain extends Activity implements KegsKeyboard.StickyReset, AssetImages.AssetsReady, DiskLoader.ImageReady {
private static final String FRAGMENT_ROM = "rom"; private static final String FRAGMENT_ROM = "rom";
private static final String FRAGMENT_DOWNLOAD = "download"; private static final String FRAGMENT_DOWNLOAD = "download";
private static final String FRAGMENT_ERROR = "error"; private static final String FRAGMENT_ERROR = "error";
@ -70,7 +70,7 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
// TODO: deal with error conditions from assets as a warning. // TODO: deal with error conditions from assets as a warning.
} }
private View.OnClickListener mButtonClick = new View.OnClickListener() { private final View.OnClickListener mButtonClick = new View.OnClickListener() {
public void onClick(View v) { public void onClick(View v) {
final int click_id = v.getId(); final int click_id = v.getId();
int key_id = -1; int key_id = -1;
@ -181,11 +181,11 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
cancel = null; cancel = null;
} }
new ErrorDialogFragment(R.string.image_error, cancel).show( new ErrorDialogFragment(R.string.image_error, cancel).show(
getSupportFragmentManager(), FRAGMENT_ERROR); getFragmentManager(), FRAGMENT_ERROR);
} else if (image.action != DiskImage.ASK) { } else if (image.action != DiskImage.ASK) {
loadDiskImage(image); loadDiskImage(image);
} else { } else {
new SwapDiskFragment(image).show(getSupportFragmentManager(), new SwapDiskFragment(image).show(getFragmentManager(),
FRAGMENT_SWAPDISK); FRAGMENT_SWAPDISK);
} }
} }
@ -202,7 +202,7 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
if (image.filename.endsWith(".zip") || image.filename.endsWith(".ZIP")) { if (image.filename.endsWith(".zip") || image.filename.endsWith(".ZIP")) {
final ZipDiskFragment zip = new ZipDiskFragment(image); final ZipDiskFragment zip = new ZipDiskFragment(image);
if (zip.needsDialog()) { if (zip.needsDialog()) {
zip.show(getSupportFragmentManager(), FRAGMENT_ZIPDISK); zip.show(getFragmentManager(), FRAGMENT_ZIPDISK);
return; return;
} else { } else {
image = zip.getFirstImage(); image = zip.getFirstImage();
@ -231,7 +231,7 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
mDiskLoader = new DiskLoader(notify, mConfigFile, image); mDiskLoader = new DiskLoader(notify, mConfigFile, image);
if (mDiskLoader.willBeSlow()) { if (mDiskLoader.willBeSlow()) {
new SpecialProgressDialog(cancel).show(getSupportFragmentManager(), new SpecialProgressDialog(cancel).show(getFragmentManager(),
FRAGMENT_LOADING); FRAGMENT_LOADING);
} }
if (android.os.Build.VERSION.SDK_INT >= 11) { if (android.os.Build.VERSION.SDK_INT >= 11) {
@ -244,7 +244,7 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
} }
private DiskImage getBootDiskImage(Intent intent) { private DiskImage getBootDiskImage(Intent intent) {
if (intent != null && intent.getAction() == Intent.ACTION_VIEW) { if (intent != null && intent.getAction().equals(Intent.ACTION_VIEW)) {
final Uri uri = intent.getData(); final Uri uri = intent.getData();
if (uri != null && uri.getScheme().equals("file")) { if (uri != null && uri.getScheme().equals("file")) {
final String path = uri.getPath(); final String path = uri.getPath();
@ -269,7 +269,7 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
withUIActive(new Runnable() { withUIActive(new Runnable() {
public void run() { public void run() {
if (findFragment(FRAGMENT_DISKIMAGE) == null) { if (findFragment(FRAGMENT_DISKIMAGE) == null) {
new DiskImageFragment(mConfigFile, DiskImage.BOOT).show(getSupportFragmentManager(), FRAGMENT_DISKIMAGE); new DiskImageFragment(mConfigFile, DiskImage.BOOT).show(getFragmentManager(), FRAGMENT_DISKIMAGE);
} }
} }
}); });
@ -279,8 +279,8 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
} }
protected void getRomFile(String romfile) { protected void getRomFile(String romfile) {
final SherlockDialogFragment download = new DownloadDialogFragment(); final DialogFragment download = new DownloadDialogFragment();
download.show(getSupportFragmentManager(), FRAGMENT_DOWNLOAD); download.show(getFragmentManager(), FRAGMENT_DOWNLOAD);
if (android.os.Build.VERSION.SDK_INT >= 11) { if (android.os.Build.VERSION.SDK_INT >= 11) {
new DownloadRom().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, romfile); new DownloadRom().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, romfile);
} else { } else {
@ -293,20 +293,20 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
protected Boolean doInBackground(String ... raw_romfile) { protected Boolean doInBackground(String ... raw_romfile) {
mRomfile = raw_romfile[0]; mRomfile = raw_romfile[0];
return new DownloadHelper().save( return new DownloadHelper().save(
"http://jsan.co/KEGS/" + mRomfile, "https://jsan.co/KEGS/" + mRomfile,
mConfigFile.getConfigPath() + "/" + mRomfile); mConfigFile.getConfigPath() + "/" + mRomfile);
} }
protected void onPostExecute(final Boolean success) { protected void onPostExecute(final Boolean success) {
withUIActive(new Runnable() { withUIActive(new Runnable() {
public void run() { public void run() {
final SherlockDialogFragment frag = (SherlockDialogFragment)getSupportFragmentManager().findFragmentByTag(FRAGMENT_DOWNLOAD); final DialogFragment frag = (DialogFragment)getFragmentManager().findFragmentByTag(FRAGMENT_DOWNLOAD);
if (frag != null) { if (frag != null) {
frag.dismiss(); frag.dismiss();
} }
if (!success) { if (!success) {
if (!isCancelled()) { if (!isCancelled()) {
new ErrorDialogFragment(R.string.rom_error, mErrorFinish).show( new ErrorDialogFragment(R.string.rom_error, mErrorFinish).show(
getSupportFragmentManager(), FRAGMENT_ERROR); getFragmentManager(), FRAGMENT_ERROR);
} }
} else { } else {
boot(); boot();
@ -316,7 +316,7 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
} }
} }
class DownloadDialogFragment extends SherlockDialogFragment { public static class DownloadDialogFragment extends DialogFragment {
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
ProgressDialog dialog = new ProgressDialog(getActivity()); ProgressDialog dialog = new ProgressDialog(getActivity());
@ -339,7 +339,7 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
@Override @Override
public void onCancel(DialogInterface dialog) { public void onCancel(DialogInterface dialog) {
super.onCancel(dialog); super.onCancel(dialog);
finish(); ((KegsMain)getActivity()).finish();
} }
} }
@ -365,10 +365,15 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
private void updateActionBar(boolean showActionBar) { private void updateActionBar(boolean showActionBar) {
showActionBar = mOverrideActionBar || showActionBar; showActionBar = mOverrideActionBar || showActionBar;
final ActionBar actionBar = getSupportActionBar();
if (actionBar != null && showActionBar) { final ActionBar actionBar = getActionBar();
if (actionBar == null) {
return;
}
if (showActionBar) {
actionBar.show(); actionBar.show();
} else if (actionBar != null && !showActionBar) { } else {
actionBar.hide(); actionBar.hide();
} }
} }
@ -439,7 +444,7 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
super.onCreateOptionsMenu(menu); super.onCreateOptionsMenu(menu);
// BUG: no overflow menu on devices with menu button // BUG: no overflow menu on devices with menu button
// BUG: when action bar is hidden, menu bar only shows overflow items // BUG: when action bar is hidden, menu bar only shows overflow items
getSupportMenuInflater().inflate(R.menu.actions, menu); getMenuInflater().inflate(R.menu.actions, menu);
return true; return true;
} }
@ -468,14 +473,14 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
} }
return true; return true;
} else if (item_id == R.id.action_speed) { } else if (item_id == R.id.action_speed) {
new SpeedFragment().show(getSupportFragmentManager(), FRAGMENT_SPEED); new SpeedFragment().show(getFragmentManager(), FRAGMENT_SPEED);
return true; return true;
} else if (item_id == R.id.action_joystick) { } else if (item_id == R.id.action_joystick) {
mModeMouse = !mModeMouse; mModeMouse = !mModeMouse;
supportInvalidateOptionsMenu(); // update icon invalidateOptionsMenu(); // update icon
return true; return true;
} else if (item_id == R.id.action_diskimage) { } else if (item_id == R.id.action_diskimage) {
new DiskImageFragment(mConfigFile, DiskImage.ASK).show(getSupportFragmentManager(), FRAGMENT_DISKIMAGE); new DiskImageFragment(mConfigFile, DiskImage.ASK).show(getFragmentManager(), FRAGMENT_DISKIMAGE);
return true; return true;
} else if (item_id == R.id.action_more_keys) { } else if (item_id == R.id.action_more_keys) {
final int vis = areControlsVisible() ? View.GONE : View.VISIBLE; final int vis = areControlsVisible() ? View.GONE : View.VISIBLE;
@ -490,12 +495,12 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
return false; return false;
} }
private SherlockDialogFragment findFragment(final String tag) { private DialogFragment findFragment(final String tag) {
return (SherlockDialogFragment)getSupportFragmentManager().findFragmentByTag(tag); return (DialogFragment)getFragmentManager().findFragmentByTag(tag);
} }
private boolean dismissFragment(final String tag) { private boolean dismissFragment(final String tag) {
final SherlockDialogFragment frag = findFragment(tag); final DialogFragment frag = findFragment(tag);
if (frag == null) { if (frag == null) {
return false; return false;
} else { } else {
@ -530,7 +535,7 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
updateActionBar(BitmapSize.quick(this).showActionBar()); updateActionBar(BitmapSize.quick(this).showActionBar());
mKegsView = (KegsViewGL)findViewById(R.id.kegsview); mKegsView = findViewById(R.id.kegsview);
mConfigFile = new ConfigFile(this); mConfigFile = new ConfigFile(this);
@ -541,7 +546,10 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
mTouchMouse = new TouchMouse(this, getThread().getEventQueue()); mTouchMouse = new TouchMouse(this, getThread().getEventQueue());
mJoystick = new TouchJoystick(getThread().getEventQueue()); mJoystick = new TouchJoystick(getThread().getEventQueue());
final SpecialRelativeLayout mainView = (SpecialRelativeLayout)findViewById(R.id.mainview); final SpecialRelativeLayout mainView = findViewById(R.id.mainview);
if (android.os.Build.VERSION.SDK_INT >= 26) {
mainView.setDefaultFocusHighlightEnabled(false);
}
mainView.setClickable(true); mainView.setClickable(true);
mainView.setLongClickable(true); mainView.setLongClickable(true);
mainView.setOnTouchListener(new OnTouchListener() { mainView.setOnTouchListener(new OnTouchListener() {
@ -589,7 +597,7 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
final String romfile = mConfigFile.whichRomFile(); final String romfile = mConfigFile.whichRomFile();
if (romfile == null) { if (romfile == null) {
new RomDialogFragment().show(getSupportFragmentManager(), FRAGMENT_ROM); new RomDialogFragment().show(getFragmentManager(), FRAGMENT_ROM);
} else { } else {
boot(); boot();
} }

View File

@ -6,9 +6,9 @@ import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import com.actionbarsherlock.app.SherlockDialogFragment; import android.app.DialogFragment;
public class RomDialogFragment extends SherlockDialogFragment { public class RomDialogFragment extends DialogFragment {
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

View File

@ -6,11 +6,11 @@ import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import com.actionbarsherlock.app.SherlockDialogFragment; import android.app.DialogFragment;
// A predefined progress dialog that calls a Runner when it's cancelled. // A predefined progress dialog that calls a Runner when it's cancelled.
public class SpecialProgressDialog extends SherlockDialogFragment { public class SpecialProgressDialog extends DialogFragment {
private Runnable mCancelRunnable; private Runnable mCancelRunnable;
public SpecialProgressDialog(Runnable runnable) { public SpecialProgressDialog(Runnable runnable) {

View File

@ -4,11 +4,10 @@ import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import com.actionbarsherlock.app.SherlockDialogFragment; import android.app.DialogFragment;
public class SpeedFragment extends SherlockDialogFragment { public class SpeedFragment extends DialogFragment {
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

View File

@ -4,11 +4,10 @@ import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import com.actionbarsherlock.app.SherlockDialogFragment; import android.app.DialogFragment;
public class SwapDiskFragment extends SherlockDialogFragment { public class SwapDiskFragment extends DialogFragment {
private DiskImage mImage; private DiskImage mImage;
public SwapDiskFragment(DiskImage image) { public SwapDiskFragment(DiskImage image) {

Some files were not shown because too many files have changed in this diff Show More