mirror of
https://github.com/jamessanford/kegs.git
synced 2025-02-08 18:30:46 +00:00
Update to Android Studio
This commit is contained in:
parent
d7029b1943
commit
32e5546ff1
1
app/.gitignore
vendored
Normal file
1
app/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
38
app/build.gradle
Normal file
38
app/build.gradle
Normal 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'
|
||||
|
||||
}
|
@ -2,6 +2,7 @@ LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
# FIXME: Use _BYTE_ORDER instead of KEGS_LITTLE_ENDIAN
|
||||
LOCAL_CFLAGS := -DNDEBUG -DKEGS_LITTLE_ENDIAN -O2 -I.
|
||||
LOCAL_MODULE := kegs
|
||||
LOCAL_SRC_FILES := adb.c clock.c config_generic.c config_kegs.c \
|
||||
|
@ -1,4 +1,2 @@
|
||||
# The ARMv7 is significanly faster due to the use of the hardware FPU
|
||||
APP_ABI := armeabi armeabi-v7a x86
|
||||
#APP_ABI := armeabi-v7a
|
||||
APP_ABI := armeabi armeabi-v7a arm64-v8a x86 x86_64
|
||||
APP_PLATFORM := android-10
|
||||
|
@ -22,6 +22,11 @@
|
||||
|
||||
#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.
|
||||
#define ANDROID_GL
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
// Lots of boilerplate OpenSLES code from the Android NDK 'native-audio' sample.
|
||||
// Hooked up to a copy of the KEGS Mac sound driver.
|
||||
|
||||
// FIXME: Consider switching to https://github.com/google/oboe
|
||||
|
||||
#include <assert.h>
|
||||
#include <jni.h>
|
||||
#include <android/log.h>
|
||||
|
21
app/proguard-rules.pro
vendored
Normal file
21
app/proguard-rules.pro
vendored
Normal 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
|
@ -1,77 +1,21 @@
|
||||
<?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:theme="@style/Theme.BlackBackground" android:icon="@drawable/icon"
|
||||
android:label="@string/app_name" android:description="@string/app_description" android:allowBackup="true">
|
||||
|
||||
<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">
|
||||
<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>
|
||||
<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>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.froop.app.kegs;
|
||||
|
||||
import android.util.Log;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -13,13 +13,13 @@ import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockDialogFragment;
|
||||
import android.app.DialogFragment;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
public class DiskImageFragment extends SherlockDialogFragment {
|
||||
public class DiskImageFragment extends DialogFragment {
|
||||
private ArrayList<DiskImage> mFoundImages = new ArrayList<DiskImage>();
|
||||
|
||||
// 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,
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int button) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
*/
|
||||
final AlertDialog dialog = builder.create();
|
||||
return dialog;
|
||||
}
|
@ -41,7 +41,8 @@ class DiskLoader extends AsyncTask<Void, Void, Boolean> {
|
||||
mDestPath = config.getImagePath();
|
||||
|
||||
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.
|
||||
mSlow = false;
|
||||
}
|
||||
@ -85,7 +86,7 @@ class DiskLoader extends AsyncTask<Void, Void, Boolean> {
|
||||
return true;
|
||||
} else {
|
||||
return new DownloadHelper().save(
|
||||
"http://jsan.co/KEGS/images/" + mImage.filename,
|
||||
"https://jsan.co/KEGS/images/" + mImage.filename,
|
||||
local_copy.getPath());
|
||||
}
|
||||
}
|
@ -7,21 +7,21 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.HttpURLConnection;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import java.net.URL;
|
||||
|
||||
// Ick. Look elsewhere.
|
||||
|
||||
public class DownloadHelper {
|
||||
private URL mURL;
|
||||
private HttpURLConnection mConnection;
|
||||
private HttpsURLConnection mConnection;
|
||||
private InputStream mStream;
|
||||
|
||||
private boolean openInputStream() {
|
||||
try {
|
||||
mConnection = (HttpURLConnection)mURL.openConnection();
|
||||
mConnection = (HttpsURLConnection)mURL.openConnection();
|
||||
mConnection.connect();
|
||||
if (mConnection.getResponseCode() != HttpURLConnection.HTTP_OK) {
|
||||
if (mConnection.getResponseCode() != HttpsURLConnection.HTTP_OK) {
|
||||
mConnection.disconnect();
|
||||
Log.e("kegs", "HTTP ERROR " + mConnection.getResponseCode());
|
||||
return false;
|
||||
|
@ -6,9 +6,9 @@ import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
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 Runnable mRunnable;
|
||||
|
||||
|
@ -21,15 +21,15 @@ import android.view.View.OnTouchListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.ToggleButton;
|
||||
|
||||
import com.actionbarsherlock.app.ActionBar;
|
||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||
import com.actionbarsherlock.app.SherlockDialogFragment;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
import android.app.ActionBar;
|
||||
import android.app.Activity;
|
||||
import android.app.DialogFragment;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
||||
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_DOWNLOAD = "download";
|
||||
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.
|
||||
}
|
||||
|
||||
private View.OnClickListener mButtonClick = new View.OnClickListener() {
|
||||
private final View.OnClickListener mButtonClick = new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
final int click_id = v.getId();
|
||||
int key_id = -1;
|
||||
@ -181,11 +181,11 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
|
||||
cancel = null;
|
||||
}
|
||||
new ErrorDialogFragment(R.string.image_error, cancel).show(
|
||||
getSupportFragmentManager(), FRAGMENT_ERROR);
|
||||
getFragmentManager(), FRAGMENT_ERROR);
|
||||
} else if (image.action != DiskImage.ASK) {
|
||||
loadDiskImage(image);
|
||||
} else {
|
||||
new SwapDiskFragment(image).show(getSupportFragmentManager(),
|
||||
new SwapDiskFragment(image).show(getFragmentManager(),
|
||||
FRAGMENT_SWAPDISK);
|
||||
}
|
||||
}
|
||||
@ -202,7 +202,7 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
|
||||
if (image.filename.endsWith(".zip") || image.filename.endsWith(".ZIP")) {
|
||||
final ZipDiskFragment zip = new ZipDiskFragment(image);
|
||||
if (zip.needsDialog()) {
|
||||
zip.show(getSupportFragmentManager(), FRAGMENT_ZIPDISK);
|
||||
zip.show(getFragmentManager(), FRAGMENT_ZIPDISK);
|
||||
return;
|
||||
} else {
|
||||
image = zip.getFirstImage();
|
||||
@ -231,7 +231,7 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
|
||||
|
||||
mDiskLoader = new DiskLoader(notify, mConfigFile, image);
|
||||
if (mDiskLoader.willBeSlow()) {
|
||||
new SpecialProgressDialog(cancel).show(getSupportFragmentManager(),
|
||||
new SpecialProgressDialog(cancel).show(getFragmentManager(),
|
||||
FRAGMENT_LOADING);
|
||||
}
|
||||
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) {
|
||||
if (intent != null && intent.getAction() == Intent.ACTION_VIEW) {
|
||||
if (intent != null && intent.getAction().equals(Intent.ACTION_VIEW)) {
|
||||
final Uri uri = intent.getData();
|
||||
if (uri != null && uri.getScheme().equals("file")) {
|
||||
final String path = uri.getPath();
|
||||
@ -269,7 +269,7 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
|
||||
withUIActive(new Runnable() {
|
||||
public void run() {
|
||||
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) {
|
||||
final SherlockDialogFragment download = new DownloadDialogFragment();
|
||||
download.show(getSupportFragmentManager(), FRAGMENT_DOWNLOAD);
|
||||
final DialogFragment download = new DownloadDialogFragment();
|
||||
download.show(getFragmentManager(), FRAGMENT_DOWNLOAD);
|
||||
if (android.os.Build.VERSION.SDK_INT >= 11) {
|
||||
new DownloadRom().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, romfile);
|
||||
} else {
|
||||
@ -293,20 +293,20 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
|
||||
protected Boolean doInBackground(String ... raw_romfile) {
|
||||
mRomfile = raw_romfile[0];
|
||||
return new DownloadHelper().save(
|
||||
"http://jsan.co/KEGS/" + mRomfile,
|
||||
"https://jsan.co/KEGS/" + mRomfile,
|
||||
mConfigFile.getConfigPath() + "/" + mRomfile);
|
||||
}
|
||||
protected void onPostExecute(final Boolean success) {
|
||||
withUIActive(new Runnable() {
|
||||
public void run() {
|
||||
final SherlockDialogFragment frag = (SherlockDialogFragment)getSupportFragmentManager().findFragmentByTag(FRAGMENT_DOWNLOAD);
|
||||
final DialogFragment frag = (DialogFragment)getFragmentManager().findFragmentByTag(FRAGMENT_DOWNLOAD);
|
||||
if (frag != null) {
|
||||
frag.dismiss();
|
||||
}
|
||||
if (!success) {
|
||||
if (!isCancelled()) {
|
||||
new ErrorDialogFragment(R.string.rom_error, mErrorFinish).show(
|
||||
getSupportFragmentManager(), FRAGMENT_ERROR);
|
||||
getFragmentManager(), FRAGMENT_ERROR);
|
||||
}
|
||||
} else {
|
||||
boot();
|
||||
@ -316,7 +316,7 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
|
||||
}
|
||||
}
|
||||
|
||||
class DownloadDialogFragment extends SherlockDialogFragment {
|
||||
public static class DownloadDialogFragment extends DialogFragment {
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
ProgressDialog dialog = new ProgressDialog(getActivity());
|
||||
@ -339,7 +339,8 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
super.onCancel(dialog);
|
||||
finish();
|
||||
//FIXME TODO
|
||||
//finish();
|
||||
}
|
||||
}
|
||||
|
||||
@ -365,10 +366,15 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
|
||||
|
||||
private void updateActionBar(boolean showActionBar) {
|
||||
showActionBar = mOverrideActionBar || showActionBar;
|
||||
final ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null && showActionBar) {
|
||||
|
||||
final ActionBar actionBar = getActionBar();
|
||||
if (actionBar == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (showActionBar) {
|
||||
actionBar.show();
|
||||
} else if (actionBar != null && !showActionBar) {
|
||||
} else {
|
||||
actionBar.hide();
|
||||
}
|
||||
}
|
||||
@ -439,7 +445,7 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
|
||||
super.onCreateOptionsMenu(menu);
|
||||
// BUG: no overflow menu on devices with menu button
|
||||
// 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;
|
||||
}
|
||||
|
||||
@ -468,14 +474,14 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
|
||||
}
|
||||
return true;
|
||||
} else if (item_id == R.id.action_speed) {
|
||||
new SpeedFragment().show(getSupportFragmentManager(), FRAGMENT_SPEED);
|
||||
new SpeedFragment().show(getFragmentManager(), FRAGMENT_SPEED);
|
||||
return true;
|
||||
} else if (item_id == R.id.action_joystick) {
|
||||
mModeMouse = !mModeMouse;
|
||||
supportInvalidateOptionsMenu(); // update icon
|
||||
invalidateOptionsMenu(); // update icon
|
||||
return true;
|
||||
} 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;
|
||||
} else if (item_id == R.id.action_more_keys) {
|
||||
final int vis = areControlsVisible() ? View.GONE : View.VISIBLE;
|
||||
@ -490,12 +496,12 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
|
||||
return false;
|
||||
}
|
||||
|
||||
private SherlockDialogFragment findFragment(final String tag) {
|
||||
return (SherlockDialogFragment)getSupportFragmentManager().findFragmentByTag(tag);
|
||||
private DialogFragment findFragment(final String tag) {
|
||||
return (DialogFragment)getFragmentManager().findFragmentByTag(tag);
|
||||
}
|
||||
|
||||
private boolean dismissFragment(final String tag) {
|
||||
final SherlockDialogFragment frag = findFragment(tag);
|
||||
final DialogFragment frag = findFragment(tag);
|
||||
if (frag == null) {
|
||||
return false;
|
||||
} else {
|
||||
@ -530,7 +536,7 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
|
||||
|
||||
updateActionBar(BitmapSize.quick(this).showActionBar());
|
||||
|
||||
mKegsView = (KegsViewGL)findViewById(R.id.kegsview);
|
||||
mKegsView = findViewById(R.id.kegsview);
|
||||
|
||||
mConfigFile = new ConfigFile(this);
|
||||
|
||||
@ -541,7 +547,10 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
|
||||
mTouchMouse = new TouchMouse(this, 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.setLongClickable(true);
|
||||
mainView.setOnTouchListener(new OnTouchListener() {
|
||||
@ -589,7 +598,7 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
|
||||
|
||||
final String romfile = mConfigFile.whichRomFile();
|
||||
if (romfile == null) {
|
||||
new RomDialogFragment().show(getSupportFragmentManager(), FRAGMENT_ROM);
|
||||
new RomDialogFragment().show(getFragmentManager(), FRAGMENT_ROM);
|
||||
} else {
|
||||
boot();
|
||||
}
|
||||
|
@ -6,9 +6,9 @@ import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockDialogFragment;
|
||||
import android.app.DialogFragment;
|
||||
|
||||
public class RomDialogFragment extends SherlockDialogFragment {
|
||||
public class RomDialogFragment extends DialogFragment {
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
|
@ -6,11 +6,11 @@ import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
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.
|
||||
|
||||
public class SpecialProgressDialog extends SherlockDialogFragment {
|
||||
public class SpecialProgressDialog extends DialogFragment {
|
||||
private Runnable mCancelRunnable;
|
||||
|
||||
public SpecialProgressDialog(Runnable runnable) {
|
||||
|
@ -4,11 +4,10 @@ import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
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
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
|
@ -4,11 +4,10 @@ import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
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;
|
||||
|
||||
public SwapDiskFragment(DiskImage image) {
|
@ -1,10 +1,8 @@
|
||||
package com.froop.app.kegs;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.ViewConfiguration;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
@ -1,12 +1,11 @@
|
||||
package com.froop.app.kegs;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
class TouchSpecialZone {
|
||||
// Clicks within this rect have a special handler.
|
||||
private Rect mSpecialRect = null;
|
||||
private Rect mSpecialRect;
|
||||
|
||||
public TouchSpecialZone(Rect zone) {
|
||||
mSpecialRect = zone; // may be null
|
||||
|
@ -2,7 +2,6 @@ package com.froop.app.kegs;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
@ -12,9 +11,9 @@ import java.util.Enumeration;
|
||||
import java.util.zip.ZipFile;
|
||||
import java.util.zip.ZipEntry;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockDialogFragment;
|
||||
import android.app.DialogFragment;
|
||||
|
||||
public class ZipDiskFragment extends SherlockDialogFragment {
|
||||
public class ZipDiskFragment extends DialogFragment {
|
||||
private ArrayList<String> mFiles = new ArrayList<String>();
|
||||
private ArrayList<String> mTitles = new ArrayList<String>();
|
||||
private DiskImage mImage;
|
@ -1,33 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- ic_bt_keyboard_hid, ic_lockscreen_ime -->
|
||||
<item android:id="@+id/action_keyboard"
|
||||
android:icon="@drawable/ic_bt_keyboard_hid"
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="@string/input_keyboard" />
|
||||
android:title="@string/input_keyboard"
|
||||
android:showAsAction="ifRoom" />
|
||||
|
||||
<item android:id="@+id/action_diskimage"
|
||||
android:icon="@drawable/ic_menu_save"
|
||||
android:title="@string/diskimage"
|
||||
android:showAsAction="ifRoom" />
|
||||
|
||||
<item android:id="@+id/action_speed"
|
||||
android:icon="@drawable/dial"
|
||||
android:title="@string/emulation_speed"
|
||||
android:showAsAction="ifRoom" />
|
||||
|
||||
<item android:id="@+id/action_joystick"
|
||||
android:icon="@drawable/ic_bt_misc_hid"
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="@string/input_joystick" />
|
||||
|
||||
<item android:id="@+id/action_speed"
|
||||
android:icon="@drawable/dial"
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="@string/emulation_speed" />
|
||||
|
||||
<item android:id="@+id/action_diskimage"
|
||||
android:icon="@drawable/ic_menu_save"
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="@string/diskimage" />
|
||||
android:title="@string/input_joystick"
|
||||
android:showAsAction="ifRoom" />
|
||||
|
||||
<item android:id="@+id/action_more_keys"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/more_keys" />
|
||||
android:title="@string/more_keys"
|
||||
android:showAsAction="never" />
|
||||
|
||||
<item android:id="@+id/action_power_off"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/power_off" />
|
||||
|
||||
</menu>
|
||||
</menu>
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<resources>
|
||||
<style name="Theme.BlackBackground" parent="Theme.Sherlock">
|
||||
<style name="Theme.BlackBackground" parent="@android:style/Theme.Holo">
|
||||
<item name="android:windowBackground">@drawable/screen_background_black</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user